17#include <lf/mesh/mesh.h>
21#include "assembly_types.h"
227 [[nodiscard]]
virtual std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const = 0;
249 unsigned int ctrl = 0);
269 using dof_map_t = std::map<lf::base::RefEl, base::size_type>;
308 dof_map_t dofmap,
bool check_edge_orientation =
true);
379 "Illegal dof index " << dofnum <<
", max = " <<
num_dof_);
385 [[nodiscard]] std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const override {
426 switch (ref_el_type) {
444 LF_VERIFY_MSG(
false,
"Illegal entity type");
448 return no_covered_dofs;
454 switch (ref_el_type) {
472 LF_VERIFY_MSG(
false,
"Illegal entity type");
480 std::shared_ptr<const lf::mesh::Mesh>
mesh_;
487 std::array<std::vector<gdof_idx_t>, 3>
dofs_;
564 template <
typename LOCALDOFINFO>
567 LOCALDOFINFO &&locdof)
569 LF_ASSERT_MSG((
mesh_p_->DimMesh() == 2),
"Can handle 2D meshes only");
578 offsets_[2].resize(no_nodes + 1, 0);
580 for (
glb_idx_t node_idx = 0; node_idx < no_nodes; node_idx++) {
583 LF_ASSERT_MSG(
mesh_p_->Index(*node_p) == node_idx,
"Node index mismatch");
585 const glb_idx_t node_dof_offset = dof_idx;
586 offsets_[2][node_idx] = node_dof_offset;
588 const size_type no_int_dof_node = locdof(*node_p);
592 for (
unsigned j = 0; j < no_int_dof_node; j++) {
593 dofs_[2].push_back(dof_idx);
605 offsets_[1].resize(no_edges + 1, 0);
608 for (
glb_idx_t edge_idx = 0; edge_idx < no_edges; edge_idx++) {
611 LF_ASSERT_MSG(
mesh_p_->Index(*edge) == edge_idx,
"Edge index mismatch");
613 offsets_[1][edge_idx] = edge_dof_offset;
614 const size_type no_int_dof_edge = locdof(*edge);
624 for (
unsigned j = 0; j < no_int_dofs_ep; j++) {
625 dofs_[1].push_back(
dofs_[2][ep_dof_offset + j]);
630 for (
unsigned j = 0; j < no_int_dof_edge; j++) {
631 dofs_[1].push_back(dof_idx);
638 offsets_[1][no_edges] = edge_dof_offset;
644 offsets_[0].resize(no_cells + 1, 0);
647 for (
glb_idx_t cell_idx = 0; cell_idx < no_cells; cell_idx++) {
651 offsets_[0][cell_idx] = cell_dof_offset;
652 const size_type no_int_dof_cell = locdof(*cell);
661 for (
unsigned j = 0; j < no_int_dofs_vt; j++) {
662 dofs_[0].push_back(
dofs_[2][vt_dof_offset + j]);
669 auto edge_orientations = cell->RelativeOrientations();
670 auto edges = cell->SubEntities(1);
672 for (
int ed_sub_idx = 0; ed_sub_idx < cell->RefEl().NumSubEntities(1);
677 offsets_[1][edge_idx + 1] - no_int_dof_edge;
682 switch (edge_orientations[ed_sub_idx]) {
684 for (
int j = 0; j < no_int_dof_edge; j++) {
685 dofs_[0].push_back(
dofs_[1][edge_int_dof_offset + j]);
691 for (
int j =
static_cast<int>(no_int_dof_edge - 1); j >= 0; j--) {
692 dofs_[0].push_back(
dofs_[1][edge_int_dof_offset + j]);
701 for (
unsigned j = 0; j < no_int_dof_cell; j++) {
702 dofs_[0].push_back(dof_idx);
709 offsets_[0][no_cells] = cell_dof_offset;
753 "Illegal dof index " << dofnum <<
", max = " <<
num_dof_);
759 [[nodiscard]] std::shared_ptr<const lf::mesh::Mesh>
Mesh()
const override {
765 std::shared_ptr<const lf::mesh::Mesh>
mesh_p_;
787 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 size_type NumInteriorDofs(const lf::mesh::Entity &entity) const =0
provides number of shape functions associated with 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 std::span< const gdof_idx_t > GlobalDofIndices(const lf::mesh::Entity &entity) const =0
access to indices of global dof's belonging to an entity
virtual std::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 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
std::vector< const lf::mesh::Entity * > dof_entities_
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_
std::span< const gdof_idx_t > InteriorGlobalDofIndices(const lf::mesh::Entity &entity) const override
global indices of shape functions associated with an entity_
std::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(DynamicFEDofHandler &&)=default
A DynamicFEDofHandler can be move constructed.
DynamicFEDofHandler & operator=(DynamicFEDofHandler &&)=default
A DynamicFEDofHandler can be moved into.
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 std::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::glb_idx_t glb_idx_t
lf::base::size_type size_type
std::ostream & operator<<(std::ostream &o, const COOMatrix< SCALARTYPE > &mat)
Defines a set of interface classes that define a mesh manager and provides mesh-related tools that bu...