summaryrefslogtreecommitdiff
path: root/src/refinement
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-02-06 21:02:21 +0100
committerAdrian Kummerlaender2019-06-24 15:17:42 +0200
commit77869487e437b4050f98c28a24db82e1e83a872c (patch)
tree933c93c9a417a6b6df12104f2544d8865c04a48f /src/refinement
parentf4069563f596b35d90a6a3b941011ebd7cf191b9 (diff)
downloadgrid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar.gz
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar.bz2
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar.lz
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar.xz
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.tar.zst
grid_refinement_openlb-77869487e437b4050f98c28a24db82e1e83a872c.zip
Continue cylinder2d refinement setup encapsulation
Diffstat (limited to 'src/refinement')
-rw-r--r--src/refinement/coupler2D.hh12
-rw-r--r--src/refinement/grid2D.h6
-rw-r--r--src/refinement/grid2D.hh12
3 files changed, 26 insertions, 4 deletions
diff --git a/src/refinement/coupler2D.hh b/src/refinement/coupler2D.hh
index 92c8d26..373a6de 100644
--- a/src/refinement/coupler2D.hh
+++ b/src/refinement/coupler2D.hh
@@ -73,7 +73,8 @@ Coupler2D<T,DESCRIPTOR>::Coupler2D(Grid2D<T,DESCRIPTOR>& coarse, Grid2D<T,DESCRI
const auto& fineGeometry = _fine.getCuboidGeometry();
const T deltaX = _fine.getConverter().getPhysDeltaX();
- const Vector<T,2> stepPhysR = _vertical ? Vector<T,2> {0, deltaX} : Vector<T,2> {deltaX, 0};
+ const Vector<T,2> stepPhysR = _vertical ? Vector<T,2> {0, deltaX} :
+ Vector<T,2> {deltaX, 0};
for (int i=0; i < _fineSize; ++i) {
if (i % 2 == 0) {
@@ -212,7 +213,8 @@ void FineCoupler2D<T,DESCRIPTOR>::couple()
fineLattice.get(finePos, fineCell);
for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
- fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop];
+ fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr)
+ + this->getScalingFactor() * fneq[iPop];
}
fineLattice.set(finePos, fineCell);
@@ -230,7 +232,8 @@ void FineCoupler2D<T,DESCRIPTOR>::couple()
fineLattice.get(finePos, fineCell);
for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
- fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop];
+ fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr)
+ + this->getScalingFactor() * fneq[iPop];
}
fineLattice.set(finePos, fineCell);
@@ -248,7 +251,8 @@ void FineCoupler2D<T,DESCRIPTOR>::couple()
fineLattice.get(finePos, fineCell);
for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
- fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr) + this->getScalingFactor() * fneq[iPop];
+ fineCell[iPop] = lbHelpers<T,DESCRIPTOR>::equilibrium(iPop, rho[0], u.data, uSqr)
+ + this->getScalingFactor() * fneq[iPop];
}
fineLattice.set(finePos, fineCell);
diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h
index 6cbbf6f..f538850 100644
--- a/src/refinement/grid2D.h
+++ b/src/refinement/grid2D.h
@@ -147,6 +147,12 @@ public:
void forEachGrid(std::function<void(Grid2D<T,DESCRIPTOR>&)>&& f);
void forEachGrid(const std::string& id, std::function<void(Grid2D<T,DESCRIPTOR>&,const std::string&)>&& f);
+ /// Returns the finest grid representing a physical position
+ /**
+ * Only works if pos is actually contained in a node of the refinement tree.
+ **/
+ Grid2D<T,DESCRIPTOR>& locate(Vector<T,2> pos);
+
std::size_t getActiveVoxelN() const;
};
diff --git a/src/refinement/grid2D.hh b/src/refinement/grid2D.hh
index fdf6461..9ca8aaf 100644
--- a/src/refinement/grid2D.hh
+++ b/src/refinement/grid2D.hh
@@ -281,6 +281,18 @@ void Grid2D<T,DESCRIPTOR>::forEachGrid(
}
template <typename T, template<typename> class DESCRIPTOR>
+Grid2D<T,DESCRIPTOR>& Grid2D<T,DESCRIPTOR>::locate(Vector<T,2> pos)
+{
+ int iC;
+ for (auto& grid : _fineGrids) {
+ if (grid->getCuboidGeometry().getC(pos, iC)) {
+ return grid->locate(pos);
+ }
+ }
+ return *this;
+}
+
+template <typename T, template<typename> class DESCRIPTOR>
std::size_t Grid2D<T,DESCRIPTOR>::getActiveVoxelN() const
{
std::size_t n = _geometry->getStatistics().getNvoxel();