All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
baseauxiliarymodule.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 */
27 #ifndef EWOMS_BASE_AUXILIARY_MODULE_HH
28 #define EWOMS_BASE_AUXILIARY_MODULE_HH
29 
31 
33 
34 #include <set>
35 #include <vector>
36 
37 namespace Ewoms {
38 namespace Properties {
39 NEW_TYPE_TAG(AuxModule);
40 
41 // declare the properties required by the for the ecl grid manager
42 NEW_PROP_TAG(Grid);
43 NEW_PROP_TAG(GridView);
44 NEW_PROP_TAG(Scalar);
45 NEW_PROP_TAG(DofMapper);
46 NEW_PROP_TAG(GlobalEqVector);
47 NEW_PROP_TAG(JacobianMatrix);
48 } // namespace Properties
49 
58 template <class TypeTag>
60 {
61  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
62  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
63  typedef typename GET_PROP_TYPE(TypeTag, GlobalEqVector) GlobalEqVector;
64  typedef typename GET_PROP_TYPE(TypeTag, JacobianMatrix) JacobianMatrix;
65 
66 protected:
67  typedef std::set<unsigned> NeighborSet;
68 
69 public:
70  virtual ~BaseAuxiliaryModule()
71  {}
72 
77  virtual unsigned numDofs() const = 0;
78 
83  void setDofOffset(int value)
84  { dofOffset_ = value; }
85 
90  int dofOffset()
91  { return dofOffset_; }
92 
97  int localToGlobalDof(unsigned localDofIdx) const
98  {
99  assert(0 <= localDofIdx);
100  assert(localDofIdx < numDofs());
101  return dofOffset_ + localDofIdx;
102  }
103 
108  virtual void addNeighbors(std::vector<NeighborSet>& neighbors) const = 0;
109 
113  virtual void applyInitial() = 0;
114 
118  virtual void linearize(JacobianMatrix& matrix, GlobalEqVector& residual) = 0;
119 
120 private:
121  int dofOffset_;
122 };
123 
124 } // namespace Ewoms
125 
126 #endif
int dofOffset()
Return the offset in the global system of equations for the first degree of freedom of this auxiliary...
Definition: baseauxiliarymodule.hh:90
virtual void applyInitial()=0
Set the initial condition of the auxiliary module in the solution vector.
virtual void linearize(JacobianMatrix &matrix, GlobalEqVector &residual)=0
Linearize the auxiliary equation.
virtual unsigned numDofs() const =0
Returns the number of additional degrees of freedom required for the auxiliary module.
void setDofOffset(int value)
Set the offset in the global system of equations for the first degree of freedom of this auxiliary mo...
Definition: baseauxiliarymodule.hh:83
int localToGlobalDof(unsigned localDofIdx) const
Given a degree of freedom relative to the current auxiliary equation, return the corresponding index ...
Definition: baseauxiliarymodule.hh:97
#define NEW_TYPE_TAG(...)
Define a new type tag.
Definition: propertysystem.hh:169
Declare the properties used by the infrastructure code of the finite volume discretizations.
virtual void addNeighbors(std::vector< NeighborSet > &neighbors) const =0
Specify the additional neighboring correlations caused by the auxiliary module.
Provides the magic behind the eWoms property system.
#define NEW_PROP_TAG(PTagName)
Define a property tag.
Definition: propertysystem.hh:247
Base class for specifying auxiliary equations.
Definition: baseauxiliarymodule.hh:59