12 #ifndef MFEM_TEMPLATE_FINITE_ELEMENTS
13 #define MFEM_TEMPLATE_FINITE_ELEMENTS
15 #include "../config/tconfig.hpp"
23 template <
typename real_t>
33 for (
int ip = 0; ip < nip; ip++)
36 for (
int id = 0;
id < dof;
id++)
38 int orig_id = dof_map ? (*dof_map)[id] : id;
39 B[ip+nip*id] = shape(orig_id);
44 template <
typename real_t>
55 for (
int ip = 0; ip < nip; ip++)
58 for (
int id = 0;
id < dof;
id++)
60 int orig_id = dof_map ? (*dof_map)[id] : id;
61 for (
int d = 0; d <
dim; d++)
63 G[ip+nip*(d+dim*id)] = dshape(orig_id, d);
69 template <
typename real_t>
71 real_t *B, real_t *G,
const Array<int> *dof_map)
79 template <Geometry::Type G,
int P>
87 static const int dim = 1;
88 static const int degree = P;
89 static const int dofs = P+1;
91 static const bool tensor_prod =
true;
92 static const int dofs_1d = P+1;
128 MFEM_ASSERT(h1_fec,
"invalid FiniteElementCollection");
133 template <
typename real_t>
138 template <
typename real_t>
152 static const int degree = P;
153 static const int dofs = ((P + 1)*(P + 2))/2;
155 static const bool tensor_prod =
false;
186 MFEM_ASSERT(h1_fec,
"invalid FiniteElementCollection");
191 template <
typename real_t>
205 static const int degree = P;
206 static const int dofs = (P+1)*(P+1);
208 static const bool tensor_prod =
true;
209 static const int dofs_1d = P+1;
247 MFEM_ASSERT(h1_fec,
"invalid FiniteElementCollection");
252 template <
typename real_t>
257 template <
typename real_t>
271 static const int degree = P;
272 static const int dofs = ((P + 1)*(P + 2)*(P + 3))/6;
274 static const bool tensor_prod =
false;
305 MFEM_ASSERT(h1_fec,
"invalid FiniteElementCollection");
310 template <
typename real_t>
324 static const int degree = P;
325 static const int dofs = (P+1)*(P+1)*(P+1);
327 static const bool tensor_prod =
true;
328 static const int dofs_1d = P+1;
367 MFEM_ASSERT(h1_fec,
"invalid FiniteElementCollection");
372 template <
typename real_t>
377 template <
typename real_t>
388 template <
Geometry::Type G,
int P,
typename L2_FE_type,
typename L2Pos_FE_type,
414 my_fe =
new L2Pos_FE_type(P);
420 my_fe =
new L2_FE_type(P, pt_type);
433 MFEM_ASSERT(l2_fec,
"invalid FiniteElementCollection");
440 template <
typename real_t>
445 template <
typename real_t>
454 template <Geometry::Type G,
int P>
461 Geometry::SEGMENT,P,L2_SegmentElement,L2Pos_SegmentElement,P+1,true>
478 L2Pos_TriangleElement,((P+1)*(P+2))/2,false>
495 L2Pos_QuadrilateralElement,(P+1)*(P+1),true>
512 L2Pos_TetrahedronElement,((P+1)*(P+2)*(P+3))/6,false>
529 L2Pos_HexahedronElement,(P+1)*(P+1)*(P+1),true>
544 #endif // MFEM_TEMPLATE_FINITE_ELEMENTS
const Array< int > * GetDofMap() const
void Init(const parameter_type type_)
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for Finite Elements.
const Array< int > * my_dof_map
const FiniteElement * my_fe_1d
int GetDim() const
Returns the reference space dimension for the finite element.
const FiniteElement * my_fe
Class for an integration rule - an Array of IntegrationPoint.
L2_FiniteElement(const FiniteElementCollection &fec)
static const Geometry::Type geom
L2_FiniteElement_base< Geometry::SEGMENT, P, L2_SegmentElement, L2Pos_SegmentElement, P+1, true > base_class
const Array< int > * GetDofMap() const
L2_FiniteElement(const FiniteElementCollection &fec)
L2_FiniteElement(const FiniteElementCollection &fec)
void Init(const parameter_type type_)
H1_FiniteElement(const FiniteElementCollection &fec)
const Array< int > * my_dof_map
Data type dense matrix using column-major storage.
void CalcShapeMatrix(const FiniteElement &fe, const IntegrationRule &ir, real_t *B, const Array< int > *dof_map=NULL)
static int GetQuadrature1D(int b_type)
Get the corresponding Quadrature1D constant, when that makes sense; otherwise return Quadrature1D::In...
const Array< int > * GetDofMap() const
H1_FiniteElement(const parameter_type type_=BasisType::GaussLobatto)
H1_FiniteElement(const FiniteElementCollection &fec)
const Array< int > * my_dof_map
const Array< int > * GetDofMap() const
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
const FiniteElement * my_fe
base_class::parameter_type parameter_type
L2_FiniteElement(const FiniteElementCollection &fec)
H1_FiniteElement(const parameter_type type_=BasisType::GaussLobatto)
void Init(const parameter_type type_)
L2_FiniteElement_base(const FiniteElementCollection &fec)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
H1_FiniteElement(const parameter_type type_=BasisType::GaussLobatto)
const FiniteElement * my_fe_1d
void CalcGradTensor(const FiniteElement &fe, const IntegrationRule &ir, real_t *G, const Array< int > *dof_map=NULL)
H1_FiniteElement(const FiniteElementCollection &fec)
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
static const bool tensor_prod
L2_FiniteElement_base< Geometry::TETRAHEDRON, P, L2_TetrahedronElement, L2Pos_TetrahedronElement,((P+1)*(P+2)*(P+3))/6, false > base_class
base_class::parameter_type parameter_type
H1_FiniteElement(const parameter_type type_=BasisType::GaussLobatto)
base_class::parameter_type parameter_type
const FiniteElement * my_fe
L2_FiniteElement(const parameter_type type_=BasisType::GaussLegendre)
base_class::parameter_type parameter_type
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
void Init(const parameter_type type_)
L2_FiniteElement_base(const parameter_type type)
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *Grad) const
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
A class to initialize the size of a Tensor.
const Array< int > & GetDofMap() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
L2_FiniteElement(const parameter_type type_=BasisType::GaussLegendre)
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
L2_FiniteElement(const parameter_type type_=BasisType::GaussLegendre)
H1_FiniteElement(const FiniteElementCollection &fec)
void Calc1DShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
H1_FiniteElement(const FiniteElementCollection &fec)
void Calc1DShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
void Calc1DShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
L2_FiniteElement(const parameter_type type_=BasisType::GaussLegendre)
H1_FiniteElement(const parameter_type type_=BasisType::GaussLobatto)
const FiniteElement * my_fe_1d
const FiniteElement * my_fe
Arbitrary order H1-conforming (continuous) finite elements.
base_class::parameter_type parameter_type
void CalcShapes(const IntegrationRule &ir, real_t *B, real_t *G) const
L2_FiniteElement(const parameter_type type_=BasisType::GaussLegendre)
void Init(const parameter_type type_)
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
L2_FiniteElement_base< Geometry::SQUARE, P, L2_QuadrilateralElement, L2Pos_QuadrilateralElement,(P+1)*(P+1), true > base_class
void CalcShapes(const FiniteElement &fe, const IntegrationRule &ir, real_t *B, real_t *G, const Array< int > *dof_map)
void Calc1DShapes(const IntegrationRule &ir, real_t *B, real_t *Grad) const
const Array< int > * GetDofMap() const
void Init(const parameter_type type_)
L2_FiniteElement(const FiniteElementCollection &fec)
const Array< int > * GetDofMap() const
Arbitrary order "L2-conforming" discontinuous finite elements.