wildmeshing / wildmeshing-toolkit

Toolkit for Meshing in the Wild
Other
113 stars 16 forks source link

Stop using binary checks for only TriMesh/TetMesh #408

Open mtao opened 1 year ago

mtao commented 1 year ago

As we are adding multiple types of meshes (from EdgeMesh to polygonal meshes) it doesn't make sense to have so much code that only switches between TriMesh and TetMesh. There are several cases where we have

auto value = mesh.top_simplex_type() == PrimitiveType::Face ? f(static_cast<const TriMesh&>(mesh)) : f(static_cast<const TetMesh&>(mesh));

This is definitely not valid.

mtao commented 1 year ago

My advice is that we develop a visitor pattern, which would involve using a pattern like what is used in std::visit or the overload pattern that is quite common now