3.6-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
basegridgeometry.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program 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 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_DISCRETIZATION_BASE_GRID_GEOMETRY_HH
25#define DUMUX_DISCRETIZATION_BASE_GRID_GEOMETRY_HH
26
27#include <memory>
28#include <dune/common/std/type_traits.hh>
31
32// make the local view function available whenever we use the grid geometry
34
35namespace Dumux {
36
37namespace Detail {
38template<class T>
39using SpecifiesBaseGridGeometry = typename T::BasicGridGeometry;
40} // end namespace Detail
41
46template<class GV, class T>
47using BasicGridGeometry_t = Dune::Std::detected_or_t<
50 T
51>;
52
59template<class GV, class Traits>
61{
62 using GridIndexType = typename IndexTraits<GV>::GridIndex;
63 using Element = typename GV::template Codim<0>::Entity;
64 using BaseImplementation = BasicGridGeometry_t<GV, Traits>;
65public:
67 using Grid = typename BaseImplementation::Grid;
69 using GridView = typename BaseImplementation::GridView;
71 using GlobalCoordinate = typename BaseImplementation::GlobalCoordinate;
73 using ElementMapper = typename BaseImplementation::ElementMapper;
75 using VertexMapper = typename BaseImplementation::VertexMapper;
76
81 BaseGridGeometry(std::shared_ptr<BaseImplementation> impl)
82 : impl_(std::move(impl))
83 {}
84
91 : BaseGridGeometry(std::make_shared<BaseImplementation>(gridView))
92 {}
93
98 { impl_->update(gridView); }
99
104 { impl_->update(std::move(gridView)); }
105
109 const GridView& gridView() const
110 { return impl_->gridView(); }
111
116 { return impl_->vertexMapper(); }
117
122 { return impl_->elementMapper(); }
123
128 { return impl_->vertexMapper(); }
129
134 { return impl_->elementMapper(); }
135
139 decltype(auto) boundingBoxTree() const
140 { return impl_->boundingBoxTree(); }
141
145 decltype(auto) elementMap() const
146 { return impl_->elementMap(); }
147
151 Element element(GridIndexType eIdx) const
152 { return impl_->element(eIdx); }
153
159 { return impl_->bBoxMin(); }
160
166 { return impl_->bBoxMax(); }
167
171 bool isPeriodic() const
172 { return periodic_; }
173
174protected:
178 void setPeriodic(bool value = true)
179 { periodic_ = value; }
180
181private:
182 std::shared_ptr<BaseImplementation> impl_;
183
185 bool periodic_ = false;
186};
187
188} // end namespace Dumux
189
190#endif
Defines the index types used for grid and local indices.
Free function to get the local view of a grid cache object.
A basic implementation of a grid geometry with some common interfaces.
BaseGridGeometry(std::shared_ptr< BaseImplementation > impl)
Constructor from a BaseImplementation.
Definition: basegridgeometry.hh:81
BaseGridGeometry(const GridView &gridView)
Constructor from a grid view.
Definition: basegridgeometry.hh:90
Dune::Std::detected_or_t< Dumux::BasicGridGeometry< GV, typename T::ElementMapper, typename T::VertexMapper >, Detail::SpecifiesBaseGridGeometry, T > BasicGridGeometry_t
Type of the basic grid geometry implementation used as backend.
Definition: basegridgeometry.hh:51
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
typename T::BasicGridGeometry SpecifiesBaseGridGeometry
Definition: basegridgeometry.hh:39
Structure to define the index types used for grid and local indices.
Definition: indextraits.hh:38
Base class for all grid geometries.
Definition: basegridgeometry.hh:61
const ElementMapper & elementMapper() const
Returns the mapper for elements to indices for constant grids.
Definition: basegridgeometry.hh:121
void setPeriodic(bool value=true)
Set the periodicity of the grid geometry.
Definition: basegridgeometry.hh:178
typename BaseImplementation::GridView GridView
export the grid view type
Definition: basegridgeometry.hh:69
typename BaseImplementation::GlobalCoordinate GlobalCoordinate
export the global coordinate type
Definition: basegridgeometry.hh:71
typename BaseImplementation::ElementMapper ElementMapper
export the element mapper type
Definition: basegridgeometry.hh:73
const GlobalCoordinate & bBoxMax() const
The coordinate of the corner of the GridView's bounding box with the largest values.
Definition: basegridgeometry.hh:165
void update(GridView &&gridView)
Update all fvElementGeometries (call this after grid adaption)
Definition: basegridgeometry.hh:103
Element element(GridIndexType eIdx) const
Get an element from a global element index.
Definition: basegridgeometry.hh:151
typename BaseImplementation::Grid Grid
export the grid type
Definition: basegridgeometry.hh:67
decltype(auto) boundingBoxTree() const
Returns the bounding box tree of the grid.
Definition: basegridgeometry.hh:139
const VertexMapper & vertexMapper() const
Returns the mapper for vertices to indices for constant grids.
Definition: basegridgeometry.hh:115
VertexMapper & vertexMapper()
Returns the mapper for vertices to indices for possibly adaptive grids.
Definition: basegridgeometry.hh:127
const GridView & gridView() const
Return the gridView this grid geometry object lives on.
Definition: basegridgeometry.hh:109
ElementMapper & elementMapper()
Returns the mapper for elements to indices for possibly adaptive grids.
Definition: basegridgeometry.hh:133
void update(const GridView &gridView)
Update all fvElementGeometries (call this after grid adaption)
Definition: basegridgeometry.hh:97
const GlobalCoordinate & bBoxMin() const
The coordinate of the corner of the GridView's bounding box with the smallest values.
Definition: basegridgeometry.hh:158
bool isPeriodic() const
Returns if the grid geometry is periodic (at all)
Definition: basegridgeometry.hh:171
decltype(auto) elementMap() const
Returns the element index to element map.
Definition: basegridgeometry.hh:145
typename BaseImplementation::VertexMapper VertexMapper
export the vertex mapper type
Definition: basegridgeometry.hh:75
An implementation of a grid geometry with some basic features.
Definition: basicgridgeometry.hh:49