From 39a22d86f807350d8fd5fd2358904a281525172c Mon Sep 17 00:00:00 2001 From: Henrik Jakob Date: Mon, 17 Jun 2024 19:39:42 +0200 Subject: [PATCH] work --- doc/doxygen/modules.txt | 2 +- dune/iga/geometrykernel/algorithms.hh | 45 ++++++ .../nurbspatchgeometrylocalview.hh | 11 +- dune/iga/hierarchicpatch/patchgrid.hh | 60 +++---- dune/iga/hierarchicpatch/patchgridentity.hh | 12 +- dune/iga/hierarchicpatch/patchgridfactory.hh | 4 +- dune/iga/hierarchicpatch/patchgridgeometry.hh | 4 + .../integrationrules/integrationruleholder.hh | 6 +- dune/iga/integrationrules/simplexgenerator.hh | 2 +- dune/iga/io/griddrawer.hh | 4 +- dune/iga/io/vtk/vtkrefinedgeometries.hh | 6 +- dune/iga/nurbsbasis.hh | 4 +- dune/iga/parameterspace/concepts.hh | 10 +- .../parameterspace/default/createentities.hh | 4 +- .../iga/parameterspace/default/createlevel.hh | 4 +- .../parameterspace/default/elementtrimdata.hh | 4 +- .../parameterspace/default/entitycontainer.hh | 4 +- dune/iga/parameterspace/default/entityinfo.hh | 4 +- dune/iga/parameterspace/default/idset.hh | 4 +- .../parameterspace/default/parameterspace.hh | 12 +- .../default/parameterspaceentity.hh | 16 +- .../default/patchgridentityseed.hh | 4 +- .../default/patchgridhierarchiciterator.hh | 6 +- .../default/patchgridindexsets.hh | 12 +- .../default/patchgridintersectioniterator.hh | 12 +- .../default/patchgridintersections.hh | 40 ++--- .../default/patchgridleafiterator.hh | 10 +- .../default/patchgridleveliterator.hh | 8 +- .../parameterspace/default/patchtrimdata.hh | 4 +- .../default/referenceelement.hh | 4 +- .../iga/parameterspace/default/trimelement.hh | 8 +- .../default/trimmedlocalgeometry.hh | 6 +- .../default/trimmerpreferences.hh | 4 +- .../trimmingutils/clipelementrectangle.hh | 15 +- .../default/trimmingutils/cliputils.hh | 4 +- .../trimmingutils/indextransformations.hh | 4 +- .../default/trimmingutils/trimutils.hh | 4 +- dune/iga/parameterspace/identity/idSet.hh | 4 +- .../parameterspace/identity/parameterspace.hh | 4 +- .../identity/patchgridentityseed.hh | 4 +- .../identity/patchgridhierarchiciterator.hh | 4 +- .../identity/patchgridindexsets.hh | 4 +- .../identity/patchgridintersectioniterator.hh | 4 +- .../identity/patchgridleafiterator.hh | 4 +- .../identity/patchgridleveliterator.hh | 4 +- .../parameterspace/localgeometryvariant.hh | 5 +- dune/iga/test/CMakeLists.txt | 1 + .../auxiliaryfiles/element_trim_scaled.ibra | 152 ++++++++++++++++++ dune/iga/test/concepttests.cpp | 36 ++--- dune/iga/test/factorytest.cpp | 8 +- dune/iga/test/gridtests.cpp | 10 +- dune/iga/test/gridteststrimmed.cpp | 34 ++-- dune/iga/test/testboundarysegmentidx.cpp | 8 +- dune/iga/test/testibrareader.cpp | 6 +- dune/iga/test/testintegrationrules.cpp | 22 +-- dune/iga/test/testintersections.cpp | 4 +- dune/iga/test/testnotreconstructedgrid.cpp | 8 +- dune/iga/test/testnurbsbasis.cpp | 12 +- dune/iga/test/testnurbsbasistrimmed.cpp | 2 +- dune/iga/test/testtrimmedgeometry.cpp | 92 +++++++++++ .../iga/test/testunstructuredgridcreation.cpp | 2 +- dune/iga/test/testutillities.cpp | 11 +- dune/iga/test/testvtkdatacollector.cpp | 2 +- dune/iga/test/trimtest.cpp | 109 +++++++------ examples/benchmark.cc | 10 +- python/dune/iga/_iga.cc | 4 +- python/dune/iga/_igagrids.py | 2 +- 67 files changed, 618 insertions(+), 321 deletions(-) create mode 100644 dune/iga/test/auxiliaryfiles/element_trim_scaled.ibra create mode 100644 dune/iga/test/testtrimmedgeometry.cpp diff --git a/doc/doxygen/modules.txt b/doc/doxygen/modules.txt index ba82d805..3cbea44d 100644 --- a/doc/doxygen/modules.txt +++ b/doc/doxygen/modules.txt @@ -2,6 +2,6 @@ // SPDX-License-Identifier: LGPL-3.0-or-later /*! @defgroup ParameterSpace ParameterSpace - @details The group of available trimmers, see the Dune::IGA::IdentityTrim::ParameterSpace for the interface definiton + @details The group of available trimmers, see the Dune::IGA::IdentityParameterSpace::ParameterSpace for the interface definiton */ diff --git a/dune/iga/geometrykernel/algorithms.hh b/dune/iga/geometrykernel/algorithms.hh index 7d045743..5d679e94 100644 --- a/dune/iga/geometrykernel/algorithms.hh +++ b/dune/iga/geometrykernel/algorithms.hh @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once +#include #include #include @@ -214,4 +215,48 @@ auto isPointOnLineSegment(const Coordinate& p, const Coordinate& linePoint0, con return false; } +template +concept GeometryConcept = requires(T t, int i) { + T::coorddimension; + typename T::ctype; + { t.corner(i) } -> std::same_as>; + { t.corners() } -> std::convertible_to; +}; + +/** + * @brief This returns the center of mass for a polygon + * + * @details See https://en.wikipedia.org/wiki/Centroid#Of_a_polygon for details + * TODO This actually only works if the corners are ordered consecutively along the polygons perimeter + */ +template +auto centerOfMass(const Geometry& geometry) -> FieldVector { + int n = geometry.corners(); + + using Point = FieldVector; + std::vector corners; + corners.reserve(n); + + for (const auto i : Dune::range(n)) + corners.push_back(geometry.corner(i)); + + double a = 0.0; + double cx = 0.0; + double cy = 0.0; + for (const auto i : Dune::range(n - 1)) { + cx += (corners[i][0] + corners[i + 1][0]) * (corners[i][0] * corners[i + 1][1] - corners[i + 1][0] * corners[i][1]); + cy += (corners[i][1] + corners[i + 1][1]) * (corners[i][0] * corners[i + 1][1] - corners[i + 1][0] * corners[i][1]); + a += corners[i][0] * corners[i + 1][1] - corners[i + 1][0] * corners[i][1]; + } + // Last index + cx += (corners[n - 1][0] + corners[0][0]) * (corners[n - 1][0] * corners[0][1] - corners[0][0] * corners[n - 1][1]); + cy += (corners[n - 1][1] + corners[0][1]) * (corners[n - 1][0] * corners[0][1] - corners[0][0] * corners[n - 1][1]); + a += corners[n - 1][0] * corners[0][1] - corners[0][0] * corners[n - 1][1]; + + a *= 0.5; + cx *= 1 / (6 * a); + cy *= 1 / (6 * a); + return {cx, cy}; +} + } // namespace Dune::IGA::GeometryKernel diff --git a/dune/iga/geometrykernel/nurbspatchgeometrylocalview.hh b/dune/iga/geometrykernel/nurbspatchgeometrylocalview.hh index 97995a10..1fc92387 100644 --- a/dune/iga/geometrykernel/nurbspatchgeometrylocalview.hh +++ b/dune/iga/geometrykernel/nurbspatchgeometrylocalview.hh @@ -139,11 +139,10 @@ namespace GeometryKernel { * @return Global coordinates of the center. */ [[nodiscard]] GlobalCoordinate center() const { - // TODO Test this? Also not really good like that if constexpr (mydimension == gridDimension and not ParameterSpace::isAlwaysTrivial) - return global(parameterSpaceGeometry->local(parameterSpaceGeometry->center())); + return centerOfMass(*parameterSpaceGeometry); else - return global(LocalCoordinate(0.5)); + return LocalCoordinate(0.5); } /** @@ -208,7 +207,7 @@ namespace GeometryKernel { * @brief Compute the volume of the patch. * @return Volume of the patch. */ - [[nodiscard]] double volume() const { // TODO: Test this + [[nodiscard]] double volume() const { int order = mydimension * *std::ranges::max_element(patchGeometry_->patchData_.degree); auto rule = [&]() { @@ -221,8 +220,8 @@ namespace GeometryKernel { Volume vol = 0.0; for (auto& gp : rule) - vol += - integrationElement(globalInParameterSpace(gp.position())) * gp.weight() * parameterSpaceGeometry->volume(); + vol += integrationElement(gp.position()) * gp.weight(); + // vol += integrationElement(globalInParameterSpace(gp.position())) * gp.weight() * parameterSpaceGeometry->volume(); return vol; } diff --git a/dune/iga/hierarchicpatch/patchgrid.hh b/dune/iga/hierarchicpatch/patchgrid.hh index ca7c3541..49edc5e5 100644 --- a/dune/iga/hierarchicpatch/patchgrid.hh +++ b/dune/iga/hierarchicpatch/patchgrid.hh @@ -32,7 +32,7 @@ class NurbsPreBasis; } namespace Dune::IGA { -namespace IdentityTrim { +namespace IdentityParameterSpace { template struct PatchGridFamily; } @@ -79,7 +79,7 @@ struct HostGridAccess; * * @endcode */ -template typename GridFamily_ = IdentityTrim::PatchGridFamily, +template typename GridFamily_ = IdentityParameterSpace::PatchGridFamily, typename ScalarType = double> class PatchGrid : public GridDefaultImplementation> { @@ -161,15 +161,15 @@ public: const std::optional& patchTrimData = std::nullopt, const typename GridFamily::ParameterSpaceTraits::ParameterType& par = {}) : patchGeometries_(1, GeometryKernel::NURBSPatch(patchData)), - trimmer_(std::make_unique(*this, patchTrimData, par)) { + parameterSpace_(std::make_unique(*this, patchTrimData, par)) { patchGeometriesUnElevated = patchGeometries_; } PatchGrid& operator=(PatchGrid&& other) noexcept { patchGeometries_ = std::move(other.patchGeometries_); patchGeometriesUnElevated = std::move(other.patchGeometriesUnElevated); - trimmer_ = std::move(other.trimmer_); - trimmer_->update(this); + parameterSpace_ = std::move(other.parameterSpace); + parameterSpace_->update(this); return *this; } @@ -178,7 +178,7 @@ public: * Levels are numbered 0 ... maxlevel with 0 the coarsest level. */ [[nodiscard]] int maxLevel() const { - return trimmer_->maxLevel(); + return parameterSpace_->maxLevel(); } // Iterator to first entity of given codim on level @@ -238,7 +238,7 @@ public: /** @brief returns the number of boundary segments within the macro grid */ [[nodiscard]] size_t numBoundarySegments() const { - return trimmer_->numBoundarySegments(); + return parameterSpace_->numBoundarySegments(); } // number of leaf entities per codim in this process @@ -258,12 +258,12 @@ public: /** @brief Access to the GlobalIdSet */ const typename Traits::GlobalIdSet& globalIdSet() const { - return *trimmer_->globalIdSet_; + return *parameterSpace_->globalIdSet_; } /** @brief Access to the LocalIdSet */ const typename Traits::LocalIdSet& localIdSet() const { - return *trimmer_->localIdSet_; + return *parameterSpace_->localIdSet_; } /** @brief Access to the LevelIndexSets */ @@ -271,18 +271,18 @@ public: if (level < 0 || level > maxLevel()) { DUNE_THROW(GridError, "levelIndexSet of nonexisting level " << level << " requested!"); } - return *trimmer_->levelIndexSets_[level]; + return *parameterSpace_->levelIndexSets_[level]; } /** @brief Access to the LeafIndexSet */ const typename Traits::LeafIndexSet& leafIndexSet() const { - return *trimmer_->leafIndexSet_; + return *parameterSpace_->leafIndexSet_; } /** @brief Create Entity from EntitySeed */ template typename Traits::template Codim::Entity entity(const EntitySeed& seed) const { - return trimmer_->entity(seed); + return parameterSpace_->entity(seed); } /** @name Grid Refinement Methods */ @@ -310,7 +310,7 @@ public: patchGeometries_.emplace_back(newfinestPatchData, newUniqueKnotVecs); patchGeometriesUnElevated.emplace_back(patchGeometries_.back()); - trimmer_->globalRefine(1); + parameterSpace_->globalRefine(1); } } @@ -388,7 +388,7 @@ public: */ bool mark(int refCount, const typename Traits::template Codim<0>::Entity& e) { // @todo trim this does not do the right thing! the knotspans should also be aware of this change - return false; // trimmer_->parameterSpaceGrid().mark(refCount, getHostEntity<0>(e)); + return false; // parameterSpace->parameterSpaceGrid().mark(refCount, getHostEntity<0>(e)); } /** @brief Return refinement mark for entity @@ -396,44 +396,44 @@ public: * \return refinement mark (1,0,-1) */ int getMark(const typename Traits::template Codim<0>::Entity& e) const { - return 0; // trimmer_->parameterSpaceGrid().getMark(getHostEntity<0>(e)); + return 0; // parameterSpace->parameterSpaceGrid().getMark(getHostEntity<0>(e)); } /** @brief returns true, if at least one entity is marked for adaption */ bool preAdapt() { - return trimmer_->parameterSpaceGrid().preAdapt(); + return parameterSpace_->parameterSpaceGrid().preAdapt(); } // Triggers the grid refinement process bool adapt() { - return trimmer_->parameterSpaceGrid().adapt(); + return parameterSpace_->parameterSpaceGrid().adapt(); } /** @brief Clean up refinement markers */ void postAdapt() { - return trimmer_->parameterSpaceGrid().postAdapt(); + return parameterSpace_->parameterSpaceGrid().postAdapt(); } /*@}*/ /** @brief Size of the overlap on the leaf level */ unsigned int overlapSize(int codim) const { - return trimmer_->parameterSpaceGrid().leafGridView().overlapSize(codim); + return parameterSpace_->parameterSpaceGrid().leafGridView().overlapSize(codim); } /** @brief Size of the ghost cell layer on the leaf level */ unsigned int ghostSize(int codim) const { - return trimmer_->parameterSpaceGrid().leafGridView().ghostSize(codim); + return parameterSpace_->parameterSpaceGrid().leafGridView().ghostSize(codim); } /** @brief Size of the overlap on a given level */ unsigned int overlapSize(int level, int codim) const { - return trimmer_->parameterSpaceGrid().levelGridView(level).overlapSize(codim); + return parameterSpace_->parameterSpaceGrid().levelGridView(level).overlapSize(codim); } /** @brief Size of the ghost cell layer on a given level */ unsigned int ghostSize(int level, int codim) const { - return trimmer_->parameterSpaceGrid().levelGridView(level).ghostSize(codim); + return parameterSpace_->parameterSpaceGrid().levelGridView(level).ghostSize(codim); } #if 0 @@ -455,13 +455,13 @@ public: /** @brief Communicate data of level gridView */ template void communicate(DataHandle& handle, InterfaceType iftype, CommunicationDirection dir, int level) const { - // trimmer_->parameterSpaceGrid().levelGridView(level).communicate(handle, iftype, dir); + // parameterSpace->parameterSpaceGrid().levelGridView(level).communicate(handle, iftype, dir); } /** @brief Communicate data of leaf gridView */ template void communicate(DataHandle& handle, InterfaceType iftype, CommunicationDirection dir) const { - // trimmer_->parameterSpaceGrid().leafGridView().communicate(handle, iftype, dir); + // parameterSpace->parameterSpaceGrid().leafGridView().communicate(handle, iftype, dir); } // ********************************************************** @@ -470,10 +470,10 @@ public: // Returns the hostgrid this PatchGrid lives in const ParameterSpaceGrid& parameterSpaceGrid() const { - return trimmer_->parameterSpaceGrid(); + return parameterSpace_->parameterSpaceGrid(); } ParameterSpaceGrid& parameterSpaceGrid() { - return trimmer_->parameterSpaceGrid(); + return parameterSpace_->parameterSpaceGrid(); } // Returns the hostgrid entity encapsulated in given PatchGrid entity @@ -488,8 +488,8 @@ public: return patchGeometries_[lvl].numberOfSpans(); } - const auto& trimmer() const { - return *trimmer_; + const auto& parameterSpace() const { + return *parameterSpace_; } const auto& patchGeometry(int i) const { return patchGeometries_.at(i); @@ -498,11 +498,13 @@ public: return patchGeometries_.back(); } + /** Obtain Integration Rule Generator (as a std::function) */ auto integrationRule() const requires(not ParameterSpace::isAlwaysTrivial and dim == 2) { return integrationRuleHolder_.integrationRule(); } + /** Dynamically set integration Rule (as a std::function, see IntegrationRuleHolder for more details) */ void integrationRule(typename IntegrationRuleHolder::FunctionType integrationRule) requires(not ParameterSpace::isAlwaysTrivial and dim == 2) { @@ -514,7 +516,7 @@ private: std::vector> patchGeometries_; std::vector> patchGeometriesUnElevated; - std::unique_ptr trimmer_; + std::unique_ptr parameterSpace_; IntegrationRuleHolder integrationRuleHolder_{}; diff --git a/dune/iga/hierarchicpatch/patchgridentity.hh b/dune/iga/hierarchicpatch/patchgridentity.hh index 0d575af2..d454c801 100644 --- a/dune/iga/hierarchicpatch/patchgridentity.hh +++ b/dune/iga/hierarchicpatch/patchgridentity.hh @@ -108,7 +108,7 @@ public: /** @brief returns EntitySeed */ EntitySeed seed() const { - return patchGrid_->trimmer_->seed(*this); + return patchGrid_->parameterSpace().seed(*this); } /** @brief level of this element */ @@ -240,7 +240,7 @@ public: /** @brief Return EntitySeed */ [[nodiscard]] EntitySeed seed() const { - return patchGrid_->trimmer_->seed(*this); + return patchGrid_->parameterSpace().seed(*this); } /** @brief Level of this element */ @@ -278,22 +278,22 @@ public: // First level intersection [[nodiscard]] LevelIntersectionIterator ilevelbegin() const { - return patchGrid_->trimmer_->ilevelbegin(*this); + return patchGrid_->parameterSpace().ilevelbegin(*this); } // Reference to one past the last neighbor LevelIntersectionIterator ilevelend() const { - return patchGrid_->trimmer_->ilevelend(*this); + return patchGrid_->parameterSpace().ilevelend(*this); } // First leaf intersection LeafIntersectionIterator ileafbegin() const { - return patchGrid_->trimmer_->ileafbegin(*this); + return patchGrid_->parameterSpace().ileafbegin(*this); } // Reference to one past the last leaf intersection LeafIntersectionIterator ileafend() const { - return patchGrid_->trimmer_->ileafend(*this); + return patchGrid_->parameterSpace().ileafend(*this); } // returns true if Entity has NO children diff --git a/dune/iga/hierarchicpatch/patchgridfactory.hh b/dune/iga/hierarchicpatch/patchgridfactory.hh index 71c6c7b5..23cdd659 100644 --- a/dune/iga/hierarchicpatch/patchgridfactory.hh +++ b/dune/iga/hierarchicpatch/patchgridfactory.hh @@ -86,7 +86,7 @@ public: template auto makePatchGridFactory() { - using PatchGrid = IGA::PatchGrid; + using PatchGrid = IGA::PatchGrid; return GridFactory{}; } @@ -102,7 +102,7 @@ constexpr auto withTrimmingCapabilities() { template auto makePatchGridFactory(Impl::UseTrimmingCapabilities) { - using PatchGrid = IGA::PatchGrid; + using PatchGrid = IGA::PatchGrid; return GridFactory{}; } diff --git a/dune/iga/hierarchicpatch/patchgridgeometry.hh b/dune/iga/hierarchicpatch/patchgridgeometry.hh index dfcc1684..b579d456 100644 --- a/dune/iga/hierarchicpatch/patchgridgeometry.hh +++ b/dune/iga/hierarchicpatch/patchgridgeometry.hh @@ -75,6 +75,10 @@ public: return geometryLocalView_.center(); } + [[nodiscard]] Volume volume() const { + return geometryLocalView_.volume(); + } + /** @brief Maps a local coordinate within reference element to * global coordinate in element */ [[nodiscard]] GlobalCoordinate global(const LocalCoordinate& local) const { diff --git a/dune/iga/integrationrules/integrationruleholder.hh b/dune/iga/integrationrules/integrationruleholder.hh index da188372..aea4d0d7 100644 --- a/dune/iga/integrationrules/integrationruleholder.hh +++ b/dune/iga/integrationrules/integrationruleholder.hh @@ -6,7 +6,7 @@ #include namespace Dune::IGA { -namespace DefaultTrim { +namespace DefaultParameterSpace { template struct DefaultIntegrationRuleGenerator { @@ -19,7 +19,7 @@ namespace DefaultTrim { typename Generator::Parameters parameters{.boundaryDivisions = Preferences::getInstance().boundaryDivisions(), .targetAccuracy = Preferences::getInstance().targetAccuracy()}; }; -}; // namespace DefaultTrim +}; // namespace DefaultParameterSpace template struct IntegrationRuleHolder @@ -32,7 +32,7 @@ struct IntegrationRuleHolder std::function(const ParameterSpaceElement&, int, QuadratureType::Enum)>; IntegrationRuleHolder() - : generator_(DefaultTrim::DefaultIntegrationRuleGenerator{}) {} + : generator_(DefaultParameterSpace::DefaultIntegrationRuleGenerator{}) {} void integrationRule(FunctionType generator) { generator_ = generator; diff --git a/dune/iga/integrationrules/simplexgenerator.hh b/dune/iga/integrationrules/simplexgenerator.hh index ae6a9971..795d8ee5 100644 --- a/dune/iga/integrationrules/simplexgenerator.hh +++ b/dune/iga/integrationrules/simplexgenerator.hh @@ -143,7 +143,7 @@ private: } }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace // Add support for Dune::FieldVector in Earcut namespace mapbox::util { diff --git a/dune/iga/io/griddrawer.hh b/dune/iga/io/griddrawer.hh index 4dd0b961..ed748ef6 100644 --- a/dune/iga/io/griddrawer.hh +++ b/dune/iga/io/griddrawer.hh @@ -9,8 +9,8 @@ namespace Dune::IGA { template void drawGrid(PatchGrid* grid, std::string&& file_name) { - const typename PatchGrid::ParameterSpace& trimmer = grid->trimmer(); - auto& nonConstParameterSpace = const_cast(trimmer); + const typename PatchGrid::ParameterSpace& parameterspace = grid->parameterspace(); + auto& nonConstParameterSpace = const_cast(parameterspace); auto eleTrimDatas = nonConstParameterSpace.trimElements(); diff --git a/dune/iga/io/vtk/vtkrefinedgeometries.hh b/dune/iga/io/vtk/vtkrefinedgeometries.hh index 74ce07e4..2a683882 100644 --- a/dune/iga/io/vtk/vtkrefinedgeometries.hh +++ b/dune/iga/io/vtk/vtkrefinedgeometries.hh @@ -40,7 +40,7 @@ public: createCubeRefinement(subSampleFull); - if constexpr (std::is_same_v>) { const auto& idSet = gridView.grid().globalIdSet(); @@ -48,8 +48,8 @@ public: using SimplexGeneratorImpl = SimplexGenerator; const auto parameters = typename SimplexGeneratorImpl::Parameters{ - .boundaryDivisions = DefaultTrim::Preferences::getInstance().boundaryDivisions(), - .targetAccuracy = DefaultTrim::Preferences::getInstance().targetAccuracy()}; + .boundaryDivisions = DefaultParameterSpace::Preferences::getInstance().boundaryDivisions(), + .targetAccuracy = DefaultParameterSpace::Preferences::getInstance().targetAccuracy()}; for (const auto& element : elements(gridView)) { if (element.impl().isTrimmed()) { diff --git a/dune/iga/nurbsbasis.hh b/dune/iga/nurbsbasis.hh index cee48908..75f02f9c 100644 --- a/dune/iga/nurbsbasis.hh +++ b/dune/iga/nurbsbasis.hh @@ -645,9 +645,9 @@ public: indicesInTrim.reserve(n_ind_original); // Reserve space to avoid multiple allocations for (auto directIndex : Dune::range(numElements)) { - auto trimFlag = gridView_.grid().trimmer().entityContainer_.trimFlags_[gridView_.impl().level()][directIndex]; + auto trimFlag = gridView_.grid().parameterspace().entityContainer_.trimFlags_[gridView_.impl().level()][directIndex]; - if (trimFlag != IGA::DefaultTrim::ElementTrimFlag::empty) + if (trimFlag != IGA::DefaultParameterSpace::ElementTrimFlag::empty) indicesInTrim.insert(originalIndices_.at(directIndex).begin(), originalIndices_.at(directIndex).end()); } diff --git a/dune/iga/parameterspace/concepts.hh b/dune/iga/parameterspace/concepts.hh index eb44b02c..e293c312 100644 --- a/dune/iga/parameterspace/concepts.hh +++ b/dune/iga/parameterspace/concepts.hh @@ -18,7 +18,7 @@ concept TrimDataContainer = requires(const T& t, size_t i) { t[i]; }; template concept ParameterSpace = T::isValid and - requires(T trimmer, const typename T::ParameterType& param, const typename T::ElementTrimData& elementTrimData, + requires(T parameterspace, const typename T::ParameterType& param, const typename T::ElementTrimData& elementTrimData, const typename T::PatchTrimData& patchTrimData, const typename T::ParameterSpaceGrid& paramSpaceGrid) { { T::mydimension } -> std::convertible_to; typename T::ctype; @@ -42,12 +42,12 @@ concept ParameterSpace = // std::convertible_to>>; // Uncomment the line above when the trimData method is added to the ParameterSpace concept. - { trimmer.globalRefine(0) } -> std::convertible_to; + { parameterspace.globalRefine(0) } -> std::convertible_to; - { trimmer.parameterSpaceGrid() } -> std::convertible_to; - { trimmer.parameterSpaceGrid() } -> std::convertible_to; + { parameterspace.parameterSpaceGrid() } -> std::convertible_to; + { parameterspace.parameterSpaceGrid() } -> std::convertible_to; - { trimmer.setParameters(std::declval()) } -> std::convertible_to; + { parameterspace.setParameters(std::declval()) } -> std::convertible_to; // { parameterspace.unTrimmedParameterSpaceGrid() } -> std::convertible_to; { parameterspace.unTrimmedParameterSpaceGrid() } -> diff --git a/dune/iga/parameterspace/default/createentities.hh b/dune/iga/parameterspace/default/createentities.hh index 3f85f3b6..e27a1d43 100644 --- a/dune/iga/parameterspace/default/createentities.hh +++ b/dune/iga/parameterspace/default/createentities.hh @@ -7,7 +7,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { namespace Util { auto sameCorner(const auto& corner1, const auto& corner2, double precision = 1e-10) -> bool { @@ -371,4 +371,4 @@ void ParameterSpaceImpl::createSubEntities(int level) } } } -} // namespace Dune::IGA::DefaultTrim \ No newline at end of file +} // namespace Dune::IGA::DefaultParameterSpace \ No newline at end of file diff --git a/dune/iga/parameterspace/default/createlevel.hh b/dune/iga/parameterspace/default/createlevel.hh index fdf06b64..8a07c0d5 100644 --- a/dune/iga/parameterspace/default/createlevel.hh +++ b/dune/iga/parameterspace/default/createlevel.hh @@ -5,7 +5,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template void ParameterSpaceImpl::refineParameterSpaceGrid(int refCount, bool initFlag) { @@ -87,4 +87,4 @@ void ParameterSpaceImpl::refineParameterSpaceGrid(int createSubEntities(newLevel); } } -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/elementtrimdata.hh b/dune/iga/parameterspace/default/elementtrimdata.hh index 341ffe01..35234ba2 100644 --- a/dune/iga/parameterspace/default/elementtrimdata.hh +++ b/dune/iga/parameterspace/default/elementtrimdata.hh @@ -12,7 +12,7 @@ #include #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { enum class ElementTrimFlag { @@ -306,4 +306,4 @@ private: int newEdgeCounter_ = 4; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/entitycontainer.hh b/dune/iga/parameterspace/default/entitycontainer.hh index 7623569f..ab1fd1d7 100644 --- a/dune/iga/parameterspace/default/entitycontainer.hh +++ b/dune/iga/parameterspace/default/entitycontainer.hh @@ -8,7 +8,7 @@ #include #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template struct VectorEntityContainer { @@ -270,4 +270,4 @@ struct VectorEntityContainer std::vector edgeCount; std::vector vertexCount; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/entityinfo.hh b/dune/iga/parameterspace/default/entityinfo.hh index 3a173ede..2e16c674 100644 --- a/dune/iga/parameterspace/default/entityinfo.hh +++ b/dune/iga/parameterspace/default/entityinfo.hh @@ -5,7 +5,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template struct IdType; @@ -124,4 +124,4 @@ struct EntityInfoImpl ReservedVector, 4> decendantIds; }; -} // namespace Dune::IGA::DefaultTrim \ No newline at end of file +} // namespace Dune::IGA::DefaultParameterSpace \ No newline at end of file diff --git a/dune/iga/parameterspace/default/idset.hh b/dune/iga/parameterspace/default/idset.hh index deb09b9e..89ce67ff 100644 --- a/dune/iga/parameterspace/default/idset.hh +++ b/dune/iga/parameterspace/default/idset.hh @@ -5,7 +5,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template class PatchGridGlobalIdSet : public IdSet, @@ -61,4 +61,4 @@ public: const GridImp* grid_; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/parameterspace.hh b/dune/iga/parameterspace/default/parameterspace.hh index c32a0ca1..9d759528 100644 --- a/dune/iga/parameterspace/default/parameterspace.hh +++ b/dune/iga/parameterspace/default/parameterspace.hh @@ -35,21 +35,21 @@ #include #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template struct IdType; } template -struct std::hash> +struct std::hash> { - std::size_t operator()(const Dune::IGA::DefaultTrim::IdType& k) const { + std::size_t operator()(const Dune::IGA::DefaultParameterSpace::IdType& k) const { using std::hash; // Compute individual hash values for first, second and third and combine them using XOR // and bit shifting: // todo // return (hash()(k.id) ^ - // hash::ElementState>()(k.entityIdType) << 1) >> + // hash::ElementState>()(k.entityIdType) << 1) >> // 1; return (hash()(k.id)); } @@ -61,7 +61,7 @@ namespace GeometryKernel { class NURBSPatch; } -namespace DefaultTrim { +namespace DefaultParameterSpace { template struct IdType @@ -598,7 +598,7 @@ namespace DefaultTrim { boundarySegmentsArchive_; }; -} // namespace DefaultTrim +} // namespace DefaultParameterSpace } // namespace Dune::IGA #include "createentities.hh" diff --git a/dune/iga/parameterspace/default/parameterspaceentity.hh b/dune/iga/parameterspace/default/parameterspaceentity.hh index 85f79de1..e85b8b56 100644 --- a/dune/iga/parameterspace/default/parameterspaceentity.hh +++ b/dune/iga/parameterspace/default/parameterspaceentity.hh @@ -1,7 +1,7 @@ #pragma once -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template class PatchGridHierarchicIterator; @@ -108,13 +108,13 @@ public: if (codim == 0) return index(); - return grid_->trimmer().entityContainer_.template subIndexFromId(entityInfo_.id, i, codim, this->level()); + return grid_->parameterSpace().entityContainer_.template subIndexFromId(entityInfo_.id, i, codim, this->level()); } template requires(codim_ == 0) auto& subId(int i, int codim) const { - return grid_->trimmer().entityContainer_.subId(entityInfo_.id, i, codim); + return grid_->parameterSpace().entityContainer_.subId(entityInfo_.id, i, codim); } // TODO isnt this the same as hostEntity() @@ -215,7 +215,7 @@ public: [[nodiscard]] TrimmedParameterSpaceGridEntity subEntity(int i) const { if constexpr (cc == 0) return *this; - auto entity = grid_->trimmer().entityContainer_.template entity(subId(i, cc), this->level()); + auto entity = grid_->parameterSpace().entityContainer_.template entity(subId(i, cc), this->level()); return entity; } @@ -262,7 +262,7 @@ public: requires(codim_ == 0) decltype(auto) father() const { assert(entityInfo_.fatherId.has_value()); - return grid_->trimmer().entityContainer_.template entity<0>(entityInfo_.fatherId.value(), this->level()); + return grid_->parameterSpace().entityContainer_.template entity<0>(entityInfo_.fatherId.value(), this->level()); // return TrimmedParameterSpaceGridEntity(grid_, hostEntity_.father(), // grid_->parameterspace().entityContainer_.idToElementInfoMap.at( entityInfo_.fatherId.value())); } @@ -319,8 +319,8 @@ public: QuadratureRule getQuadratureRule(const std::optional& p_order = std::nullopt, const QuadratureType::Enum qt = QuadratureType::GaussLegendre) const { - auto degree = grid_->patchGeometry(this->level()).degree(); - int order = p_order.value_or(mydimension * *std::ranges::max_element(degree)); + // The parameterSpace has linear geometry, so if no order is specified, we assume it to be myDimension + int order = p_order.value_or(mydimension); if (not isTrimmed()) return QuadratureRules::rule(this->type(), order, qt); @@ -335,4 +335,4 @@ private: std::optional trimData_{}; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridentityseed.hh b/dune/iga/parameterspace/default/patchgridentityseed.hh index 543f0691..3f388151 100644 --- a/dune/iga/parameterspace/default/patchgridentityseed.hh +++ b/dune/iga/parameterspace/default/patchgridentityseed.hh @@ -8,7 +8,7 @@ * @brief The PatchGridEntitySeed class */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { /** * @brief The EntitySeed class provides the minimal information needed to restore an Entity using the grid. @@ -70,6 +70,6 @@ private: unsigned int indexInLvlStorage_{std::numeric_limits::max()}; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace // #define DUNE_IDENTITY_GRID_ENTITY_SEED_HH diff --git a/dune/iga/parameterspace/default/patchgridhierarchiciterator.hh b/dune/iga/parameterspace/default/patchgridhierarchiciterator.hh index 2c33f69b..c3d2978d 100644 --- a/dune/iga/parameterspace/default/patchgridhierarchiciterator.hh +++ b/dune/iga/parameterspace/default/patchgridhierarchiciterator.hh @@ -7,7 +7,7 @@ * @brief The PatchGridHierarchicIterator class */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { //********************************************************************** // @@ -88,7 +88,7 @@ private: if (target->level() < maxLevel_ && !target->isLeaf()) for (auto descendantId : target->entityInfo_.decendantIds) parameterSpaceElementStack_.push( - ¶meterSpaceGrid_->trimmer().entityContainer_.template entity<0>(descendantId, target->level() + 1)); + ¶meterSpaceGrid_->parameterSpace().entityContainer_.template entity<0>(descendantId, target->level() + 1)); } void setCurrentEntity() { @@ -102,4 +102,4 @@ private: int maxLevel_; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridindexsets.hh b/dune/iga/parameterspace/default/patchgridindexsets.hh index 62929d6c..e282e67e 100644 --- a/dune/iga/parameterspace/default/patchgridindexsets.hh +++ b/dune/iga/parameterspace/default/patchgridindexsets.hh @@ -9,7 +9,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { namespace Impl { enum class IndexSetType @@ -55,15 +55,15 @@ namespace Impl { } std::size_t size(int codim) const { - return grid_->trimmer().entityContainer_.size(codim, level()); + return grid_->parameterSpace().entityContainer_.size(codim, level()); } std::size_t size(GeometryType type) const { - return grid_->trimmer().entityContainer_.size(type, level()); + return grid_->parameterSpace().entityContainer_.size(type, level()); } GeoTypes types(int codim) const { - return grid_->trimmer().entityContainer_.types(codim, level()); + return grid_->parameterSpace().entityContainer_.types(codim, level()); } template @@ -73,7 +73,7 @@ namespace Impl { else { if (not e.impl().isTrimmed()) return hostIndexSet().contains(grid_->template getHostEntity(e).getHostEntity()); - return grid_->trimmer().entityContainer_.contains(e, level()); + return grid_->parameterSpace().entityContainer_.contains(e, level()); } } @@ -272,4 +272,4 @@ private: const GridImp* grid_; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridintersectioniterator.hh b/dune/iga/parameterspace/default/patchgridintersectioniterator.hh index b36174d5..3e021944 100644 --- a/dune/iga/parameterspace/default/patchgridintersectioniterator.hh +++ b/dune/iga/parameterspace/default/patchgridintersectioniterator.hh @@ -12,7 +12,7 @@ * @brief The PatchGridLeafIntersectionIterator and PatchGridLevelIntersectionIterator classes */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { namespace Impl { @@ -95,8 +95,8 @@ namespace Impl { auto& entityInfo = localEntity_.entityInfo(); auto& trimData = localEntity_.trimData(); auto& edgeTrimInfo = trimData.edge(iterator_); - auto edgeId = patchGrid_->trimmer().entityContainer_.globalEdgesIdOfElementsMap_.at(entityInfo.id)[iterator_]; - auto edgeInfo = patchGrid_->trimmer().entityContainer_.idToEdgeInfoMap.at(edgeId); + auto edgeId = patchGrid_->parameterSpace().entityContainer_.globalEdgesIdOfElementsMap_.at(entityInfo.id)[iterator_]; + auto edgeInfo = patchGrid_->parameterSpace().entityContainer_.idToEdgeInfoMap.at(edgeId); if (edgeInfo.isTrimmedHost() or not edgeInfo.isTrimmed()) { auto localIntersection = findLocalIntersection(edgeInfo, edgeTrimInfo, edgeInfo.isTrimmed()); @@ -153,8 +153,8 @@ namespace Impl { ++hostIterator_; } Intersection dereference() const { - auto parameterspaceIntersection = ParameterSpaceIntersection(patchGrid_, *hostIterator_); - auto realIntersection = typename Intersection::Implementation(patchGrid_, parameterspaceIntersection); + auto parameterSpaceIntersection = ParameterSpaceIntersection(patchGrid_, *hostIterator_); + auto realIntersection = typename Intersection::Implementation(patchGrid_, parameterSpaceIntersection); return Intersection(realIntersection); } @@ -301,4 +301,4 @@ private: IteratorImpl underlying_{}; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridintersections.hh b/dune/iga/parameterspace/default/patchgridintersections.hh index 4db1a661..eec1f66a 100644 --- a/dune/iga/parameterspace/default/patchgridintersections.hh +++ b/dune/iga/parameterspace/default/patchgridintersections.hh @@ -11,7 +11,7 @@ * @brief The TrimmedPatchGridLeafIntersection and TrimmedLevelIntersection classes */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { // External forward declarations template @@ -78,7 +78,7 @@ namespace Impl { } ParameterSpaceGridEntity inside() const { - return patchGrid_->trimmer().entityContainer_.template entity<0>(insideElementId_, level()); + return patchGrid_->parameterSpace().entityContainer_.template entity<0>(insideElementId_, level()); } ParameterSpaceGridEntity outside() const { @@ -201,11 +201,11 @@ namespace Impl { } ParameterSpaceGridEntity inside() const { - return patchGrid_->trimmer().entityContainer_.template entity<0>(insideElementId(), level()); + return patchGrid_->parameterSpace().entityContainer_.template entity<0>(insideElementId(), level()); } ParameterSpaceGridEntity outside() const { - return patchGrid_->trimmer().entityContainer_.template entity<0>(outsideElementId(), level()); + return patchGrid_->parameterSpace().entityContainer_.template entity<0>(outsideElementId(), level()); } bool boundary() const { @@ -252,8 +252,8 @@ namespace Impl { } int indexInOutside() const { - if (patchGrid_->trimmer().entityContainer_.isElementTrimmed(outsideElementId())) - return patchGrid_->trimmer().entityContainer_.outsideIntersectionIndex(insideElementId(), outsideElementId(), + if (patchGrid_->parameterSpace().entityContainer_.isElementTrimmed(outsideElementId())) + return patchGrid_->parameterSpace().entityContainer_.outsideIntersectionIndex(insideElementId(), outsideElementId(), indexInInside()); return hostIntersection_.indexInOutside(); } @@ -293,11 +293,11 @@ namespace Impl { return hostIntersection_.inside().level(); } IdType insideElementId() const { - auto hostId = patchGrid_->trimmer().parameterSpaceGrid().globalIdSet().id(hostIntersection_.inside()); + auto hostId = patchGrid_->parameterSpace().parameterSpaceGrid().globalIdSet().id(hostIntersection_.inside()); return {.entityIdType = IdType::EntityIdType::host, .id = hostId}; } IdType outsideElementId() const { - auto hostId = patchGrid_->trimmer().parameterSpaceGrid().globalIdSet().id(hostIntersection_.outside()); + auto hostId = patchGrid_->parameterSpace().parameterSpaceGrid().globalIdSet().id(hostIntersection_.outside()); return {.entityIdType = IdType::EntityIdType::host, .id = hostId}; } @@ -334,11 +334,11 @@ namespace Impl { indexInInside_(indexInInside) {} ParameterSpaceGridEntity inside() const { - return patchGrid_->trimmer().entityContainer_.template entity<0>(insideElementId(), level()); + return patchGrid_->parameterSpace().entityContainer_.template entity<0>(insideElementId(), level()); } ParameterSpaceGridEntity outside() const { - return patchGrid_->trimmer().entityContainer_.template entity<0>(outsideElementId(), level()); + return patchGrid_->parameterSpace().entityContainer_.template entity<0>(outsideElementId(), level()); } bool boundary() const { @@ -354,8 +354,8 @@ namespace Impl { if (not boundary()) DUNE_THROW(Dune::GridError, "BoundarySegmentIndex failed: Not a boundary"); - auto yaspEle = patchGrid_->trimmer().parameterSpaceGrid().template getHostEntity<0>(inside().hostEntity()); - auto gridView = patchGrid_->trimmer().untrimmedParameterSpaceGrid_->levelGridView(yaspEle.level()); + auto yaspEle = patchGrid_->parameterSpace().parameterSpaceGrid().template getHostEntity<0>(inside().hostEntity()); + auto gridView = patchGrid_->parameterSpace().untrimmedParameterSpaceGrid_->levelGridView(yaspEle.level()); auto yaspIntersection = *std::ranges::find_if( gridView.ibegin(yaspEle), gridView.iend(yaspEle), @@ -393,8 +393,8 @@ namespace Impl { } int indexInOutside() const { - if (patchGrid_->trimmer().entityContainer_.isElementTrimmed(outsideElementId())) - return patchGrid_->trimmer().entityContainer_.outsideIntersectionIndex(insideElementId(), outsideElementId(), + if (patchGrid_->parameterSpace().entityContainer_.isElementTrimmed(outsideElementId())) + return patchGrid_->parameterSpace().entityContainer_.outsideIntersectionIndex(insideElementId(), outsideElementId(), indexInInside()); return hostIntersection_.indexInOutside(); } @@ -432,12 +432,12 @@ namespace Impl { } IdType insideElementId() const { - auto hostId = patchGrid_->trimmer().parameterSpaceGrid().globalIdSet().id(hostIntersection_.inside()); + auto hostId = patchGrid_->parameterSpace().parameterSpaceGrid().globalIdSet().id(hostIntersection_.inside()); return {.entityIdType = IdType::EntityIdType::host, .id = hostId}; } IdType outsideElementId() const { - auto hostId = patchGrid_->trimmer().parameterSpaceGrid().globalIdSet().id(hostIntersection_.outside()); + auto hostId = patchGrid_->parameterSpace().parameterSpaceGrid().globalIdSet().id(hostIntersection_.outside()); return {.entityIdType = IdType::EntityIdType::host, .id = hostId}; } @@ -565,7 +565,7 @@ class TrimmedLeafIntersection public: // The type used to store coordinates - typedef typename GridImp::ctype ctype; + using ctype = typename GridImp::ctype; using LocalCoordinate = FieldVector; typedef typename GridImp::ParameterSpace::ParameterSpaceTraits::template Codim<1>::LocalParameterSpaceGeometry Geometry; @@ -597,7 +597,7 @@ public: int indexInInside) : underlying_{Impl::TrimmedIntersectionImpl(patchGrid, insideElementId, edgeInfo, indexInInside)} {} - + // Todo re-add move contructors // TrimmedLeafIntersection(const GridImp* parameterSpaceGrid, HostLeafIntersection&& hostIntersection) // : patchGrid_(parameterSpaceGrid), // hostIntersection_{hostIntersection} {} @@ -679,7 +679,7 @@ public: } /** - * @return Geometry of the intersection in the grid world space, here parameterspace geometry + * @return Geometry of the intersection in the grid world space, here parameterSpace geometry */ Geometry geometry() const { return underlying_.geometry(); @@ -882,4 +882,4 @@ private: IntersectionImpl underlying_{}; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridleafiterator.hh b/dune/iga/parameterspace/default/patchgridleafiterator.hh index 7f021395..0da35643 100644 --- a/dune/iga/parameterspace/default/patchgridleafiterator.hh +++ b/dune/iga/parameterspace/default/patchgridleafiterator.hh @@ -9,7 +9,7 @@ * @brief The PatchGridLeafIterator class */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { /** @brief Iterator over all entities of a given codimension and level of a grid. * @ingroup PatchGrid @@ -17,8 +17,6 @@ namespace Dune::IGA::DefaultTrim { template class PatchGridLeafIterator { -private: - // LevelIterator to the equivalent entity in the host grid using IteratorImplR = typename GridImp::ParameterSpace::template ParameterSpaceLeafIterator; using OLDIteratorImpl = typename GridImp::ParameterSpaceGrid::template Codim::template Partition::LeafIterator; @@ -35,11 +33,11 @@ public: explicit PatchGridLeafIterator(const GridImp* patchGrid) : patchGrid_(patchGrid), parameterSpaceLeafIterator( - patchGrid_->trimmer().entityContainer_.template begin(patchGrid_->maxLevel())) {} + patchGrid_->parameterSpace().entityContainer_.template begin(patchGrid_->maxLevel())) {} explicit PatchGridLeafIterator(const GridImp* patchGrid, [[maybe_unused]] bool endDummy) : patchGrid_(patchGrid), - parameterSpaceLeafIterator(patchGrid_->trimmer().entityContainer_.template end(patchGrid_->maxLevel())) { + parameterSpaceLeafIterator(patchGrid_->parameterSpace().entityContainer_.template end(patchGrid_->maxLevel())) { } // prefix increment @@ -70,4 +68,4 @@ private: IteratorImpl parameterSpaceLeafIterator; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchgridleveliterator.hh b/dune/iga/parameterspace/default/patchgridleveliterator.hh index fafaff45..24d9e5b6 100644 --- a/dune/iga/parameterspace/default/patchgridleveliterator.hh +++ b/dune/iga/parameterspace/default/patchgridleveliterator.hh @@ -9,7 +9,7 @@ * @brief The PatchGridLevelIterator class */ -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { /** @brief Iterator over all entities of a given codimension and level of a grid. * @ingroup PatchGrid @@ -33,7 +33,7 @@ public: explicit PatchGridLevelIterator(const GridImp* patchGrid, int level) : patchGrid_(patchGrid), - parameterSpaceLevelIterator(patchGrid_->trimmer().entityContainer_.template begin(level)) {} + parameterSpaceLevelIterator(patchGrid_->parameterSpace().entityContainer_.template begin(level)) {} /** @brief Constructor which create the end iterator @param endDummy Here only to distinguish it from the other constructor @@ -49,7 +49,7 @@ public: // template requires (codim==0) explicit PatchGridLevelIterator(const GridImp* patchGrid, int level, [[maybe_unused]] bool endDummy) : patchGrid_(patchGrid), - parameterSpaceLevelIterator(patchGrid_->trimmer().entityContainer_.template end(level)) {} + parameterSpaceLevelIterator(patchGrid_->parameterSpace().entityContainer_.template end(level)) {} // prefix increment void increment() { @@ -76,4 +76,4 @@ private: IteratorImpl parameterSpaceLevelIterator; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/patchtrimdata.hh b/dune/iga/parameterspace/default/patchtrimdata.hh index f81fd708..65ba857b 100644 --- a/dune/iga/parameterspace/default/patchtrimdata.hh +++ b/dune/iga/parameterspace/default/patchtrimdata.hh @@ -2,7 +2,7 @@ #pragma once #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { namespace Impl { template @@ -209,4 +209,4 @@ private: CurveManager manager_; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/referenceelement.hh b/dune/iga/parameterspace/default/referenceelement.hh index 1767eedc..c767cff1 100644 --- a/dune/iga/parameterspace/default/referenceelement.hh +++ b/dune/iga/parameterspace/default/referenceelement.hh @@ -10,7 +10,7 @@ namespace Dune { namespace IGA { - namespace DefaultTrim { + namespace DefaultParameterSpace { // template // struct ElementTrimData; @@ -477,6 +477,6 @@ namespace IGA { // But this should have value semantics and therefore it should be cheap to copy, thus maybe store it at the // entity }; - } // namespace DefaultTrim + } // namespace DefaultParameterSpace } // namespace IGA } // namespace Dune diff --git a/dune/iga/parameterspace/default/trimelement.hh b/dune/iga/parameterspace/default/trimelement.hh index 5acfe62b..d8009c02 100644 --- a/dune/iga/parameterspace/default/trimelement.hh +++ b/dune/iga/parameterspace/default/trimelement.hh @@ -10,7 +10,7 @@ #include #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { template auto ParameterSpaceImpl::trimElement(const YASPEntity<0>& element, const auto& gv, @@ -20,7 +20,7 @@ auto ParameterSpaceImpl::trimElement(const YASPEntity using CurveIndex = Impl::CurveLoopIndexEncoder::IndexResult; - static constexpr int numberOfCorners = 4; + constexpr int numberOfCorners = 4; std::array, numberOfCorners> corners; for (const auto i : Dune::range(numberOfCorners)) corners[i] = geo.corner(Util::vertexIndexMapping[i]); @@ -47,7 +47,7 @@ auto ParameterSpaceImpl::trimElement(const YASPEntity }; auto throwGridError = [] { - DUNE_THROW(Dune::GridError, "TrimElement wasn't successfull. Could not connect element trim curves"); + DUNE_THROW(Dune::GridError, "TrimElement wasn't successful. Could not connect element trim curves"); }; auto assertPoint = [&](const Clipper2Lib::PointD& ip, const FieldVector& curvePt, @@ -291,4 +291,4 @@ auto ParameterSpaceImpl::trimElement(const YASPEntity elementTrimData.finalize(); return std::move(elementTrimData); } -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/trimmedlocalgeometry.hh b/dune/iga/parameterspace/default/trimmedlocalgeometry.hh index dd6e5973..1e07a731 100644 --- a/dune/iga/parameterspace/default/trimmedlocalgeometry.hh +++ b/dune/iga/parameterspace/default/trimmedlocalgeometry.hh @@ -5,7 +5,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { enum class LocalGeometryTag { @@ -75,8 +75,6 @@ public: return true; } - // TODO Write something to get the integration Rule for this element (maybe give a pointer to parameterspace element - // instead of trimData) // return the number of corners of this element. Corners are numbered 0...n-1 [[nodiscard]] int corners() const { @@ -337,4 +335,4 @@ private: FieldVector pos_{}; }; -} // namespace Dune::IGA::DefaultTrim +} // namespace Dune::IGA::DefaultParameterSpace diff --git a/dune/iga/parameterspace/default/trimmerpreferences.hh b/dune/iga/parameterspace/default/trimmerpreferences.hh index 6966a307..578c8d50 100644 --- a/dune/iga/parameterspace/default/trimmerpreferences.hh +++ b/dune/iga/parameterspace/default/trimmerpreferences.hh @@ -6,7 +6,7 @@ #include -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { class Preferences { public: @@ -67,4 +67,4 @@ private: bool reportTrimmedElementGeometryTypeAsNone_{true}; bool reconstructTrimmedLocalGeometry_{true}; }; -} // namespace Dune::IGA::DefaultTrim \ No newline at end of file +} // namespace Dune::IGA::DefaultParameterSpace \ No newline at end of file diff --git a/dune/iga/parameterspace/default/trimmingutils/clipelementrectangle.hh b/dune/iga/parameterspace/default/trimmingutils/clipelementrectangle.hh index 4bbf4bd3..15aff507 100644 --- a/dune/iga/parameterspace/default/trimmingutils/clipelementrectangle.hh +++ b/dune/iga/parameterspace/default/trimmingutils/clipelementrectangle.hh @@ -12,10 +12,10 @@ #include #include -namespace Dune::IGA::DefaultTrim::Util { +namespace Dune::IGA::DefaultParameterSpace::Util { -auto clipElementRectangle(const auto& element, - const auto& patchTrimData) -> std::tuple { +auto clipElementRectangle(const auto& element, const auto& patchTrimData) + -> std::tuple { using namespace Clipper2Lib; auto eleGeo = element.geometry(); @@ -60,10 +60,6 @@ auto clipElementRectangle(const auto& element, auto intersectionIndices = patchTrimData.getIndices(intersectionPoint.z); - // std::cout << "First Curve: " << firstTrimmingCurvePoint.z << " " << firstTrimmingCurveIndices << std::endl; - // std::cout << "Second Curve: " << secondTrimmingCurvePoint.z << " " << secondTrimmingCurveIndices << std::endl; - // std::cout << "Intersection: " << intersectionPoint.z << " " << intersectionIndices << std::endl; - assert(firstTrimmingCurveIndices.loop == secondTrimmingCurveIndices.loop && "The points of the trimming curves should be on the same loop"); @@ -90,6 +86,9 @@ auto clipElementRectangle(const auto& element, clipper.Execute(ClipType::Intersection, FillRule::NonZero, resultClosedPaths, resultOpenPaths); assert(resultOpenPaths.empty() && "There should be no open paths in the clipping result"); + if (resultClosedPaths.size() > 1) + DUNE_THROW(Dune::GridError, + "Clipping was not successful: Multiple closed regions per element, please refine accordingly"); auto isFullElement = [&](const auto& clippedEdges) { return clippedEdges.size() == 4 and @@ -156,4 +155,4 @@ auto clipElementRectangle(const auto& element, return std::make_tuple(ElementTrimFlag::trimmed, result); } -} // namespace Dune::IGA::DefaultTrim::Util +} // namespace Dune::IGA::DefaultParameterSpace::Util diff --git a/dune/iga/parameterspace/default/trimmingutils/cliputils.hh b/dune/iga/parameterspace/default/trimmingutils/cliputils.hh index 0b14a5f7..18ee2ed9 100644 --- a/dune/iga/parameterspace/default/trimmingutils/cliputils.hh +++ b/dune/iga/parameterspace/default/trimmingutils/cliputils.hh @@ -10,7 +10,7 @@ #include #include -namespace Dune::IGA::DefaultTrim::Util { +namespace Dune::IGA::DefaultParameterSpace::Util { inline int giveEdgeIdx(const std::size_t e1, const std::size_t e2) { if ((e1 == 0 and e2 == 1) or (e1 == 1 and e2 == 0)) @@ -279,4 +279,4 @@ private: } }; -} // namespace Dune::IGA::DefaultTrim::Util +} // namespace Dune::IGA::DefaultParameterSpace::Util diff --git a/dune/iga/parameterspace/default/trimmingutils/indextransformations.hh b/dune/iga/parameterspace/default/trimmingutils/indextransformations.hh index 5bc96c65..d3b5ef38 100644 --- a/dune/iga/parameterspace/default/trimmingutils/indextransformations.hh +++ b/dune/iga/parameterspace/default/trimmingutils/indextransformations.hh @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once -namespace Dune::IGA::DefaultTrim { +namespace Dune::IGA::DefaultParameterSpace { /** * \brief Transformations for vertex and edge indices between ParameterSpace Notation and Dune Notation @@ -94,4 +94,4 @@ private: } } }; -} // namespace Dune::IGA::DefaultTrim \ No newline at end of file +} // namespace Dune::IGA::DefaultParameterSpace \ No newline at end of file diff --git a/dune/iga/parameterspace/default/trimmingutils/trimutils.hh b/dune/iga/parameterspace/default/trimmingutils/trimutils.hh index bc688222..bbb6578e 100644 --- a/dune/iga/parameterspace/default/trimmingutils/trimutils.hh +++ b/dune/iga/parameterspace/default/trimmingutils/trimutils.hh @@ -11,7 +11,7 @@ #include #include -namespace Dune::IGA::DefaultTrim::Util { +namespace Dune::IGA::DefaultParameterSpace::Util { template auto approxSamePoint(const Clipper2Lib::PointD& pt1, const FieldVector& pt2, const double prec) -> bool { @@ -90,4 +90,4 @@ Entity coarsestFather(const Entity& ele) { return father; } -} // namespace Dune::IGA::DefaultTrim::Util +} // namespace Dune::IGA::DefaultParameterSpace::Util diff --git a/dune/iga/parameterspace/identity/idSet.hh b/dune/iga/parameterspace/identity/idSet.hh index 04b13ddb..c0dd4515 100644 --- a/dune/iga/parameterspace/identity/idSet.hh +++ b/dune/iga/parameterspace/identity/idSet.hh @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LGPL-2.1-or-later #pragma once -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { template class PatchGridGlobalIdSet : public IdSet, typename std::remove_const_t::Traits::GlobalIdSet::IdType> @@ -86,4 +86,4 @@ public: const GridImp* grid_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/identity/parameterspace.hh b/dune/iga/parameterspace/identity/parameterspace.hh index 63177d35..79715bf8 100644 --- a/dune/iga/parameterspace/identity/parameterspace.hh +++ b/dune/iga/parameterspace/identity/parameterspace.hh @@ -34,7 +34,7 @@ namespace GeometryKernel { class NURBSPatch; } -namespace IdentityTrim { +namespace IdentityParameterSpace { /** * @brief Parameter struct representing parameters for the trimming operation. @@ -401,5 +401,5 @@ namespace IdentityTrim { std::unique_ptr parameterSpaceGrid_; ///< The parameter space grid. }; -} // namespace IdentityTrim +} // namespace IdentityParameterSpace } // namespace Dune::IGA diff --git a/dune/iga/parameterspace/identity/patchgridentityseed.hh b/dune/iga/parameterspace/identity/patchgridentityseed.hh index 2082c78e..d5ccc5be 100644 --- a/dune/iga/parameterspace/identity/patchgridentityseed.hh +++ b/dune/iga/parameterspace/identity/patchgridentityseed.hh @@ -8,7 +8,7 @@ * @brief The PatchGridEntitySeed class */ -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { /** * @brief The EntitySeed class provides the minimal information needed to restore an Entity using the grid. @@ -61,6 +61,6 @@ private: ParameterSpaceGridEntitySeed hostEntitySeed_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace // #define DUNE_IDENTITY_GRID_ENTITY_SEED_HH diff --git a/dune/iga/parameterspace/identity/patchgridhierarchiciterator.hh b/dune/iga/parameterspace/identity/patchgridhierarchiciterator.hh index d6817900..0a59298f 100644 --- a/dune/iga/parameterspace/identity/patchgridhierarchiciterator.hh +++ b/dune/iga/parameterspace/identity/patchgridhierarchiciterator.hh @@ -7,7 +7,7 @@ * @brief The PatchGridHierarchicIterator class */ -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { //********************************************************************** // @@ -64,4 +64,4 @@ private: HostGridHierarchicIterator hostHierarchicIterator_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/identity/patchgridindexsets.hh b/dune/iga/parameterspace/identity/patchgridindexsets.hh index a04ff274..df6eab66 100644 --- a/dune/iga/parameterspace/identity/patchgridindexsets.hh +++ b/dune/iga/parameterspace/identity/patchgridindexsets.hh @@ -11,7 +11,7 @@ #include -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { template class PatchGridLevelIndexSet @@ -145,4 +145,4 @@ public: const GridImp* grid_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/identity/patchgridintersectioniterator.hh b/dune/iga/parameterspace/identity/patchgridintersectioniterator.hh index 81fefe3d..4b3ba56f 100644 --- a/dune/iga/parameterspace/identity/patchgridintersectioniterator.hh +++ b/dune/iga/parameterspace/identity/patchgridintersectioniterator.hh @@ -11,7 +11,7 @@ * @brief The PatchGridLeafIntersectionIterator and PatchGridLevelIntersectionIterator classes */ -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { /** @brief Iterator over all element neighbors * @ingroup PatchGrid @@ -109,4 +109,4 @@ private: HostLevelIntersectionIterator hostIterator_ = {}; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/identity/patchgridleafiterator.hh b/dune/iga/parameterspace/identity/patchgridleafiterator.hh index e9792da5..3b783091 100644 --- a/dune/iga/parameterspace/identity/patchgridleafiterator.hh +++ b/dune/iga/parameterspace/identity/patchgridleafiterator.hh @@ -9,7 +9,7 @@ * @brief The PatchGridLeafIterator class */ -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { /** @brief Iterator over all entities of a given codimension and level of a grid. * @ingroup PatchGrid @@ -62,4 +62,4 @@ private: IteratorImpl hostLeafIterator_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/identity/patchgridleveliterator.hh b/dune/iga/parameterspace/identity/patchgridleveliterator.hh index 7efb2bf9..2fa2376f 100644 --- a/dune/iga/parameterspace/identity/patchgridleveliterator.hh +++ b/dune/iga/parameterspace/identity/patchgridleveliterator.hh @@ -9,7 +9,7 @@ * @brief The PatchGridLevelIterator class */ -namespace Dune::IGA::IdentityTrim { +namespace Dune::IGA::IdentityParameterSpace { /** @brief Iterator over all entities of a given codimension and level of a grid. * @ingroup PatchGrid @@ -63,4 +63,4 @@ private: HostGridLevelIterator hostLevelIterator_; }; -} // namespace Dune::IGA::IdentityTrim +} // namespace Dune::IGA::IdentityParameterSpace diff --git a/dune/iga/parameterspace/localgeometryvariant.hh b/dune/iga/parameterspace/localgeometryvariant.hh index 7723a61f..da24d6eb 100644 --- a/dune/iga/parameterspace/localgeometryvariant.hh +++ b/dune/iga/parameterspace/localgeometryvariant.hh @@ -79,7 +79,7 @@ public: /** @brief Return the transposed of the Jacobian */ - JacobianTransposed jacobianTransposed(const auto& local) const { // @todo Trim remove JacobianTransposed + JacobianTransposed jacobianTransposed(const auto& local) const { return visit([&](const auto& impl) -> JacobianTransposed { return impl.jacobianTransposed(local); }); } @@ -105,11 +105,12 @@ public: auto getQuadratureRule(const std::optional& p_order = std::nullopt, const QuadratureType::Enum qt = QuadratureType::GaussLegendre) const { + // The parameterSpace has linear geometry, so if no order is specified, we assume it to be myDimension return visit([&](const auto& impl) { if constexpr (requires { impl.getQuadratureRule(p_order, qt); }) return impl.getQuadratureRule(p_order, qt); else - return QuadratureRule(type(), p_order, qt); + return QuadratureRules::rule(type(), p_order.value_or(mydimension), qt); }); } diff --git a/dune/iga/test/CMakeLists.txt b/dune/iga/test/CMakeLists.txt index 82612bff..9785854a 100644 --- a/dune/iga/test/CMakeLists.txt +++ b/dune/iga/test/CMakeLists.txt @@ -20,6 +20,7 @@ set(TESTS testboundarysegmentidx testunstructuredgridcreation testnotreconstructedgrid + testtrimmedgeometry ) option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) diff --git a/dune/iga/test/auxiliaryfiles/element_trim_scaled.ibra b/dune/iga/test/auxiliaryfiles/element_trim_scaled.ibra new file mode 100644 index 00000000..8934f0c4 --- /dev/null +++ b/dune/iga/test/auxiliaryfiles/element_trim_scaled.ibra @@ -0,0 +1,152 @@ +[ + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<0>", + "type": "NurbsCurveGeometry2D", + "degree": 2, + "knots": [-0.90855398792515929,-0.90855398792515929,-0.28351119663930086,-0.28351119663930086], + "nb_poles": 3, + "poles": [[0.755864067929434,1.0],[0.457136070948748,0.62539591346630918],[0.0,0.39382376404068359]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<1>", + "type": "NurbsCurveGeometry2D", + "degree": 1, + "knots": [0.60617623595931636,1.0], + "nb_poles": 2, + "poles": [[0.0,0.39382376404068359],[0.0,0.0]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<2>", + "type": "NurbsCurveGeometry2D", + "degree": 1, + "knots": [0.0,1.0], + "nb_poles": 2, + "poles": [[0.0,0.0],[1.0,0.0]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<3>", + "type": "NurbsCurveGeometry2D", + "degree": 1, + "knots": [0.0,1.0], + "nb_poles": 2, + "poles": [[1.0,0.0],[1.0,1.0]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<4>", + "type": "NurbsCurveGeometry2D", + "degree": 1, + "knots": [0.0,0.24413593207056605], + "nb_poles": 2, + "poles": [[1.0,1.0],[0.755864067929434,1.0]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsSurfaceGeometry3D<0>", + "type": "NurbsSurfaceGeometry3D", + "degree_u": 1, + "degree_v": 1, + "knots_u": [0.0,1.0], + "knots_v": [0.0,1.0], + "nb_poles_u": 2, + "nb_poles_v": 2, + "poles": [[0.0,0.0,0.0],[0.0,5.0,0.0],[5.0,0.0,0.0],[5.0,5.0,0.0]] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepFace<0>", + "type": "BrepFace", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loops": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>"], + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsSurfaceGeometry3D<0>" + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "type": "BrepLoop", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "face": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepFace<0>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<0>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<1>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<2>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<3>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<4>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<0>", + "type": "BrepTrim", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loop": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "Edge": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<3>", + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<0>", + "domain": [-0.90855398792515929,-0.28351119663930086] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<1>", + "type": "BrepTrim", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loop": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "Edge": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<4>", + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<1>", + "domain": [0.60617623595931636,1.0] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<2>", + "type": "BrepTrim", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loop": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "Edge": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<0>", + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<2>", + "domain": [0.0,1.0] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<3>", + "type": "BrepTrim", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loop": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "Edge": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<1>", + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<3>", + "domain": [0.0,1.0] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<4>", + "type": "BrepTrim", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "loop": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>", + "Edge": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<2>", + "geometry": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<4>", + "domain": [0.0,0.24413593207056605] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<0>", + "type": "BrepEdge", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<2>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<1>", + "type": "BrepEdge", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<3>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<2>", + "type": "BrepEdge", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<4>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<3>", + "type": "BrepEdge", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<0>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<4>", + "type": "BrepEdge", + "brep": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<1>"] + }, + { + "key": "rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>", + "type": "Brep", + "curve_geometries_2d": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<0>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<1>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<2>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<3>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsCurveGeometry2D<4>"], + "surface_geometries_3d": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.NurbsSurfaceGeometry3D<0>"], + "faces": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepFace<0>"], + "loops": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepLoop<0>"], + "trims": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<0>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<1>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<2>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<3>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepTrim<4>"], + "edges": ["rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<0>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<1>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<2>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<3>","rhino<0986f635-14f3-4eb4-8601-b98b20fe2d35>.BrepEdge<4>"] + } +] \ No newline at end of file diff --git a/dune/iga/test/concepttests.cpp b/dune/iga/test/concepttests.cpp index d21bc549..f7202605 100644 --- a/dune/iga/test/concepttests.cpp +++ b/dune/iga/test/concepttests.cpp @@ -77,24 +77,24 @@ int main() { // Check concepts with trim - checkConcepts>(); - checkConcepts>(); - // checkConcepts>(); - - static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - // static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); - static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + checkConcepts>(); + checkConcepts>(); + // checkConcepts>(); + + static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + // static_assert(not Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); + static_assert(Dune::IGA::Concept::ParameterSpace::ParameterSpace>); return 0; } diff --git a/dune/iga/test/factorytest.cpp b/dune/iga/test/factorytest.cpp index 787732de..a442cf9e 100644 --- a/dune/iga/test/factorytest.cpp +++ b/dune/iga/test/factorytest.cpp @@ -32,7 +32,7 @@ using namespace Dune::IGA; auto testFactoryWithTorus() { Dune::TestSuite t("", Dune::TestSuite::ThrowPolicy::ThrowOnRequired); - using Grid = Dune::IGA::PatchGrid<1, 3, IdentityTrim::PatchGridFamily>; + using Grid = Dune::IGA::PatchGrid<1, 3, IdentityParameterSpace::PatchGridFamily>; Dune::GridFactory gridFactory; const double r = 1.0; auto circle = makeCircularArc(r); @@ -67,7 +67,7 @@ auto testFactoryWithPlateWithTriangularTrim2D() { constexpr int gridDim = 2; constexpr auto dimworld = 2; - using Grid = Dune::IGA::PatchGrid; + using Grid = Dune::IGA::PatchGrid; const std::array order = {2, 2}; const std::array, gridDim> knotSpans = { @@ -126,7 +126,7 @@ auto testFactoryWithPlateWithTriangularTrim3D() { constexpr int gridDim = 2; constexpr auto dimworld = 3; - using Grid = Dune::IGA::PatchGrid; + using Grid = Dune::IGA::PatchGrid; const std::array order = {2, 2}; const std::array, gridDim> knotSpans = { @@ -187,7 +187,7 @@ auto testFactoryWithPlateWithCircularTrim3D() { constexpr int gridDim = 2; constexpr auto dimworld = 3; - using Grid = Dune::IGA::PatchGrid; + using Grid = Dune::IGA::PatchGrid; const std::array order = {2, 2}; const std::array, gridDim> knotSpans = { diff --git a/dune/iga/test/gridtests.cpp b/dune/iga/test/gridtests.cpp index e9cbb25e..11a1ea68 100644 --- a/dune/iga/test/gridtests.cpp +++ b/dune/iga/test/gridtests.cpp @@ -810,7 +810,7 @@ auto testNURBSCurve() { patchData.knotSpans = knotSpans; patchData.degree = order; patchData.controlPoints = controlNet; - IGA::PatchGrid grid(patchData); + IGA::PatchGrid grid(patchData); auto leafGridView = grid.leafGridView(); auto& leafIndexSet = leafGridView.indexSet(); @@ -970,14 +970,14 @@ int main(int argc, char** argv) try { TestSuite t; std::cout << "==================================" << std::endl; - std::cout << "===============TEST DefaultTrim===" << std::endl; + std::cout << "===============TEST DefaultParameterSpace===" << std::endl; std::cout << "==================================" << std::endl; - t.subTest(testGrids()); + t.subTest(testGrids()); std::cout << "==================================" << std::endl; - std::cout << "===============TEST IdentityTrim===" << std::endl; + std::cout << "===============TEST IdentityParameterSpace===" << std::endl; std::cout << "==================================" << std::endl; - t.subTest(testGrids()); + t.subTest(testGrids()); std::cout << "testNURBSCurve" << std::endl; t.subTest(testNURBSCurve()); diff --git a/dune/iga/test/gridteststrimmed.cpp b/dune/iga/test/gridteststrimmed.cpp index 13e0e56b..76177c66 100644 --- a/dune/iga/test/gridteststrimmed.cpp +++ b/dune/iga/test/gridteststrimmed.cpp @@ -218,7 +218,7 @@ auto runGridTests(TestSuite& t, const auto& testCases) { constexpr int gridDim = 2; constexpr int dimworld = 2; - using PatchGrid = PatchGrid; + using PatchGrid = PatchGrid; using GridFactory = Dune::GridFactory; auto gridFactory = GridFactory(); @@ -230,7 +230,7 @@ auto runGridTests(TestSuite& t, const auto& testCases) { gridFactory.insertTrimParameters(GridFactory::TrimParameterType{splitter}); auto grid = gridFactory.createGrid(); - for (int i = min; i <= max; i++) { + for (int i = min; i <= max; ++i) { std::cout << "Testing now " << name << " (Refinement " << i << ")" << std::endl; if (i > min) grid->globalRefine(1); @@ -244,28 +244,22 @@ template