fvbaseconstraintscontext.hh
Go to the documentation of this file.
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  Copyright (C) 2010-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
26 #ifndef EWOMS_FV_BASE_CONSTRAINTS_CONTEXT_HH
27 #define EWOMS_FV_BASE_CONSTRAINTS_CONTEXT_HH
28 
29 #include "fvbaseproperties.hh"
30 
31 #include <dune/common/fvector.hh>
32 
33 namespace Ewoms {
34 
40 template<class TypeTag>
42 {
43  typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
44  typedef typename GET_PROP_TYPE(TypeTag, Model) Model;
45  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
46  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
47  typedef typename GridView::template Codim<0>::Entity Element;
48 
49  enum { dimWorld = GridView::dimensionworld };
50 
51  typedef typename GridView::ctype CoordScalar;
52  typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
53 
54 public:
58  explicit FvBaseConstraintsContext(const ElementContext &elemCtx)
59  : elemCtx_(elemCtx)
60  { }
61 
65  const Problem &problem() const
66  { return elemCtx_.problem(); }
67 
71  const Model &model() const
72  { return elemCtx_.model(); }
73 
77  const GridView &gridView() const
78  { return elemCtx_.gridView(); }
79 
83  const Element &element() const
84  { return elemCtx_.element(); }
85 
89  int numDof(int timeIdx) const
90  { return elemCtx_.numDof(timeIdx); }
91 
95  int numInteriorFaces(int timeIdx) const
96  { return elemCtx_.numInteriorFaces(timeIdx); }
97 
101  int globalSpaceIndex(int dofIdx, int timeIdx) const
102  { return elemCtx_.globalSpaceIndex(dofIdx, timeIdx); }
103 
107  GlobalPosition pos(int dofIdx, int timeIdx) const
108  { return elemCtx_.pos(dofIdx, timeIdx); }
109 
110 protected:
111  const ElementContext &elemCtx_;
112 };
113 
114 } // namespace Ewoms
115 
116 #endif
const Model & model() const
Definition: fvbaseconstraintscontext.hh:71
int globalSpaceIndex(int dofIdx, int timeIdx) const
Definition: fvbaseconstraintscontext.hh:101
int numDof(int timeIdx) const
Definition: fvbaseconstraintscontext.hh:89
Declare the properties used by the infrastructure code of the finite volume discretizations.
const GridView & gridView() const
Definition: fvbaseconstraintscontext.hh:77
GlobalPosition pos(int dofIdx, int timeIdx) const
Definition: fvbaseconstraintscontext.hh:107
Represents all quantities which available for calculating constraints.
Definition: fvbaseconstraintscontext.hh:41
Definition: baseauxiliarymodule.hh:35
FvBaseConstraintsContext(const ElementContext &elemCtx)
The constructor.
Definition: fvbaseconstraintscontext.hh:58
const ElementContext & elemCtx_
Definition: fvbaseconstraintscontext.hh:111
int numInteriorFaces(int timeIdx) const
Definition: fvbaseconstraintscontext.hh:95
const Element & element() const
Definition: fvbaseconstraintscontext.hh:83
const Problem & problem() const
Definition: fvbaseconstraintscontext.hh:65