Commit 9adbe088 authored by Melanie Lipp's avatar Melanie Lipp Committed by Dennis Gläser
Browse files

Extract GlobalPosition from Grid.

With contributions of Farid Mohammadi <farid.mohammadi@iws.uni-stuttgart.de>.
parent 3abd8e30
......@@ -65,13 +65,11 @@ class FVProblem
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView;
enum {
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
dim = GridView::dimension
};
using Element = typename GridView::template Codim<0>::Entity;
using CoordScalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
static constexpr bool isBox = GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod == DiscretizationMethod::box;
......
......@@ -40,8 +40,10 @@ template <class GridView, int codim = 0>
class GridViewGeometricEntitySet
{
using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
using Entity = typename GridView::template Codim<codim>::Entity;
public:
using Entity = typename GridView::template Codim<codim>::Entity;
GridViewGeometricEntitySet(const GridView& gridView)
: gridView_(gridView)
, mapper_(gridView, Dune::mcmgLayout(Dune::Codim<codim>()))
......
......@@ -33,12 +33,12 @@
namespace Dumux {
//! Checks if four points lie within the same plane.
template<class Scalar>
bool pointsAreCoplanar(const std::vector<Dune::FieldVector<Scalar, 3>>& points, Scalar eps = 1e-20)
template<class CoordScalar>
bool pointsAreCoplanar(const std::vector<Dune::FieldVector<CoordScalar, 3>>& points, CoordScalar eps = 1e-20)
{
assert(points.size() == 4);
// (see "Real-Time Collision Detection" by Christer Ericson)
Dune::FieldMatrix<Scalar, 4, 4> M;
Dune::FieldMatrix<CoordScalar, 4, 4> M;
for(int i = 0; i < 3; ++i )
M[i] = {points[0][i], points[1][i], points[2][i], points[3][i]};
M[3] = {1.0, 1.0, 1.0, 1.0};
......@@ -53,8 +53,8 @@ bool pointsAreCoplanar(const std::vector<Dune::FieldVector<Scalar, 3>>& points,
*
* \param points The user-specified vector of points (potentially in wrong order).
*/
template<class Scalar>
std::vector<Dune::FieldVector<Scalar, 3>> getReorderedPoints(const std::vector<Dune::FieldVector<Scalar, 3>>& points)
template<class CoordScalar>
std::vector<Dune::FieldVector<CoordScalar, 3>> getReorderedPoints(const std::vector<Dune::FieldVector<CoordScalar, 3>>& points)
{
std::array<int, 4> tmp;
return getReorderedPoints(points, tmp);
......@@ -66,8 +66,8 @@ std::vector<Dune::FieldVector<Scalar, 3>> getReorderedPoints(const std::vector<D
* \param points The user-specified vector of points (potentially in wrong order).
* \param orientations An array of orientations that can be useful for further processing.
*/
template<class Scalar>
std::vector<Dune::FieldVector<Scalar, 3>> getReorderedPoints(const std::vector<Dune::FieldVector<Scalar, 3>>& points,
template<class CoordScalar>
std::vector<Dune::FieldVector<CoordScalar, 3>> getReorderedPoints(const std::vector<Dune::FieldVector<CoordScalar, 3>>& points,
std::array<int, 4>& orientations)
{
if(points.size() == 4)
......@@ -94,7 +94,7 @@ std::vector<Dune::FieldVector<Scalar, 3>> getReorderedPoints(const std::vector<D
return points;
// the points do not conform with the dune ordering, re-order
using GlobalPosition = Dune::FieldVector<Scalar, 3>;
using GlobalPosition = Dune::FieldVector<CoordScalar, 3>;
if(!diagonalsIntersect && orientations[0] == 1)
return std::vector<GlobalPosition>{p1, p0, p2, p3};
else if(!diagonalsIntersect && orientations[0] == -1)
......@@ -109,19 +109,19 @@ std::vector<Dune::FieldVector<Scalar, 3>> getReorderedPoints(const std::vector<D
/*!
* \brief Creates a dune quadrilateral geometry given 4 corner points.
*
* \tparam Scalar The Scalar type.
* \tparam CoordScalar The CoordScalar type.
* \tparam enableSanityCheck Turn on/off sanity check and reordering of points
* \param points The user-specified vector of points (potentially in wrong order).
*/
template<class Scalar, bool enableSanityCheck = true>
auto makeDuneQuadrilaterial(const std::vector<Dune::FieldVector<Scalar, 3>>& points)
template<class CoordScalar, bool enableSanityCheck = true>
auto makeDuneQuadrilaterial(const std::vector<Dune::FieldVector<CoordScalar, 3>>& points)
{
assert(points.size() == 4 && "A quadrilateral needs 4 corner points!");
using GlobalPosition = Dune::FieldVector<Scalar, 3>;
using GlobalPosition = Dune::FieldVector<CoordScalar, 3>;
static constexpr auto coordDim = GlobalPosition::dimension;
static constexpr auto dim = coordDim-1;
using GeometryType = Dune::MultiLinearGeometry<Scalar, dim, coordDim>;
using GeometryType = Dune::MultiLinearGeometry<CoordScalar, dim, coordDim>;
// if no sanity check if desired, use the given points directly to construct the geometry
if(!enableSanityCheck)
......
......@@ -64,7 +64,7 @@ class StaggeredFVProblem : public FVProblem<TypeTag>
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using CoordScalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, GridView::dimensionworld>;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
static constexpr auto cellCenterIdx = FVGridGeometry::cellCenterIdx();
static constexpr auto faceIdx = FVGridGeometry::faceIdx();
......
......@@ -52,8 +52,9 @@ class BaseFVGridGeometry
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using CoordScalar = typename GV::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
using Element = typename GV::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
public:
//! export the grid view type
......
......@@ -69,7 +69,6 @@ class BoxDarcysLaw
enum { dimWorld = GridView::dimensionworld};
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
......@@ -101,7 +100,7 @@ public:
const auto& shapeValues = fluxVarCache.shapeValues();
// evaluate gradP - rho*g at integration point
GlobalPosition gradP(0.0);
Dune::FieldVector<Scalar, dimWorld> gradP(0.0);
Scalar rho(0.0);
for (auto&& scv : scvs(fvGeometry))
{
......
......@@ -67,7 +67,6 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::box>
numComponents = ModelTraits::numComponents()
};
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
public:
......@@ -117,7 +116,7 @@ public:
const auto D = problem.spatialParams().harmonicMean(insideD, outsideD, scvf.unitOuterNormal());
// the mole/mass fraction gradient
GlobalPosition gradX(0.0);
Dune::FieldVector<Scalar, dimWorld> gradX(0.0);
for (auto&& scv : scvs(fvGeometry))
gradX.axpy(elemVolVars[scv].moleFraction(phaseIdx, compIdx), fluxVarsCache.gradN(scv.indexInElement()));
......
......@@ -63,7 +63,6 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethod::box>
enum { numPhases = GET_PROP_TYPE(TypeTag, ModelTraits)::numPhases()} ;
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
static Scalar flux(const Problem& problem,
......@@ -94,7 +93,7 @@ public:
const auto& fluxVarsCache = elemFluxVarsCache[scvf];
// compute the temperature gradient with the shape functions
GlobalPosition gradTemp(0.0);
Dune::FieldVector<Scalar, dimWorld> gradTemp(0.0);
for (auto&& scv : scvs(fvGeometry))
gradTemp.axpy(elemVolVars[scv].temperature(), fluxVarsCache.gradN(scv.indexInElement()));
......
......@@ -68,7 +68,6 @@ class FouriersLawNonEquilibriumImplementation<TypeTag, DiscretizationMethod::box
enum {sPhaseIdx = FluidSystem::sPhaseIdx};
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
public:
static Scalar flux(const Problem& problem,
......@@ -117,7 +116,7 @@ public:
// evaluate gradTemp at integration point
const auto& fluxVarsCache = elemFluxVarsCache[scvf];
GlobalPosition gradTemp(0.0);
Dune::FieldVector<Scalar, dimWorld> gradTemp(0.0);
for (auto&& scv : scvs(fvGeometry))
{
// compute the temperature gradient with the shape functions
......
......@@ -59,6 +59,7 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::box >
using IndexType = typename GridView::IndexSet::IndexType;
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
enum { dim = GridView::dimension} ;
enum { dimWorld = GridView::dimensionworld} ;
......@@ -68,7 +69,6 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::box >
numComponents = GET_PROP_TYPE(TypeTag, ModelTraits)::numComponents()
};
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
using ReducedComponentVector = Dune::FieldVector<Scalar, numComponents-1>;
using ReducedComponentMatrix = Dune::FieldMatrix<Scalar, numComponents-1, numComponents-1>;
......@@ -118,7 +118,7 @@ public:
for (int compIdx = 0; compIdx < numComponents-1; compIdx++)
{
GlobalPosition gradX(0.0);
Dune::FieldVector<Scalar, dimWorld> gradX(0.0);
for (auto&& scv : scvs(fvGeometry))
{
const auto& volVars = elemVolVars[scv];
......
......@@ -91,11 +91,12 @@ class BoxSubControlVolume
using GridIndexType = typename T::GridIndexType;
using LocalIndexType = typename T::LocalIndexType;
using Scalar = typename T::Scalar;
using GlobalPosition = typename T::GlobalPosition;
using CornerStorage = typename T::CornerStorage;
enum { dim = Geometry::mydimension };
public:
using GlobalPosition = typename T::GlobalPosition;
//! state the traits public and thus export all types
using Traits = T;
......
......@@ -94,7 +94,6 @@ class BoxSubControlVolumeFace
using GridIndexType = typename T::GridIndexType;
using LocalIndexType = typename T::LocalIndexType;
using Scalar = typename T::Scalar;
using GlobalPosition = typename T::GlobalPosition;
using CornerStorage = typename T::CornerStorage;
using Geometry = typename T::Geometry;
using BoundaryFlag = typename T::BoundaryFlag;
......@@ -105,6 +104,7 @@ public:
//! The default constructor
BoxSubControlVolumeFace() = default;
using GlobalPosition = typename T::GlobalPosition;
//! Constructor for inner scvfs
template<class GeometryHelper, class Element>
......
......@@ -178,7 +178,6 @@ class CCMpfaFVElementGeometry<GG, false>
static const int dimWorld = GridView::dimensionworld;
using CoordScalar = typename GridView::ctype;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
public:
//! export type of subcontrol volume
......
......@@ -51,7 +51,9 @@ class MpfaDimensionHelper<FVGridGeometry, /*dim*/2, /*dimWorld*/2>
{
using GridView = typename FVGridGeometry::GridView;
using CoordScalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, GridView::dimensionworld>;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace;
using ScvfCornerVector = typename SubControlVolumeFace::Traits::CornerStorage;
......@@ -274,8 +276,9 @@ class MpfaDimensionHelper<FVGridGeometry, /*dim*/3, /*dimWorld*/3>
// Be picky about the dimensions
using GridView = typename FVGridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using CoordScalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, /*dimworld*/3>;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
// container to store the positions of intersections required for
// scvf corner computation. Maximum number of points needed is 9
......@@ -526,10 +529,10 @@ class CCMpfaHelper : public MpfaDimensionHelper<FVGridGeometry,
using GridView = typename FVGridGeometry::GridView;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using CoordScalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
using ReferenceElements = typename Dune::ReferenceElements<CoordScalar, dim>;
public:
......
......@@ -93,12 +93,12 @@ class CCMpfaSubControlVolumeFace
{
using GridIndexType = typename T::GridIndexType;
using Scalar = typename T::Scalar;
using GlobalPosition = typename T::GlobalPosition;
using CornerStorage = typename T::CornerStorage;
using OutsideGridIndexStorage = typename T::OutsideGridIndexStorage;
using Geometry = typename T::Geometry;
public:
using GlobalPosition = typename T::GlobalPosition;
//! state the traits public and thus export all types
using Traits = T;
......
......@@ -43,7 +43,8 @@ struct CCDefaultScvGeometryTraits
using GridIndexType = typename GridView::IndexSet::IndexType;
using LocalIndexType = unsigned int;
using Scalar = typename GridView::ctype;
using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimensionworld>;
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
};
/*!
......@@ -63,9 +64,10 @@ class CCSubControlVolume
using GridIndexType = typename T::GridIndexType;
using LocalIndexType = typename T::LocalIndexType;
using Scalar = typename T::Scalar;
using GlobalPosition = typename T::GlobalPosition;
public:
using GlobalPosition = typename T::GlobalPosition;
//! state the traits public and thus export all types
using Traits = T;
......
......@@ -68,7 +68,6 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::cctpfa>
static const int numComponents = ModelTraits::numComponents();
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
//! Class that fills the cache corresponding to tpfa Fick's Law
......
......@@ -60,7 +60,6 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethod::cctpfa>
static const int dimWorld = GridView::dimensionworld;
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
using ThermalConductivityModel = typename GET_PROP_TYPE(TypeTag, ThermalConductivityModel);
......
......@@ -93,8 +93,6 @@ class CCTpfaFVGridGeometry<GV, true, Traits>
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using CoordScalar = typename GV::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
public:
//! export the type of the fv element geometry (the local view type)
......@@ -364,9 +362,6 @@ class CCTpfaFVGridGeometry<GV, false, Traits>
static const int dim = GV::dimension;
static const int dimWorld = GV::dimensionworld;
using CoordScalar = typename GV::ctype;
using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
using ScvfGridIndexStorage = typename Traits::SubControlVolumeFace::Traits::GridIndexStorage;
using NeighborVolVarIndices = typename std::conditional_t< (dim<dimWorld),
ScvfGridIndexStorage,
......
......@@ -67,7 +67,6 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::cctpfa >
static const int numComponents = GET_PROP_TYPE(TypeTag, ModelTraits)::numComponents();
using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>;
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
using ReducedComponentVector = Dune::FieldVector<Scalar, numComponents-1>;
using ReducedComponentMatrix = Dune::FieldMatrix<Scalar, numComponents-1, numComponents-1>;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment