Commit 67c01978 authored by Bernd Flemisch's avatar Bernd Flemisch

[uggrid] start implementing a method updateBoundarySegmentIndices

parent 282c6c1e
Pipeline #8366 passed with stage
in 50 minutes and 24 seconds
......@@ -701,6 +701,8 @@ namespace Dune {
};
#endif // ModelP
void updateBoundarySegmentIndices_();
public:
// **********************************************************
// End of Interface Methods
......
......@@ -604,6 +604,33 @@ void UGGrid<dim>::loadState(const std::string& filename)
DUNE_THROW(GridError, "In loadState()");
}
template < int dim >
void UGGrid < dim >::updateBoundarySegmentIndices_()
{
std::set<size_t> usedIndices;
for (const auto& element : elements(this->leafGridView()))
{
if (element.hasBoundaryIntersections())
{
for (const auto& intersection : intersections(this->leafGridView(), element))
{
if (intersection.boundary())
{
usedIndices.insert(intersection.boundarySegmentIndex());
}
}
}
}
auto numBoundarySegments = usedIndices.size();
std::map<size_t, size_t> oldToNew;
auto it = usedIndices.begin();
for (size_t i = 0; i < numBoundarySegments; ++i)
{
oldToNew[*it++] = i;
}
}
template < int dim >
void UGGrid < dim >::setIndices(bool setLevelZero,
std::vector<unsigned int>* nodePermutation)
......@@ -624,6 +651,8 @@ void UGGrid < dim >::setIndices(bool setLevelZero,
leafIndexSet_.update(nodePermutation);
updateBoundarySegmentIndices_();
// id sets don't need updating
}
......
Markdown is supported
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