Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
henrij22 committed May 17, 2024
1 parent 9b079cc commit 908398d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dune/iga/test/testintersections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ auto testInsideOutside(auto& grid) {
auto testReportFullIntersections() {
TestSuite t;

Preferences::getInstance().reportTrimmedIntersections(false);
Preferences::getInstance().reconstructTrimmedLocalGeometry(false);

using PatchGrid = PatchGrid<2, 2, DefaultTrim::PatchGridFamily>;
using GridFactory = Dune::GridFactory<PatchGrid>;
Expand All @@ -266,7 +266,7 @@ auto testReportFullIntersections() {
for (const auto& ele : elements(leafGridView))
t.check(count(ele, levelGridView) == 4);

Preferences::getInstance().reportTrimmedIntersections(true);
Preferences::getInstance().reconstructTrimmedLocalGeometry(true);

return t;
}
Expand Down
10 changes: 5 additions & 5 deletions dune/iga/trimmer/defaulttrimmer/createentities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void TrimmerImpl<dim, dimworld, ScalarType>::collectElementEdges(int level, cons
}
};

if (eleTrimData.flag() == ElementTrimFlag::full) {
if (eleTrimData.flag() == ElementTrimFlag::full or not Preferences::getInstance().reconstructTrimmedLocalGeometry()) {
for (auto localEdgeIndex : Dune::range(ele.subEntities(1))) {
addHostEdge(localEdgeIndex);
}
Expand Down Expand Up @@ -295,7 +295,7 @@ void TrimmerImpl<dim, dimworld, ScalarType>::collectElementVertices(int level, c
entityContainer_.idToVertexInfoMap.back().insert({vertexId, vertexInfo});
};

if (eleTrimData.flag() == ElementTrimFlag::full) {
if (eleTrimData.flag() == ElementTrimFlag::full or not Preferences::getInstance().reconstructTrimmedLocalGeometry()) {
// Save eleVertices in local order
for (auto localVertexIndex : Dune::range(ele.subEntities(2))) {
addHostVertex(localVertexIndex);
Expand Down Expand Up @@ -324,7 +324,7 @@ void TrimmerImpl<dim, dimworld, ScalarType>::createElements(int level, const std
for (auto& [eleId, eleInfo] :
elementMap | std::ranges::views::filter([level](const auto& pair) { return pair.second.lvl == level; })) {
auto ele = parameterSpaceGrid_->entity(eleInfo.hostSeed);
if (not eleInfo.trimmed) {
if (not eleInfo.trimmed or not Preferences::getInstance().reconstructTrimmedLocalGeometry()) {
elementContainer[eleInfo.indexInLvlStorage] = ElementEntity{grid_, ele, eleInfo};
} else {
elementContainer[eleInfo.indexInLvlStorage] =
Expand Down Expand Up @@ -352,7 +352,7 @@ void TrimmerImpl<dim, dimworld, ScalarType>::createSubEntities(int level) {

vertexContainer.resize(entityContainer_.vertexCount.back());
for (auto& [vertexId, vertexInfo] : vertexMap) {
if (not vertexInfo.trimmed) {
if (not vertexInfo.trimmed or not Preferences::getInstance().reconstructTrimmedLocalGeometry()) {
auto vertex = parameterSpaceGrid_->entity(vertexInfo.hostSeed);
vertexContainer[vertexInfo.indexInLvlStorage] = VertexEntity{grid_, vertex, vertexInfo};
} else {
Expand All @@ -363,7 +363,7 @@ void TrimmerImpl<dim, dimworld, ScalarType>::createSubEntities(int level) {
edgeContainer.resize(entityContainer_.edgeCount.back());
for (auto& [edgeId, edgeInfo] :
edgeMap | std::ranges::views::filter([level](const auto& pair) { return pair.second.lvl == level; })) {
if (not edgeInfo.trimmed) {
if (not edgeInfo.trimmed or not Preferences::getInstance().reconstructTrimmedLocalGeometry()) {
auto edge = parameterSpaceGrid_->entity(edgeInfo.hostSeed);
edgeContainer[edgeInfo.indexInLvlStorage] = EdgeEntity{grid_, edge, edgeInfo};
} else {
Expand Down
8 changes: 4 additions & 4 deletions dune/iga/trimmer/defaulttrimmer/trimmer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ namespace DefaultTrim {
using IntersectionIterator = PatchGridLevelIntersectionIterator<const GridImp>;
auto& localEntity = ent.impl().getLocalEntity();

if (not localEntity.isTrimmed() or not Preferences::getInstance().reportTrimmedIntersections())
if (not localEntity.isTrimmed() or not Preferences::getInstance().reconstructTrimmedLocalGeometry())
return IntersectionIterator(
grid_, parameterSpaceGrid().levelGridView(ent.level()).ibegin(localEntity.getHostEntity()));
return IntersectionIterator(grid_, localEntity, IntersectionIterator::PositionToken::Begin,
Expand All @@ -319,7 +319,7 @@ namespace DefaultTrim {
using IntersectionIterator = PatchGridLevelIntersectionIterator<const GridImp>;
auto& localEntity = ent.impl().getLocalEntity();

if (not localEntity.isTrimmed() or not Preferences::getInstance().reportTrimmedIntersections())
if (not localEntity.isTrimmed() or not Preferences::getInstance().reconstructTrimmedLocalGeometry())
return IntersectionIterator(grid_,
parameterSpaceGrid().levelGridView(ent.level()).iend(localEntity.getHostEntity()));
return IntersectionIterator(grid_, localEntity, IntersectionIterator::PositionToken::End,
Expand All @@ -331,7 +331,7 @@ namespace DefaultTrim {
using IntersectionIterator = PatchGridLeafIntersectionIterator<const GridImp>;
auto& localEntity = ent.impl().getLocalEntity();

if (not localEntity.isTrimmed() or not Preferences::getInstance().reportTrimmedIntersections())
if (not localEntity.isTrimmed() or not Preferences::getInstance().reconstructTrimmedLocalGeometry())
return IntersectionIterator(grid_, parameterSpaceGrid().leafGridView().ibegin(localEntity.getHostEntity()));
return IntersectionIterator(grid_, localEntity, IntersectionIterator::PositionToken::Begin,
parameterSpaceGrid().leafGridView().ibegin(localEntity.getHostEntity()));
Expand All @@ -342,7 +342,7 @@ namespace DefaultTrim {
using IntersectionIterator = PatchGridLeafIntersectionIterator<const GridImp>;
auto& localEntity = ent.impl().getLocalEntity();

if (not localEntity.isTrimmed() or not Preferences::getInstance().reportTrimmedIntersections())
if (not localEntity.isTrimmed() or not Preferences::getInstance().reconstructTrimmedLocalGeometry())
return IntersectionIterator(grid_, parameterSpaceGrid().leafGridView().iend(localEntity.getHostEntity()));
return IntersectionIterator(grid_, localEntity, IntersectionIterator::PositionToken::End,
parameterSpaceGrid().leafGridView().ibegin(localEntity.getHostEntity()));
Expand Down
10 changes: 5 additions & 5 deletions dune/iga/trimmer/defaulttrimmer/trimmerpreferences.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public:
this->reportTrimmedElementGeometryTypeAsNone_ = _reportTrimmedElementGeometryTypeAsNone;
}

bool reportTrimmedIntersections() const {
return reportTrimmedIntersections_;
bool reconstructTrimmedLocalGeometry() const {
return reconstructTrimmedLocalGeometry_;
}

void reportTrimmedIntersections(bool _reportTrimmedIntersections_) {
void reconstructTrimmedLocalGeometry(bool _reconstructTrimmedLocalGeometry) {
std::lock_guard lock(mtx);
this->reportTrimmedIntersections_ = _reportTrimmedIntersections_;
this->reconstructTrimmedLocalGeometry_ = _reconstructTrimmedLocalGeometry;
}

private:
Expand All @@ -63,5 +63,5 @@ private:
int boundaryDivisions_;
double targetAccuracy_;
bool reportTrimmedElementGeometryTypeAsNone_{true};
bool reportTrimmedIntersections_{true};
bool reconstructTrimmedLocalGeometry_{true};
};

0 comments on commit 908398d

Please sign in to comment.