17#include <lf/mesh/mesh.h>
21#include "assembly_types.h"
224 [[nodiscard]]
virtual std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const = 0;
246 unsigned int ctrl = 0);
274 using dof_map_t = std::map<lf::base::RefEl, base::size_type>;
339 "Illegal dof index " << dofnum <<
", max = " <<
num_dof_);
345 [[nodiscard]] std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const override {
386 switch (ref_el_type) {
404 LF_VERIFY_MSG(
false,
"Illegal entity type");
408 return no_covered_dofs;
414 switch (ref_el_type) {
432 LF_VERIFY_MSG(
false,
"Illegal entity type");
440 std::shared_ptr<const lf::mesh::Mesh>
mesh_;
447 std::array<std::vector<gdof_idx_t>, 3>
dofs_;
522 template <
typename LOCALDOFINFO>
524 LOCALDOFINFO &&locdof)
526 LF_ASSERT_MSG((
mesh_p_->DimMesh() == 2),
"Can handle 2D meshes only");
535 offsets_[2].resize(no_nodes + 1, 0);
537 for (
glb_idx_t node_idx = 0; node_idx < no_nodes; node_idx++) {
540 LF_ASSERT_MSG(
mesh_p_->Index(*node_p) == node_idx,
"Node index mismatch");
543 offsets_[2][node_idx] = node_dof_offset;
545 size_type no_int_dof_node = locdof(*node_p);
549 for (
unsigned j = 0; j < no_int_dof_node; j++) {
550 dofs_[2].push_back(dof_idx);
562 offsets_[1].resize(no_edges + 1, 0);
565 for (
glb_idx_t edge_idx = 0; edge_idx < no_edges; edge_idx++) {
568 LF_ASSERT_MSG(
mesh_p_->Index(*edge) == edge_idx,
"Edge index mismatch");
570 offsets_[1][edge_idx] = edge_dof_offset;
571 size_type no_int_dof_edge = locdof(*edge);
581 for (
unsigned j = 0; j < no_int_dofs_ep; j++) {
582 dofs_[1].push_back(
dofs_[2][ep_dof_offset + j]);
587 for (
unsigned j = 0; j < no_int_dof_edge; j++) {
588 dofs_[1].push_back(dof_idx);
595 offsets_[1][no_edges] = edge_dof_offset;
601 offsets_[0].resize(no_cells + 1, 0);
604 for (
glb_idx_t cell_idx = 0; cell_idx < no_cells; cell_idx++) {
608 offsets_[0][cell_idx] = cell_dof_offset;
609 size_type no_int_dof_cell = locdof(*cell);
618 for (
unsigned j = 0; j < no_int_dofs_vt; j++) {
619 dofs_[0].push_back(
dofs_[2][vt_dof_offset + j]);
626 auto edge_orientations = cell->RelativeOrientations();
627 auto edges = cell->SubEntities(1);
629 for (
int ed_sub_idx = 0; ed_sub_idx < cell->RefEl().NumSubEntities(1);
634 offsets_[1][edge_idx + 1] - no_int_dof_edge;
639 switch (edge_orientations[ed_sub_idx]) {
641 for (
int j = 0; j < no_int_dof_edge; j++) {
642 dofs_[0].push_back(
dofs_[1][edge_int_dof_offset + j]);
648 for (
int j =
static_cast<int>(no_int_dof_edge - 1); j >= 0; j--) {
649 dofs_[0].push_back(
dofs_[1][edge_int_dof_offset + j]);
658 for (
unsigned j = 0; j < no_int_dof_cell; j++) {
659 dofs_[0].push_back(dof_idx);
666 offsets_[0][no_cells] = cell_dof_offset;
710 "Illegal dof index " << dofnum <<
", max = " <<
num_dof_);
716 [[nodiscard]] std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const override {
722 std::shared_ptr<const lf::mesh::Mesh>
mesh_p_;
744 std::array<std::vector<gdof_idx_t>, 3>
dofs_;
A general (interface) class for DOF handling, see Lecture Document Paragraph 2.7.4....
virtual std::shared_ptr< const lf::mesh::Mesh > Mesh() const =0
Acess to underlying mesh object.
void PrintInfo(std::ostream &stream, const DofHandler &dof_handler, unsigned int ctrl=0)
Output information about the given dof handler to the given stream object.
DofHandler(DofHandler &&)=default
DofHandler & operator=(DofHandler &&)=default
virtual nonstd::span< const gdof_idx_t > InteriorGlobalDofIndices(const lf::mesh::Entity &entity) const =0
global indices of shape functions associated with an entity_
virtual size_type NumInteriorDofs(const lf::mesh::Entity &entity) const =0
provides number of shape functions associated with an entity
virtual nonstd::span< const gdof_idx_t > GlobalDofIndices(const lf::mesh::Entity &entity) const =0
access to indices of global dof's belonging to an entity
DofHandler()=default
Default constructor, can only be called from derived class.
DofHandler(const DofHandler &)=default
virtual const lf::mesh::Entity & Entity(gdof_idx_t dofnum) const =0
retrieve unique entity at which a basis function is located
virtual size_type NumLocalDofs(const lf::mesh::Entity &entity) const =0
tells the number of degrees of freedom subordinate/_belonging_ to to an entity
virtual size_type NumDofs() const =0
total number of dof's handled by the object
virtual ~DofHandler()=default
virtual Destructor
DofHandler & operator=(const DofHandler &)=default
Dof handler allowing variable local dof layouts.
std::vector< const lf::mesh::Entity * > dof_entities_
nonstd::span< const gdof_idx_t > InteriorGlobalDofIndices(const lf::mesh::Entity &entity) const override
global indices of shape functions associated with an entity_
size_type NumInteriorDofs(const lf::mesh::Entity &entity) const override
provides number of shape functions associated with an entity
DynamicFEDofHandler & operator=(const DynamicFEDofHandler &)=delete
Copy assignment is forbidden.
std::shared_ptr< const lf::mesh::Mesh > mesh_p_
DynamicFEDofHandler(DynamicFEDofHandler &&)=default
A DynamicFEDofHandler can be move constructed.
DynamicFEDofHandler & operator=(DynamicFEDofHandler &&)=default
A DynamicFEDofHandler can be moved into.
nonstd::span< const gdof_idx_t > GlobalDofIndices(const lf::mesh::Entity &entity) const override
access to indices of global dof's belonging to an entity
DynamicFEDofHandler(std::shared_ptr< const lf::mesh::Mesh > mesh_p, LOCALDOFINFO &&locdof)
Set-up of dof handler.
std::array< std::vector< size_type >, 3 > offsets_
size_type NumLocalDofs(const lf::mesh::Entity &entity) const override
tells the number of degrees of freedom subordinate/_belonging_ to to an entity
std::array< std::vector< gdof_idx_t >, 3 > dofs_
const lf::mesh::Entity & Entity(gdof_idx_t dofnum) const override
retrieve unique entity at which a basis function is located
std::shared_ptr< const lf::mesh::Mesh > Mesh() const override
Acess to underlying mesh object.
~DynamicFEDofHandler() override=default
Virtual destructor.
std::array< std::vector< size_type >, 3 > num_int_dofs_
DynamicFEDofHandler(const DynamicFEDofHandler &)=delete
It doesn't make much sense to copy construct a DynamicFEDofHandler.
size_type NumDofs() const override
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.
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!...
D.o.f. index mapping and assembly facilities.
lf::base::size_type size_type
lf::base::glb_idx_t glb_idx_t
std::ostream & operator<<(std::ostream &o, const COOMatrix< SCALARTYPE > &mat)