11#ifndef DUNE_LOCALFUNCTIONS_TEST_GEOMETRIES_HH
12#define DUNE_LOCALFUNCTIONS_TEST_GEOMETRIES_HH
17#include <dune/common/exceptions.hh>
18#include <dune/common/fvector.hh>
20#include <dune/geometry/type.hh>
21#include <dune/geometry/multilineargeometry.hh>
23template<
class ctype, std::
size_t dim>
27class TestGeometries<ctype, 0> :
28 public std::vector<Dune::MultiLinearGeometry<ctype, 0, 0> >
30 static constexpr std::size_t dim = 0;
33 typedef Dune::MultiLinearGeometry<ctype, dim, dim> Geometry;
36 Dune::GeometryType gt;
37 std::vector<Dune::FieldVector<ctype, dim> > coords;
39 gt = Dune::GeometryTypes::vertex;
41 this->push_back(Geometry(gt, coords));
44 const Geometry &get(
const Dune::GeometryType >)
const {
45 for(std::size_t i = 0; i < this->size(); ++i)
46 if((*
this)[i].type() == gt)
return (*
this)[i];
47 DUNE_THROW(Dune::NotImplemented,
"No predefined test-geometry in "
48 "dimension " << dim <<
" for GeometryType " << gt);
53class TestGeometries<ctype, 1> :
54 public std::vector<Dune::MultiLinearGeometry<ctype, 1, 1> >
56 static constexpr std::size_t dim = 1;
59 typedef Dune::MultiLinearGeometry<ctype, dim, dim> Geometry;
62 Dune::GeometryType gt;
63 std::vector<Dune::FieldVector<ctype, dim> > coords;
65 gt = Dune::GeometryTypes::line;
69 this->push_back(Geometry(gt, coords));
72 const Geometry &get(
const Dune::GeometryType >)
const {
73 for(std::size_t i = 0; i < this->size(); ++i)
74 if((*
this)[i].type() == gt)
return (*
this)[i];
75 DUNE_THROW(Dune::NotImplemented,
"No predefined test-geometry in "
76 "dimension " << dim <<
" for GeometryType " << gt);
81class TestGeometries<ctype, 2> :
82 public std::vector<Dune::MultiLinearGeometry<ctype, 2, 2> >
84 static constexpr std::size_t dim = 2;
87 typedef Dune::MultiLinearGeometry<ctype, dim, dim> Geometry;
90 Dune::GeometryType gt;
91 std::vector<Dune::FieldVector<ctype, dim> > coords;
93 gt = Dune::GeometryTypes::triangle;
95 coords[0][0] = -.5; coords[0][1] = -.5;
96 coords[1][0] = .5; coords[1][1] = -.5;
97 coords[2][0] = 0 ; coords[2][1] = .5;
98 this->push_back(Geometry(gt, coords));
100 gt = Dune::GeometryTypes::quadrilateral;
102 coords[0][0] = -.5; coords[0][1] = 0;
103 coords[1][0] = 0 ; coords[1][1] = -.5;
104 coords[2][0] = .5; coords[2][1] = 0;
105 coords[3][0] = 0 ; coords[3][1] = .5;
106 this->push_back(Geometry(gt, coords));
109 const Geometry &get(
const Dune::GeometryType >)
const {
110 for(std::size_t i = 0; i < this->size(); ++i)
111 if((*
this)[i].type() == gt)
return (*
this)[i];
112 DUNE_THROW(Dune::NotImplemented,
"No predefined test-geometry in "
113 "dimension " << dim <<
" for GeometryType " << gt);
118class TestGeometries<ctype, 3> :
119 public std::vector<Dune::MultiLinearGeometry<ctype, 3, 3> >
121 static constexpr std::size_t dim = 3;
124 typedef Dune::MultiLinearGeometry<ctype, dim, dim> Geometry;
127 Dune::GeometryType gt;
128 std::vector<Dune::FieldVector<ctype, dim> > coords;
130 gt = Dune::GeometryTypes::tetrahedron;
132 coords[0][0] = -.5; coords[0][1] = -.5; coords[0][2] = -.5;
133 coords[1][0] = .5; coords[1][1] = -.5; coords[1][2] = -.5;
134 coords[2][0] = 0 ; coords[2][1] = .5; coords[2][2] = -.5;
135 coords[3][0] = 0 ; coords[3][1] = 0 ; coords[3][2] = .5;
136 this->push_back(Geometry(gt, coords));
138 gt = Dune::GeometryTypes::pyramid;
140 coords[0][0] = -.5; coords[0][1] = 0; coords[0][2] = -.5;
141 coords[1][0] = 0 ; coords[1][1] = -.5; coords[1][2] = -.5;
142 coords[2][0] = .5; coords[2][1] = 0; coords[2][2] = -.5;
143 coords[3][0] = 0 ; coords[3][1] = .5; coords[3][2] = -.5;
144 coords[4][0] = .1; coords[4][1] = .1; coords[4][2] = .1;
145 this->push_back(Geometry(gt, coords));
147 gt = Dune::GeometryTypes::prism;
149 coords[0][0] = -.6; coords[0][1] = -.5; coords[0][2] = -.4;
150 coords[1][0] = .5; coords[1][1] = -.6; coords[1][2] = -.5;
151 coords[2][0] = .1; coords[2][1] = .5; coords[2][2] = -.6;
152 coords[3][0] = -.5; coords[3][1] = -.4; coords[3][2] = .5;
153 coords[4][0] = .4; coords[4][1] = -.5; coords[4][2] = .6;
154 coords[5][0] = 0 ; coords[5][1] = .4; coords[5][2] = .5;
155 this->push_back(Geometry(gt, coords));
157 gt = Dune::GeometryTypes::hexahedron;
159 coords[0][0] = -.7; coords[0][1] = -.6; coords[0][2] = -.5;
160 coords[1][0] = .4; coords[1][1] = -.3; coords[1][2] = -.7;
161 coords[2][0] = -.6; coords[2][1] = .5; coords[2][2] = -.4;
162 coords[3][0] = .3; coords[3][1] = .7; coords[3][2] = -.6;
163 coords[4][0] = -.5; coords[4][1] = -.4; coords[4][2] = .3;
164 coords[5][0] = .7; coords[5][1] = -.6; coords[5][2] = .5;
165 coords[6][0] = -.4; coords[6][1] = .3; coords[6][2] = .7;
166 coords[7][0] = .6; coords[7][1] = .5; coords[7][2] = .4;
167 this->push_back(Geometry(gt, coords));
170 const Geometry &get(
const Dune::GeometryType >)
const {
171 for(std::size_t i = 0; i < this->size(); ++i)
172 if((*
this)[i].type() == gt)
return (*
this)[i];
173 DUNE_THROW(Dune::NotImplemented,
"No predefined test-geometry in "
174 "dimension " << dim <<
" for GeometryType " << gt);