16 : coords_(std::move(coords)) {
29 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
30 "local coordinates out of bounds for reference element");
33 Eigen::VectorXd local_vec = local.transpose();
34 auto tmp = ((
alpha_ * local).colwise() +
beta_).array().rowwise();
36 return (tmp * local_vec.transpose().array()).matrix().colwise() +
gamma_;
40 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
41 "local coordinates out of bounds for reference element");
47 const Eigen::MatrixXd& local)
const {
48 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
49 "local coordinates out of bounds for reference element");
51 auto jacobian = (2. *
alpha_ * local).colwise() +
beta_;
54 return jacobian.cwiseInverse();
61 const Eigen::VectorXd jTj_inv = jTj.cwiseInverse().transpose();
63 return jacobian.array().rowwise() * jTj_inv.transpose().array();
67 const Eigen::MatrixXd& local)
const {
68 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
69 "local coordinates out of bounds for reference element");
75 return jTj.cwiseSqrt().transpose();
80 LF_ASSERT_MSG(i == 0,
"i is out of bounds");
81 return std::make_unique<SegmentO2>(
coords_);
84 LF_ASSERT_MSG(0 <= i && i <= 2,
"i is out of bounds");
85 return std::make_unique<Point>(
coords_.col(i));
87 LF_VERIFY_MSG(
false,
"codim is out of bounds");
94 LF_VERIFY_MSG(codim < 2,
"Illegal codim = " << codim);
96 const double hLattice = 1. /
static_cast<double>(ref_pat.
LatticeConst());
97 std::vector<std::unique_ptr<Geometry>> childGeoPtrs = {};
100 std::vector<Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic>> childPolygons(
103 const size_t noChildren = childPolygons.size();
106 "NumChildren " << noChildren <<
" <-> " << ref_pat.
NumChildren(codim));
109 for (
size_t child = 0; child < noChildren; ++child) {
113 childPolygons[child].rows() == 1,
114 "childPolygons[child].rows() = " << childPolygons[child].rows());
116 childPolygons[child].cols() == (2 - codim),
117 "childPolygons[child].cols() = " << childPolygons[child].cols());
119 Eigen::MatrixXd locCoords(1, 3 - 2 * codim);
124 locCoords << hLattice * childPolygons[child].cast<
double>(),
125 (hLattice * childPolygons[child].cast<double>()).sum() / 2;
126 childGeoPtrs.push_back(std::make_unique<SegmentO2>(
Global(locCoords)));
131 locCoords << hLattice * childPolygons[child].cast<
double>();
132 childGeoPtrs.push_back(std::make_unique<Point>(
Global(locCoords)));
137 LF_VERIFY_MSG(
false,
"Illegal co-dimension");
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
std::string ToString() const
Return a string representation of this Reference element.
Abstract interface class for encoding topological local refinement
lf::base::size_type LatticeConst() const
Provides information about lattice constant used.
virtual lf::base::size_type NumChildren(lf::base::dim_t codim) const =0
provide number of child entities of a given co-dimension to be created by refinement
virtual std::vector< Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > > ChildPolygons(lf::base::dim_t codim) const =0
provide lattice reference coordinates of vertices of child polygons
lf::base::RefEl RefEl() const
Returns topological type of entity for which the current object is set up.
Eigen::VectorXd IntegrationElement(const Eigen::MatrixXd &local) const override
The integration element (factor appearing in integral transformation formula, see below) at number of...
SegmentO2(Eigen::Matrix< double, Eigen::Dynamic, 3 > coords)
Constructor building segment from vertex/midpoint coordinates.
std::vector< std::unique_ptr< Geometry > > ChildGeometry(const RefinementPattern &ref_pat, base::dim_t codim) const override
Generate geometry objects for child entities created in the course of refinement.
Eigen::MatrixXd Global(const Eigen::MatrixXd &local) const override
Map a number of points in local coordinates into the global coordinate system.
Eigen::Matrix< double, Eigen::Dynamic, 3 > coords_
Coordinates of the 3 vertices/midpoints, stored in matrix columns.
Eigen::Matrix< double, Eigen::Dynamic, 1 > beta_
Eigen::MatrixXd JacobianInverseGramian(const Eigen::MatrixXd &local) const override
Evaluate the Jacobian * Inverse Gramian ( ) simultaneously at numPoints.
Eigen::Matrix< double, Eigen::Dynamic, 1 > gamma_
dim_t DimGlobal() const override
Dimension of the image of this mapping.
Eigen::Matrix< double, Eigen::Dynamic, 1 > alpha_
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...
Eigen::MatrixXd Jacobian(const Eigen::MatrixXd &local) const override
Evaluate the jacobian of the mapping simultaneously at numPoints points.
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Defines the Geometry interface and provides a number of classes that implement this interface + addit...