![]() |
Reference documentation for deal.II version 9.6.0
|
#include <deal.II/dofs/dof_accessor.h>
Public Types | |
using | BaseClass |
using | AccessorData = DoFHandler<dimension, space_dimension> |
Public Member Functions | |
const DoFHandler< dim, spacedim > & | get_dof_handler () const |
template<bool level_dof_access2> | |
void | copy_from (const DoFAccessor< structdim, dim, spacedim, level_dof_access2 > &a) |
void | copy_from (const TriaAccessorBase< structdim, dim, spacedim > &da) |
template<int structdim2, int dim2, int spacedim2, bool level_dof_access2> | |
bool | operator== (const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > &) const |
template<int structdim2, int dim2, int spacedim2, bool level_dof_access2> | |
bool | operator!= (const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > &) const |
Constructors | |
DoFAccessor () | |
DoFAccessor (const Triangulation< dim, spacedim > *tria, const int level, const int index, const DoFHandler< dim, spacedim > *dof_handler) | |
DoFAccessor (const DoFAccessor< structdim, dim, spacedim, level_dof_access > &)=default | |
DoFAccessor (DoFAccessor< structdim, dim, spacedim, level_dof_access > &&) | |
~DoFAccessor ()=default | |
template<int structdim2, int dim2, int spacedim2> | |
DoFAccessor (const InvalidAccessor< structdim2, dim2, spacedim2 > &) | |
template<int structdim2, int dim2, int spacedim2, bool level_dof_access2> | |
DoFAccessor (const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > &) | |
template<bool level_dof_access2> | |
DoFAccessor (const DoFAccessor< structdim, dim, spacedim, level_dof_access2 > &) | |
DoFAccessor< structdim, dim, spacedim, level_dof_access > & | operator= (const DoFAccessor< structdim, dim, spacedim, level_dof_access > &da)=delete |
DoFAccessor< structdim, dim, spacedim, level_dof_access > & | operator= (DoFAccessor< structdim, dim, spacedim, level_dof_access > &&) |
Accessing sub-objects | |
TriaIterator< DoFAccessor< structdim, dim, spacedim, level_dof_access > > | child (const unsigned int c) const |
typename::internal::DoFHandlerImplementation::Iterators< dim, spacedim, level_dof_access >::line_iterator | line (const unsigned int i) const |
typename::internal::DoFHandlerImplementation::Iterators< dim, spacedim, level_dof_access >::quad_iterator | quad (const unsigned int i) const |
Accessing the DoF indices of this object | |
void | get_dof_indices (std::vector< types::global_dof_index > &dof_indices, const types::fe_index fe_index=numbers::invalid_fe_index) const |
void | get_mg_dof_indices (const int level, std::vector< types::global_dof_index > &dof_indices, const types::fe_index fe_index=numbers::invalid_fe_index) const |
void | set_mg_dof_indices (const int level, const std::vector< types::global_dof_index > &dof_indices, const types::fe_index fe_index=numbers::invalid_fe_index) |
types::global_dof_index | vertex_dof_index (const unsigned int vertex, const unsigned int i, const types::fe_index fe_index=numbers::invalid_fe_index) const |
types::global_dof_index | mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const types::fe_index fe_index=numbers::invalid_fe_index) const |
types::global_dof_index | dof_index (const unsigned int i, const types::fe_index fe_index=numbers::invalid_fe_index) const |
types::global_dof_index | mg_dof_index (const int level, const unsigned int i) const |
Accessing the finite element associated with this object | |
unsigned int | n_active_fe_indices () const |
types::fe_index | nth_active_fe_index (const unsigned int n) const |
std::set< types::fe_index > | get_active_fe_indices () const |
bool | fe_index_is_active (const types::fe_index fe_index) const |
const FiniteElement< dim, spacedim > & | get_fe (const types::fe_index fe_index) const |
Static Public Member Functions | |
static bool | is_level_cell () |
static ::ExceptionBase & | ExcInvalidObject () |
static ::ExceptionBase & | ExcVectorNotEmpty () |
static ::ExceptionBase & | ExcVectorDoesNotMatch () |
static ::ExceptionBase & | ExcMatrixDoesNotMatch () |
static ::ExceptionBase & | ExcNotActive () |
static ::ExceptionBase & | ExcCantCompareIterators () |
Static Public Attributes | |
static constexpr unsigned int | dimension = dim |
static constexpr unsigned int | space_dimension = spacedim |
Protected Member Functions | |
void | set_dof_handler (DoFHandler< dim, spacedim > *dh) |
void | set_dof_index (const unsigned int i, const types::global_dof_index index, const types::fe_index fe_index=numbers::invalid_fe_index) const |
void | set_mg_dof_index (const int level, const unsigned int i, const types::global_dof_index index) const |
void | set_mg_vertex_dof_index (const int level, const unsigned int vertex, const unsigned int i, const types::global_dof_index index, const types::fe_index fe_index=numbers::invalid_fe_index) const |
Protected Attributes | |
DoFHandler< dim, spacedim > * | dof_handler |
Friends | |
template<typename > | |
class | TriaRawIterator |
template<int , int , int , bool > | |
class | DoFAccessor |
class | DoFHandler< dim, spacedim > |
struct | ::internal::DoFHandlerImplementation::Policy::Implementation |
struct | ::internal::DoFHandlerImplementation::Implementation |
struct | ::internal::hp::DoFHandlerImplementation::Implementation |
struct | ::internal::DoFCellAccessorImplementation::Implementation |
struct | ::internal::DoFAccessorImplementation::Implementation |
A class that gives access to the degrees of freedom stored in a DoFHandler object. Accessors are used to access the data that pertains to edges, faces, and cells of a triangulation. The concept is explained in more detail in connection to Iterators on mesh-like containers.
This class follows mainly the route laid out by the accessor library declared in the triangulation library (TriaAccessor). It enables the user to access the degrees of freedom on lines, quads, or hexes. The first template argument of this class determines the dimensionality of the object under consideration: 1 for lines, 2 for quads, and 3 for hexes. The second argument denotes the type of DoFHandler we should work on. From the second template argument we also deduce the dimension of the Triangulation this object refers to as well as the dimension of the space into which it is embedded. Finally, the template argument level_dof_access
governs the behavior of the function get_active_or_mg_dof_indices(). See the section on Generic loops below.
Usage is best to happen through the alias to the various kinds of iterators provided by the DoFHandler class, since they are more secure to changes in the class naming and template interface as well as providing easier typing (much less complicated names!).
Many loops look very similar, whether they operate on the active dofs of the active cells of the Triangulation or on the level dofs of a single level or the whole grid hierarchy. In order to use polymorphism in such loops, they access degrees of freedom through the function get_active_or_mg_dof_indices(), which changes behavior according to the third template argument. If the argument is false, then the active dofs of active cells are accessed. If it is true, the level dofs are used. DoFHandler has functions, for instance begin() and begin_mg(), which return either type or the other. Additionally, they can be cast into each other, in case this is needed, since they access the same data.
It is recommended to use the function get_active_or_mg_dof_indices() in generic loops in lieu of get_dof_indices() or get_mg_dof_indices().
If the structural dimension given by the first template argument equals the dimension of the DoFHandler (given as the second template argument), then we are obviously dealing with cells, rather than lower-dimensional objects. In that case, inheritance is from CellAccessor, to provide access to all the cell specific information afforded by that class. Otherwise, i.e. for lower-dimensional objects, inheritance is from TriaAccessor.
There is a DoFCellAccessor class that provides the equivalent to the CellAccessor class.
structdim | The dimensionality of the objects the accessor represents. For example, points have structdim equal to zero, edges have structdim equal to one, etc. |
dim | Dimension of the underlying DoFHandler. |
spacedim | Space dimension of the underlying DoFHandler. |
level_dof_access | If false , then the accessor simply represents a cell, face, or edge in a DoFHandler for which degrees of freedom only exist on the finest level. Some operations are not allowed in this case, such as asking for DoF indices on non-active cells. On the other hand, if this template argument is true , then the accessor represents an object in a multilevel hierarchy of degrees of freedom. In this case, accessing DoF indices of any cell is possible, and will return the level indices (which, for active cells, may be different from the global indices). |
Definition at line 210 of file dof_accessor.h.
using DoFAccessor< structdim, dim, spacedim, level_dof_access >::BaseClass |
Declare an alias to the base class to make accessing some of the exception classes simpler.
Definition at line 230 of file dof_accessor.h.
using DoFAccessor< structdim, dim, spacedim, level_dof_access >::AccessorData = DoFHandler<dimension, space_dimension> |
Data type passed by the iterator class.
Definition at line 236 of file dof_accessor.h.
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | ) |
Default constructor. Provides an accessor that can't be used.
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | const Triangulation< dim, spacedim > * | tria, |
const int | level, | ||
const int | index, | ||
const DoFHandler< dim, spacedim > * | dof_handler ) |
Constructor that generates an access that points to a particular cell or face or edge in a DoFHandler.
tria | The triangulation into which this accessor points. |
level | The level within the mesh hierarchy of the object pointed to. For example, coarse mesh cells will have level zero, their children level one, and so on. This argument is ignored for faces and edges which do not have a level. |
index | The index of the object pointed to within the specified refinement level. |
dof_handler | A pointer to the DoFHandler object to which the accessor shall refer. This DoFHandler object must of course be built on the same triangulation as the one specified in the first argument. |
|
default |
Copy constructor.
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | DoFAccessor< structdim, dim, spacedim, level_dof_access > && | ) |
Move constructor.
|
default |
Destructor.
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | const InvalidAccessor< structdim2, dim2, spacedim2 > & | ) |
Conversion constructor. This constructor exists to make certain constructs simpler to write in dimension independent code. For example, it allows assigning a face iterator to a line iterator, an operation that is useful in 2d but doesn't make any sense in 3d. The constructor here exists for the purpose of making the code conform to C++ but it will unconditionally abort; in other words, assigning a face iterator to a line iterator is better put into an if-statement that checks that the dimension is two, and assign to a quad iterator in 3d (an operator that, without this constructor would be illegal if we happen to compile for 2d).
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > & | ) |
Another conversion operator between objects that don't make sense, just like the previous one.
DoFAccessor< structdim, dim, spacedim, level_dof_access >::DoFAccessor | ( | const DoFAccessor< structdim, dim, spacedim, level_dof_access2 > & | ) |
Copy constructor allowing to switch level access and active access.
|
delete |
Copy operator. These operators are usually used in a context like iterator a,b; *a=*b;
. Presumably, the intent here is to copy the object pointed to by b
to the object pointed to by a
. However, the result of dereferencing an iterator is not an object but an accessor; consequently, this operation is not useful for iterators on DoF handler objects. Consequently, this operator is declared as deleted and can not be used.
DoFAccessor< structdim, dim, spacedim, level_dof_access > & DoFAccessor< structdim, dim, spacedim, level_dof_access >::operator= | ( | DoFAccessor< structdim, dim, spacedim, level_dof_access > && | ) |
Move assignment operator.
const DoFHandler< dim, spacedim > & DoFAccessor< structdim, dim, spacedim, level_dof_access >::get_dof_handler | ( | ) | const |
Return a handle on the DoFHandler object which we are using.
void DoFAccessor< structdim, dim, spacedim, level_dof_access >::copy_from | ( | const DoFAccessor< structdim, dim, spacedim, level_dof_access2 > & | a | ) |
Implement the copy operator needed for the iterator classes.
void DoFAccessor< structdim, dim, spacedim, level_dof_access >::copy_from | ( | const TriaAccessorBase< structdim, dim, spacedim > & | da | ) |
Copy operator used by the iterator class. Keeps the previously set dof handler, but sets the object coordinates of the TriaAccessor.
|
inlinestatic |
Tell the caller whether get_active_or_mg_dof_indices() accesses active or level dofs.
Definition at line 2120 of file dof_accessor.h.
TriaIterator< DoFAccessor< structdim, dim, spacedim, level_dof_access > > DoFAccessor< structdim, dim, spacedim, level_dof_access >::child | ( | const unsigned int | c | ) | const |
Return an iterator pointing to the c-th
child.
typename::internal::DoFHandlerImplementation::Iterators< dim, spacedim, level_dof_access >::line_iterator DoFAccessor< structdim, dim, spacedim, level_dof_access >::line | ( | const unsigned int | i | ) | const |
Pointer to the ith
line bounding this object. If the current object is a line itself, then the only valid index is i
equals to zero, and the function returns an iterator to itself.
typename::internal::DoFHandlerImplementation::Iterators< dim, spacedim, level_dof_access >::quad_iterator DoFAccessor< structdim, dim, spacedim, level_dof_access >::quad | ( | const unsigned int | i | ) | const |
Pointer to the ith
quad bounding this object. If the current object is a quad itself, then the only valid index is i
equals to zero, and the function returns an iterator to itself.
|
inline |
Return the global indices of the degrees of freedom located on this object in the standard ordering defined by the finite element (i.e., dofs on vertex 0, dofs on vertex 1, etc, dofs on line 0, dofs on line 1, etc, dofs on quad 0, etc.) This function is only available on active objects (see this glossary entry).
The cells needs to be an active cell (and not artificial in a parallel distributed computation).
The vector has to have the right size before being passed to this function.
The last argument denotes the finite element index. For the standard DoFHandler class, this value must be equal to its default value since that class only supports the same finite element on all cells anyway.
However, when the relevant DoFHandler object has hp-capabilities enabled, different finite element objects may be used on different cells. On faces between two cells, as well as vertices, there may therefore be two sets of degrees of freedom, one for each of the finite elements used on the adjacent cells. In order to specify which set of degrees of freedom to work on, the last argument is used to disambiguate. Finally, if this function is called for a cell object, there can only be a single set of degrees of freedom, and fe_index has to match the result of active_fe_index().
For cells, there is only a single possible finite element index (namely the one for that cell, returned by cell->active_fe_index
. Consequently, the derived DoFCellAccessor class has an overloaded version of this function that calls the present function with cell->active_fe_index
as last argument.
Definition at line 179 of file dof_accessor.cc.
|
inline |
Return the global multilevel indices of the degrees of freedom that live on the current object with respect to the given level within the multigrid hierarchy. The indices refer to the local numbering for the level this line lives on.
Definition at line 216 of file dof_accessor.cc.
|
inline |
Set the level DoF indices that are returned by get_mg_dof_indices.
Definition at line 238 of file dof_accessor.cc.
types::global_dof_index DoFAccessor< structdim, dim, spacedim, level_dof_access >::vertex_dof_index | ( | const unsigned int | vertex, |
const unsigned int | i, | ||
const types::fe_index | fe_index = numbers::invalid_fe_index ) const |
Global DoF index of the i degree associated with the vertexth
vertex of the present cell.
The last argument denotes the finite element index. For the standard DoFHandler class, this value must be equal to its default value since that class only supports the same finite element on all cells anyway.
However, when hp-capabilities are enabled, different finite element objects may be used on different cells. On faces between two cells, as well as vertices, there may therefore be two sets of degrees of freedom, one for each of the finite elements used on the adjacent cells. In order to specify which set of degrees of freedom to work on, the last argument is used to disambiguate. Finally, if this function is called for a cell object, there can only be a single set of degrees of freedom, and fe_index
has to match the result of cell->active_fe_index()
. Alternatively, if fe_index
is left to its default value when this function is called on a cell, then this is interpreted as equal to cell->active_fe_index()
.
types::global_dof_index DoFAccessor< structdim, dim, spacedim, level_dof_access >::mg_vertex_dof_index | ( | const int | level, |
const unsigned int | vertex, | ||
const unsigned int | i, | ||
const types::fe_index | fe_index = numbers::invalid_fe_index ) const |
Return the global DoF index of the i
th degree of freedom associated with the vertex
th vertex on level level
. Also see vertex_dof_index().
types::global_dof_index DoFAccessor< structdim, dim, spacedim, level_dof_access >::dof_index | ( | const unsigned int | i, |
const types::fe_index | fe_index = numbers::invalid_fe_index ) const |
Index of the ith degree of freedom of this object.
The last argument denotes the finite element index. For the standard DoFHandler class, this value must be equal to its default value since that class only supports the same finite element on all cells anyway.
However, when hp-capabilities are enabled, different finite element objects may be used on different cells. On faces between two cells, as well as vertices, there may therefore be two sets of degrees of freedom, one for each of the finite elements used on the adjacent cells. In order to specify which set of degrees of freedom to work on, the last argument is used to disambiguate. Finally, if this function is called for a cell object, there can only be a single set of degrees of freedom, and fe_index has to match the result of active_fe_index().
types::global_dof_index DoFAccessor< structdim, dim, spacedim, level_dof_access >::mg_dof_index | ( | const int | level, |
const unsigned int | i ) const |
Return the dof_index on the given level. Also see dof_index.
unsigned int DoFAccessor< structdim, dim, spacedim, level_dof_access >::n_active_fe_indices | ( | ) | const |
Return the number of finite elements that are active on a given object.
When hp-capabilities are disabled the answer is, of course, always one. However, when hp-capabilities are enabled, this isn't the case: If this is a cell, the answer is of course one. If it is a face, the answer may be one or two, depending on whether the two adjacent cells use the same finite element or not. If it is an edge in 3d, the possible return value may be one or any other value larger than that.
types::fe_index DoFAccessor< structdim, dim, spacedim, level_dof_access >::nth_active_fe_index | ( | const unsigned int | n | ) | const |
Return the n-th
active FE index on this object. For cells and all non-hp-objects, there is only a single active FE index, so the argument must be equal to zero. For lower-dimensional hp-objects, there are n_active_fe_indices() active finite elements, and this function can be queried for their indices.
std::set< types::fe_index > DoFAccessor< structdim, dim, spacedim, level_dof_access >::get_active_fe_indices | ( | ) | const |
Returns all active FE indices on this object.
The size of the returned set equals the number of finite elements that are active on this object.
bool DoFAccessor< structdim, dim, spacedim, level_dof_access >::fe_index_is_active | ( | const types::fe_index | fe_index | ) | const |
Return true if the finite element with given index is active on the present object. When the current DoFHandler does not have hp-capabilities, this is of course the case only if fe_index
equals zero. For cells, it is the case if fe_index
equals active_fe_index() of this cell. For faces and other lower- dimensional objects, there may be more than one fe_index
that are active on any given object (see n_active_fe_indices()).
const FiniteElement< dim, spacedim > & DoFAccessor< structdim, dim, spacedim, level_dof_access >::get_fe | ( | const types::fe_index | fe_index | ) | const |
Return a reference to the finite element used on this object with the given fe_index
. fe_index
must be used on this object, i.e. fe_index_is_active(fe_index)
must return true.
bool DoFAccessor< structdim, dim, spacedim, level_dof_access >::operator== | ( | const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > & | ) | const |
Compare for equality. Return true
if the two accessors refer to the same object.
The template parameters of this function allow for a comparison of very different objects. Therefore, some of them are disabled. Namely, if the dimension, or the dof handler of the two objects differ, an exception is generated. It can be expected that this is an unwanted comparison.
The template parameter level_dof_access2
is ignored, such that an iterator with level access can be equal to one with access to the active degrees of freedom.
bool DoFAccessor< structdim, dim, spacedim, level_dof_access >::operator!= | ( | const DoFAccessor< structdim2, dim2, spacedim2, level_dof_access2 > & | ) | const |
Compare for inequality. The boolean not of operator==().
|
protected |
Reset the DoF handler pointer.
|
protected |
Set the index of the ith degree of freedom of this object to index
.
The last argument denotes the finite element index. For the standard DoFHandler class, this value must be equal to its default value since that class only supports the same finite element on all cells anyway.
However, when the relevant DoFHandler has hp-capabilities, different finite element objects may be used on different cells. On faces between two cells, as well as vertices, there may therefore be two sets of degrees of freedom, one for each of the finite elements used on the adjacent cells. In order to specify which set of degrees of freedom to work on, the last argument is used to disambiguate. Finally, if this function is called for a cell object, there can only be a single set of degrees of freedom, and fe_index has to match the result of active_fe_index().
|
protected |
|
protected |
|
friend |
Definition at line 735 of file dof_accessor.h.
|
friend |
Definition at line 737 of file dof_accessor.h.
|
friend |
Definition at line 737 of file dof_accessor.h.
|
friend |
Definition at line 744 of file dof_accessor.h.
|
friend |
Definition at line 746 of file dof_accessor.h.
|
friend |
Definition at line 747 of file dof_accessor.h.
|
friend |
Definition at line 748 of file dof_accessor.h.
|
friend |
Definition at line 749 of file dof_accessor.h.
|
staticconstexpr |
A static variable that allows users of this class to discover the value of the second template argument.
Definition at line 218 of file dof_accessor.h.
|
staticconstexpr |
A static variable that allows users of this class to discover the value of the third template argument.
Definition at line 224 of file dof_accessor.h.
|
protected |
Store the address of the DoFHandler object to be accessed.
Definition at line 659 of file dof_accessor.h.