Reference documentation for deal.II version Git abc1da1e07 2020-07-06 12:09:19 -0400
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Member Functions | List of all members
hp::DoFHandler< dim, spacedim > Class Template Reference

#include <deal.II/hp/dof_handler.h>

Inheritance diagram for hp::DoFHandler< dim, spacedim >:
[legend]

Public Member Functions

 DoFHandler ()
 
 DoFHandler (const Triangulation< dim, spacedim > &tria)
 
 DoFHandler (const DoFHandler &)=delete
 
DoFHandleroperator= (const DoFHandler &)=delete
 
- Public Member Functions inherited from DoFHandler< dim, spacedim >
 DoFHandler (const bool hp_capability_enabled=false)
 
 DoFHandler (const Triangulation< dim, spacedim > &tria, const bool hp_capability_enabled=false)
 
 DoFHandler (const DoFHandler &)=delete
 
virtual ~DoFHandler () override
 
DoFHandleroperator= (const DoFHandler &)=delete
 
void initialize (const Triangulation< dim, spacedim > &tria, const FiniteElement< dim, spacedim > &fe)
 
void initialize (const Triangulation< dim, spacedim > &tria, const hp::FECollection< dim, spacedim > &fe)
 
void set_fe (const FiniteElement< dim, spacedim > &fe)
 
void set_fe (const hp::FECollection< dim, spacedim > &fe)
 
void set_active_fe_indices (const std::vector< unsigned int > &active_fe_indices)
 
void get_active_fe_indices (std::vector< unsigned int > &active_fe_indices) const
 
void distribute_dofs (const FiniteElement< dim, spacedim > &fe)
 
void distribute_dofs (const hp::FECollection< dim, spacedim > &fe)
 
void distribute_mg_dofs ()
 
bool has_level_dofs () const
 
bool has_active_dofs () const
 
void initialize_local_block_info ()
 
void clear ()
 
void renumber_dofs (const std::vector< types::global_dof_index > &new_numbers)
 
void renumber_dofs (const unsigned int level, const std::vector< types::global_dof_index > &new_numbers)
 
unsigned int max_couplings_between_dofs () const
 
unsigned int max_couplings_between_boundary_dofs () const
 
cell_iterator begin (const unsigned int level=0) const
 
active_cell_iterator begin_active (const unsigned int level=0) const
 
cell_iterator end () const
 
cell_iterator end (const unsigned int level) const
 
active_cell_iterator end_active (const unsigned int level) const
 
level_cell_iterator begin_mg (const unsigned int level=0) const
 
level_cell_iterator end_mg (const unsigned int level) const
 
level_cell_iterator end_mg () const
 
IteratorRange< cell_iteratorcell_iterators () const
 
IteratorRange< active_cell_iteratoractive_cell_iterators () const
 
IteratorRange< level_cell_iteratormg_cell_iterators () const
 
IteratorRange< cell_iteratorcell_iterators_on_level (const unsigned int level) const
 
IteratorRange< active_cell_iteratoractive_cell_iterators_on_level (const unsigned int level) const
 
IteratorRange< level_cell_iteratormg_cell_iterators_on_level (const unsigned int level) const
 
types::global_dof_index n_dofs () const
 
types::global_dof_index n_dofs (const unsigned int level) const
 
types::global_dof_index n_boundary_dofs () const
 
template<typename number >
types::global_dof_index n_boundary_dofs (const std::map< types::boundary_id, const Function< spacedim, number > *> &boundary_ids) const
 
types::global_dof_index n_boundary_dofs (const std::set< types::boundary_id > &boundary_ids) const
 
const BlockInfoblock_info () const
 
types::global_dof_index n_locally_owned_dofs () const
 
const IndexSetlocally_owned_dofs () const
 
const IndexSetlocally_owned_mg_dofs (const unsigned int level) const
 
const std::vector< IndexSet > & locally_owned_dofs_per_processor () const
 
const std::vector< types::global_dof_index > & n_locally_owned_dofs_per_processor () const
 
const std::vector< IndexSet > & locally_owned_mg_dofs_per_processor (const unsigned int level) const
 
const FiniteElement< dim, spacedim > & get_fe (const unsigned int index=0) const
 
const hp::FECollection< dim, spacedim > & get_fe_collection () const
 
const Triangulation< dim, spacedim > & get_triangulation () const
 
void prepare_for_serialization_of_active_fe_indices ()
 
void deserialize_active_fe_indices ()
 
virtual std::size_t memory_consumption () const
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&) noexcept
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&) noexcept
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Additional Inherited Members

- Public Types inherited from DoFHandler< dim, spacedim >
using cell_accessor = typename ActiveSelector::CellAccessor
 
using face_accessor = typename ActiveSelector::FaceAccessor
 
using line_iterator = typename ActiveSelector::line_iterator
 
using active_line_iterator = typename ActiveSelector::active_line_iterator
 
using quad_iterator = typename ActiveSelector::quad_iterator
 
using active_quad_iterator = typename ActiveSelector::active_quad_iterator
 
using hex_iterator = typename ActiveSelector::hex_iterator
 
using active_hex_iterator = typename ActiveSelector::active_hex_iterator
 
using active_cell_iterator = typename ActiveSelector::active_cell_iterator
 
using cell_iterator = typename ActiveSelector::cell_iterator
 
using face_iterator = typename ActiveSelector::face_iterator
 
using active_face_iterator = typename ActiveSelector::active_face_iterator
 
using level_cell_accessor = typename LevelSelector::CellAccessor
 
using level_face_accessor = typename LevelSelector::FaceAccessor
 
using level_cell_iterator = typename LevelSelector::cell_iterator
 
using level_face_iterator = typename LevelSelector::face_iterator
 
using active_fe_index_type = unsigned short int
 
using offset_type = unsigned int
 
- Static Public Member Functions inherited from DoFHandler< dim, spacedim >
static ::ExceptionBaseExcNoFESelected ()
 
static ::ExceptionBaseExcInvalidBoundaryIndicator ()
 
static ::ExceptionBaseExcInvalidLevel (int arg1)
 
static ::ExceptionBaseExcNewNumbersNotConsecutive (types::global_dof_index arg1)
 
static ::ExceptionBaseExcInvalidFEIndex (int arg1, int arg2)
 
static ::ExceptionBaseExcNotAvailableWithoutHP ()
 
static ::ExceptionBaseExcNotImplementedWithHP ()
 
- Static Public Member Functions inherited from Subscriptor
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 
- Public Attributes inherited from DoFHandler< dim, spacedim >
const bool hp_capability_enabled
 
- Static Public Attributes inherited from DoFHandler< dim, spacedim >
static const unsigned int dimension = dim
 
static const unsigned int space_dimension = spacedim
 
static const unsigned int default_fe_index = 0
 
static const unsigned int invalid_fe_index = numbers::invalid_unsigned_int
 
static const active_fe_index_type invalid_active_fe_index
 

Detailed Description

template<int dim, int spacedim = dim>
class hp::DoFHandler< dim, spacedim >

Manage the distribution and numbering of the degrees of freedom for hp- FEM algorithms. This class satisfies the MeshType concept requirements.

The purpose of this class is to allow for an enumeration of degrees of freedom in the same way as the DoFHandler class, but it allows to use a different finite element on every cell. To this end, one assigns an active_fe_index to every cell that indicates which element within a collection of finite elements (represented by an object of type hp::FECollection) is the one that lives on this cell. The class then enumerates the degree of freedom associated with these finite elements on each cell of a triangulation and, if possible, identifies degrees of freedom at the interfaces of cells if they match. If neighboring cells have degrees of freedom along the common interface that do not immediate match (for example, if you have \(Q_2\) and \(Q_3\) elements meeting at a common face), then one needs to compute constraints to ensure that the resulting finite element space on the mesh remains conforming.

The whole process of working with objects of this type is explained in step-27. Many of the algorithms this class implements are described in the hp paper.

Active FE indices and their behavior under mesh refinement

The typical workflow for using this class is to create a mesh, assign an active FE index to every active cell, calls hp::DoFHandler::distribute_dofs(), and then assemble a linear system and solve a problem on this finite element space. However, one can skip assigning active FE indices upon mesh refinement in certain circumstances. In particular, the following rules apply:

Note
Finite elements need to be assigned to each cell by either calling set_fe() or distribute_dofs() first to make this functionality available.

Active FE indices and parallel meshes

When this class is used with either a parallel::shared::Triangulation or a parallel::distributed::Triangulation, you can only set active FE indices on cells that are locally owned, using a call such as cell->set_active_fe_index(...). On the other hand, setting the active FE index on ghost or artificial cells is not allowed.

Ghost cells do acquire the information what element is active on them, however: whenever you call hp::DoFHandler::distribute_dofs(), all processors that participate in the parallel mesh exchange information in such a way that the active FE index on ghost cells equals the active FE index that was set on that processor that owned that particular ghost cell. Consequently, one can query the active_fe_index on ghost cells, just not set it by hand.

On artificial cells, no information is available about the active_fe_index used there. That's because we don't even know whether these cells exist at all, and even if they did, the current processor does not know anything specific about them. See the glossary entry on artificial cells for more information.

During refinement and coarsening, information about the active_fe_index of each cell will be automatically transferred.

However, using a parallel::distributed::Triangulation with an hp::DoFHandler requires additional attention during serialization, since no information on active FE indices will be automatically transferred. This has to be done manually using the prepare_for_serialization_of_active_fe_indices() and deserialize_active_fe_indices() functions. The former has to be called before parallel::distributed::Triangulation::save() is invoked, and the latter needs to be run after parallel::distributed::Triangulation::load(). If further data will be attached to the triangulation via the parallel::distributed::CellDataTransfer, parallel::distributed::SolutionTransfer, or Particles::ParticleHandler classes, all corresponding preparation and deserialization function calls need to happen in the same order. Consult the documentation of parallel::distributed::SolutionTransfer for more information.

Note
Task is delegated to the base class DoFHandler.

Definition at line 125 of file dof_handler.h.

Constructor & Destructor Documentation

◆ DoFHandler() [1/3]

template<int dim, int spacedim>
DoFHandler< dim, spacedim >::DoFHandler ( )

Default Constructor.

Definition at line 23 of file dof_handler.cc.

◆ DoFHandler() [2/3]

template<int dim, int spacedim>
DoFHandler< dim, spacedim >::DoFHandler ( const Triangulation< dim, spacedim > &  tria)

Constructor. Take tria as the triangulation to work on.

Definition at line 30 of file dof_handler.cc.

◆ DoFHandler() [3/3]

template<int dim, int spacedim = dim>
hp::DoFHandler< dim, spacedim >::DoFHandler ( const DoFHandler< dim, spacedim > &  )
delete

Copy constructor. DoFHandler objects are large and expensive. They should not be copied, in particular not by accident, but rather deliberately constructed. As a consequence, this constructor is explicitly removed from the interface of this class.

Member Function Documentation

◆ operator=()

template<int dim, int spacedim = dim>
DoFHandler& hp::DoFHandler< dim, spacedim >::operator= ( const DoFHandler< dim, spacedim > &  )
delete

Copy operator. DoFHandler objects are large and expensive. They should not be copied, in particular not by accident, but rather deliberately constructed. As a consequence, this operator is explicitly removed from the interface of this class.


The documentation for this class was generated from the following files: