MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
filter_base.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 
21 #ifndef __mast__filter_base_h__
22 #define __mast__filter_base_h__
23 
24 
25 // MAST includes
26 #include "base/mast_data_types.h"
27 
28 // libMesh includes
29 #include "libmesh/system.h"
30 #include "libmesh/node.h"
31 #include "libmesh/elem.h"
32 
33 
34 namespace MAST {
35 
39  class FilterBase {
40 
41  public:
42 
43  FilterBase(libMesh::System& sys,
44  const Real radius,
45  const std::set<unsigned int>& dv_dof_ids);
46 
47 
48  virtual ~FilterBase();
49 
53  void compute_filtered_values(const libMesh::NumericVector<Real>& input,
54  libMesh::NumericVector<Real>& output,
55  bool close_vector = true) const;
56 
65  void compute_filtered_values(std::map<unsigned int, Real>& nonzero_vals,
66  libMesh::NumericVector<Real>& output,
67  bool close_vector) const;
68 
69  void compute_filtered_values(const std::vector<Real>& input,
70  std::vector<Real>& output) const;
71 
79  bool if_elem_in_domain_of_influence(const libMesh::Elem& elem,
80  const libMesh::Node& level_set_node) const;
81 
82 
83 
87  virtual void print(std::ostream& o) const;
88 
89 
90  protected:
91 
95  void _init();
96  void _init2();
97 
101  libMesh::System& _level_set_system;
102 
107 
108 
113 
118  const std::set<unsigned int>& _dv_dof_ids;
119 
124  std::map<unsigned int, std::vector<std::pair<unsigned int, Real>>> _filter_map;
125  };
126 
127 
128 }
129 
130 
131 #endif // __mast__filter_base_h__
libMesh::System & _level_set_system
system on which the level set discrete function is defined
Definition: filter_base.h:101
std::map< unsigned int, std::vector< std::pair< unsigned int, Real > > > _filter_map
Algebraic relation between filtered level set values and the design variables .
Definition: filter_base.h:124
Real _level_set_fe_size
largest element size in the level set mesh
Definition: filter_base.h:112
libMesh::Real Real
void compute_filtered_values(const libMesh::NumericVector< Real > &input, libMesh::NumericVector< Real > &output, bool close_vector=true) const
computes the filtered output from the provided input.
Definition: filter_base.cpp:59
const std::set< unsigned int > & _dv_dof_ids
dof ids that are design variables.
Definition: filter_base.h:118
Real _radius
radius of the filter.
Definition: filter_base.h:106
void _init()
initializes the algebraic data structures
FilterBase(libMesh::System &sys, const Real radius, const std::set< unsigned int > &dv_dof_ids)
Definition: filter_base.cpp:35
Creates a geometric filter for the level-set design variables.
Definition: filter_base.h:39
virtual void print(std::ostream &o) const
prints the filter data.
virtual ~FilterBase()
Definition: filter_base.cpp:53
bool if_elem_in_domain_of_influence(const libMesh::Elem &elem, const libMesh::Node &level_set_node) const
function identifies if the given element is within the domain of influence of this specified level se...