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.");
57 else if (global[0] <= 1.0)
60 DUNE_THROW(InvalidStateException,
"no subelement defined");
71 FieldVector<D,1>& local)
73 if (global[0] <= 0.5) {
75 local[0] = 2.0 * global[0];
80 local[0] = 2.0 * global[0] - 1.0;
121 if (global[0] + global[1] <= 0.5)
123 else if (global[0] >= 0.5)
125 else if (global[1] >= 0.5)
139 FieldVector<D,2>& local)
141 if (global[0] + global[1] <= 0.5) {
143 local[0] = 2*global[0];
144 local[1] = 2*global[1];
146 }
else if (global[0] >= 0.5) {
148 local[0] = 2*global[0]-1;
149 local[1] = 2*global[1];
151 }
else if (global[1] >= 0.5) {
153 local[0] = 2*global[0];
154 local[1] = 2*global[1]-1;
159 local[0] = -2 * global[0] + 1;
160 local[1] = -2 * global[1] + 1;
217 if (global[0] + global[1] + global[2] <= 0.5)
219 else if (global[0] >= 0.5)
221 else if (global[1] >= 0.5)
223 else if (global[2] >= 0.5)
225 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5))
227 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5))
229 else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5))
231 else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5))
234 DUNE_THROW(InvalidStateException,
"no subelement defined");
245 FieldVector<D,3>& local)
247 if (global[0] + global[1] + global[2] <= 0.5) {
252 }
else if (global[0] >= 0.5) {
258 }
else if (global[1] >= 0.5) {
264 }
else if (global[2] >= 0.5) {
270 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] <= 0.5)) {
272 local[0] = 2.0 * global[1];
273 local[1] = 2.0 * (0.5 - global[0] - global[1]);
274 local[2] = 2.0 * (-0.5 + global[0] + global[1] + global[2]);
286 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] <= 0.5)) {
288 local[0] = 2.0 * (0.5 - global[0]);
289 local[1] = 2.0 * (0.5 - global[1] - global[2]);
290 local[2] = 2.0 * global[2];
300 }
else if ((global[0] + global[1] <= 0.5)and (global[1] + global[2] >= 0.5)) {
302 local[0] = 2.0 * (0.5 - global[0] - global[1]);
303 local[1] = 2.0 * global[0];
304 local[2] = 2.0 * (-0.5 + global[1] + global[2]);
315 }
else if ((global[0] + global[1] >= 0.5)and (global[1] + global[2] >= 0.5)) {
317 local[0] = 2.0 * (-0.5 + global[1] + global[2]);
318 local[1] = 2.0 * (0.5 - global[1]);
319 local[2] = 2.0 * (-0.5 + global[0] + global[1]);
333 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:41
static void getSubElement(const FieldVector< D, 1 > &global, int &subElement, FieldVector< D, 1 > &local)
Get local coordinates in the subelement.
Definition: refinedsimplexlocalbasis.hh:69
static int getSubElement(const FieldVector< D, 1 > &global)
Get the number of the subelement containing a given point.
Definition: refinedsimplexlocalbasis.hh:53
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition: refinedsimplexlocalbasis.hh:102
static int getSubElement(const FieldVector< D, 2 > &global)
Get the number of the subtriangle containing a given point.
Definition: refinedsimplexlocalbasis.hh:119
static void getSubElement(const FieldVector< D, 2 > &global, int &subElement, FieldVector< D, 2 > &local)
Get local coordinates in the subtriangle.
Definition: refinedsimplexlocalbasis.hh:137
static void getSubElement(const FieldVector< D, 3 > &global, int &subElement, FieldVector< D, 3 > &local)
Get local coordinates in the subsimplex.
Definition: refinedsimplexlocalbasis.hh:243
RefinedSimplexLocalBasis()
Protected default constructor so this class can only be instantiated as a base class.
Definition: refinedsimplexlocalbasis.hh:183
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:215