9#ifndef PROJECTS_DPG_DISCONTINUOUS_FE_CONSTANT_H
10#define PROJECTS_DPG_DISCONTINUOUS_FE_CONSTANT_H
13#include <lf/uscalfe/uscalfe.h>
32template <
typename SCALAR>
47 [[nodiscard]]
unsigned Degree()
const override {
return 0; }
57 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
58 return (codim == 0) ? 1 : 0;
64 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
65 return (codim == 0) ? 1 : 0;
71 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
73 LF_ASSERT_MSG(refcoords.rows() == 2,
74 "Reference coordinates must be 2-vectors");
76 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, n_pts);
77 result.row(0) = Eigen::RowVectorXd::Constant(n_pts, 1);
84 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
86 const Eigen::MatrixXd& refcoords)
const override {
87 LF_ASSERT_MSG(refcoords.rows() == 2,
88 "Reference coordinates must be 2-vectors");
91 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, 2 * n_pts);
92 result.row(0) = Eigen::RowVectorXd::Constant(2 * n_pts, 0);
100 Eigen::MatrixXd nodes(2, 1);
101 nodes << 1.0 / 3.0, 1.0 / 3.0;
124template <
typename SCALAR>
139 [[nodiscard]]
unsigned Degree()
const override {
return 0; }
148 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
149 return (codim == 0) ? 1 : 0;
155 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
156 return (codim == 0) ? 1 : 0;
162 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
164 LF_ASSERT_MSG(refcoords.rows() == 2,
165 "Reference coordinates must be 2-vectors");
167 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, n_pts);
168 result.row(0) = Eigen::RowVectorXd::Constant(n_pts, 1);
175 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
177 const Eigen::MatrixXd& refcoords)
const override {
178 LF_ASSERT_MSG(refcoords.rows() == 2,
179 "Reference coordinates must be 2-vectors");
182 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, 2 * n_pts);
183 result.row(0) = Eigen::RowVectorXd::Constant(2 * n_pts, 0);
191 Eigen::MatrixXd nodes(2, 1);
213template <
typename SCALAR>
230 [[nodiscard]]
unsigned Degree()
const override {
return 0; }
239 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
240 return (codim == 0) ? 1 : 0;
246 LF_ASSERT_MSG(codim <= 2,
"Illegal codim" << codim);
247 return (codim == 0) ? 1 : 0;
253 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
255 LF_ASSERT_MSG(refcoords.rows() == 1,
256 "Reference coordinates must be 1-vectors");
258 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, n_pts);
259 result.row(0) = Eigen::RowVectorXd::Constant(n_pts, 1);
266 [[nodiscard]] Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic>
268 const Eigen::MatrixXd& refcoords)
const override {
269 LF_ASSERT_MSG(refcoords.rows() == 1,
270 "Reference coordinates must be 1-vectors");
273 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> result(1, n_pts);
274 result.row(0) = Eigen::RowVectorXd::Constant(n_pts, 0);
283 Eigen::MatrixXd nodes(1, 1);
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
static constexpr RefEl kTria()
Returns the reference triangle.
static constexpr RefEl kQuad()
Returns the reference quadrilateral.
Interface class for parametric scalar valued finite elements.
Discontinuous constant finite element on a quadrilateral reference element.
size_type NumRefShapeFunctions(dim_t codim, sub_idx_t) const override
FeDiscontinuousO0Quad(FeDiscontinuousO0Quad &&) noexcept=default
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > GradientsReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Computation of the gradients of all reference shape functions in a number of points.
size_type NumEvaluationNodes() const override
Only one evaluation node.
size_type NumRefShapeFunctions(dim_t codim) const override
FeDiscontinuousO0Quad(const FeDiscontinuousO0Quad &)=default
size_type NumRefShapeFunctions() const override
Total number of reference shape functions associated with the reference cell.
lf::base::RefEl RefEl() const override
Tells the type of reference cell underlying the parametric finite element.
Eigen::MatrixXd EvaluationNodes() const override
Only evaluation node is the center of the reference quadrilateral.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > EvalReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Evaluation of all reference shape functions in a number of points.
unsigned Degree() const override
Request the maximal polynomial degree of the basis functions in this finite element.
Discontinuous constant finite element on a line segment.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > EvalReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Evaluation of all reference shape functions in a number of points.
FeDiscontinuousO0Segment(const FeDiscontinuousO0Segment &)=default
size_type NumRefShapeFunctions() const override
Total number of reference shape functions associated with the reference cell.
FeDiscontinuousO0Segment(FeDiscontinuousO0Segment &&) noexcept=default
size_type NumEvaluationNodes() const override
Only one evaluation node.
size_type NumRefShapeFunctions(dim_t codim, sub_idx_t) const override
Eigen::MatrixXd EvaluationNodes() const override
The only evaluation node is the center of the reference line segment.
unsigned Degree() const override
Request the maximal polynomial degree of the basis functions in this finite element.
lf::base::RefEl RefEl() const override
Tells the type of reference cell underlying the parametric finite element.
size_type NumRefShapeFunctions(dim_t codim) const override
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > GradientsReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Computation of the gradients of all reference shape functions in a number of points.
Discontinuous constant finite element on a triangular reference element.
size_type NumRefShapeFunctions(dim_t codim) const override
Eigen::MatrixXd EvaluationNodes() const override
Only evaluation node is the barycenter of the reference triangle.
size_type NumRefShapeFunctions(dim_t codim, sub_idx_t) const override
size_type NumRefShapeFunctions() const override
Total number of reference shape functions associated with the reference cell.
unsigned Degree() const override
Request the maximal polynomial degree of the basis functions in this finite element.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > EvalReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Evaluation of all reference shape functions in a number of points.
size_type NumEvaluationNodes() const override
One evaluation node.
FeDiscontinuousO0Tria(FeDiscontinuousO0Tria &&) noexcept=default
lf::base::RefEl RefEl() const override
Tells the type of reference cell underlying the parametric finite element.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > GradientsReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Computation of the gradients of all reference shape functions in a number of points.
FeDiscontinuousO0Tria(const FeDiscontinuousO0Tria &)=default
Contains functionality for the implementation of DPG methods.
lf::uscalfe::sub_idx_t sub_idx_t
Type for indexing of sub-entities.
lf::uscalfe::dim_t dim_t
Tpe for (co)-dimensions.
lf::uscalfe::size_type size_type
Type for vector length/matrix sizes.