15#include "dofhandler.h"
28 auto mesh = dof_handler.
Mesh();
32 stream <<
"DofHandler(" << dof_handler.
NumDofs() <<
" dofs)";
48 stream << *e <<
' ' << e_idx <<
": " << no_dofs <<
" dofs = [";
59 stream << int_dof <<
' ';
72 stream <<
"dof " << dof_idx <<
" -> " << e <<
" " << mesh->Index(e)
84 std::shared_ptr<const lf::mesh::Mesh> mesh,
dof_map_t dofmap)
85 : mesh_(std::move(mesh)), num_dofs_() {
86 LF_ASSERT_MSG((
mesh_->DimMesh() == 2),
"Can handle 2D meshes only");
89 auto map_end = dofmap.end();
93 if (map_el_pt != map_end) {
99 if (map_el_ed != map_end) {
105 if (map_el_tr != map_end) {
111 if (map_el_qd != map_end) {
146 for (
glb_idx_t node_idx = 0; node_idx < no_nodes; node_idx++) {
148 LF_ASSERT_MSG(
mesh_->Index(*node_p) == node_idx,
"Node index mismatch");
168 for (
glb_idx_t edge_idx = 0; edge_idx < no_edges; edge_idx++) {
171 LF_ASSERT_MSG(
mesh_->Index(*edge_p) == edge_idx,
"Edge index mismatch");
206 for (
glb_idx_t cell_idx = 0; cell_idx < no_cells; cell_idx++) {
209 LF_ASSERT_MSG(cell_idx ==
mesh_->Index(*cell_p),
"cell index mismatch");
225 auto edge_orientations = cell_p->RelativeOrientations();
226 auto edges = cell_p->SubEntities(1);
228 const size_type no_edges_cell = cell_p->RefEl().NumSubEntities(1);
229 for (
int ed_sub_idx = 0; ed_sub_idx < no_edges_cell; ed_sub_idx++) {
236 switch (edge_orientations[ed_sub_idx]) {
238 for (
int j = 0; j < no_int_dof_edge; j++) {
245 for (
int j =
static_cast<int>(no_int_dof_edge - 1); j >= 0; j--) {
263 false,
"Illegal cell type; only triangles and quads are supported");
267 for (
unsigned j = 0; j < num_int_dofs_cell; j++) {
283 LF_ASSERT_MSG((
mesh_->NumEntities(codim) > entity_index),
284 "Index " << entity_index <<
" out of range");
288 const gdof_idx_t *end = begin + no_covered_dofs;
304 LF_ASSERT_MSG((
mesh_->NumEntities(codim) > entity_index),
305 "Index " << entity_index <<
" out of range");
309 const gdof_idx_t *end = begin + no_covered_dofs;
310 begin += (no_covered_dofs - no_loc_dofs);
345 offsets_[codim][entity_index + 1] - idx_offset;
348 const gdof_idx_t *end = begin + no_covered_dofs;
364 offsets_[codim][entity_index + 1] - idx_offset;
369 const gdof_idx_t *end = begin + no_covered_dofs;
372 begin += (no_covered_dofs - no_loc_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.
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 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
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
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
std::shared_ptr< const lf::mesh::Mesh > mesh_p_
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
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_
std::array< std::vector< size_type >, 3 > num_int_dofs_
Represents a reference element with all its properties.
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
constexpr dim_t Dimension() const
Return the dimension of this reference element.
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!...
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
unsigned int glb_idx_t
type for global index of mesh entities (nodes, edges, cells)
D.o.f. index mapping and assembly facilities.
lf::base::size_type size_type
lf::base::glb_idx_t glb_idx_t
void PrintInfo(std::ostream &stream, const DofHandler &dof_handler, unsigned ctrl)
std::ostream & operator<<(std::ostream &o, const COOMatrix< SCALARTYPE > &mat)