My Project
DefaultGeometryPolicy.hpp
1//===========================================================================
2//
3// File: DefaultGeometryPolicy.hpp
4//
5// Created: Tue Jun 2 16:23:01 2009
6//
7// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
8// Bård Skaflestad <bard.skaflestad@sintef.no>
9//
10// $Date$
11//
12// $Revision$
13//
14//===========================================================================
15
16/*
17Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18Copyright 2009, 2010, 2022 Equinor ASA.
19
20This file is part of The Open Porous Media project (OPM).
21
22OPM is free software: you can redistribute it and/or modify
23it under the terms of the GNU General Public License as published by
24the Free Software Foundation, either version 3 of the License, or
25(at your option) any later version.
26
27OPM is distributed in the hope that it will be useful,
28but WITHOUT ANY WARRANTY; without even the implied warranty of
29MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30GNU General Public License for more details.
31
32You should have received a copy of the GNU General Public License
33along with OPM. If not, see <http://www.gnu.org/licenses/>.
34*/
35
36#ifndef OPM_DEFAULTGEOMETRYPOLICY_HEADER
37#define OPM_DEFAULTGEOMETRYPOLICY_HEADER
38
39#include "EntityRep.hpp"
40
41namespace Dune
42{
43
44 class CpGrid;
45
46 namespace cpgrid
47 {
48 template<int mydim, int dim>
49 class Geometry;
53 {
54 friend class CpGridData;
55 template<int mydim, int dim>
56 friend class Geometry;
57 friend class ::Dune::CpGrid;
58 public:
62 {
63 }
64
69 const EntityVariable<cpgrid::Geometry<2, 3>, 1>& face_geom,
70 const EntityVariable<cpgrid::Geometry<0, 3>, 3>& point_geom)
71 : cell_geom_(cell_geom), face_geom_(face_geom), point_geom_(point_geom)
72 {
73 }
74
80 template <int codim>
81 const EntityVariable<cpgrid::Geometry<3 - codim, 3>, codim>& geomVector() const
82 {
83 static_assert(codim != 2, "");
84 return geomVector(std::integral_constant<int,codim>());
85 }
86
87 private:
89 const EntityVariable<cpgrid::Geometry<3, 3>, 0>& geomVector(const std::integral_constant<int, 0>&) const
90 {
91 return cell_geom_;
92 }
94 EntityVariable<cpgrid::Geometry<3, 3>, 0>& geomVector(const std::integral_constant<int, 0>&)
95 {
96 return cell_geom_;
97 }
99 const EntityVariable<cpgrid::Geometry<2, 3>, 1>& geomVector(const std::integral_constant<int, 1>&) const
100 {
101 return face_geom_;
102 }
104 EntityVariable<cpgrid::Geometry<2, 3>, 1>& geomVector(const std::integral_constant<int, 1>&)
105 {
106 return face_geom_;
107 }
108
110 template<int codim>
111 const EntityVariable<cpgrid::Geometry<0, 3>, 3>& geomVector(const std::integral_constant<int, codim>&) const
112 {
113 static_assert(codim==3, "Codim has to be 3");
114 return point_geom_;
115 }
116 template<int codim>
117 EntityVariable<cpgrid::Geometry<0, 3>, 3>& geomVector(const std::integral_constant<int, codim>&)
118 {
119 static_assert(codim==3, "Codim has to be 3");
120 return point_geom_;
121 }
122 EntityVariable<cpgrid::Geometry<3, 3>, 0> cell_geom_;
123 EntityVariable<cpgrid::Geometry<2, 3>, 1> face_geom_;
124 EntityVariable<cpgrid::Geometry<0, 3>, 3> point_geom_;
125 };
126
127
128
129 } // namespace cpgrid
130} // namespace Dune
131
132
133#endif // OPM_DEFAULTGEOMETRYPOLICY_HEADER
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:122
Definition: DefaultGeometryPolicy.hpp:53
const EntityVariable< cpgrid::Geometry< 3 - codim, 3 >, codim > & geomVector() const
Definition: DefaultGeometryPolicy.hpp:81
DefaultGeometryPolicy()
Definition: DefaultGeometryPolicy.hpp:61
DefaultGeometryPolicy(const EntityVariable< cpgrid::Geometry< 3, 3 >, 0 > &cell_geom, const EntityVariable< cpgrid::Geometry< 2, 3 >, 1 > &face_geom, const EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > &point_geom)
Definition: DefaultGeometryPolicy.hpp:68
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:267
This class encapsulates geometry for vertices, intersections, and cells.
Definition: Geometry.hpp:74
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10