summaryrefslogtreecommitdiff
path: root/src/refinement
diff options
context:
space:
mode:
Diffstat (limited to 'src/refinement')
-rw-r--r--src/refinement/coupler2D.hh4
-rw-r--r--src/refinement/grid2D.h3
-rw-r--r--src/refinement/grid2D.hh9
3 files changed, 12 insertions, 4 deletions
diff --git a/src/refinement/coupler2D.hh b/src/refinement/coupler2D.hh
index 5614d16..d599728 100644
--- a/src/refinement/coupler2D.hh
+++ b/src/refinement/coupler2D.hh
@@ -160,7 +160,7 @@ void FineCoupler2D<T,DESCRIPTOR>::interpolate()
template <typename T, template<typename> class DESCRIPTOR>
void FineCoupler2D<T,DESCRIPTOR>::couple()
{
- auto& coarseLattice = this->_coarse.getSuperLattice();
+ const auto& coarseLattice = this->_coarse.getSuperLattice();
auto& fineLattice = this->_fine.getSuperLattice();
for (int y=0; y < this->_coarseSize; ++y) {
@@ -333,7 +333,7 @@ CoarseCoupler2D<T,DESCRIPTOR>::CoarseCoupler2D(
template <typename T, template<typename> class DESCRIPTOR>
void CoarseCoupler2D<T,DESCRIPTOR>::couple()
{
- auto& fineLattice = this->_fine.getSuperLattice();
+ const auto& fineLattice = this->_fine.getSuperLattice();
auto& coarseLattice = this->_coarse.getSuperLattice();
for (int y=0; y < this->_coarseSize; ++y) {
diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h
index 6d3579c..cc6bb62 100644
--- a/src/refinement/grid2D.h
+++ b/src/refinement/grid2D.h
@@ -76,7 +76,8 @@ public:
CoarseCoupler2D<T,DESCRIPTOR>& addCoarseCoupling(
Grid2D<T,DESCRIPTOR>& fineGrid, Vector<T,2> origin, Vector<T,2> extend);
- Vector<T,2> alignToGrid(Vector<T,2> physR) const;
+ Vector<T,2> alignLocationToGrid(Vector<T,2> physR) const;
+ Vector<T,2> alignExtendToGrid(Vector<T,2> physR) const;
Grid2D<T,DESCRIPTOR>& refine(IndicatorF2D<T>& domainF);
Grid2D<T,DESCRIPTOR>& refine(Vector<T,2> origin, Vector<T,2> extend);
diff --git a/src/refinement/grid2D.hh b/src/refinement/grid2D.hh
index 65dd84d..59e23ce 100644
--- a/src/refinement/grid2D.hh
+++ b/src/refinement/grid2D.hh
@@ -181,7 +181,7 @@ Grid2D<T,DESCRIPTOR>& Grid2D<T,DESCRIPTOR>::refine(IndicatorF2D<T>& domainF)
}
template <typename T, template<typename> class DESCRIPTOR>
-Vector<T,2> Grid2D<T,DESCRIPTOR>::alignToGrid(Vector<T,2> physR) const
+Vector<T,2> Grid2D<T,DESCRIPTOR>::alignLocationToGrid(Vector<T,2> physR) const
{
Vector<int,3> latticeR{};
_cuboids->getLatticeR(physR, latticeR);
@@ -189,6 +189,13 @@ Vector<T,2> Grid2D<T,DESCRIPTOR>::alignToGrid(Vector<T,2> physR) const
}
template <typename T, template<typename> class DESCRIPTOR>
+Vector<T,2> Grid2D<T,DESCRIPTOR>::alignExtendToGrid(Vector<T,2> extend) const
+{
+ const T deltaX = _converter->getPhysDeltaX();
+ return floor(extend / deltaX) * deltaX;
+}
+
+template <typename T, template<typename> class DESCRIPTOR>
Grid2D<T,DESCRIPTOR>& Grid2D<T,DESCRIPTOR>::refine(Vector<T,2> origin, Vector<T,2> extend)
{
IndicatorCuboid2D<T> fineCuboid(extend, origin);