Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 96861c8

Browse files
committedDec 14, 2015
[MeL] ElementStatus: Use PV instead of getValue()/setValue().
1 parent fece418 commit 96861c8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed
 

‎MeshLib/ElementStatus.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ ElementStatus::ElementStatus(Mesh const* const mesh,
3434
std::vector<unsigned> const& vec_inactive_matIDs)
3535
: ElementStatus(mesh, !vec_inactive_matIDs.empty())
3636
{
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+
}
4246
}
4347

44-
_vec_active_eles.reserve(this->getNActiveElements());
48+
_vec_active_eles.reserve(getNActiveElements());
49+
const std::size_t nElems (_mesh->getNElements());
4550
for (std::size_t i=0; i<nElems; ++i)
4651
if (_element_status[i])
4752
_vec_active_eles.push_back(const_cast<MeshLib::Element*>(_mesh->getElement(i)));

0 commit comments

Comments
 (0)
Failed to load comments.