simplexvanguard.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_SIMPLEX_GRID_VANGUARD_HH
28#define EWOMS_SIMPLEX_GRID_VANGUARD_HH
29
33
34#include <dune/grid/utility/structuredgridfactory.hh>
35#include <dune/common/fvector.hh>
36
37#include <memory>
38
39namespace Opm {
43template <class TypeTag>
45{
50
51 using GridPointer = std::unique_ptr<Grid>;
52 using CoordScalar = typename Grid::ctype;
53 enum { dimWorld = Grid::dimensionworld };
54 using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
55
56public:
60 static void registerParameters()
61 {
62 Parameters::registerParam<TypeTag, Properties::GridGlobalRefinements>
63 ("The number of global refinements of the grid "
64 "executed after it was loaded");
65 Parameters::registerParam<TypeTag, Properties::DomainSizeX>
66 ("The size of the domain in x direction");
67 Parameters::registerParam<TypeTag, Properties::CellsX>
68 ("The number of intervalls in x direction");
69 if (dimWorld > 1) {
70 Parameters::registerParam<TypeTag, Properties::DomainSizeY>
71 ("The size of the domain in y direction");
72 Parameters::registerParam<TypeTag, Properties::CellsY>
73 ("The number of intervalls in y direction");
74 }
75 if (dimWorld > 2) {
76 Parameters::registerParam<TypeTag, Properties::DomainSizeZ>
77 ("The size of the domain in z direction");
78 Parameters::registerParam<TypeTag, Properties::CellsZ>
79 ("The number of intervalls in z direction");
80 }
81 }
82
86 SimplexGridVanguard(Simulator& simulator)
87 : ParentType(simulator)
88 {
89 Dune::array<unsigned, dimWorld> cellRes;
90 GlobalPosition upperRight;
91 GlobalPosition lowerLeft;
92
93 lowerLeft[0] = 0.0;
94 upperRight[0] = Parameters::get<TypeTag, Properties::DomainSizeX>();
95 cellRes[0] = Parameters::get<TypeTag, Properties::CellsX>();
96 if (dimWorld > 1) {
97 lowerLeft[1] = 0.0;
98 upperRight[1] = Parameters::get<TypeTag, Properties::DomainSizeY>();
99 cellRes[1] = Parameters::get<TypeTag, Properties::CellsY>();
100 }
101 if (dimWorld > 2) {
102 lowerLeft[2] = 0.0;
103 upperRight[2] = Parameters::get<TypeTag, Properties::DomainSizeZ>();
104 cellRes[2] = Parameters::get<TypeTag, Properies::CellsZ>();
105 }
106
107 simplexGrid_ = Dune::StructuredGridFactory<Grid>::createSimplexGrid(lowerLeft,
108 upperRight,
109 cellRes);
110
111 unsigned numRefinments = Parameters::get<TypeTag, Properties::GridGlobalRefinements>();
112 simplexGrid_->globalRefine(numRefinments);
113
114 this->finalizeInit_();
115 }
116
120 Grid& grid()
121 { return simplexGrid_; }
122
126 const Grid& grid() const
127 { return *simplexGrid_; }
128
129private:
130 GridPointer simplexGrid_;
131};
132} // namespace Opm
133
134#endif
Defines a type tags and some fundamental properties all models.
Provides the base class for most (all?) simulator vanguards.
Definition: basevanguard.hh:49
Provides a simulator vanguard which a creates regular grid made of simplices.
Definition: simplexvanguard.hh:45
static void registerParameters()
Register all run-time parameters for the grid manager.
Definition: simplexvanguard.hh:60
SimplexGridVanguard(Simulator &simulator)
Create the Grid.
Definition: simplexvanguard.hh:86
const Grid & grid() const
Returns a reference to the grid.
Definition: simplexvanguard.hh:126
Grid & grid()
Returns a reference to the grid.
Definition: simplexvanguard.hh:120
Definition: blackoilboundaryratevector.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:242
This file provides the infrastructure to retrieve run-time parameters.
The Opm property system, traits with inheritance.