26 void mesh_fem_level_set::clear_build_methods() {
27 for (
size_type i = 0; i < build_methods.size(); ++i)
29 build_methods.clear();
31 void mesh_fem_level_set::clear(
void) {
33 clear_build_methods();
37 mesh_fem_level_set::mesh_fem_level_set(
const mesh_level_set &me,
39 : mesh_fem(mef.linked_mesh()), mls(me), mf(mef) {
40 xfem_index = reserve_xfem_index();
41 GMM_ASSERT1(mf.get_qdim() == 1,
"base mesh_fem for mesh_fem_level_set has " 42 "to be of qdim one for the moment ...");
48 DAL_SIMPLE_KEY(special_mfls_key,
pfem);
50 void mesh_fem_level_set::build_method_of_convex(
size_type cv) {
51 pfem pf = std::make_shared<fem_level_set>
53 mf.ind_basic_dof_of_element(cv).begin()) ,
54 mf.fem_of_element(cv), mls, xfem_index);
55 dal::pstatic_stored_object_key
56 pk = std::make_shared<special_mfls_key>(pf);
58 build_methods.push_back(pf);
59 set_finite_element(cv, pf);
62 void mesh_fem_level_set::adapt(
void) {
65 GMM_ASSERT1(!mf.is_reduced(),
"Mesh fem level set not defined for reduced " 66 "mesh fems (difficult or impossible to define it in the " 68 enriched_dofs.clear(); enriched_elements.clear();
69 dof_enrichments.resize(0);
70 dof_enrichments.resize(mf.nb_basic_dof(), 0);
72 for (
size_type i = 0; i < mf.nb_basic_dof(); ++i) {
73 const mesh::ind_cv_ct &ct = mf.convex_to_basic_dof(i);
74 bool touch_cut =
false;
75 for (mesh::ind_cv_ct::const_iterator it = ct.begin();
77 if (mls.is_convex_cut(*it)) { touch_cut =
true;
break; }
81 mesh_level_set::zoneset zones;
83 for (mesh::ind_cv_ct::const_iterator it = ct.begin();
84 it != ct.end(); ++it) {
85 if (mls.is_convex_cut(*it)) {
86 mls.merge_zoneset(zones, mls.zoneset_of_convex(*it));
89 mls.merge_zoneset(zones, mls.primary_zone_of_convex(*it));
93 if (zones.size() != 1) {
94 dof_enrichments[i] = &(*(enrichments.insert(zones).first));
96 for (mesh::ind_cv_ct::const_iterator it = ct.begin();
97 it != ct.end(); ++it) enriched_elements.add(*it);
105 for (dal::bv_visitor i(mf.convex_index()); !i.finished(); ++i) {
106 if (enriched_elements[i]) build_method_of_convex(i);
else 107 set_finite_element(i, mf.fem_of_element(i));
109 is_adapted =
true; touch();
void del_stored_object(const pstatic_stored_object &o, bool ignore_unstored)
Delete an object and the object which depend on it.
a subclass of mesh_fem which is conformal to a number of level sets.
size_t size_type
used as the common size type in the library
void add_stored_object(pstatic_stored_object_key k, pstatic_stored_object o, permanence perm)
Add an object with two optional dependencies.
void add_dependency(pstatic_stored_object o1, pstatic_stored_object o2)
Add a dependency, object o1 will depend on object o2.
GEneric Tool for Finite Element Methods.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
void clear(L &l)
clear (fill with zeros) a vector or matrix.
tab_ref_index_ref_iterator_< ITER, ITER_INDEX > index_ref_iterator(ITER it, ITER_INDEX it_i)
convenience template function for quick obtention of a indexed iterator without having to specify its...