49 using ElemMat = Eigen::Matrix<double, 4, 4>;
73 const double kSqrt3 = 1.0 / std::sqrt(3.0);
81 const Eigen::Vector2d &xh);
83 const Eigen::Matrix<double, 2, 1>
kTriabc{
84 (Eigen::Matrix<double, 2, 1>() << (1.0 / 3), (1.0 / 3)).finished()};
86 const Eigen::Matrix<double, 2, 1>
kQuadpt{
87 (Eigen::Matrix<double, 2, 1>() << 0.7, 0.3).finished()};
93 static std::shared_ptr<spdlog::logger> &
Logger();
125template <
typename SCALAR,
typename FUNCTOR>
162template <
typename SCALAR,
typename FUNCTOR>
173 LF_ASSERT_MSG(geo_ptr !=
nullptr,
"Invalid geometry!");
175 "Only 2D implementation available!");
176 const Eigen::MatrixXd &ref_el_corners(ref_el.NodeCoords());
181 ref_el, geo_ptr->
Global(ref_el_corners));
184 Eigen::MatrixXd ref_mp(2, 4);
188 ref_mp << 0.5,0.5,0.0,-1.0,
195 ref_mp << 0.5,1,0.5,0.0,
201 LF_ASSERT_MSG(
false,
"Illegal entity type!");
209 ElemVec elem_vec = ElemVec::Zero();
212 auto fvals = f_(cell, ref_mp);
214 for (
int k = 0; k < num_nodes; k++) {
215 elem_vec[k] += 0.5 * fvals[k];
216 elem_vec[(k + 1) % num_nodes] += 0.5 * fvals[k];
219 elem_vec.head(num_nodes).transpose());
221 return (area / num_nodes) * elem_vec;
Represents a reference element with all its properties.
static constexpr RefEl kTria()
Returns the reference triangle.
constexpr size_type NumNodes() const
The number of nodes of this reference element.
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 Eigen::MatrixXd Global(const Eigen::MatrixXd &local) const =0
Map a number of points in local coordinates into the global coordinate system.
virtual dim_t DimLocal() const =0
Dimension of the domain of this mapping.
virtual dim_t DimGlobal() const =0
Dimension of the image of this mapping.
Interface class representing a topological entity in a cellular complex
virtual const geometry::Geometry * Geometry() const =0
Describes the geometry of this entity.
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Computing the element matrix for the (negative) Laplacian and linear finite elements.
LinearFELaplaceElementMatrix()=default
Idle constructor.
const double kSqrt3
quadrature points on reference quadrilateral
virtual bool isActive(const lf::mesh::Entity &) const
All cells are considered active in the default implementation.
Eigen::Matrix< double, 4, 4 > ElemMat
const Eigen::Matrix< double, 2, 1 > kTriabc
const Eigen::Matrix< double, 2, 1 > kQuadpt
ElemMat Eval(const lf::mesh::Entity &cell) const
main routine for the computation of element matrices
static std::shared_ptr< spdlog::logger > & Logger()
Used by LinearFELaplaceElementMatrix to log additional (debug) info.
static Eigen::Matrix< double, 4, 2 > DervRefShapFncts(const Eigen::Vector2d &xh)
const std::array< Eigen::Vector2d, 4 > kQuadPoints
Class for computation of local load vector for linear finite elements.
LinearFELocalLoadVector(FUNCTOR f)
Constructor storing the right hand side function.
ElemVec Eval(const lf::mesh::Entity &cell) const
Main method for computing the element vector.
virtual bool isActive(const lf::mesh::Entity &) const
Default implement: all cells are active.
Eigen::Matrix< SCALAR, 4, 1 > ElemVec
unsigned int size_type
general type for variables related to size of arrays
double Volume(const Geometry &geo)
Compute the (approximate) volume (area) of a shape.
Collects data structures and algorithms designed for scalar finite element methods primarily meant fo...
std::shared_ptr< spdlog::logger > & LinearFeLocalLoadVectorLogger()
Used by LinearFELocalLoadVector to log additional (debug) information during vector assembly.