16 std::shared_ptr<lf::geometry::Geometry> geo_ptr;
19 geo_ptr = std::make_shared<lf::geometry::TriaO1>(
23 geo_ptr = std::make_shared<lf::geometry::QuadO1>(
27 LF_ASSERT_MSG(
false, ref_el <<
"unsupported reference element.");
32 std::vector<lf::quad::QuadRule> BoundaryQuadRules(numSegments);
35 for (
int segment = 0; segment < numSegments; ++segment) {
37 auto edge_ptr = geo_ptr->SubGeometry(1, segment);
38 Eigen::MatrixXd Points = edge_ptr->Global(qr.
Points());
39 Eigen::VectorXd Weights =
41 edge_ptr->IntegrationElement((Eigen::VectorXd(1) << 0.5).finished());
43 BoundaryQuadRules[segment] = bqr;
46 return BoundaryQuadRules;
54 "invalid reference element: " << refEl);
58 int n_corners = corners.cols();
59 int n_edges = n_corners;
71 Eigen::MatrixXd point = Eigen::MatrixXd::Zero(2, 1);
72 Eigen::MatrixXd Jacobian = geometry.
Jacobian(point);
73 double JacobianDeterminant = Jacobian.determinant();
74 orientation = JacobianDeterminant > 0 ? 1 : -1;
86 int positiveJacobianDeterminantCount = 0;
87 for (
int i = 0; i < 4; ++i) {
88 Eigen::MatrixXd Jacobian = Jacobians.block(0, 2 * i, 2, 2);
89 double JacobianDeterminant = Jacobian.determinant();
90 if (JacobianDeterminant > 0) {
91 positiveJacobianDeterminantCount++;
102 orientation = positiveJacobianDeterminantCount >= 3 ? 1 : -1;
106 Eigen::MatrixXd edges(2, n_edges);
107 for (
int i = 0; i < n_edges; ++i) {
115 Eigen::MatrixXd normals(2, n_edges);
116 for (
int i = 0; i < n_edges; ++i) {
117 Eigen::Vector2d normal;
118 normal(0) = edges(1, i) * orientation;
119 normal(1) = -edges(0, i) * orientation;
121 normals.col(i) = normal;
128 LF_ASSERT_MSG((
mesh_ptr_ !=
nullptr),
"invalid mesh (nullptr)");
135 LF_ASSERT_MSG(maxElement.
DefinedOn(*subent),
136 "maxElement_ not defined on subentity" << *subent);
137 maxElement(*subent) = std::max(maxElement(*subent), entity_idx);
146 LF_ASSERT_MSG(maxElement.
DefinedOn(edge),
147 "maxElement_ not defined on edge " << edge);
148 return mesh_ptr_->Index(element) == maxElement(edge) ? 1 : -1;
Represents a reference element with all its properties.
constexpr sub_idx_t SubSubEntity2SubEntity(dim_t sub_codim, sub_idx_t sub_index, dim_t sub_rel_codim, sub_idx_t sub_rel_index) const
Identifies sub-entities of sub-entities (so-called sub-sub-entities) with sub-entities.
const Eigen::MatrixXd & NodeCoords() const
Get the coordinates of the nodes of this reference element.
constexpr size_type NumSubEntities(dim_t sub_codim) const
Get the number of sub-entities of this RefEl with the given codimension.
static constexpr RefEl kTria()
Returns the reference triangle.
static constexpr RefEl kQuad()
Returns the reference quadrilateral.
Interface class for shape information on a mesh cell in the spirit of parametric finite element metho...
virtual base::RefEl RefEl() const =0
The Reference element that defines the domain of this mapping.
virtual Eigen::MatrixXd Jacobian(const Eigen::MatrixXd &local) const =0
Evaluate the jacobian of the mapping simultaneously at numPoints points.
Interface class representing a topological entity in a cellular complex
virtual nonstd::span< const Entity *const > SubEntities(unsigned rel_codim) const =0
Return all sub entities of this entity that have the given codimension (w.r.t. this entity!...
A MeshDataSet that attaches data of type T to every entity of a mesh that has a specified codimension...
bool DefinedOn(const Entity &e) const override
Does the dataset store information with this entity?
Represents a Quadrature Rule over one of the Reference Elements.
const Eigen::VectorXd & Weights() const
All quadrature weights as a vector.
const Eigen::MatrixXd & Points() const
All quadrature points as column vectors.
int PrescribedSign(const lf::mesh::Entity &element, const lf::mesh::Entity &edge) const
evaluates the the function at the midpoint of the edge of cell
std::shared_ptr< const lf::mesh::Mesh > mesh_ptr_
std::shared_ptr< lf::mesh::utils::CodimMeshDataSet< int > > maxElement_ptr_
Eigen::MatrixXd Corners(const Geometry &geo)
The corners of a shape with piecewise smooth boundary.
Contains functionality for the implementation of DPG methods.
std::vector< lf::quad::QuadRule > BoundaryQuadRule(lf::base::RefEl ref_el, const lf::quad::QuadRule &qr)
Constructs a quadrature rule on the boundary of a reference element.
Eigen::MatrixXd OuterNormals(const lf::geometry::Geometry &geometry)
Compute the outer normals of a geometry object.