5#ifndef DUNE_REFINED_SIMPLEX_LOCALBASIS_HH
6#define DUNE_REFINED_SIMPLEX_LOCALBASIS_HH
12#include <dune/common/fvector.hh>
13#include <dune/common/exceptions.hh>
18 template<
class D,
int dim>
24 DUNE_THROW(Dune::NotImplemented,
"RefinedSimplexLocalBasis not implemented for dim > 3.");
58 else if (global[0] <= 1.0)
61 DUNE_THROW(InvalidStateException,
"no subelement defined");
72 FieldVector<D,1>& local)
74 if (global[0] <= 0.5) {
76 local[0] = 2.0 * global[0];
81 local[0] = 2.0 * global[0] - 1.0;
123 if (global[0] + global[1] <= 0.5)
125 else if (global[0] >= 0.5)
127 else if (global[1] >= 0.5)
141 FieldVector<D,2>& local)
143 if (global[0] + global[1] <= 0.5) {
145 local[0] = 2*global[0];
146 local[1] = 2*global[1];
148 }
else if (global[0] >= 0.5) {
150 local[0] = 2*global[0]-1;
151 local[1] = 2*global[1];
153 }
else if (global[1] >= 0.5) {
155 local[0] = 2*global[0];
156 local[1] = 2*global[1]-1;
161 local[0] = -2 * global[0] + 1;
162 local[1] = -2 * global[1] + 1;
220 if (global[0] + global[1] + global[2] <= 0.5)
222 else if (global[0] >= 0.5)
224 else if (global[1] >= 0.5)
226 else if (global[2] >= 0.5)
228 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5))
230 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5))
232 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5))
234 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5))
237 DUNE_THROW(InvalidStateException,
"no subelement defined");
248 FieldVector<D,3>& local)
250 if (global[0] + global[1] + global[2] <= 0.5) {
255 }
else if (global[0] >= 0.5) {
261 }
else if (global[1] >= 0.5) {
267 }
else if (global[2] >= 0.5) {
273 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5)) {
275 local[0] = 2.0 * global[1];
276 local[1] = 2.0 * (0.5 - global[0] - global[1]);
277 local[2] = 2.0 * (-0.5 + global[0] + global[1] + global[2]);
289 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5)) {
291 local[0] = 2.0 * (0.5 - global[0]);
292 local[1] = 2.0 * (0.5 - global[1] - global[2]);
293 local[2] = 2.0 * global[2];
303 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5)) {
305 local[0] = 2.0 * (0.5 - global[0] - global[1]);
306 local[1] = 2.0 * global[0];
307 local[2] = 2.0 * (-0.5 + global[1] + global[2]);
318 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5)) {
320 local[0] = 2.0 * (-0.5 + global[1] + global[2]);
321 local[1] = 2.0 * (0.5 - global[1]);
322 local[2] = 2.0 * (-0.5 + global[0] + global[1]);
336 DUNE_THROW(InvalidStateException,
"no subelement defined");
Definition bdfmcube.hh:18
Definition refinedsimplexlocalbasis.hh:20
RefinedSimplexLocalBasis()
Definition refinedsimplexlocalbasis.hh:22
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition refinedsimplexlocalbasis.hh:42
static void getSubElement(const FieldVector< D, 1 > &global, int &subElement, FieldVector< D, 1 > &local)
Get local coordinates in the subelement.
Definition refinedsimplexlocalbasis.hh:70
static int getSubElement(const FieldVector< D, 1 > &global)
Get the number of the subelement containing a given point.
Definition refinedsimplexlocalbasis.hh:54
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition refinedsimplexlocalbasis.hh:104
static int getSubElement(const FieldVector< D, 2 > &global)
Get the number of the subtriangle containing a given point.
Definition refinedsimplexlocalbasis.hh:121
static void getSubElement(const FieldVector< D, 2 > &global, int &subElement, FieldVector< D, 2 > &local)
Get local coordinates in the subtriangle.
Definition refinedsimplexlocalbasis.hh:139
static void getSubElement(const FieldVector< D, 3 > &global, int &subElement, FieldVector< D, 3 > &local)
Get local coordinates in the subsimplex.
Definition refinedsimplexlocalbasis.hh:246
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition refinedsimplexlocalbasis.hh:186
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:218