1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,19 @@ ElementStatus::ElementStatus(Mesh const* const mesh,
34
34
std::vector<unsigned > const & vec_inactive_matIDs)
35
35
: ElementStatus(mesh, !vec_inactive_matIDs.empty())
36
36
{
37
- const std::size_t nElems (_mesh->getNElements ());
38
- for (auto material_id : vec_inactive_matIDs) {
39
- for (auto e : _mesh->getElements ())
40
- if (e->getValue () == material_id)
41
- this ->setElementStatus (e->getID (), false );
37
+ auto materialIds = mesh->getProperties ().getPropertyVector <int >(" MaterialIDs" );
38
+ if (materialIds) {
39
+ for (auto material_id : vec_inactive_matIDs) {
40
+ for (auto e : _mesh->getElements ()) {
41
+ if ((*materialIds)[e->getID ()] == material_id) {
42
+ setElementStatus (e->getID (), false );
43
+ }
44
+ }
45
+ }
42
46
}
43
47
44
- _vec_active_eles.reserve (this ->getNActiveElements ());
48
+ _vec_active_eles.reserve (getNActiveElements ());
49
+ const std::size_t nElems (_mesh->getNElements ());
45
50
for (std::size_t i=0 ; i<nElems; ++i)
46
51
if (_element_status[i])
47
52
_vec_active_eles.push_back (const_cast <MeshLib::Element*>(_mesh->getElement (i)));
0 commit comments