Skip to content

Commit

Permalink
included non_const version of materialIDs in mesh
Browse files Browse the repository at this point in the history
and used new version for mat_ids
  • Loading branch information
HeiJuli authored and endJunction committed Jul 26, 2023
1 parent 0e769c5 commit ae80889
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions MeshLib/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ PropertyVector<int> const* materialIDs(Mesh const& mesh)
return nullptr;
}

PropertyVector<int>* materialIDs(Mesh& mesh)
{
return const_cast<PropertyVector<int>*>(
MeshLib::materialIDs(std::as_const(mesh)));
}

PropertyVector<std::size_t> const* bulkNodeIDs(Mesh const& mesh)
{
auto const& properties = mesh.getProperties();
Expand Down
1 change: 1 addition & 0 deletions MeshLib/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ inline bool operator!=(Mesh const& a, Mesh const& b)
/// If the property does not exists (or is of different type), a nullptr is
/// returned.
PropertyVector<int> const* materialIDs(Mesh const& mesh);
PropertyVector<int>* materialIDs(Mesh& mesh);
PropertyVector<std::size_t> const* bulkNodeIDs(Mesh const& mesh);
PropertyVector<std::size_t> const* bulkElementIDs(Mesh const& mesh);

Expand Down
3 changes: 1 addition & 2 deletions MeshToolsLib/MeshGenerators/AddFaultToVoxelGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

namespace
{
static std::string mat_name = "MaterialIDs";
// tests if a plane and an AABB are intersecting
// (based on Christer Ericson "Real Time Collision Detection" 5.2.3)
bool testAABBIntersectingPlane(Eigen::Vector3d const& aabb_centre,
Expand Down Expand Up @@ -99,7 +98,7 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
{
auto const& elems = mesh.getElements();
std::size_t const n_elems = mesh.getNumberOfElements();
auto mat_ids = mesh.getProperties().getPropertyVector<int>("MaterialIDs");
auto mat_ids = MeshLib::materialIDs(mesh);
auto const& fnodes = fault.getNodes();
auto const& felems = fault.getElements();
GeoLib::AABB const fault_aabb(fnodes.cbegin(), fnodes.cend());
Expand Down

0 comments on commit ae80889

Please sign in to comment.