MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
fe_l2.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_FE_L2
13 #define MFEM_FE_L2
14 
15 #include "fe_base.hpp"
16 
17 namespace mfem
18 {
19 
20 /// Arbitrary order L2 elements in 1D on a segment
22 {
23 private:
24 #ifndef MFEM_THREAD_SAFE
25  mutable Vector shape_x, dshape_x;
26 #endif
27 
28 public:
29  /// Construct the L2_SegmentElement of order @a p and BasisType @a btype
30  L2_SegmentElement(const int p, const int btype = BasisType::GaussLegendre);
31  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
32  virtual void CalcDShape(const IntegrationPoint &ip,
33  DenseMatrix &dshape) const;
34  virtual void ProjectDelta(int vertex, Vector &dofs) const;
35 };
36 
37 
38 /// Arbitrary order L2 elements in 2D on a square
40 {
41 private:
42 #ifndef MFEM_THREAD_SAFE
43  mutable Vector shape_x, shape_y, dshape_x, dshape_y;
44 #endif
45 
46 public:
47  /// Construct the L2_QuadrilateralElement of order @a p and BasisType @a btype
48  L2_QuadrilateralElement(const int p,
49  const int btype = BasisType::GaussLegendre);
50  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
51  virtual void CalcDShape(const IntegrationPoint &ip,
52  DenseMatrix &dshape) const;
53  virtual void ProjectDelta(int vertex, Vector &dofs) const;
54  virtual void ProjectCurl(const FiniteElement &fe,
56  DenseMatrix &curl) const
57  { ProjectCurl_2D(fe, Trans, curl); }
59  virtual void ProjectDiv(const FiniteElement &fe,
61  DenseMatrix &div) const;
62  virtual void Project(Coefficient &coeff,
63  ElementTransformation &Trans, Vector &dofs) const;
64 };
65 
66 
67 /// Arbitrary order L2 elements in 3D on a cube
69 {
70 private:
71 #ifndef MFEM_THREAD_SAFE
72  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
73 #endif
74 
75 public:
76  /// Construct the L2_HexahedronElement of order @a p and BasisType @a btype
77  L2_HexahedronElement(const int p,
78  const int btype = BasisType::GaussLegendre);
79  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
80  virtual void CalcDShape(const IntegrationPoint &ip,
81  DenseMatrix &dshape) const;
82  virtual void ProjectDelta(int vertex, Vector &dofs) const;
84  virtual void ProjectDiv(const FiniteElement &fe,
86  DenseMatrix &div) const;
87  virtual void Project(Coefficient &coeff,
88  ElementTransformation &Trans, Vector &dofs) const;
89 };
90 
91 
92 /// Arbitrary order L2 elements in 2D on a triangle
94 {
95 private:
96 #ifndef MFEM_THREAD_SAFE
97  mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
98  mutable DenseMatrix du;
99 #endif
101 
102 public:
103  /// Construct the L2_TriangleElement of order @a p and BasisType @a btype
104  L2_TriangleElement(const int p,
105  const int btype = BasisType::GaussLegendre);
106  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
107  virtual void CalcDShape(const IntegrationPoint &ip,
108  DenseMatrix &dshape) const;
109  virtual void ProjectDelta(int vertex, Vector &dofs) const;
110  virtual void ProjectCurl(const FiniteElement &fe,
112  DenseMatrix &curl) const
113  { ProjectCurl_2D(fe, Trans, curl); }
114 };
115 
116 
117 /// Arbitrary order L2 elements in 3D on a tetrahedron
119 {
120 private:
121 #ifndef MFEM_THREAD_SAFE
122  mutable Vector shape_x, shape_y, shape_z, shape_l;
123  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
124  mutable DenseMatrix du;
125 #endif
127 
128 public:
129  /// Construct the L2_TetrahedronElement of order @a p and BasisType @a btype
130  L2_TetrahedronElement(const int p,
131  const int btype = BasisType::GaussLegendre);
132  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
133  virtual void CalcDShape(const IntegrationPoint &ip,
134  DenseMatrix &dshape) const;
135  virtual void ProjectDelta(int vertex, Vector &dofs) const;
136 };
137 
138 
139 /// Arbitrary order L2 elements in 3D on a wedge
141 {
142 private:
143 #ifndef MFEM_THREAD_SAFE
144  mutable Vector t_shape, s_shape;
145  mutable DenseMatrix t_dshape, s_dshape;
146 #endif
147  Array<int> t_dof, s_dof;
148 
149  L2_TriangleElement TriangleFE;
150  L2_SegmentElement SegmentFE;
151 
152 public:
153  /// Construct the L2_WedgeElement of order @a p and BasisType @a btype
154  L2_WedgeElement(const int p,
155  const int btype = BasisType::GaussLegendre);
156  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
157  virtual void CalcDShape(const IntegrationPoint &ip,
158  DenseMatrix &dshape) const;
159 };
160 
161 } // namespace mfem
162 
163 #endif
Abstract class for all finite elements.
Definition: fe_base.hpp:235
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:101
Arbitrary order L2 elements in 3D on a wedge.
Definition: fe_l2.hpp:140
Arbitrary order L2 elements in 2D on a triangle.
Definition: fe_l2.hpp:93
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe_base.cpp:125
Arbitrary order L2 elements in 3D on a cube.
Definition: fe_l2.hpp:68
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:121
L2_SegmentElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_SegmentElement of order p and BasisType btype.
Definition: fe_l2.cpp:23
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe_l2.cpp:521
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:39
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe_l2.cpp:803
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe_l2.cpp:190
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:745
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe_l2.hpp:110
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
Given a coefficient and a transformation, compute its projection (approximation) in the local finite ...
Definition: fe_l2.cpp:255
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe_l2.cpp:451
Class for standard nodal finite elements.
Definition: fe_base.hpp:706
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:46
Arbitrary order L2 elements in 1D on a segment.
Definition: fe_l2.hpp:21
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:637
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe_l2.cpp:367
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:882
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:615
L2_QuadrilateralElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_QuadrilateralElement of order p and BasisType btype.
Definition: fe_l2.cpp:82
L2_WedgeElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_WedgeElement of order p and BasisType btype.
Definition: fe_l2.cpp:839
L2_TetrahedronElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_TetrahedronElement of order p and BasisType btype.
Definition: fe_l2.cpp:695
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto &#39;this&#39; FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
Definition: fe_l2.hpp:54
Arbitrary order L2 elements in 3D on a tetrahedron.
Definition: fe_l2.hpp:118
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe_l2.cpp:58
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Definition: coefficient.hpp:41
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:770
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:901
Class for integration point with weight.
Definition: intrules.hpp:25
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe_l2.cpp:666
Arbitrary order L2 elements in 2D on a square.
Definition: fe_l2.hpp:39
void ProjectCurl_2D(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Definition: fe_base.cpp:587
Vector data type.
Definition: vector.hpp:60
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
Definition: fe_l2.cpp:342
L2_HexahedronElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_HexahedronElement of order p and BasisType btype.
Definition: fe_l2.cpp:298
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
Definition: fe_l2.cpp:320
L2_TriangleElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_TriangleElement of order p and BasisType btype.
Definition: fe_l2.cpp:570
virtual void ProjectDelta(int vertex, Vector &dofs) const
Project a delta function centered on the given vertex in the local finite dimensional space represent...
Definition: fe_l2.cpp:142