fvbaseprimaryvariables.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) 2011-2014 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_PRIMARY_VARIABLES_HH
27 #define EWOMS_FV_BASE_PRIMARY_VARIABLES_HH
28 
29 #include <dune/common/fvector.hh>
30 
31 #include "fvbaseproperties.hh"
32 
33 namespace Ewoms {
34 
40 template <class TypeTag>
42  : public Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, Scalar),
43  GET_PROP_VALUE(TypeTag, NumEq)>
44 {
45  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
46  typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
47 
48  enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) };
49 
50  typedef Opm::MathToolbox<Evaluation> Toolbox;
51  typedef Dune::FieldVector<Scalar, numEq> ParentType;
52 
53 public:
55  : ParentType()
56  { Valgrind::SetUndefined(*this); }
57 
61  FvBasePrimaryVariables(Scalar value)
62  : ParentType(value)
63  { }
64 
69  : ParentType(value)
70  { }
71 
79  Evaluation makeEvaluation(int varIdx, int timeIdx) const
80  {
81  if (timeIdx == 0)
82  return Toolbox::createVariable((*this)[varIdx], varIdx);
83  else
84  return Toolbox::createConstant((*this)[varIdx]);
85  }
86 
97  template <class FluidState>
98  void assignNaive(const FluidState &fluidState)
99  {
100  OPM_THROW(std::runtime_error,
101  "The PrimaryVariables class does not define a assignNaive() method");
102  }
107  void checkDefined() const
108  {
109  Valgrind::CheckDefined(*static_cast<const ParentType*>(this));
110  }
111 };
112 
113 } // namespace Ewoms
114 
115 #endif
FvBasePrimaryVariables()
Definition: fvbaseprimaryvariables.hh:54
Declare the properties used by the infrastructure code of the finite volume discretizations.
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:41
FvBasePrimaryVariables(const FvBasePrimaryVariables &value)
Assignment from another primary variables object.
Definition: fvbaseprimaryvariables.hh:68
Definition: baseauxiliarymodule.hh:35
void checkDefined() const
Instruct valgrind to check the definedness of all attributes of this class.
Definition: fvbaseprimaryvariables.hh:107
FvBasePrimaryVariables(Scalar value)
Construction from a scalar value.
Definition: fvbaseprimaryvariables.hh:61
Evaluation makeEvaluation(int varIdx, int timeIdx) const
Return a primary variable intensive evaluation.
Definition: fvbaseprimaryvariables.hh:79
void assignNaive(const FluidState &fluidState)
Assign the primary variables "somehow" from a fluid state.
Definition: fvbaseprimaryvariables.hh:98