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 Statoil 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 "Geometry.hpp"
40#include "EntityRep.hpp"
41
42namespace Dune
43{
44 namespace cpgrid
45 {
49 {
50 friend class CpGridData;
51 public:
55 {
56 }
57
62 const EntityVariable<cpgrid::Geometry<2, 3>, 1>& face_geom,
63 const EntityVariable<cpgrid::Geometry<0, 3>, 3>& point_geom)
64 : cell_geom_(cell_geom), face_geom_(face_geom), point_geom_(point_geom)
65 {
66 }
67
73 template <int codim>
74 const EntityVariable<cpgrid::Geometry<3 - codim, 3>, codim>& geomVector() const
75 {
76 static_assert(codim != 2, "");
77 return geomVector(std::integral_constant<int,codim>());
78 }
79
80 private:
82 const EntityVariable<cpgrid::Geometry<3, 3>, 0>& geomVector(const std::integral_constant<int, 0>&) const
83 {
84 return cell_geom_;
85 }
87 EntityVariable<cpgrid::Geometry<3, 3>, 0>& geomVector(const std::integral_constant<int, 0>&)
88 {
89 return cell_geom_;
90 }
92 const EntityVariable<cpgrid::Geometry<2, 3>, 1>& geomVector(const std::integral_constant<int, 1>&) const
93 {
94 return face_geom_;
95 }
97 EntityVariable<cpgrid::Geometry<2, 3>, 1>& geomVector(const std::integral_constant<int, 1>&)
98 {
99 return face_geom_;
100 }
101
103 template<int codim>
104 const EntityVariable<cpgrid::Geometry<0, 3>, 3>& geomVector(const std::integral_constant<int, codim>&) const
105 {
106 static_assert(codim==3, "Codim has to be 3");
107 return point_geom_;
108 }
109 template<int codim>
110 EntityVariable<cpgrid::Geometry<0, 3>, 3>& geomVector(const std::integral_constant<int, codim>&)
111 {
112 static_assert(codim==3, "Codim has to be 3");
113 return point_geom_;
114 }
115 EntityVariable<cpgrid::Geometry<3, 3>, 0> cell_geom_;
116 EntityVariable<cpgrid::Geometry<2, 3>, 1> face_geom_;
117 EntityVariable<cpgrid::Geometry<0, 3>, 3> point_geom_;
118 };
119
120
121
122 } // namespace cpgrid
123} // namespace Dune
124
125
126#endif // OPM_DEFAULTGEOMETRYPOLICY_HEADER
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:123
Definition: DefaultGeometryPolicy.hpp:49
const EntityVariable< cpgrid::Geometry< 3 - codim, 3 >, codim > & geomVector() const
Definition: DefaultGeometryPolicy.hpp:74
DefaultGeometryPolicy()
Definition: DefaultGeometryPolicy.hpp:54
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:61
A class design to hold a variable with a value for each entity of the given codimension,...
Definition: EntityRep.hpp:264
This class encapsulates geometry for both vertices, intersections and cells.
Definition: Geometry.hpp:71
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10