Skip to content

Commit

Permalink
remove the property storage of XFEM deleted element and side
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwen84 committed Feb 18, 2021
1 parent 12c454b commit 69a4d03
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions framework/include/materials/MaterialData.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ class MaterialData
*/
bool isOnlyResizeIfSmaller() const { return _resize_only_if_smaller; };

/**
* Remove the property storage and element pointer from MaterialPropertyStorage data structures
*/
void eraseProperty(const Elem * elem) { _storage.eraseProperty(elem); };

protected:
/// Reference to the MaterialStorage class
MaterialPropertyStorage & _storage;
Expand Down
6 changes: 3 additions & 3 deletions framework/include/materials/MaterialPropertyStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ class MaterialPropertyStorage
return _prop_names.count(retrievePropertyId(prop_name)) > 0;
}

/// Remove the property storage and element pointer from internal data structures
void eraseProperty(const Elem * elem);

protected:
/// Release all internal data structures
void releaseProperties();

/// Remove the property storage and element pointer from internal data structures
void eraseProperty(const Elem * elem);

/// Internal property storage release helper
void releasePropertyMap(HashMap<unsigned int, MaterialProperties> & inner_map);

Expand Down
19 changes: 19 additions & 0 deletions modules/xfem/src/base/XFEM.C
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,25 @@ XFEM::cutMeshWithEFA(NonlinearSystemBase & nl, AuxiliarySystem & aux)
}

elem_to_delete->nullify_neighbors();

// remove the property storage of deleted element/side
for (unsigned int side = 0; side < elem_to_delete->n_sides(); ++side)
{
std::vector<boundary_id_type> deleted_elem_boundary_ids;
_mesh->boundary_info->boundary_ids(elem_to_delete, side, deleted_elem_boundary_ids);
std::vector<boundary_id_type>::iterator it_bd = deleted_elem_boundary_ids.begin();
for (; it_bd != deleted_elem_boundary_ids.end(); ++it_bd)
{
if (_fe_problem->needBoundaryMaterialOnSide(*it_bd, 0))
{
const Elem * side_elem = elem_to_delete->side_ptr(side).get();
(*_bnd_material_data)[0]->eraseProperty(side_elem);
}
}
}

(*_material_data)[0]->eraseProperty(elem_to_delete);

_mesh->boundary_info->remove(elem_to_delete);
unsigned int deleted_elem_id = elem_to_delete->id();
_mesh->delete_elem(elem_to_delete);
Expand Down

0 comments on commit 69a4d03

Please sign in to comment.