Skip to content
Snippets Groups Projects
Commit 4e48a279 authored by Tom Fischer's avatar Tom Fischer
Browse files

[GL] Extract GeoLib::markUsedPoints() for surfaces

parent 5e5dd1fc
No related branches found
No related tags found
No related merge requests found
...@@ -92,13 +92,7 @@ int main(int argc, char* argv[]) ...@@ -92,13 +92,7 @@ int main(int argc, char* argv[])
{ {
for (auto const* surface : *surfaces) for (auto const* surface : *surfaces)
{ {
for (std::size_t i = 0; i < surface->getNumberOfTriangles(); ++i) GeoLib::markUsedPoints(*surface, used_points);
{
auto const* triangle = (*surface)[i];
used_points[(*triangle)[0]] = true;
used_points[(*triangle)[1]] = true;
used_points[(*triangle)[2]] = true;
}
} }
} }
......
...@@ -129,4 +129,23 @@ void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping) ...@@ -129,4 +129,23 @@ void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping)
} }
} }
void markUsedPoints(Surface const& surface, std::vector<bool>& used_points)
{
if (surface.getPointVec()->size() != used_points.size())
{
OGS_FATAL(
"internal error in markUsedPoints(): surface based on point vector "
"of size {}, given used_points has size {}",
surface.getPointVec()->size(), used_points.size());
}
for (std::size_t i = 0; i < surface.getNumberOfTriangles(); ++i)
{
auto const& triangle = *surface[i];
for (std::size_t k = 0; k < 3; ++k)
{
used_points[triangle[k]] = true;
}
}
}
} // namespace GeoLib } // namespace GeoLib
...@@ -97,4 +97,5 @@ bool operator==(Surface const& lhs, Surface const& rhs); ...@@ -97,4 +97,5 @@ bool operator==(Surface const& lhs, Surface const& rhs);
/// Resets the point IDs of the surface corresponding to the mapping. /// Resets the point IDs of the surface corresponding to the mapping.
void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping); void resetPointIDs(Surface& surface, std::vector<std::size_t> const& mapping);
void markUsedPoints(Surface const& surface, std::vector<bool>& used_points);
} // namespace GeoLib } // namespace GeoLib
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