Reference documentation for deal.II version 9.1.1
|
#include <deal.II/lac/block_vector_base.h>
Public Types | |
using | size_type = types::global_dof_index |
using | value_type = typename std::conditional< Constness, const typename BlockVectorType::value_type, typename BlockVectorType::value_type >::type |
using | iterator_category = std::random_access_iterator_tag |
using | BlockVector = typename std::conditional< Constness, const BlockVectorType, BlockVectorType >::type |
Public Member Functions | |
Iterator (BlockVector &parent, const size_type global_index) | |
Iterator (const Iterator< BlockVectorType, !Constness > &c) | |
Iterator (const Iterator &c) | |
Iterator & | operator= (const Iterator &c) |
dereference_type | operator* () const |
dereference_type | operator[] (const difference_type d) const |
Iterator & | operator++ () |
Iterator | operator++ (int) |
Iterator & | operator-- () |
Iterator | operator-- (int) |
template<bool OtherConstness> | |
bool | operator== (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
bool | operator!= (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
bool | operator< (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
bool | operator<= (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
bool | operator> (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
bool | operator>= (const Iterator< BlockVectorType, OtherConstness > &i) const |
template<bool OtherConstness> | |
difference_type | operator- (const Iterator< BlockVectorType, OtherConstness > &i) const |
Iterator | operator+ (const difference_type &d) const |
Iterator | operator- (const difference_type &d) const |
Iterator & | operator+= (const difference_type &d) |
Iterator & | operator-= (const difference_type &d) |
Static Public Member Functions | |
static ::ExceptionBase & | ExcPointerToDifferentVectors () |
Private Member Functions | |
Iterator (BlockVector &parent, const size_type global_index, const size_type current_block, const size_type index_within_block, const size_type next_break_forward, const size_type next_break_backward) | |
void | move_forward () |
void | move_backward () |
Private Attributes | |
BlockVector * | parent |
size_type | global_index |
unsigned int | current_block |
size_type | next_break_forward |
Friends | |
template<typename , bool > | |
class | Iterator |
General random-access iterator class for block vectors. Since we do not want to have two classes for non-const iterator and const_iterator, we take a second template argument which denotes whether the vector we point into is a constant object or not. The first template argument is always the number type of the block vector in use.
This class satisfies all requirements of random access iterators defined in the C++ standard. Operations on these iterators are constant in the number of elements in the block vector. However, they are sometimes linear in the number of blocks in the vector, but since that does rarely change dynamically within an application, this is a constant and we again have that the iterator satisfies the requirements of a random access iterator.
Definition at line 137 of file block_vector_base.h.
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::size_type = types::global_dof_index |
Declare the type for container size.
Definition at line 143 of file block_vector_base.h.
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::value_type = typename std::conditional<Constness, const typename BlockVectorType::value_type, typename BlockVectorType::value_type>::type |
Type of the number this iterator points to. Depending on the value of the second template parameter, this is either a constant or non-const number.
Definition at line 153 of file block_vector_base.h.
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::iterator_category = std::random_access_iterator_tag |
Declare some alias which are standard for iterators and are used by algorithms to enquire about the specifics of the iterators they work on.
Definition at line 160 of file block_vector_base.h.
using internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::BlockVector = typename std:: conditional<Constness, const BlockVectorType, BlockVectorType>::type |
Typedef the type of the block vector (which differs in constness, depending on the second template parameter).
Definition at line 175 of file block_vector_base.h.
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator | ( | BlockVector & | parent, |
const size_type | global_index | ||
) |
Construct an iterator from a vector to which we point and the global index of the element pointed to.
Depending on the value of the Constness
template argument of this class, the first argument of this constructor is either is a const or non-const reference.
internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator | ( | const Iterator< BlockVectorType, !Constness > & | c | ) |
Copy constructor from an iterator of different constness.
static_assert
). internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::Iterator | ( | const Iterator< BlockVectorType, Constness > & | c | ) |
Copy constructor from an iterator with the same constness.
|
private |
Constructor used internally in this class. The arguments match exactly the values of the respective member variables.
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator= | ( | const Iterator< BlockVectorType, Constness > & | c | ) |
Copy operator.
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator* | ( | ) | const |
Dereferencing operator. If the template argument Constness
is true
, then no writing to the result is possible, making this a const_iterator.
dereference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator[] | ( | const difference_type | d | ) | const |
Random access operator, grant access to arbitrary elements relative to the one presently pointed to.
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ | ( | ) |
Prefix increment operator. This operator advances the iterator to the next element and returns a reference to *this
.
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator++ | ( | int | ) |
Postfix increment operator. This operator advances the iterator to the next element and returns a copy of the old value of this iterator.
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- | ( | ) |
Prefix decrement operator. This operator retracts the iterator to the previous element and returns a reference to *this
.
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-- | ( | int | ) |
Postfix decrement operator. This operator retracts the iterator to the previous element and returns a copy of the old value of this iterator.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator== | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Compare for equality of iterators. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator!= | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Compare for inequality of iterators. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator< | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Check whether this iterators points to an element previous to the one pointed to by the given argument. This operator checks whether the vectors pointed to are the same, and if not it throws an exception.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator<= | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Comparison operator alike to the one above.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator> | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Comparison operator alike to the one above.
bool internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator>= | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Comparison operator alike to the one above.
difference_type internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- | ( | const Iterator< BlockVectorType, OtherConstness > & | i | ) | const |
Return the distance between the two iterators, in elements.
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+ | ( | const difference_type & | d | ) | const |
Return an iterator which is the given number of elements in front of the present one.
Iterator internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator- | ( | const difference_type & | d | ) | const |
Return an iterator which is the given number of elements behind the present one.
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator+= | ( | const difference_type & | d | ) |
Move the iterator d
elements forward at once, and return the result.
Iterator& internal::BlockVectorIterators::Iterator< BlockVectorType, Constness >::operator-= | ( | const difference_type & | d | ) |
Move the iterator d
elements backward at once, and return the result.
|
private |
Move forward one element.
|
private |
Move backward one element.
|
friend |
Mark all other instances of this template as friends.
Definition at line 406 of file block_vector_base.h.
|
private |
Pointer to the block vector object to which this iterator points. Depending on the value of the Constness
template argument of this class, this is a const
or non-const
pointer.
Definition at line 366 of file block_vector_base.h.
|
private |
Global index of the element to which we presently point.
Definition at line 371 of file block_vector_base.h.
|
private |
Current block and index within this block of the element presently pointed to.
Definition at line 377 of file block_vector_base.h.
|
private |
Indices of the global element address at which we have to move on to another block when moving forward and backward. These indices are kept as a cache since this is much more efficient than always asking the parent object.
Definition at line 386 of file block_vector_base.h.