Skip to content
Snippets Groups Projects
Commit da723ce0 authored by Julian Heinze's avatar Julian Heinze Committed by Dmitri Naumov
Browse files

std::any_of instead of for-loop

parent 0d1886a9
No related branches found
No related tags found
No related merge requests found
...@@ -167,22 +167,23 @@ bool isVoxelGrid(MeshLib::Mesh const& mesh) ...@@ -167,22 +167,23 @@ bool isVoxelGrid(MeshLib::Mesh const& mesh)
"aligned hexahedra)."); "aligned hexahedra).");
return false; return false;
} }
auto is_voxel = [](auto const& e)
for (auto const& e : elements)
{ {
auto const n = e->getNodes(); auto const n = e->getNodes();
if ((*n[0])[2] != (*n[1])[2] || (*n[1])[2] != (*n[2])[2] || return ((*n[0])[2] != (*n[1])[2] || (*n[1])[2] != (*n[2])[2] ||
(*n[4])[2] != (*n[5])[2] || (*n[5])[2] != (*n[6])[2] || (*n[4])[2] != (*n[5])[2] || (*n[5])[2] != (*n[6])[2] ||
(*n[1])[0] != (*n[2])[0] || (*n[2])[0] != (*n[5])[0] || (*n[1])[0] != (*n[2])[0] || (*n[2])[0] != (*n[5])[0] ||
(*n[0])[0] != (*n[3])[0] || (*n[3])[0] != (*n[7])[0]) (*n[0])[0] != (*n[3])[0] || (*n[3])[0] != (*n[7])[0]);
{ };
ERR("Input mesh needs to be voxel grid (i.e. equally sized axis "
"aligned hexahedra)."); if (std::any_of(elements.cbegin(), elements.cend(), is_voxel))
return false; {
} ERR("Input mesh needs to be voxel grid (i.e. equally sized axis "
"aligned hexahedra).");
return false;
} }
return true; return true;
} } // namespace
} // namespace } // namespace
namespace MeshToolsLib::MeshGenerator::AddFaultToVoxelGrid namespace MeshToolsLib::MeshGenerator::AddFaultToVoxelGrid
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment