All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
28 #ifndef EWOMS_FV_BASE_CONSTRAINTS_CONTEXT_HH
29 #define EWOMS_FV_BASE_CONSTRAINTS_CONTEXT_HH
30 
31 #include "fvbaseproperties.hh"
32 
33 #include <dune/common/fvector.hh>
34 
35 namespace Ewoms {
36 
42 template<class TypeTag>
44 {
45  typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
46  typedef typename GET_PROP_TYPE(TypeTag, Model) Model;
47  typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
48  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
49  typedef typename GridView::template Codim<0>::Entity Element;
50 
51  enum { dimWorld = GridView::dimensionworld };
52 
53  typedef typename GridView::ctype CoordScalar;
54  typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
55 
56 public:
60  explicit FvBaseConstraintsContext(const ElementContext& elemCtx)
61  : elemCtx_(elemCtx)
62  { }
63 
67  const Problem& problem() const
68  { return elemCtx_.problem(); }
69 
73  const Model& model() const
74  { return elemCtx_.model(); }
75 
79  const GridView& gridView() const
80  { return elemCtx_.gridView(); }
81 
85  const Element& element() const
86  { return elemCtx_.element(); }
87 
91  int numDof(int timeIdx) const
92  { return elemCtx_.numDof(timeIdx); }
93 
97  int numInteriorFaces(int timeIdx) const
98  { return elemCtx_.numInteriorFaces(timeIdx); }
99 
103  int globalSpaceIndex(int dofIdx, int timeIdx) const
104  { return elemCtx_.globalSpaceIndex(dofIdx, timeIdx); }
105 
109  GlobalPosition pos(int dofIdx, int timeIdx) const
110  { return elemCtx_.pos(dofIdx, timeIdx); }
111 
112 protected:
113  const ElementContext& elemCtx_;
114 };
115 
116 } // namespace Ewoms
117 
118 #endif
const Element & element() const
Definition: fvbaseconstraintscontext.hh:85
const GridView & gridView() const
Definition: fvbaseconstraintscontext.hh:79
int numDof(int timeIdx) const
Definition: fvbaseconstraintscontext.hh:91
int globalSpaceIndex(int dofIdx, int timeIdx) const
Definition: fvbaseconstraintscontext.hh:103
Declare the properties used by the infrastructure code of the finite volume discretizations.
FvBaseConstraintsContext(const ElementContext &elemCtx)
The constructor.
Definition: fvbaseconstraintscontext.hh:60
Represents all quantities which available for calculating constraints.
Definition: fvbaseconstraintscontext.hh:43
const Problem & problem() const
Definition: fvbaseconstraintscontext.hh:67
const Model & model() const
Definition: fvbaseconstraintscontext.hh:73
int numInteriorFaces(int timeIdx) const
Definition: fvbaseconstraintscontext.hh:97
GlobalPosition pos(int dofIdx, int timeIdx) const
Definition: fvbaseconstraintscontext.hh:109