16 : coords_(std::move(coords)),
32 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
33 "local coordinates out of bounds for reference element");
36 Eigen::VectorXd local_vec = local.transpose();
37 auto tmp = ((
alpha_ * local).colwise() +
beta_).array().rowwise();
39 return (tmp * local_vec.transpose().array()).matrix().colwise() +
gamma_;
43 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
44 "local coordinates out of bounds for reference element");
50 const Eigen::MatrixXd& local)
const {
51 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
52 "local coordinates out of bounds for reference element");
54 auto jacobian = (2. *
alpha_ * local).colwise() +
beta_;
57 return jacobian.cwiseInverse();
64 const Eigen::VectorXd jTj_inv = jTj.cwiseInverse().transpose();
66 return jacobian.array().rowwise() * jTj_inv.transpose().array();
70 const Eigen::MatrixXd& local)
const {
71 LF_VERIFY_MSG((0. <= local.array()).all() && (local.array() <= 1.).all(),
72 "local coordinates out of bounds for reference element");
78 return jTj.cwiseSqrt().transpose();
83 LF_ASSERT_MSG(i == 0,
"i is out of bounds");
84 return std::make_unique<SegmentO2>(
coords_);
87 LF_ASSERT_MSG(0 <= i && i <= 2,
"i is out of bounds");
88 return std::make_unique<Point>(
coords_.col(i));
90 LF_VERIFY_MSG(
false,
"codim is out of bounds");
97 LF_VERIFY_MSG(codim < 2,
"Illegal codim = " << codim);
99 const double hLattice = 1. /
static_cast<double>(ref_pat.
LatticeConst());
100 std::vector<std::unique_ptr<Geometry>> childGeoPtrs = {};
103 std::vector<Eigen::Matrix<int, Eigen::Dynamic, Eigen::Dynamic>> childPolygons(
106 const size_t noChildren = childPolygons.size();
109 "NumChildren " << noChildren <<
" <-> " << ref_pat.
NumChildren(codim));
112 for (
size_t child = 0; child < noChildren; ++child) {
116 childPolygons[child].rows() == 1,
117 "childPolygons[child].rows() = " << childPolygons[child].rows());
119 childPolygons[child].cols() == (2 - codim),
120 "childPolygons[child].cols() = " << childPolygons[child].cols());
122 Eigen::MatrixXd locCoords(1, 3 - 2 * codim);
127 locCoords << hLattice * childPolygons[child].cast<
double>(),
128 (hLattice * childPolygons[child].cast<double>()).sum() / 2;
129 childGeoPtrs.push_back(std::make_unique<SegmentO2>(
Global(locCoords)));
134 locCoords << hLattice * childPolygons[child].cast<
double>();
135 childGeoPtrs.push_back(std::make_unique<Point>(
Global(locCoords)));
140 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...