MAST
filter_base.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
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) const;
55 
56 
57  void compute_filtered_values(const std::vector<Real>& input,
58  std::vector<Real>& output) const;
59 
67  bool if_elem_in_domain_of_influence(const libMesh::Elem& elem,
68  const libMesh::Node& level_set_node) const;
69 
70 
71 
75  virtual void print(std::ostream& o) const;
76 
77 
78  protected:
79 
83  void _init();
84 
88  libMesh::System& _level_set_system;
89 
94 
95 
100 
105  const std::set<unsigned int>& _dv_dof_ids;
106 
111  std::map<unsigned int, std::vector<std::pair<unsigned int, Real>>> _filter_map;
112  };
113 
114 
115 }
116 
117 
118 #endif // __mast__filter_base_h__
virtual void print(std::ostream &o) const
prints the filter data.
libMesh::System & _level_set_system
system on which the level set discrete function is defined
Definition: filter_base.h:88
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:111
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...
Real _level_set_fe_size
largest element size in the level set mesh
Definition: filter_base.h:99
libMesh::Real Real
const std::set< unsigned int > & _dv_dof_ids
dof ids that are design variables.
Definition: filter_base.h:105
Real _radius
radius of the filter.
Definition: filter_base.h:93
void compute_filtered_values(const libMesh::NumericVector< Real > &input, libMesh::NumericVector< Real > &output) const
computes the filtered output from the provided input.
Definition: filter_base.cpp:53
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:33
Creates a geometric filter for the level-set design variables.
Definition: filter_base.h:39
virtual ~FilterBase()
Definition: filter_base.cpp:47