3 #ifndef DUNE_REFINED_SIMPLEX_LOCALBASIS_HH
4 #define DUNE_REFINED_SIMPLEX_LOCALBASIS_HH
10 #include <dune/common/fvector.hh>
11 #include <dune/common/exceptions.hh>
16 template<
class D,
int dim>
22 DUNE_THROW(Dune::NotImplemented,
"RefinedSimplexLocalBasis not implemented for dim > 3.");
55 else if (global[0] <= 1.0)
58 DUNE_THROW(InvalidStateException,
"no subelement defined");
69 FieldVector<D,1>& local)
71 if (global[0] <= 0.5) {
73 local[0] = 2.0 * global[0];
78 local[0] = 2.0 * global[0] - 1.0;
118 if (global[0] + global[1] <= 0.5)
120 else if (global[0] >= 0.5)
122 else if (global[1] >= 0.5)
136 FieldVector<D,2>& local)
138 if (global[0] + global[1] <= 0.5) {
140 local[0] = 2*global[0];
141 local[1] = 2*global[1];
143 }
else if (global[0] >= 0.5) {
145 local[0] = 2*global[0]-1;
146 local[1] = 2*global[1];
148 }
else if (global[1] >= 0.5) {
150 local[0] = 2*global[0];
151 local[1] = 2*global[1]-1;
156 local[0] = -2 * global[0] + 1;
157 local[1] = -2 * global[1] + 1;
214 if (global[0] + global[1] + global[2] <= 0.5)
216 else if (global[0] >= 0.5)
218 else if (global[1] >= 0.5)
220 else if (global[2] >= 0.5)
222 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5))
224 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5))
226 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5))
228 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5))
231 DUNE_THROW(InvalidStateException,
"no subelement defined");
242 FieldVector<D,3>& local)
244 if (global[0] + global[1] + global[2] <= 0.5) {
249 }
else if (global[0] >= 0.5) {
255 }
else if (global[1] >= 0.5) {
261 }
else if (global[2] >= 0.5) {
267 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5)) {
269 local[0] = 2.0 * global[1];
270 local[1] = 2.0 * (0.5 - global[0] - global[1]);
271 local[2] = 2.0 * (-0.5 + global[0] + global[1] + global[2]);
283 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5)) {
285 local[0] = 2.0 * (0.5 - global[0]);
286 local[1] = 2.0 * (0.5 - global[1] - global[2]);
287 local[2] = 2.0 * global[2];
297 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5)) {
299 local[0] = 2.0 * (0.5 - global[0] - global[1]);
300 local[1] = 2.0 * global[0];
301 local[2] = 2.0 * (-0.5 + global[1] + global[2]);
312 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5)) {
314 local[0] = 2.0 * (-0.5 + global[1] + global[2]);
315 local[1] = 2.0 * (0.5 - global[1]);
316 local[2] = 2.0 * (-0.5 + global[0] + global[1]);
330 DUNE_THROW(InvalidStateException,
"no subelement defined");
static int getSubElement(const FieldVector< D, 1 > &global)
Get the number of the subelement containing a given point.
Definition: refinedsimplexlocalbasis.hh:51
RefinedSimplexLocalBasis()
Definition: refinedsimplexlocalbasis.hh:20
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition: refinedsimplexlocalbasis.hh:39
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition: refinedsimplexlocalbasis.hh:180
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:14
static void getSubElement(const FieldVector< D, 1 > &global, int &subElement, FieldVector< D, 1 > &local)
Get local coordinates in the subelement.
Definition: refinedsimplexlocalbasis.hh:67
static void getSubElement(const FieldVector< D, 2 > &global, int &subElement, FieldVector< D, 2 > &local)
Get local coordinates in the subtriangle.
Definition: refinedsimplexlocalbasis.hh:134
static int getSubElement(const FieldVector< D, 3 > &global)
Get the number of the subsimplex containing a given point in the reference element.
Definition: refinedsimplexlocalbasis.hh:212
static int getSubElement(const FieldVector< D, 2 > &global)
Get the number of the subtriangle containing a given point.
Definition: refinedsimplexlocalbasis.hh:116
static void getSubElement(const FieldVector< D, 3 > &global, int &subElement, FieldVector< D, 3 > &local)
Get local coordinates in the subsimplex.
Definition: refinedsimplexlocalbasis.hh:240
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition: refinedsimplexlocalbasis.hh:100
Definition: refinedsimplexlocalbasis.hh:17