17#include <lf/assemble/assemble.h>
18#include <lf/fe/scalar_fe_space.h>
49template <
typename SCALAR>
83 std::shared_ptr<const
lf::mesh::
Mesh> mesh_p,
84 std::shared_ptr<const
lf::fe::ScalarReferenceFiniteElement<SCALAR>>
86 std::shared_ptr<const
lf::fe::ScalarReferenceFiniteElement<SCALAR>>
88 std::shared_ptr<const
lf::fe::ScalarReferenceFiniteElement<SCALAR>>
90 std::shared_ptr<const
lf::fe::ScalarReferenceFiniteElement<SCALAR>>
91 rfs_point_p =
nullptr)
102 [[nodiscard]] std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const override {
110 LF_VERIFY_MSG(
Mesh() !=
nullptr,
"No valid FE space object: no mesh");
152 std::shared_ptr<const lf::fe::ScalarReferenceFiniteElement<SCALAR>>
155 std::shared_ptr<const lf::fe::ScalarReferenceFiniteElement<SCALAR>>
158 std::shared_ptr<const lf::fe::ScalarReferenceFiniteElement<SCALAR>>
161 std::shared_ptr<const lf::fe::ScalarReferenceFiniteElement<SCALAR>>
172 std::shared_ptr<const lf::mesh::Mesh> mesh_p);
175 LF_VERIFY_MSG(
Mesh() !=
nullptr,
"No valid FE space object: no mesh");
177 "No valid FE space object: no rsfs for cells");
225template <
class SCALAR>
227 unsigned int ctrl = 0);
234template <
typename SCALAR>
239template <
typename SCALAR>
241 std::shared_ptr<const lf::mesh::Mesh> mesh_p) {
243 LF_VERIFY_MSG(mesh_p !=
nullptr,
"Missing mesh!");
244 LF_VERIFY_MSG((rfs_quad_p_ !=
nullptr) || (rfs_tria_p_ !=
nullptr),
245 "Missing FE specification for cells");
246 LF_VERIFY_MSG((mesh_p->DimMesh() == 2),
"Only for 2D meshes");
251 (rfs_tria_p_ !=
nullptr),
252 "Missing FE specification for triangles though mesh contains some");
254 (rfs_quad_p_ !=
nullptr),
255 "Missing FE specification for quads though mesh contains some");
260 if (rfs_tria_p_ !=
nullptr) {
263 "Wrong type for triangle!");
264 LF_VERIFY_MSG((*rfs_tria_p_).NumRefShapeFunctions(2) <= 1,
265 "At most one shape function can be assigned to each vertex");
267 num_rsf_node_ = (*rfs_tria_p_).NumRefShapeFunctions(2);
268 num_rsf_edge_ = (*rfs_tria_p_).NumRefShapeFunctions(1);
269 num_rsf_tria_ = (*rfs_tria_p_).NumRefShapeFunctions(0);
271 if (rfs_quad_p_ !=
nullptr) {
274 "Wrong type for quad!");
275 LF_VERIFY_MSG((*rfs_quad_p_).NumRefShapeFunctions(2) <= 1,
276 "At most one shape function can be assigned to each vertex");
278 num_rsf_node_ = (*rfs_quad_p_).NumRefShapeFunctions(2);
279 num_rsf_edge_ = (*rfs_quad_p_).NumRefShapeFunctions(1);
280 num_rsf_quad_ = (*rfs_quad_p_).NumRefShapeFunctions(0);
282 if (rfs_edge_p_ !=
nullptr) {
284 "Wrong type for edge!");
285 LF_VERIFY_MSG((*rfs_edge_p_).NumRefShapeFunctions(1) <= 1,
286 "At most one shape function can be assigned to each vertex");
287 num_rsf_node_ = (*rfs_edge_p_).NumRefShapeFunctions(1);
288 num_rsf_edge_ = (*rfs_edge_p_).NumRefShapeFunctions(0);
294 if ((rfs_tria_p_ !=
nullptr) && (rfs_quad_p_ !=
nullptr)) {
295 LF_ASSERT_MSG(((*rfs_tria_p_).NumRefShapeFunctions(2) ==
296 (*rfs_quad_p_).NumRefShapeFunctions(2)),
297 "#RSF mismatch on nodes "
298 << (*rfs_tria_p_).NumRefShapeFunctions(2) <<
" <-> "
299 << (*rfs_quad_p_).NumRefShapeFunctions(2));
300 LF_ASSERT_MSG(((*rfs_tria_p_).NumRefShapeFunctions(1) ==
301 (*rfs_quad_p_).NumRefShapeFunctions(1)),
302 "#RSF mismatch on edges "
303 << (*rfs_tria_p_).NumRefShapeFunctions(1) <<
" <-> "
304 << (*rfs_quad_p_).NumRefShapeFunctions(1));
306 if ((rfs_tria_p_ !=
nullptr) && (rfs_edge_p_ !=
nullptr)) {
307 LF_ASSERT_MSG(((*rfs_tria_p_).NumRefShapeFunctions(2) ==
308 (*rfs_edge_p_).NumRefShapeFunctions(1)),
309 "#RSF mismatch on nodes "
310 << (*rfs_tria_p_).NumRefShapeFunctions(2) <<
" <-> "
311 << (*rfs_edge_p_).NumRefShapeFunctions(1));
312 LF_ASSERT_MSG(((*rfs_tria_p_).NumRefShapeFunctions(1) ==
313 (*rfs_edge_p_).NumRefShapeFunctions(0)),
314 "#RSF mismatch on edges "
315 << (*rfs_tria_p_).NumRefShapeFunctions(1) <<
" <-> "
316 << (*rfs_edge_p_).NumRefShapeFunctions(0));
318 if ((rfs_quad_p_ !=
nullptr) && (rfs_edge_p_ !=
nullptr)) {
319 LF_ASSERT_MSG(((*rfs_quad_p_).NumRefShapeFunctions(2) ==
320 (*rfs_edge_p_).NumRefShapeFunctions(1)),
321 "#RSF mismatch on edges "
322 << (*rfs_quad_p_).NumRefShapeFunctions(2) <<
" <-> "
323 << (*rfs_edge_p_).NumRefShapeFunctions(1));
324 LF_ASSERT_MSG(((*rfs_quad_p_).NumRefShapeFunctions(1) ==
325 (*rfs_edge_p_).NumRefShapeFunctions(0)),
326 "#RSF mismatch on edges "
327 << (*rfs_quad_p_).NumRefShapeFunctions(1) <<
" <-> "
328 << (*rfs_edge_p_).NumRefShapeFunctions(0));
341template <
typename SCALAR>
345 return ShapeFunctionLayout(entity.
RefEl());
348template <
typename SCALAR>
353 switch (ref_el_type) {
355 return rfs_point_p_.get();
361 return rfs_edge_p_.get();
367 return rfs_tria_p_.get();
373 return rfs_quad_p_.get();
376 LF_VERIFY_MSG(
false,
"Illegal entity type");
382template <
typename SCALAR>
385 return NumRefShapeFunctions(entity.
RefEl());
390template <
typename SCALAR>
393 LF_ASSERT_MSG((rfs_quad_p_ !=
nullptr) && (rfs_quad_p_ !=
nullptr),
394 "No valid FE space object: no rsfs");
396 switch (ref_el_type) {
398 return num_rsf_node_;
401 return num_rsf_edge_;
404 return num_rsf_tria_;
407 return num_rsf_quad_;
410 LF_VERIFY_MSG(
false,
"Illegal entity type");
416template <
typename SCALAR>
423 o << *fes.
Mesh() << std::endl;
432 <<
" rsfs @ edges" << std::endl;
434 <<
" rsfs @ triangles" << std::endl;
441template <
typename SCALAR>
A general (interface) class for DOF handling, see Lecture Document Paragraph 2.7.4....
virtual size_type NumDofs() const =0
total number of dof's handled by the object
Represents a reference element with all its properties.
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
static constexpr RefEl kPoint()
Returns the (0-dimensional) reference point.
static constexpr RefEl kTria()
Returns the reference triangle.
static constexpr RefEl kQuad()
Returns the reference quadrilateral.
Space of scalar valued finite element functions on a hybrid 2D mesh
ScalarFESpace()=default
default constructor, needed by std::vector
Interface class for parametric scalar valued finite elements.
Interface class representing a topological entity in a cellular complex
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Collects data structures and algorithms designed for scalar finite element methods primarily meant fo...
const unsigned int kUniformScalarFESpaceOutDofh
information about the dof handler will be printed.
void PrintInfo(std::ostream &o, const UniformScalarFESpace< SCALAR > &fes, unsigned ctrl)
const unsigned int kUniformScalarFESpaceOutMesh
mesh information will be printed
lf::assemble::size_type size_type
const unsigned int kUniformScalarFESpaceOutRsfs
information about the reference shape functions will be printed
std::ostream & operator<<(std::ostream &o, const UniformScalarFESpace< SCALAR > &fes)