LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
tria_o2.h
1
9#ifndef TRIA_O2_H
10#define TRIA_O2_H
11
12#include "geometry_interface.h"
13
14namespace lf::geometry {
15
29class TriaO2 : public Geometry {
30 public:
39 explicit TriaO2(Eigen::Matrix<double, Eigen::Dynamic, 6> coords);
40
41 [[nodiscard]] dim_t DimLocal() const override { return 2; }
42 [[nodiscard]] dim_t DimGlobal() const override { return coords_.rows(); }
43 [[nodiscard]] base::RefEl RefEl() const override {
44 return base::RefEl::kTria();
45 }
46
47 [[nodiscard]] Eigen::MatrixXd Global(
48 const Eigen::MatrixXd &local) const override;
49 [[nodiscard]] Eigen::MatrixXd Jacobian(
50 const Eigen::MatrixXd &local) const override;
51 [[nodiscard]] Eigen::MatrixXd JacobianInverseGramian(
52 const Eigen::MatrixXd &local) const override;
53 [[nodiscard]] Eigen::VectorXd IntegrationElement(
54 const Eigen::MatrixXd &local) const override;
55
56 [[nodiscard]] std::unique_ptr<Geometry> SubGeometry(dim_t codim,
57 dim_t i) const override;
58
59 [[nodiscard]] std::vector<std::unique_ptr<Geometry>> ChildGeometry(
60 const RefinementPattern &ref_pat, lf::base::dim_t codim) const override;
61
62 private:
66 Eigen::Matrix<double, Eigen::Dynamic, 6> coords_;
67
68 /*
69 * TriaO2 is parametrized by:
70 * alpha_ + beta_ * [x1, x2] + gamma_ * [x1^2, x2^2] + delta_ * [x1 * x2]
71 */
72 Eigen::Matrix<double, Eigen::Dynamic, 1> alpha_;
73 Eigen::Matrix<double, Eigen::Dynamic, 2> beta_;
74 Eigen::Matrix<double, Eigen::Dynamic, 2> gamma_;
75 Eigen::Matrix<double, Eigen::Dynamic, 1> delta_;
76
77 /* Coefficient for efficient evaluation of Jacobian() */
78 Eigen::Matrix<double, Eigen::Dynamic, 2> gamma_x_2_;
79};
80} // namespace lf::geometry
81
82#endif /* TRIA_O2_H */
Represents a reference element with all its properties.
Definition ref_el.h:109
static constexpr RefEl kTria()
Returns the reference triangle.
Definition ref_el.h:161
Interface class for shape information on a mesh cell in the spirit of parametric finite element metho...
base::RefEl::dim_t dim_t
Abstract interface class for encoding topological local refinement
A second-order triangle in the plane or in 3D space.
Definition tria_o2.h:29
Eigen::MatrixXd Global(const Eigen::MatrixXd &local) const override
Map a number of points in local coordinates into the global coordinate system.
Definition tria_o2.cc:50
dim_t DimGlobal() const override
Dimension of the image of this mapping.
Definition tria_o2.h:42
Eigen::Matrix< double, Eigen::Dynamic, 6 > coords_
Coordinates of the 6 vertices/midpoints, stored in matrix columns.
Definition tria_o2.h:66
Eigen::Matrix< double, Eigen::Dynamic, 2 > beta_
Definition tria_o2.h:73
Eigen::MatrixXd JacobianInverseGramian(const Eigen::MatrixXd &local) const override
Evaluate the Jacobian * Inverse Gramian ( ) simultaneously at numPoints.
Definition tria_o2.cc:87
std::unique_ptr< Geometry > SubGeometry(dim_t codim, dim_t i) const override
Construct a new Geometry() object that describes the geometry of the i-th sub-entity with codimension...
Definition tria_o2.cc:149
Eigen::Matrix< double, Eigen::Dynamic, 1 > alpha_
Definition tria_o2.h:72
Eigen::Matrix< double, Eigen::Dynamic, 2 > gamma_
Definition tria_o2.h:74
dim_t DimLocal() const override
Dimension of the domain of this mapping.
Definition tria_o2.h:41
std::vector< std::unique_ptr< Geometry > > ChildGeometry(const RefinementPattern &ref_pat, lf::base::dim_t codim) const override
Generate geometry objects for child entities created in the course of refinement.
Definition tria_o2.cc:173
Eigen::Matrix< double, Eigen::Dynamic, 1 > delta_
Definition tria_o2.h:75
Eigen::VectorXd IntegrationElement(const Eigen::MatrixXd &local) const override
The integration element (factor appearing in integral transformation formula, see below) at number of...
Definition tria_o2.cc:123
Eigen::Matrix< double, Eigen::Dynamic, 2 > gamma_x_2_
Definition tria_o2.h:78
base::RefEl RefEl() const override
The Reference element that defines the domain of this mapping.
Definition tria_o2.h:43
TriaO2(Eigen::Matrix< double, Eigen::Dynamic, 6 > coords)
Constructor building triangle from vertex/midpoint coordinates.
Definition tria_o2.cc:18
Eigen::MatrixXd Jacobian(const Eigen::MatrixXd &local) const override
Evaluate the jacobian of the mapping simultaneously at numPoints points.
Definition tria_o2.cc:64
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Definition types.h:32
Defines the Geometry interface and provides a number of classes that implement this interface + addit...
Definition compose.h:13