diff options
Add named types to Grid2D constructor
This allows for readable differentiation between constructor overloads.
Diffstat (limited to 'src/refinement/grid2D.h')
-rw-r--r-- | src/refinement/grid2D.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/refinement/grid2D.h b/src/refinement/grid2D.h index 9a20544..f58a4ea 100644 --- a/src/refinement/grid2D.h +++ b/src/refinement/grid2D.h @@ -43,6 +43,29 @@ 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, typename Identificator> +class NamedType { +private: + T _value; + +public: + explicit NamedType(const T& value): + _value(value) {} + explicit NamedType(T&& value): + _value(std::move(value)) {} + + operator T() const + { + return _value; + } +}; + +template <typename T> +using RelaxationTime = NamedType<T,struct NamedRelaxationTime>; + +template <typename T> +using LatticeVelocity = NamedType<T,struct NamedLatticeVelocity>; + template <typename T, template<typename> class DESCRIPTOR> class Grid2D { protected: @@ -60,7 +83,8 @@ protected: std::vector<std::unique_ptr<CoarseCoupler2D<T,DESCRIPTOR>>> _coarseCouplers; public: - Grid2D(FunctorPtr<IndicatorF2D<T>>&& domainF, int resolution, T tau, int re); + Grid2D(FunctorPtr<IndicatorF2D<T>>&& domainF, int resolution, RelaxationTime<T> tau, int re); + Grid2D(FunctorPtr<IndicatorF2D<T>>&& domainF, int resolution, LatticeVelocity<T> uMax, int re); UnitConverter<T,DESCRIPTOR>& getConverter(); CuboidGeometry2D<T>& getCuboidGeometry(); |