summaryrefslogtreecommitdiff
path: root/src/refinement/grid2D.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/refinement/grid2D.h')
-rw-r--r--src/refinement/grid2D.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h
index 1d15170..d782651 100644
--- a/src/refinement/grid2D.h
+++ b/src/refinement/grid2D.h
@@ -34,23 +34,27 @@
#include "geometry/superGeometry2D.h"
#include "communication/loadBalancer.h"
#include "functors/analytical/indicator/indicatorF2D.h"
+#include "utilities/functorPtr.h"
namespace olb {
template <typename T, template<typename> class DESCRIPTOR> class FineCoupler2D;
template <typename T, template<typename> class DESCRIPTOR> class CoarseCoupler2D;
+template <typename T, template<typename> class DESCRIPTOR> class RefiningGrid2D;
template <typename T, template<typename> class DESCRIPTOR>
class Grid2D {
-private:
+protected:
+ FunctorPtr<IndicatorF2D<T>> _domainF;
+
std::unique_ptr<UnitConverter<T,DESCRIPTOR>> _converter;
std::unique_ptr<CuboidGeometry2D<T>> _cuboids;
std::unique_ptr<LoadBalancer<T>> _balancer;
std::unique_ptr<SuperGeometry2D<T>> _geometry;
std::unique_ptr<SuperLattice2D<T,DESCRIPTOR>> _lattice;
- std::vector<std::unique_ptr<Grid2D<T,DESCRIPTOR>>> _fineGrids;
+ std::vector<std::unique_ptr<RefiningGrid2D<T,DESCRIPTOR>>> _fineGrids;
std::vector<std::unique_ptr<FineCoupler2D<T,DESCRIPTOR>>> _fineCouplers;
std::vector<std::unique_ptr<CoarseCoupler2D<T,DESCRIPTOR>>> _coarseCouplers;
@@ -58,7 +62,7 @@ private:
public:
static std::unique_ptr<Grid2D<T,DESCRIPTOR>> make(IndicatorF2D<T>& domainF, int resolution, T tau, int re);
- Grid2D(IndicatorF2D<T>& domainF, int resolution, T tau, int re);
+ Grid2D(FunctorPtr<IndicatorF2D<T>>&& domainF, int resolution, T tau, int re);
UnitConverter<T,DESCRIPTOR>& getConverter();
CuboidGeometry2D<T>& getCuboidGeometry();
@@ -76,8 +80,26 @@ public:
Vector<T,2> alignOriginToGrid(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);
+ RefiningGrid2D<T,DESCRIPTOR>& refine(Vector<T,2> origin, Vector<T,2> extend, bool addCouplers=true);
+
+};
+
+template <typename T, template<typename> class DESCRIPTOR>
+class RefiningGrid2D : public Grid2D<T,DESCRIPTOR> {
+private:
+ const Vector<T,2> _origin;
+ const Vector<T,2> _extend;
+
+ Grid2D<T,DESCRIPTOR>& _parentGrid;
+
+public:
+ RefiningGrid2D(Grid2D<T,DESCRIPTOR>& parentGrid, Vector<T,2> origin, Vector<T,2> extend);
+
+ Vector<T,2> getOrigin() const;
+ Vector<T,2> getExtend() const;
+
+ /// Indicates the subdomain of the coarse grid rendered moot by refinement
+ std::unique_ptr<IndicatorF2D<T>> getRefinedOverlap() const;
};