26 #ifndef EWOMS_ECFV_STENCIL_HH 
   27 #define EWOMS_ECFV_STENCIL_HH 
   31 #include <dune/grid/common/mcmgmapper.hh> 
   32 #include <dune/grid/common/intersectioniterator.hh> 
   33 #include <dune/geometry/type.hh> 
   34 #include <dune/common/fvector.hh> 
   35 #include <dune/common/version.hh> 
   50 template <
class Scalar, 
class Gr
idView>
 
   53     enum { dimWorld = GridView::dimensionworld };
 
   55     typedef typename GridView::ctype CoordScalar;
 
   56     typedef typename GridView::Intersection Intersection;
 
   57     typedef typename GridView::template Codim<0>::Entity Element;
 
   58 #if ! DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
   59     typedef typename GridView::template Codim<0>::EntityPointer ElementPointer;
 
   62     typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView,
 
   63                                                       Dune::MCMGElementLayout> ElementMapper;
 
   65     typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
 
   67     typedef Dune::FieldVector<Scalar, dimWorld> WorldVector;
 
   83 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
   88             : elementPtr_(elementPtr)
 
   92 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
   93         void update(
const Element &element)
 
   96         void update(
const ElementPointer &elementPtr)
 
   97         { elementPtr_ = elementPtr; }
 
  102 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  103             const auto &
geometry = element_.geometry();
 
  105             const auto &
geometry = elementPtr_->geometry();
 
  115         { 
return centerPos_; }
 
  121         { 
return centerPos_; }
 
  132 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  133         const LocalGeometry 
geometry()
 const 
  134         { 
return element_.geometry(); }
 
  137         { 
return elementPtr_->geometry(); }
 
  141         GlobalPosition centerPos_;
 
  144 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  147         ElementPointer elementPtr_;
 
  162             exteriorIdx_ = localNeighborIdx;
 
  164             normal_ = intersection.centerUnitOuterNormal();
 
  166             const auto &geometry = intersection.geometry();
 
  167             integrationPos_ = geometry.center();
 
  168             area_ = geometry.volume();
 
  190         { 
return exteriorIdx_; }
 
  197         { 
return integrationPos_; }
 
  218         GlobalPosition integrationPos_;
 
  220         std::vector<Scalar> shapeValue_;
 
  221         std::vector<WorldVector> shapeGradient_;
 
  225         : gridView_(gridView)
 
  226         , elementMapper_(gridView)
 
  231         auto isIt = gridView_.ibegin(element);
 
  232         const auto &endIsIt = gridView_.iend(element);
 
  234 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  237         subControlVolumes_.resize(0, scv);
 
  238         subControlVolumes_.push_back(scv);
 
  239         elements_.resize(0, element);
 
  240         elements_.push_back(element);
 
  242         auto ePtr = ElementPointer(element);
 
  245         subControlVolumes_.resize(0, scv);
 
  246         subControlVolumes_.push_back(scv);
 
  247         elements_.resize(0, ePtr);
 
  248         elements_.push_back(ePtr);
 
  251         interiorFaces_.resize(0);
 
  252         boundaryFaces_.resize(0);
 
  254         for (; isIt != endIsIt; ++isIt) {
 
  255             const auto& intersection = *isIt;
 
  259             if (intersection.neighbor()) {
 
  260                 elements_.push_back(intersection.outside());
 
  284     { 
return *elements_[0]; }
 
  291     { 
return *gridView_; }
 
  298     { 
return subControlVolumes_.size(); }
 
  318         assert(0 <= dofIdx && dofIdx < 
numDof());
 
  320 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  321         return elementMapper_.index(
element(dofIdx));
 
  323         return elementMapper_.map(
element(dofIdx));
 
  331     { 
return elements_[dofIdx]->partitionType(); }
 
  342         assert(0 <= dofIdx && dofIdx < 
numDof());
 
  344 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  345         return elements_[dofIdx];
 
  347         return *elements_[dofIdx];
 
  356     { 
return subControlVolumes_[dofIdx]; }
 
  362     { 
return interiorFaces_.size(); }
 
  369     { 
return interiorFaces_[bfIdx]; }
 
  375     { 
return boundaryFaces_.size(); }
 
  382     { 
return boundaryFaces_[bfIdx]; }
 
  386     ElementMapper elementMapper_;
 
  388 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) 
  389     std::vector<Element> elements_;
 
  391     std::vector<ElementPointer> elements_;
 
  394     std::vector<SubControlVolume> subControlVolumes_;
 
  395     std::vector<SubControlVolumeFace> interiorFaces_;
 
  396     std::vector<SubControlVolumeFace> boundaryFaces_;
 
void updateTopology(const Element &element)
Definition: ecfvstencil.hh:229
 
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization. 
Definition: ecfvstencil.hh:51
 
const SubControlVolumeFace & boundaryFace(int bfIdx) const 
Returns the boundary face object belonging to a given boundary face index. 
Definition: ecfvstencil.hh:381
 
EcfvStencil(const GridView &gridView)
Definition: ecfvstencil.hh:224
 
Quadrature geometry for quadrilaterals. 
 
const SubControlVolumeFace & interiorFace(int bfIdx) const 
Returns the face object belonging to a given face index in the interior of the domain. 
Definition: ecfvstencil.hh:368
 
int numInteriorFaces() const 
Returns the number of interior faces of the stencil. 
Definition: ecfvstencil.hh:361
 
void updateCenterGradients()
Definition: ecfvstencil.hh:275
 
int exteriorIndex() const 
Returns the local index of the degree of freedom to the face's outside. 
Definition: ecfvstencil.hh:189
 
void update()
Definition: ecfvstencil.hh:100
 
int numPrimaryDof() const 
Returns the number of degrees of freedom which are contained by within the current element...
Definition: ecfvstencil.hh:309
 
const GlobalPosition & center() const 
The center of the sub-control volume. 
Definition: ecfvstencil.hh:120
 
int numDof() const 
Returns the number of degrees of freedom which the current element interacts with. 
Definition: ecfvstencil.hh:297
 
const Element & element() const 
Return the element to which the stencil refers. 
Definition: ecfvstencil.hh:283
 
SubControlVolumeFace(const Intersection &intersection, int localNeighborIdx)
Definition: ecfvstencil.hh:160
 
Represents a sub-control volume. 
Definition: ecfvstencil.hh:80
 
int globalSpaceIndex(int dofIdx) const 
Return the global space index given the index of a degree of freedom. 
Definition: ecfvstencil.hh:316
 
const GlobalPosition & globalPos() const 
The global position associated with the sub-control volume. 
Definition: ecfvstencil.hh:114
 
Element::Geometry LocalGeometry
Definition: ecfvstencil.hh:70
 
const WorldVector & normal() const 
Returns the outer unit normal at the face's integration point. 
Definition: ecfvstencil.hh:203
 
const LocalGeometry geometry() const 
The geometry of the sub-control volume. 
Definition: ecfvstencil.hh:136
 
Definition: baseauxiliarymodule.hh:35
 
const SubControlVolume & subControlVolume(int dofIdx) const 
Returns the sub-control volume object belonging to a given degree of freedom. 
Definition: ecfvstencil.hh:355
 
int interiorIndex() const 
Returns the local index of the degree of freedom to the face's interior. 
Definition: ecfvstencil.hh:175
 
const Element & element(int dofIdx=0) const 
Return the element given the index of a degree of freedom. 
Definition: ecfvstencil.hh:340
 
Scalar area() const 
Returns the area [m^2] of the face. 
Definition: ecfvstencil.hh:209
 
SubControlVolumeFace()
Definition: ecfvstencil.hh:157
 
Scalar volume() const 
The volume [m^3] occupied by the sub-control volume. 
Definition: ecfvstencil.hh:126
 
const GridView & gridView() const 
Return the grid view of the element to which the stencil refers. 
Definition: ecfvstencil.hh:290
 
Represents a face of a sub-control volume. 
Definition: ecfvstencil.hh:154
 
void update(const Element &element)
Definition: ecfvstencil.hh:270
 
SubControlVolume(const ElementPointer &elementPtr)
Definition: ecfvstencil.hh:87
 
Dune::PartitionType partitionType(int dofIdx) const 
Return partition type of a given degree of freedom. 
Definition: ecfvstencil.hh:330
 
const GlobalPosition & integrationPos() const 
Returns the global position of the face's integration point. 
Definition: ecfvstencil.hh:196
 
void update(const ElementPointer &elementPtr)
Definition: ecfvstencil.hh:96
 
int numBoundaryFaces() const 
Returns the number of boundary faces of the stencil. 
Definition: ecfvstencil.hh:374