Skip to content
Snippets Groups Projects
Commit 086dcd27 authored by Philipp Suffa's avatar Philipp Suffa
Browse files

Merge branch 'mr_assert_face_normals' into 'master'

Added missing calls to compute mesh face normals in mesa_pd convex polyhedron

See merge request walberla/walberla!546
parents 27988dd7 c6cf5b99
Branches
No related merge requests found
......@@ -79,6 +79,8 @@ bool isPointInsideCylindricalBoundary(const Vec3& point,
#ifdef WALBERLA_MESAPD_CONVEX_POLYHEDRON_AVAILABLE
bool isPointInsideConvexPolyhedronBF(const Vec3& point, const mesh::TriangleMesh& mesh)
{
WALBERLA_ASSERT(mesh.has_face_normals(), "Provided mesh has no face normals! E.g., call `mesh.request_face_normals(); mesh.update_face_normals();` to add them.")
return std::none_of(mesh.faces().begin(),
mesh.faces().end(),
[&](auto fh)
......
......@@ -130,6 +130,9 @@ inline void ConvexPolyhedron::updateMassAndInertia(const real_t density) {
inline void ConvexPolyhedron::updateMeshQuantities() {
WALBERLA_CHECK_GREATER(mesh_.n_vertices(), 0, "Cannot compute mesh quantities for an empty mesh!");
mesh_.request_face_normals();
mesh_.update_face_normals();
octandVertices_[0] = supportVertex(mesh::TriangleMesh::Normal(real_t(1), real_t(1), real_t(1)), *mesh_.vertices_begin());
octandVertices_[1] = supportVertex(mesh::TriangleMesh::Normal(real_t(1), real_t(1), real_t(-1)), *mesh_.vertices_begin());
octandVertices_[2] = supportVertex(mesh::TriangleMesh::Normal(real_t(1), real_t(-1), real_t(1)), *mesh_.vertices_begin());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment