37 #ifndef GETFEM_MESH_LEVEL_SET_H__
38 #define GETFEM_MESH_LEVEL_SET_H__
54 typedef std::string subzone;
55 typedef std::set<const subzone *> zone;
56 typedef std::set<const zone*> zoneset;
60 mutable std::set<subzone> allsubzones;
61 mutable std::set<zone> allzones;
65 mutable bool is_adapted_;
68 std::vector<plevel_set> level_sets;
70 typedef std::shared_ptr<mesh> pmesh;
76 convex_info() : pmsh(0) {}
79 std::map<size_type, convex_info> cut_cv;
81 mutable dal::bit_vector crack_tip_convexes_;
86 plevel_set get_level_set(
size_type i)
const {
return level_sets[i]; }
89 {
return (cut_cv.find(i) != cut_cv.end()); }
90 const mesh& mesh_of_convex(
size_type i)
const {
91 if (is_convex_cut(i))
return *((cut_cv.find(i))->second.pmsh);
92 GMM_ASSERT1(
false,
"This element is not cut !");
95 const dal::bit_vector &crack_tip_convexes()
const;
103 + level_sets.size() *
sizeof(plevel_set);
104 for (std::map<size_type, convex_info>::const_iterator it=cut_cv.begin();
105 it != cut_cv.end(); ++it) {
106 res +=
sizeof(convex_info)
107 + it->second.pmsh->memsize()
108 + it->second.zones.size()
109 * (level_sets.size() +
sizeof(std::string *) +
sizeof(std::string));
115 if (std::find(level_sets.begin(), level_sets.end(), &ls)
116 == level_sets.end()) {
117 level_sets.push_back(&ls); touch();
122 std::vector<plevel_set>::iterator
123 it = std::find(level_sets.begin(), level_sets.end(), &ls);
124 if (it != level_sets.end()) {
125 level_sets.erase(it);
135 void merge_zoneset(zoneset &zones1,
const zoneset &zones2)
const;
136 void merge_zoneset(zoneset &zones1,
const std::string &subz)
const;
137 const std::string &primary_zone_of_convex(
size_type cv)
const
138 {
return *(zones_of_convexes[cv]); }
139 const zoneset &zoneset_of_convex(
size_type cv)
const {
140 std::map<size_type, convex_info>::const_iterator it = cut_cv.find(cv);
141 if (it != cut_cv.end())
return (*it).second.zones;
142 GMM_ASSERT1(
false,
"You cannot call this function for uncut convexes");
146 void find_level_set_potential_intersections
147 (std::vector<size_type> &icv, std::vector<dal::bit_vector> &ils);
149 void init_with_mesh(mesh &me);
150 mesh_level_set(mesh &me);
151 mesh_level_set(
void);
152 virtual ~mesh_level_set();
153 mesh_level_set(
const mesh_level_set &mls) : context_dependencies() {
154 GMM_ASSERT1(linked_mesh_ == 0 && mls.linked_mesh_ == 0,
155 "Copy constructor is not allowed for mesh_level_set");
157 mesh_level_set & operator=(
const mesh_level_set &mls) {
158 GMM_ASSERT1(linked_mesh_ == 0 && mls.linked_mesh_ == 0,
159 "Copy operator is not allowed for mesh_level_set");
165 void cut_element(
size_type cv,
const dal::bit_vector &primary,
166 const dal::bit_vector &secondary, scalar_type radius);
167 int is_not_crossed_by(
size_type c, plevel_set ls,
unsigned lsnum,
169 int sub_simplex_is_not_crossed_by(
size_type cv, plevel_set ls,
171 void find_zones_of_element(
size_type cv, std::string &prezone,
178 void find_crossing_level_set(
size_type cv,
179 dal::bit_vector &prim,
180 dal::bit_vector &sec, std::string &zone,
182 void run_delaunay(std::vector<base_node> &fixed_points,
183 gmm::dense_matrix<size_type> &simplexes,
184 std::vector<dal::bit_vector> &fixed_points_constraints);
186 void update_crack_tip_convexes();
189 void getfem_mesh_level_set_noisy(
void);
191 std::ostream &
operator<<(std::ostream &os,
const mesh_level_set::zone &z);
192 std::ostream &
operator<<(std::ostream &os,
const mesh_level_set::zoneset &zs);
base class for static stored objects
Deal with interdependencies of objects.
Keep informations about a mesh crossed by level-sets.
void global_cut_mesh(mesh &m) const
fill m with the (non-conformal) "cut" mesh.
void add_level_set(level_set &ls)
add a new level set.
size_type nb_level_sets(void) const
Get number of level-sets referenced in this object.
void adapt(void)
do all the work (cut the convexes wrt the levelsets)
mesh & linked_mesh(void) const
Gives a reference to the linked mesh of type mesh.
void update_from_context(void) const
this function has to be defined and should update the object when the context is modified.
structure used to hold a set of convexes and/or convex faces.
Describe a mesh (collection of convexes (elements) and points).
Definition of the finite element methods.
Integration methods (exact and approximated) on convexes.
std::ostream & operator<<(std::ostream &o, const convex_structure &cv)
Print the details of the convex structure cvs to the output stream o.
size_t size_type
used as the common size type in the library
GEneric Tool for Finite Element Methods.