deal.II version GIT relicensing-2287-g6548a49e0a 2024-12-20 18:30:00+00:00
|
#include <deal.II/lac/read_write_vector.h>
Classes | |
class | FunctorTemplate |
Public Types | |
using | value_type = Number |
using | pointer = value_type * |
using | const_pointer = const value_type * |
using | iterator = value_type * |
using | const_iterator = const value_type * |
using | reference = value_type & |
using | const_reference = const value_type & |
using | size_type = types::global_dof_index |
using | real_type = typename numbers::NumberTraits< Number >::real_type |
Public Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
1: Basic Object-handling | |
ReadWriteVector () | |
ReadWriteVector (const ReadWriteVector< Number > &in_vector) | |
ReadWriteVector (const size_type size) | |
ReadWriteVector (const IndexSet &locally_stored_indices) | |
~ReadWriteVector () override=default | |
virtual void | reinit (const size_type size, const bool omit_zeroing_entries=false) |
template<typename Number2 > | |
void | reinit (const ReadWriteVector< Number2 > &in_vector, const bool omit_zeroing_entries=false) |
virtual void | reinit (const IndexSet &locally_stored_indices, const bool omit_zeroing_entries=false) |
void | reinit (const TrilinosWrappers::MPI::Vector &trilinos_vec) |
template<typename Functor > | |
void | apply (const Functor &func) |
void | swap (ReadWriteVector< Number > &v) noexcept |
ReadWriteVector< Number > & | operator= (const ReadWriteVector< Number > &in_vector) |
template<typename Number2 > | |
ReadWriteVector< Number > & | operator= (const ReadWriteVector< Number2 > &in_vector) |
ReadWriteVector< Number > & | operator= (const Number s) |
void | import_elements (const ::Vector< Number > &vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import (const ::Vector< Number > &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
template<typename MemorySpace > | |
void | import_elements (const distributed::Vector< Number, MemorySpace > &vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
template<typename MemorySpace > | |
void | import (const distributed::Vector< Number, MemorySpace > &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import_elements (const PETScWrappers::MPI::Vector &petsc_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import (const PETScWrappers::MPI::Vector &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import_elements (const TrilinosWrappers::MPI::Vector &trilinos_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import (const TrilinosWrappers::MPI::Vector &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
template<typename MemorySpace , typename Dummy = Number> | |
std::enable_if_t< std::is_same_v< Dummy, Number > &&::is_tpetra_type< Number >::value > | import_elements (const TpetraWrappers::Vector< Number, MemorySpace > &tpetra_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
template<typename MemorySpace , typename Dummy = Number> | |
std::enable_if_t< std::is_same_v< Dummy, Number > &&::is_tpetra_type< Number >::value > | import (const TpetraWrappers::Vector< Number, MemorySpace > &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import_elements (const EpetraWrappers::Vector &epetra_vec, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
void | import (const EpetraWrappers::Vector &V, VectorOperation::values operation, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern={}) |
size_type | size () const override |
size_type | locally_owned_size () const |
const IndexSet & | get_stored_elements () const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
2: Data-Access | |
Number | operator() (const size_type global_index) const |
Number & | operator() (const size_type global_index) |
Number | operator[] (const size_type global_index) const |
Number & | operator[] (const size_type global_index) |
template<typename Number2 > | |
void | extract_subvector_to (const std::vector< size_type > &indices, std::vector< Number2 > &values) const |
virtual void | extract_subvector_to (const ArrayView< const types::global_dof_index > &indices, const ArrayView< Number > &entries) const override |
template<typename ForwardIterator , typename OutputIterator > | |
void | extract_subvector_to (ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const |
Number | local_element (const size_type local_index) const |
Number & | local_element (const size_type local_index) |
3: Modification of vectors | |
template<typename Number2 > | |
void | add (const std::vector< size_type > &indices, const std::vector< Number2 > &values) |
template<typename Number2 > | |
void | add (const std::vector< size_type > &indices, const ReadWriteVector< Number2 > &values) |
template<typename Number2 > | |
void | add (const size_type n_elements, const size_type *indices, const Number2 *values) |
void | print (std::ostream &out, const unsigned int precision=3, const bool scientific=true) const |
std::size_t | memory_consumption () const |
EnableObserverPointer functionality | |
Classes derived from EnableObserverPointer provide a facility to subscribe to this object. This is mostly used by the ObserverPointer class. | |
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 |
Static Public Member Functions | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Protected Member Functions | |
template<typename MemorySpace , typename Dummy = Number> | |
std::enable_if_t< std::is_same_v< Dummy, Number > &&::is_tpetra_type< Number >::value > | import_elements (const Tpetra::Vector< Number, int, types::signed_global_dof_index, MemorySpace > &tpetra_vector, const IndexSet &locally_owned_elements, VectorOperation::values operation, const MPI_Comm mpi_comm, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern) |
void | import_elements (const Epetra_MultiVector &multivector, const IndexSet &locally_owned_elements, VectorOperation::values operation, const MPI_Comm mpi_comm, const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > &communication_pattern) |
unsigned int | global_to_local (const types::global_dof_index global_index) const |
template<typename MemorySpace = ::MemorySpace::Host> | |
TpetraWrappers::CommunicationPattern< MemorySpace > | create_tpetra_comm_pattern (const IndexSet &source_index_set, const MPI_Comm mpi_comm) |
EpetraWrappers::CommunicationPattern | create_epetra_comm_pattern (const IndexSet &source_index_set, const MPI_Comm mpi_comm) |
Protected Attributes | |
IndexSet | stored_elements |
IndexSet | source_stored_elements |
std::shared_ptr< Utilities::MPI::CommunicationPatternBase > | comm_pattern |
AlignedVector< Number > | values |
std::shared_ptr<::parallel::internal::TBBPartitioner > | thread_loop_partitioner |
Private Types | |
using | map_value_type = decltype(counter_map)::value_type |
using | map_iterator = decltype(counter_map)::iterator |
Private Member Functions | |
void | check_no_subscribers () const noexcept |
Private Attributes | |
std::atomic< unsigned int > | counter |
std::map< std::string, unsigned int > | counter_map |
std::vector< std::atomic< bool > * > | validity_pointers |
const std::type_info * | object_info |
Static Private Attributes | |
static std::mutex | mutex |
Friends | |
template<typename Number2 > | |
class | ReadWriteVector |
ReadWriteVector is intended to represent vectors in \({\mathbb R}^N\) for which it stores all or a subset of elements. The latter case in important in parallel computations, where \(N\) may be so large that no processor can actually store all elements of a solution vector, but where this is also not necessary: one typically only has to store the values of degrees of freedom that live on cells that are locally owned plus potentially those degrees of freedom that live on ghost cells.
This class provides access to individual elements to be read or written. However, it does not allow global operations such as taking the norm or dot products between vectors.
Most of the time, one will simply read from or write into a vector of the current class using the global numbers of these degrees of freedom. This is done using operator()() or operator[]() which call global_to_local() to transform the global index into a local one. In such cases, it is clear that one can only access elements of the vector that the current object indeed stores.
However, it is also possible to access elements in the order in which they are stored by the current object. In other words, one is not interested in accessing elements with their global indices, but instead using an enumeration that only takes into account the elements that are actually stored. This is facilitated by the local_element() function. To this end, it is necessary to know in which order the current class stores its element. The elements of all the consecutive ranges are stored in ascending order of the first index of each range. The function IndexSet::largest_range_starting_index() can be used to get the first index of the largest range.
Definition at line 125 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::value_type = Number |
Declare standard types used in all containers. These types parallel those in the C++
standard libraries vector<...>
class.
Definition at line 133 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::pointer = value_type * |
Definition at line 134 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::const_pointer = const value_type * |
Definition at line 135 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::iterator = value_type * |
Definition at line 136 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::const_iterator = const value_type * |
Definition at line 137 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::reference = value_type & |
Definition at line 138 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::const_reference = const value_type & |
Definition at line 139 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::size_type = types::global_dof_index |
Definition at line 140 of file read_write_vector.h.
using LinearAlgebra::ReadWriteVector< Number >::real_type = typename numbers::NumberTraits<Number>::real_type |
Definition at line 141 of file read_write_vector.h.
|
privateinherited |
The data type used in counter_map.
Definition at line 238 of file enable_observer_pointer.h.
|
privateinherited |
The iterator type used in counter_map.
Definition at line 243 of file enable_observer_pointer.h.
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector | ( | ) |
Empty constructor.
LinearAlgebra::ReadWriteVector< Number >::ReadWriteVector | ( | const ReadWriteVector< Number > & | in_vector | ) |
Copy constructor.
|
explicit |
Construct a vector given the size, the stored elements have their index in [0,size).
|
explicit |
Construct a vector whose stored elements indices are given by the IndexSet locally_stored_indices
.
|
overridedefault |
Destructor.
|
virtual |
Set the global size of the vector to size
. The stored elements have their index in [0,size).
If the flag omit_zeroing_entries
is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).
void LinearAlgebra::ReadWriteVector< Number >::reinit | ( | const ReadWriteVector< Number2 > & | in_vector, |
const bool | omit_zeroing_entries = false |
||
) |
Uses the same IndexSet as the one of the input vector in_vector
and allocates memory for this vector.
If the flag omit_zeroing_entries
is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it).
|
virtual |
Initializes the vector. The indices are specified by locally_stored_indices
.
If the flag omit_zeroing_entries
is set to false, the memory will be initialized with zero, otherwise the memory will be untouched (and the user must make sure to fill it with reasonable data before using it). locally_stored_indices.
void LinearAlgebra::ReadWriteVector< Number >::reinit | ( | const TrilinosWrappers::MPI::Vector & | trilinos_vec | ) |
Initialize this ReadWriteVector by supplying access to all locally available entries in the given ghosted or non-ghosted vector.
trilinos_vec
.This function is mainly written for backwards-compatibility to get element access to a ghosted TrilinosWrappers::MPI::Vector inside the library.
void LinearAlgebra::ReadWriteVector< Number >::apply | ( | const Functor & | func | ) |
Apply the functor func
to each element of the vector. The functor should look like
|
noexcept |
Swap the contents of this vector and the other vector v
. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.
This function is analogous to the swap
function of all C++ standard containers. Also, there is a global function swap(u,v)
that simply calls u.swap(v)
, again in analogy to standard functions.
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= | ( | const ReadWriteVector< Number > & | in_vector | ) |
Copies the data and the IndexSet of the input vector in_vector
.
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= | ( | const ReadWriteVector< Number2 > & | in_vector | ) |
Copies the data and the IndexSet of the input vector in_vector
.
ReadWriteVector< Number > & LinearAlgebra::ReadWriteVector< Number >::operator= | ( | const Number | s | ) |
Sets all elements of the vector to the scalar s
. This operation is only allowed if s
is equal to zero.
void LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const ::Vector< Number > & | vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements.
communication_pattern
is ignored since we are dealing with a serial vector here.
|
inline |
Definition at line 301 of file read_write_vector.h.
void LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const distributed::Vector< Number, MemorySpace > & | vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.
|
inline |
Definition at line 330 of file read_write_vector.h.
void LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const PETScWrappers::MPI::Vector & | petsc_vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector petsc_vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.
|
inline |
Definition at line 360 of file read_write_vector.h.
void LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const TrilinosWrappers::MPI::Vector & | trilinos_vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector trilinos_vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.
trilinos_vec
is not allowed to have ghost entries.
|
inline |
Definition at line 392 of file read_write_vector.h.
std::enable_if_t< std::is_same_v< Dummy, Number > && ::is_tpetra_type< Number >::value > LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const TpetraWrappers::Vector< Number, MemorySpace > & | tpetra_vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector tpetra_vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.
|
inline |
Definition at line 424 of file read_write_vector.h.
void LinearAlgebra::ReadWriteVector< Number >::import_elements | ( | const EpetraWrappers::Vector & | epetra_vec, |
VectorOperation::values | operation, | ||
const std::shared_ptr< const Utilities::MPI::CommunicationPatternBase > & | communication_pattern = {} |
||
) |
Imports all the elements present in the vector's IndexSet from the input vector epetra_vec
. VectorOperation::values operation
is used to decide if the elements in V
should be added to the current vector or replace the current elements. The last parameter can be used if the same communication pattern is used multiple times. This can be used to improve performance.
|
inline |
Definition at line 453 of file read_write_vector.h.
|
overridevirtual |
The value returned by this function denotes the dimension of the vector spaces that are modeled by objects of this kind. However, objects of the current class do not actually stores all elements of vectors of this space but may, in fact store only a subset. The number of elements stored is returned by n_elements() and is smaller or equal to the number returned by the current function.
Implements ReadVector< Number >.
size_type LinearAlgebra::ReadWriteVector< Number >::locally_owned_size | ( | ) | const |
Return the local size of the vector, i.e., the number of indices owned locally.
const IndexSet & LinearAlgebra::ReadWriteVector< Number >::get_stored_elements | ( | ) | const |
Return the IndexSet that represents the indices of the elements stored.
iterator LinearAlgebra::ReadWriteVector< Number >::begin | ( | ) |
Make the ReadWriteVector
class a bit like the vector<>
class of the C++ standard library by returning iterators to the start and end of the locally stored elements of this vector.
const_iterator LinearAlgebra::ReadWriteVector< Number >::begin | ( | ) | const |
Return constant iterator to the start of the locally stored elements of the vector.
iterator LinearAlgebra::ReadWriteVector< Number >::end | ( | ) |
Return an iterator pointing to the element past the end of the array of locally stored entries.
const_iterator LinearAlgebra::ReadWriteVector< Number >::end | ( | ) | const |
Return a constant iterator pointing to the element past the end of the array of the locally stored entries.
Number LinearAlgebra::ReadWriteVector< Number >::operator() | ( | const size_type | global_index | ) | const |
Read access to the data in the position corresponding to global_index
. An exception is thrown if global_index
is not stored by the current object.
Number & LinearAlgebra::ReadWriteVector< Number >::operator() | ( | const size_type | global_index | ) |
Read and write access to the data in the position corresponding to global_index
. An exception is thrown if global_index
is not stored by the current object.
Number LinearAlgebra::ReadWriteVector< Number >::operator[] | ( | const size_type | global_index | ) | const |
Read access to the data in the position corresponding to global_index
. An exception is thrown if global_index
is not stored by the current object.
This function does the same thing as operator().
Number & LinearAlgebra::ReadWriteVector< Number >::operator[] | ( | const size_type | global_index | ) |
Read and write access to the data in the position corresponding to global_index
. An exception is thrown if global_index
is not stored by the current object.
This function does the same thing as operator().
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to | ( | const std::vector< size_type > & | indices, |
std::vector< Number2 > & | values | ||
) | const |
Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. The indices of the elements to be read are stated in the first argument, the corresponding values are returned in the second.
If the current vector is called v
, then this function is the equivalent to the code
indices
and values
arrays must be identical.
|
overridevirtual |
Extract a range of elements all at once.
Implements ReadVector< Number >.
void LinearAlgebra::ReadWriteVector< Number >::extract_subvector_to | ( | ForwardIterator | indices_begin, |
const ForwardIterator | indices_end, | ||
OutputIterator | values_begin | ||
) | const |
Instead of getting individual elements of a vector via operator(), this function allows getting a whole set of elements at once. In contrast to the previous function, this function obtains the indices of the elements by dereferencing all elements of the iterator range provided by the first two arguments, and puts the vector values into memory locations obtained by dereferencing a range of iterators starting at the location pointed to by the third argument.
If the current vector is called v
, then this function is the equivalent to the code
values_begin
as there are iterators between indices_begin
and indices_end
. Number LinearAlgebra::ReadWriteVector< Number >::local_element | ( | const size_type | local_index | ) | const |
Read access to the data field specified by local_index
. When you access elements in the order in which they are stored, it is necessary that you know in which they are stored. In other words, you need to know the map between the global indices of the elements this class stores, and the local indices into the contiguous array of these global elements. For this, see the general documentation of this class.
Performance: Direct array access (fast).
Number & LinearAlgebra::ReadWriteVector< Number >::local_element | ( | const size_type | local_index | ) |
Read and write access to the data field specified by local_index
. When you access elements in the order in which they are stored, it is necessary that you know in which they are stored. In other words, you need to know the map between the global indices of the elements this class stores, and the local indices into the contiguous array of these global elements. For this, see the general documentation of this class.
Performance: Direct array access (fast).
void LinearAlgebra::ReadWriteVector< Number >::add | ( | const std::vector< size_type > & | indices, |
const std::vector< Number2 > & | values | ||
) |
This function adds a whole set of values stored in values
to the vector components specified by indices
.
void LinearAlgebra::ReadWriteVector< Number >::add | ( | const std::vector< size_type > & | indices, |
const ReadWriteVector< Number2 > & | values | ||
) |
This function is similar to the previous one but takes a ReadWriteVector of values.
void LinearAlgebra::ReadWriteVector< Number >::add | ( | const size_type | n_elements, |
const size_type * | indices, | ||
const Number2 * | values | ||
) |
Take an address where n_elements
are stored contiguously and add them into the vector. Handles all cases which are not covered by the other two add()
functions above.
void LinearAlgebra::ReadWriteVector< Number >::print | ( | std::ostream & | out, |
const unsigned int | precision = 3 , |
||
const bool | scientific = true |
||
) | const |
Prints the vector to the output stream out
.
std::size_t LinearAlgebra::ReadWriteVector< Number >::memory_consumption | ( | ) | const |
Return the memory consumption of this class in bytes.
|
protected |
Import all the elements present in the vector's IndexSet from the input vector tpetra_vector
. This is an helper function and it should not be used directly.
|
protected |
Import all the elements present in the vector's IndexSet from the input vector multivector
. This is an helper function and it should not be used directly.
|
protected |
Return the local position of global_index
.
|
protected |
Return a TpetraWrappers::CommunicationPattern and store it for future use.
|
protected |
Return a EpetraWrappers::CommunicationPattern and store it for future use.
|
inherited |
Subscribes a user of the object by storing the pointer validity
. The subscriber may be identified by text supplied as identifier
.
Definition at line 131 of file enable_observer_pointer.cc.
|
inherited |
Unsubscribes a user from the object.
identifier
and the validity
pointer must be the same as the one supplied to subscribe(). Definition at line 151 of file enable_observer_pointer.cc.
|
inlineinherited |
Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.
Definition at line 322 of file enable_observer_pointer.h.
|
inlineinherited |
List the subscribers to the input stream
.
Definition at line 339 of file enable_observer_pointer.h.
|
inherited |
List the subscribers to deallog
.
Definition at line 199 of file enable_observer_pointer.cc.
|
inlineinherited |
Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.
This function does not actually serialize any of the member variables of this class. The reason is that what this class stores is only who subscribes to this object, but who does so at the time of storing the contents of this object does not necessarily have anything to do with who subscribes to the object when it is restored. Consequently, we do not want to overwrite the subscribers at the time of restoring, and then there is no reason to write the subscribers out in the first place.
Definition at line 331 of file enable_observer_pointer.h.
|
privatenoexceptinherited |
Check that there are no objects subscribing to this object. If this check passes then it is safe to destroy the current object. It this check fails then this function will either abort or print an error message to deallog (by using the AssertNothrow mechanism), but will not throw an exception.
Definition at line 53 of file enable_observer_pointer.cc.
Definition at line 790 of file read_write_vector.h.
|
protected |
Indices of the elements stored.
Definition at line 763 of file read_write_vector.h.
|
protected |
IndexSet of the elements of the last imported vector;
Definition at line 768 of file read_write_vector.h.
|
protected |
CommunicationPattern for the communication between the source_stored_elements IndexSet and the current vector.
Definition at line 774 of file read_write_vector.h.
|
protected |
Locally stored elements.
Definition at line 779 of file read_write_vector.h.
|
mutableprotected |
For parallel loops with TBB, this member variable stores the affinity information of loops.
Definition at line 786 of file read_write_vector.h.
|
mutableprivateinherited |
Store the number of objects which subscribed to this object. Initially, this number is zero, and upon destruction it shall be zero again (i.e. all objects which subscribed should have unsubscribed again).
The creator (and owner) of an object is counted in the map below if HE manages to supply identification.
We use the mutable
keyword in order to allow subscription to constant objects also.
This counter may be read from and written to concurrently in multithreaded code: hence we use the std::atomic
class template.
Definition at line 227 of file enable_observer_pointer.h.
|
mutableprivateinherited |
In this map, we count subscriptions for each different identification string supplied to subscribe().
Definition at line 233 of file enable_observer_pointer.h.
|
mutableprivateinherited |
In this vector, we store pointers to the validity bool in the ObserverPointer objects that subscribe to this class.
Definition at line 249 of file enable_observer_pointer.h.
|
mutableprivateinherited |
Pointer to the typeinfo object of this object, from which we can later deduce the class name. Since this information on the derived class is neither available in the destructor, nor in the constructor, we obtain it in between and store it here.
Definition at line 257 of file enable_observer_pointer.h.
|
staticprivateinherited |
A mutex used to ensure data consistency when accessing the mutable
members of this class. This lock is used in the subscribe() and unsubscribe() functions, as well as in list_subscribers()
.
Definition at line 280 of file enable_observer_pointer.h.