Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
internal::hp::DoFLevel Class Reference

#include <dof_level.h>

Public Member Functions

void set_dof_index (const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index, const types::global_dof_index global_index)
 
types::global_dof_index get_dof_index (const unsigned int obj_index, const unsigned int fe_index, const unsigned int local_index) const
 
unsigned int active_fe_index (const unsigned int obj_index) const
 
bool fe_index_is_active (const unsigned int obj_index, const unsigned int fe_index) const
 
void set_active_fe_index (const unsigned int obj_index, const unsigned int fe_index)
 
const types::global_dof_indexget_cell_cache_start (const unsigned int obj_index, const unsigned int dofs_per_cell) const
 
std::size_t memory_consumption () const
 

Private Types

typedef unsigned int offset_type
 
typedef unsigned short int active_fe_index_type
 
typedef signed short int signed_active_fe_index_type
 

Private Member Functions

template<int dim, int spacedim>
void compress_data (const ::hp::FECollection< dim, spacedim > &fe_collection)
 
template<int dim, int spacedim>
void uncompress_data (const ::hp::FECollection< dim, spacedim > &fe_collection)
 

Private Attributes

std::vector< active_fe_index_typeactive_fe_indices
 
std::vector< offset_typedof_offsets
 
std::vector
< types::global_dof_index
dof_indices
 
std::vector< offset_typecell_cache_offsets
 
std::vector
< types::global_dof_index
cell_dof_indices_cache
 

Friends

template<int , int >
class ::hp::DoFHandler
 
struct ::internal::hp::DoFHandler::Implementation
 
struct ::internal::DoFCellAccessor::Implementation
 

Detailed Description

This is the class that stores the degrees of freedom on cells in a hp hierarchy. Compared to faces and edges, the task here is simple since each cell can only have a single active finite element index. Consequently, all we need is one long array with DoF indices and one array of offsets where each cell's indices start within the array of indices. This is in contrast to the DoFObjects class where each face or edge may have more than one associated finite element with corresponding degrees of freedom.

The data stored here is represented by three arrays

Compression

It is common for the indices stored in dof_indices for one cell to be numbered consecutively. For example, using the standard numbering (without renumbering DoFs), the quad dofs on the first cell of a mesh when using a $Q_3$ element will be numbered 12, 13, 14, 15. This allows for compression if we only store the first entry and have some way to mark the DoFs on this object as compressed. Here, compression means that we know that subsequent DoF indices can be obtained from the previous ones by just incrementing them by one – in other words, we use a variant of doing run-length encoding. The way to do this is that we use positive FE indices for uncompressed sets of DoFs and if a set of indices is compressed, then we instead store the FE index in binary complement (which we can identify by looking at the sign bit when interpreting the number as a signed one). There are two functions, compress_data() and uncompress_data() that convert between the two possible representations.

Note that compression is not always possible. For example, if one renumbered the example above using DoFRenumbering::downstream with $(1,0)^T$ as direction, then they would likely be numbered 12, 14, 13, 15, which can not be compressed using run-length encoding.

Definition at line 103 of file dof_level.h.

Member Typedef Documentation

typedef unsigned int internal::hp::DoFLevel::offset_type
private

The type in which we store the offsets into the dof_indices array.

Definition at line 109 of file dof_level.h.

typedef unsigned short int internal::hp::DoFLevel::active_fe_index_type
private

The type in which we store the active FE index.

Definition at line 114 of file dof_level.h.

A signed type that matches the type in which we store the active FE index. We use this in computing binary complements.

Definition at line 120 of file dof_level.h.

Member Function Documentation

void internal::hp::DoFLevel::set_dof_index ( const unsigned int  obj_index,
const unsigned int  fe_index,
const unsigned int  local_index,
const types::global_dof_index  global_index 
)
inline

Set the global index of the local_index-th degree of freedom located on the object with number obj_index to the value given by global_index. The dof_handler argument is used to access the finite element that is to be used to compute the location where this data is stored.

The third argument, fe_index, denotes which of the finite elements associated with this object we shall access. Refer to the general documentation of the internal::hp::DoFLevel class template for more information.

Definition at line 348 of file dof_level.h.

types::global_dof_index internal::hp::DoFLevel::get_dof_index ( const unsigned int  obj_index,
const unsigned int  fe_index,
const unsigned int  local_index 
) const
inline

Return the global index of the local_index-th degree of freedom located on the object with number obj_index. The dof_handler argument is used to access the finite element that is to be used to compute the location where this data is stored.

The third argument, fe_index, denotes which of the finite elements associated with this object we shall access. Refer to the general documentation of the internal::hp::DoFLevel class template for more information.

Definition at line 317 of file dof_level.h.

unsigned int internal::hp::DoFLevel::active_fe_index ( const unsigned int  obj_index) const
inline

Return the fe_index of the active finite element on this object.

Definition at line 375 of file dof_level.h.

bool internal::hp::DoFLevel::fe_index_is_active ( const unsigned int  obj_index,
const unsigned int  fe_index 
) const
inline

Check whether a given finite element index is used on the present object or not.

Definition at line 391 of file dof_level.h.

void internal::hp::DoFLevel::set_active_fe_index ( const unsigned int  obj_index,
const unsigned int  fe_index 
)
inline

Set the fe_index of the active finite element on this object.

Definition at line 401 of file dof_level.h.

const types::global_dof_index * internal::hp::DoFLevel::get_cell_cache_start ( const unsigned int  obj_index,
const unsigned int  dofs_per_cell 
) const
inline

Return a pointer to the beginning of the DoF indices cache for a given cell.

Parameters
obj_indexThe number of the cell we are looking at.
dofs_per_cellThe number of DoFs per cell for this cell. This is not used for the hp case but necessary to keep the interface the same as for the non-hp case.
Returns
A pointer to the first DoF index for the current cell. The next dofs_per_cell indices are for the current cell.

Definition at line 414 of file dof_level.h.

std::size_t internal::hp::DoFLevel::memory_consumption ( ) const

Determine an estimate for the memory consumption (in bytes) of this object.

template<int dim, int spacedim>
void internal::hp::DoFLevel::compress_data ( const ::hp::FECollection< dim, spacedim > &  fe_collection)
private

Compress the arrays that store dof indices by using a variant of run-length encoding. See the general documentation of this class for more information.

Parameters
fe_collectionThe object that can tell us how many degrees of freedom each of the finite elements has that we store in this object.
template<int dim, int spacedim>
void internal::hp::DoFLevel::uncompress_data ( const ::hp::FECollection< dim, spacedim > &  fe_collection)
private

Uncompress the arrays that store dof indices by using a variant of run-length encoding. See the general documentation of this class for more information.

Parameters
fe_collectionThe object that can tell us how many degrees of freedom each of the finite elements has that we store in this object.

Friends And Related Function Documentation

template<int , int >
friend class ::hp::DoFHandler
friend

Make hp::DoFHandler and its auxiliary class a friend since it is the class that needs to create these data structures.

Definition at line 306 of file dof_level.h.

Member Data Documentation

std::vector<active_fe_index_type> internal::hp::DoFLevel::active_fe_indices
private

Indices specifying the finite element of hp::FECollection to use for the different cells on the current level. The vector stores one element per cell since the active_fe_index is unique for cells.

If a cell is not active on the level corresponding to the current object (i.e., it has children on higher levels) then it does not have an associated fe index and we store an invalid fe index marker instead.

Definition at line 133 of file dof_level.h.

std::vector<offset_type> internal::hp::DoFLevel::dof_offsets
private

Store the start index for the degrees of freedom of each object in the dof_indices array. If the cell corresponding to a particular index in this array is not active on this level, then we do not store any DoFs for it. In that case, the offset we store here must be an invalid number and indeed we store (std::vector<types::global_dof_index>::size_type)(-1) for it.

The type we store is then obviously the type the dof_indices array uses for indexing.

Definition at line 147 of file dof_level.h.

std::vector<types::global_dof_index> internal::hp::DoFLevel::dof_indices
private

Store the global indices of the degrees of freedom. information. The dof_offsets field determines where each (active) cell's data is stored.

Definition at line 154 of file dof_level.h.

std::vector<offset_type> internal::hp::DoFLevel::cell_cache_offsets
private

The offsets for each cell of the cache that holds all DoF indices.

Definition at line 159 of file dof_level.h.

std::vector<types::global_dof_index> internal::hp::DoFLevel::cell_dof_indices_cache
private

Cache for the DoF indices on cells. The size of this array equals the sum over all cells of selected_fe[active_fe_index[cell]].dofs_per_cell.

Definition at line 166 of file dof_level.h.


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