KASKADE 7 development version
|
A structure for holding a sequence of several local vectors to be filled sequentially and to be scattered jointly. More...
#include <localVectors.hh>
A structure for holding a sequence of several local vectors to be filled sequentially and to be scattered jointly.
This realizes a container of vector, with the critical feature that the entries for all the vectors are stored in a contiguous memory block. This should improve locality of memory access during assembly and scattering of local vectors.
Entry | the type of matrix entries |
SortedIdx | a range of indices (global idx, local idx) sorted ascendingly by global idx |
Vector | the type of the global Vector |
Definition at line 94 of file localVectors.hh.
Public Types | |
using | value_type = LocalVector< Entry, SortedIdx > |
Public Member Functions | |
LocalVectors (Vector &globalVector, std::vector< std::mutex > &scatterMutexes_, size_t maxStorage=256 *1024) | |
LocalVectors () | |
Default constructor. More... | |
~LocalVectors () | |
Destructor. More... | |
void | push_back (SortedIdx const &idx) |
Appends another (zero-initialized) local vector. More... | |
value_type & | operator[] (int n) |
A reference to the n-th local matrix. More... | |
value_type const & | operator[] (int n) const |
value_type & | back () |
A reference to the last pushed local matrix. More... | |
value_type const & | back () const |
size_t | size () const |
The number of local vectors that are stored. More... | |
void | scatter () |
Scatters the local vectors into the global one and removes them from the local container. More... | |
void | clear () |
clears all the data, leaving an empty state More... | |
size_t | storageSize () const |
reports the size of the local vectors storage in bytes More... | |
using Kaskade::LocalVectors< Entry, SortedIdx, Vector >::value_type = LocalVector<Entry,SortedIdx> |
Definition at line 97 of file localVectors.hh.
|
inline |
globalVector | global vector where computed local vectors are to be scattered to. |
scatterMutexes_ | several mutexes (associated with ranges in the global vector), required to lock ranges in the global vector during scattering. By the number of given mutexes it can be controlled into how many ranges the global vector is to be subdivided during scattering. |
maxStorage | the desired size of the buffer for data of local vectors, in bytes. |
Definition at line 105 of file localVectors.hh.
|
inline |
Default constructor.
This creates an essentially useless empty local matrix buffer.
Definition at line 121 of file localVectors.hh.
|
inline |
Destructor.
The destructor scatters all remaining local matrices into the global matrix.
Definition at line 129 of file localVectors.hh.
|
inline |
A reference to the last pushed local matrix.
Definition at line 167 of file localVectors.hh.
|
inline |
Definition at line 168 of file localVectors.hh.
|
inline |
clears all the data, leaving an empty state
Definition at line 223 of file localVectors.hh.
Referenced by Kaskade::LocalVectors< Entry, SortedIdx, Vector >::scatter().
|
inline |
A reference to the n-th local matrix.
Definition at line 161 of file localVectors.hh.
|
inline |
Definition at line 162 of file localVectors.hh.
|
inline |
Appends another (zero-initialized) local vector.
In case that appending the new local vector exceeds the maximum storage size, the existing local vectors are scattered into the global vector before the new vector is created.
idx | a range of (global idx, local idx) pairs sorted by global index |
Definition at line 142 of file localVectors.hh.
|
inline |
Scatters the local vectors into the global one and removes them from the local container.
This is generally not necessary, as the LocalVectors class scatters automatically as soon as its buffer is filled, and also on destruction. Use this only if you need to control the specific time point at which scattering occurs.
Definition at line 182 of file localVectors.hh.
Referenced by Kaskade::LocalVectors< Entry, SortedIdx, Vector >::push_back(), and Kaskade::LocalVectors< Entry, SortedIdx, Vector >::~LocalVectors().
|
inline |
The number of local vectors that are stored.
Definition at line 173 of file localVectors.hh.
Referenced by Kaskade::LocalVectors< Entry, SortedIdx, Vector >::push_back().
|
inline |
reports the size of the local vectors storage in bytes
Definition at line 232 of file localVectors.hh.