MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
fe_l2.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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
17namespace mfem
18{
19
20/// Arbitrary order L2 elements in 1D on a segment
22{
23private:
24#ifndef MFEM_THREAD_SAFE
25 mutable Vector shape_x, dshape_x;
26#endif
27
28public:
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
37 DenseMatrix &R) const
38 { ScalarLocalL2Restriction(Trans, R, *this); }
39
40};
41
42
43/// Arbitrary order L2 elements in 2D on a square
45{
46private:
47#ifndef MFEM_THREAD_SAFE
48 mutable Vector shape_x, shape_y, dshape_x, dshape_y;
49#endif
50
51public:
52 /// Construct the L2_QuadrilateralElement of order @a p and BasisType @a btype
53 L2_QuadrilateralElement(const int p,
54 const int btype = BasisType::GaussLegendre);
55 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
56 virtual void CalcDShape(const IntegrationPoint &ip,
57 DenseMatrix &dshape) const;
58 virtual void ProjectDelta(int vertex, Vector &dofs) const;
59 virtual void ProjectCurl(const FiniteElement &fe,
61 DenseMatrix &curl) const
62 { ProjectCurl_2D(fe, Trans, curl); }
63
65 DenseMatrix &R) const
66 { ScalarLocalL2Restriction(Trans, R, *this); }
67
69 virtual void ProjectDiv(const FiniteElement &fe,
71 DenseMatrix &div) const;
72 virtual void Project(Coefficient &coeff,
73 ElementTransformation &Trans, Vector &dofs) const;
74};
75
76
77/// Arbitrary order L2 elements in 3D on a cube
79{
80private:
81#ifndef MFEM_THREAD_SAFE
82 mutable Vector shape_x, shape_y, shape_z, dshape_x, dshape_y, dshape_z;
83#endif
84
85public:
86 /// Construct the L2_HexahedronElement of order @a p and BasisType @a btype
87 L2_HexahedronElement(const int p,
88 const int btype = BasisType::GaussLegendre);
89 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
90 virtual void CalcDShape(const IntegrationPoint &ip,
91 DenseMatrix &dshape) const;
92 virtual void ProjectDelta(int vertex, Vector &dofs) const;
93
95 DenseMatrix &R) const
96 { ScalarLocalL2Restriction(Trans, R, *this); }
97
99 virtual void ProjectDiv(const FiniteElement &fe,
101 DenseMatrix &div) const;
102 virtual void Project(Coefficient &coeff,
103 ElementTransformation &Trans, Vector &dofs) const;
104};
105
106
107/// Arbitrary order L2 elements in 2D on a triangle
109{
110private:
111#ifndef MFEM_THREAD_SAFE
112 mutable Vector shape_x, shape_y, shape_l, dshape_x, dshape_y, dshape_l, u;
113 mutable DenseMatrix du;
114#endif
116
117public:
118 /// Construct the L2_TriangleElement of order @a p and BasisType @a btype
119 L2_TriangleElement(const int p,
120 const int btype = BasisType::GaussLegendre);
121 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
122 virtual void CalcDShape(const IntegrationPoint &ip,
123 DenseMatrix &dshape) const;
124 virtual void ProjectDelta(int vertex, Vector &dofs) const;
125 virtual void ProjectCurl(const FiniteElement &fe,
127 DenseMatrix &curl) const
128 { ProjectCurl_2D(fe, Trans, curl); }
129
131 DenseMatrix &R) const
132 { ScalarLocalL2Restriction(Trans, R, *this); }
133
134};
135
136
137/// Arbitrary order L2 elements in 3D on a tetrahedron
139{
140private:
141#ifndef MFEM_THREAD_SAFE
142 mutable Vector shape_x, shape_y, shape_z, shape_l;
143 mutable Vector dshape_x, dshape_y, dshape_z, dshape_l, u;
144 mutable DenseMatrix du;
145#endif
147
148public:
149 /// Construct the L2_TetrahedronElement of order @a p and BasisType @a btype
150 L2_TetrahedronElement(const int p,
151 const int btype = BasisType::GaussLegendre);
152 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
153 virtual void CalcDShape(const IntegrationPoint &ip,
154 DenseMatrix &dshape) const;
155 virtual void ProjectDelta(int vertex, Vector &dofs) const;
156
158 DenseMatrix &R) const
159 { ScalarLocalL2Restriction(Trans, R, *this); }
160
161};
162
163
164/// Arbitrary order L2 elements in 3D on a wedge
166{
167private:
168#ifndef MFEM_THREAD_SAFE
169 mutable Vector t_shape, s_shape;
170 mutable DenseMatrix t_dshape, s_dshape;
171#endif
172 Array<int> t_dof, s_dof;
173
174 L2_TriangleElement TriangleFE;
175 L2_SegmentElement SegmentFE;
176
177public:
178 /// Construct the L2_WedgeElement of order @a p and BasisType @a btype
179 L2_WedgeElement(const int p,
180 const int btype = BasisType::GaussLegendre);
181 virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const;
182 virtual void CalcDShape(const IntegrationPoint &ip,
183 DenseMatrix &dshape) const;
184};
185
186} // namespace mfem
187
188#endif
@ GaussLegendre
Open type.
Definition fe_base.hpp:31
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Data type dense matrix using column-major storage.
Definition densemat.hpp:24
Abstract class for all finite elements.
Definition fe_base.hpp:239
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:126
Class for integration point with weight.
Definition intrules.hpp:35
Arbitrary order L2 elements in 3D on a cube.
Definition fe_l2.hpp:79
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
Definition fe_l2.hpp:94
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
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
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
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 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 ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_l2.cpp:451
Arbitrary order L2 elements in 2D on a square.
Definition fe_l2.hpp:45
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
Definition fe_l2.hpp:64
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
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
virtual void ProjectDiv(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &div) const
Compute the discrete divergence matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_l2.cpp:190
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 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
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
virtual void ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_l2.hpp:59
Arbitrary order L2 elements in 1D on a segment.
Definition fe_l2.hpp:22
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:58
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
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
Definition fe_l2.hpp:36
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 3D on a tetrahedron.
Definition fe_l2.hpp:139
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
Definition fe_l2.hpp:157
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 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
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 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
Arbitrary order L2 elements in 2D on a triangle.
Definition fe_l2.hpp:109
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 GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs.
Definition fe_l2.hpp:130
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
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
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 ProjectCurl(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Compute the discrete curl matrix from the given FiniteElement onto 'this' FiniteElement....
Definition fe_l2.hpp:125
Arbitrary order L2 elements in 3D on a wedge.
Definition fe_l2.hpp:166
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
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
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
Class for standard nodal finite elements.
Definition fe_base.hpp:715
void ProjectCurl_2D(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &curl) const
Definition fe_base.cpp:724
void ScalarLocalL2Restriction(ElementTransformation &Trans, DenseMatrix &R, const ScalarFiniteElement &coarse_fe) const
Get restriction matrix R defined through local L2-projection in the space defined by the coarse_fe.
Definition fe_base.cpp:602
Vector data type.
Definition vector.hpp:80
real_t p(const Vector &x, real_t t)