MFEM  v4.4.0
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); }
58 };
59 
60 
61 /// Arbitrary order L2 elements in 3D on a cube
63 {
64 private:
65 #ifndef MFEM_THREAD_SAFE
66  mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
67 #endif
68 
69 public:
70  /// Construct the L2_HexahedronElement of order @a p and BasisType @a btype
71  L2_HexahedronElement(const int p,
72  const int btype = BasisType::GaussLegendre);
73  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
74  virtual void CalcDShape(const IntegrationPoint &ip,
75  DenseMatrix &dshape) const;
76  virtual void ProjectDelta(int vertex, Vector &dofs) const;
77 };
78 
79 
80 /// Arbitrary order L2 elements in 2D on a triangle
82 {
83 private:
84 #ifndef MFEM_THREAD_SAFE
85  mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
86  mutable DenseMatrix du;
87 #endif
89 
90 public:
91  /// Construct the L2_TriangleElement of order @a p and BasisType @a btype
92  L2_TriangleElement(const int p,
93  const int btype = BasisType::GaussLegendre);
94  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
95  virtual void CalcDShape(const IntegrationPoint &ip,
96  DenseMatrix &dshape) const;
97  virtual void ProjectDelta(int vertex, Vector &dofs) const;
98  virtual void ProjectCurl(const FiniteElement &fe,
100  DenseMatrix &curl) const
101  { ProjectCurl_2D(fe, Trans, curl); }
102 };
103 
104 
105 /// Arbitrary order L2 elements in 3D on a tetrahedron
107 {
108 private:
109 #ifndef MFEM_THREAD_SAFE
110  mutable Vector shape_x, shape_y, shape_z, shape_l;
111  mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
112  mutable DenseMatrix du;
113 #endif
115 
116 public:
117  /// Construct the L2_TetrahedronElement of order @a p and BasisType @a btype
118  L2_TetrahedronElement(const int p,
119  const int btype = BasisType::GaussLegendre);
120  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
121  virtual void CalcDShape(const IntegrationPoint &ip,
122  DenseMatrix &dshape) const;
123  virtual void ProjectDelta(int vertex, Vector &dofs) const;
124 };
125 
126 
127 /// Arbitrary order L2 elements in 3D on a wedge
129 {
130 private:
131 #ifndef MFEM_THREAD_SAFE
132  mutable Vector t_shape, s_shape;
133  mutable DenseMatrix t_dshape, s_dshape;
134 #endif
135  Array<int> t_dof, s_dof;
136 
137  L2_TriangleElement TriangleFE;
138  L2_SegmentElement SegmentFE;
139 
140 public:
141  /// Construct the L2_WedgeElement of order @a p and BasisType @a btype
142  L2_WedgeElement(const int p,
143  const int btype = BasisType::GaussLegendre);
144  virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
145  virtual void CalcDShape(const IntegrationPoint &ip,
146  DenseMatrix &dshape) const;
147 };
148 
149 } // namespace mfem
150 
151 #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:98
Arbitrary order L2 elements in 3D on a wedge.
Definition: fe_l2.hpp:128
Arbitrary order L2 elements in 2D on a triangle.
Definition: fe_l2.hpp:81
Arbitrary order L2 elements in 3D on a cube.
Definition: fe_l2.hpp:62
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:117
L2_SegmentElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_SegmentElement of order p and BasisType btype.
Definition: fe_l2.cpp:22
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
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:38
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:571
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:513
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:98
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:44
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:405
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:253
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:650
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:383
L2_QuadrilateralElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_QuadrilateralElement of order p and BasisType btype.
Definition: fe_l2.cpp:79
L2_WedgeElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_WedgeElement of order p and BasisType btype.
Definition: fe_l2.cpp:607
L2_TetrahedronElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_TetrahedronElement of order p and BasisType btype.
Definition: fe_l2.cpp:463
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:106
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:55
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:538
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:669
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:434
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:229
L2_HexahedronElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_HexahedronElement of order p and BasisType btype.
Definition: fe_l2.cpp:186
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:208
L2_TriangleElement(const int p, const int btype=BasisType::GaussLegendre)
Construct the L2_TriangleElement of order p and BasisType btype.
Definition: fe_l2.cpp:338
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:137