| FEAT 3
    Finite Element Analysis Toolbox | 
Communication Request vector class. More...
#include <dist.hpp>
| Public Member Functions | |
| RequestVector () | |
| Standard constructor.  More... | |
| RequestVector (const RequestVector &)=delete | |
| request vectors are non-copyable | |
| RequestVector (RequestVector &&other) | |
| Move constructor.  More... | |
| RequestVector (std::size_t size_) | |
| Sized constructor.  More... | |
| virtual | ~RequestVector () | 
| virtual destructor  More... | |
| std::size_t | active_count () const | 
| Returns the number of active requests in the vector.  More... | |
| void | cancel () | 
| Cancels all remaining active requests.  More... | |
| void | clear () | 
| Clears the request vector.  More... | |
| std::size_t | compress () | 
| Compresses the request vector.  More... | |
| bool | empty () const | 
| Checks whether the request vector is empty.  More... | |
| void | free () | 
| Frees all remaining active requests.  More... | |
| Request & | get_request (std::size_t idx) | 
| Returns a (const) reference to a single request in the vector.  More... | |
| const Request & | get_request (std::size_t idx) const | 
| Returns a (const) reference to a single request in the vector.   More... | |
| Status & | get_status (std::size_t idx) | 
| Returns a (const) reference to a single status in the vector.  More... | |
| const Status & | get_status (std::size_t idx) const | 
| Returns a (const) reference to a single status in the vector.   More... | |
| bool | is_null () const | 
| Checks whether all requests are null requests.  More... | |
| RequestVector & | operator= (const RequestVector &)=delete | 
| request vectors are non-copyable | |
| RequestVector & | operator= (RequestVector &&other) | 
| Move-assignment operator.  More... | |
| Request & | operator[] (std::size_t idx) | 
| Returns a (const) reference to a single request in the vector.   More... | |
| const Request & | operator[] (std::size_t idx) const | 
| Returns a (const) reference to a single request in the vector.   More... | |
| void | push_back (Request &&request) | 
| Inserts a new request at the end of the request vector.  More... | |
| void | reserve (std::size_t size_) | 
| Reserves sufficient space for a specified number of requests.  More... | |
| void | resize (std::size_t size_) | 
| Resizes the request vector.  More... | |
| std::size_t | size () const | 
| Returns the total number of (both active and null) requests in the vector.  More... | |
| bool | test_all () | 
| Tests whether all active requests are fulfilled (or null).  More... | |
| bool | test_any (Status &status) | 
| Tests whether one of the active requests has been fulfilled.  More... | |
| bool | test_any (std::size_t &idx) | 
| Tests whether one of the active requests has been fulfilled.  More... | |
| bool | test_any (std::size_t &idx, Status &status) | 
| Tests whether one of the active requests has been fulfilled.  More... | |
| bool | test_for (std::size_t idx) | 
| Tests whether a specific request is fulfilled (or null).  More... | |
| bool | test_for (std::size_t idx, Status &status) | 
| Tests whether a specific request is fulfilled (or null).  More... | |
| void | wait_all () | 
| Blocks until all active requests are fulfilled.  More... | |
| bool | wait_any (Status &status) | 
| Blocks until one of the active requests has been fulfilled.  More... | |
| bool | wait_any (std::size_t &idx) | 
| Blocks until one of the active requests has been fulfilled.  More... | |
| bool | wait_any (std::size_t &idx, Status &status) | 
| Blocks until one of the active requests has been fulfilled.  More... | |
| bool | wait_for (std::size_t idx) | 
| Blocks until a specific request is fulfilled (or null).  More... | |
| bool | wait_for (std::size_t idx, Status &status) | 
| Blocks until a specific request is fulfilled (or null).  More... | |
| Private Attributes | |
| std::vector< Request > | _reqs | 
| internal vector of Request objects  More... | |
| std::vector< Status > | _stats | 
| internal vector of Status objects  More... | |
Communication Request vector class.
This class encapsulates vectors of Request and Status objects, which can be used to manage a (related) set of requests. This class also offers the corresponding wait and test wrapper functions to check for the completion of a single, multiple or all requests.
This class is move-constructible and move-assignable, but objects of this class are non-copyable.
Waiting for completion:
There are two common scenarios regarding the completion of a request vector:
The second of the above scenarios can be easily implemented by using a for or while loop and the wait_any() function: 
| 
 | inline | 
| 
 | inlineexplicit | 
| 
 | inline | 
| 
 | inlinevirtual | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
Clears the request vector.
This function sets the size of the request vector to zero.
| 
 | inline | 
Compresses the request vector.
This function removes all null requests (and their corresponding statuses) from the vector and resizes the vector to the size of the remaining active requests.
| 
 | inline | 
Checks whether the request vector is empty.
This function checks whether there are neither active nor null requests in the vector.
true, if there are no requests in the vector, otherwise false. Definition at line 937 of file dist.hpp.
References _reqs.
| 
 | inline | 
Frees all remaining active requests.
This function frees all active requests, but does not resize or clear the vector. Upon exit, the vector consists only of null requests (or no requests at all).
Definition at line 974 of file dist.hpp.
References _reqs.
| 
 | inline | 
Returns a (const) reference to a single request in the vector.
| [in] | idx | The index of the request to be returned. | 
Definition at line 755 of file dist.hpp.
References _reqs, and XASSERT.
Referenced by FEAT::Global::SynchMatrix< MT_, VMT_ >::exec(), test_for(), and wait_for().
| 
 | inline | 
| 
 | inline | 
Returns a (const) reference to a single status in the vector.
| [in] | idx | The index of the status to be returned. | 
Definition at line 777 of file dist.hpp.
References _stats, and XASSERT.
Referenced by test_for(), and wait_for().
| 
 | inline | 
| 
 | inline | 
Checks whether all requests are null requests.
This function checks whether are no active requests left in the vector.
true, if all requests are null, or false, if there exists at least one active request in the vector. Definition at line 954 of file dist.hpp.
References _reqs.
Referenced by ~RequestVector(), clear(), compress(), FEAT::Global::AlgDofPartiVector< LocalVector_, Mirror_ >::download(), and operator=().
| 
 | inline | 
Move-assignment operator.
This operator moves the input request vector into this request vector object and clears the input request vector other.
this must be a null request, i.e. it must not contain any active requests, as this operator will fire an assertion failure otherwise!| [in,out] | other | The source request vector that is to be moved. | 
*this. | 
 | inline | 
| 
 | inline | 
| 
 | inline | 
Inserts a new request at the end of the request vector.
This function also reserves a new internal Status object for the request.
| [in,out] | request | The request that is to be inserted into the vector. This object is set to a null request upon exit of this function. | 
Definition at line 886 of file dist.hpp.
Referenced by FEAT::Global::SynchVectorTicket< VT_, VMT_ >::SynchVectorTicket(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_calc_shortest_edge(), FEAT::Geometry::GlobalMaskedBoundaryFactory< ParentMesh_ >::_sync_bnd_masks(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_synchronize(), FEAT::Geometry::DistributedUmbrellaSmoother< MeshType_ >::_synchronize(), and FEAT::Assembly::StokesFBMAssembler< MeshType_ >::sync().
| 
 | inline | 
Reserves sufficient space for a specified number of requests.
This function effectively wraps around the reserve() function of the internal std::vector objects.
| [in] | size_ | The minimum number of requests that space is to be reserved for. | 
Definition at line 813 of file dist.hpp.
Referenced by FEAT::Global::SynchVectorTicket< VT_, VMT_ >::SynchVectorTicket(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_calc_shortest_edge(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_synchronize(), FEAT::Geometry::DistributedUmbrellaSmoother< MeshType_ >::_synchronize(), and FEAT::Assembly::StokesFBMAssembler< MeshType_ >::sync().
| 
 | inline | 
Resizes the request vector.
This function effectively wraps around the resize() function of the internal std::vector objects.
| [in] | size_ | The new number of requests to be managed. | 
| 
 | inline | 
Returns the total number of (both active and null) requests in the vector.
Definition at line 901 of file dist.hpp.
References _reqs.
| bool FEAT::Dist::RequestVector::test_all | ( | ) | 
Tests whether all active requests are fulfilled (or null).
true, if all requests are fulfilled, of false, if there at least one active request remains.| 
 | inline | 
Tests whether one of the active requests has been fulfilled.
| [out] | status | A transient reference to the Status object that receives information about the active request that has been fulfilled by this call. | 
true, if a previously active request has been fulfilled by this call, or false, if no active request has been fulfilled or if there were no active requests left prior to the call of this function. Definition at line 1137 of file dist.hpp.
References test_any().
| 
 | inline | 
Tests whether one of the active requests has been fulfilled.
| [out] | idx | A transient reference that receives the index of the previously active request that has been fulfilled by this call. | 
true, the corresponding Status object can be queried by get_status().true, if a previously active request has been fulfilled by this call, or false, if no active request has been fulfilled or if there were no active requests left prior to the call of this function. Definition at line 1112 of file dist.hpp.
References _stats, and test_any().
| bool FEAT::Dist::RequestVector::test_any | ( | std::size_t & | idx, | 
| Status & | status | ||
| ) | 
Tests whether one of the active requests has been fulfilled.
| [out] | idx | A transient reference that receives the index of the previously active request that has been fulfilled by this call. | 
| [out] | status | A transient reference to the Status object that receives information about the active request that has been fulfilled by this call. | 
true, if a previously active request has been fulfilled by this call, or false, if no active request has been fulfilled or if there were no active requests left prior to the call of this function.Definition at line 290 of file dist.cpp.
References FEAT::Dist::Status::mpi_status().
Referenced by test_any().
| 
 | inline | 
Tests whether a specific request is fulfilled (or null).
| [in] | idx | The index of the request that is to be tested. | 
true, the corresponding Status object can be queried by get_status().true, if the corresponding request is fulfilled, or false, if the request is still active. Definition at line 1033 of file dist.hpp.
References get_request(), get_status(), and FEAT::Dist::Request::test().
| 
 | inline | 
Tests whether a specific request is fulfilled (or null).
| [in] | idx | The index of the request that is to be tested. | 
| [out] | status | A transient reference to the Status object that receives information about the request, if it was fulfilled by this call. | 
true, if the corresponding request is fulfilled, or false, if the request is still active. Definition at line 1054 of file dist.hpp.
References get_request(), and FEAT::Dist::Request::test().
| void FEAT::Dist::RequestVector::wait_all | ( | ) | 
Blocks until all active requests are fulfilled.
Definition at line 324 of file dist.cpp.
Referenced by FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::_apply(), FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::_assemble_buffers(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_calc_shortest_edge(), FEAT::Control::Domain::VoxelDomainControl< DomainLevel_ >::_deslag_patch_halos(), FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::_split_basemesh_halos(), FEAT::Geometry::GlobalMaskedBoundaryFactory< ParentMesh_ >::_sync_bnd_masks(), FEAT::Geometry::DistributedUmbrellaSmoother< MeshType_ >::_synchronize(), FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::asm_adp_symbolic(), FEAT::Global::AlgDofParti< LAFEM::DenseVector< DT_, IT_ >, LAFEM::VectorMirror< DT_, IT_ > >::assemble_by_gate(), FEAT::Global::AlgDofPartiVector< LocalVector_, Mirror_ >::download(), FEAT::Global::SynchMatrix< MT_, VMT_ >::exec(), FEAT::Global::SynchMatrix< MT_, VMT_ >::init(), FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::init_numeric(), FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::init_symbolic(), FEAT::Assembly::StokesFBMAssembler< MeshType_ >::sync(), FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::upload_numeric(), and FEAT::Global::SynchVectorTicket< VT_, VMT_ >::wait().
| 
 | inline | 
Blocks until one of the active requests has been fulfilled.
| [out] | status | A transient reference to the Status object that receives information about the active request that has been fulfilled by this call. | 
true, if a previously active request has been fulfilled by this call, or false, if there were no active requests left upon call of this function.while loop as this function only returns false when all active requests have been fulfilled. Definition at line 1267 of file dist.hpp.
References wait_any().
| 
 | inline | 
Blocks until one of the active requests has been fulfilled.
| [out] | idx | A transient reference that receives the index of the previously active request that has been fulfilled by this call. | 
true, the corresponding Status object can be queried by get_status().true, if a previously active request has been fulfilled by this call, or false, if there were no active requests left upon call of this function.while loop as this function only returns false when all active requests have been fulfilled. Definition at line 1239 of file dist.hpp.
References _stats, and wait_any().
| bool FEAT::Dist::RequestVector::wait_any | ( | std::size_t & | idx, | 
| Status & | status | ||
| ) | 
Blocks until one of the active requests has been fulfilled.
| [out] | idx | A transient reference that receives the index of the previously active request that has been fulfilled by this call. | 
| [out] | status | A transient reference to the Status object that receives information about the active request that has been fulfilled by this call. | 
true, if a previously active request has been fulfilled by this call, or false, if there were no active requests left upon call of this function.while loop as this function only returns false when all active requests have been fulfilled.Definition at line 329 of file dist.cpp.
References FEAT::Dist::Status::mpi_status().
Referenced by FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_calc_shortest_edge(), FEAT::Geometry::DistributedMeshDistortion< MeshType_ >::_synchronize(), FEAT::Geometry::DistributedUmbrellaSmoother< MeshType_ >::_synchronize(), FEAT::Global::AlgDofParti< LAFEM::DenseVector< DT_, IT_ >, LAFEM::VectorMirror< DT_, IT_ > >::assemble_by_gate(), FEAT::Global::AlgDofPartiVector< LocalVector_, Mirror_ >::download(), FEAT::Global::SynchMatrix< MT_, VMT_ >::exec(), FEAT::Global::AlgDofPartiMatrix< LocalMatrix_, Mirror_ >::upload_numeric(), FEAT::Global::SynchVectorTicket< VT_, VMT_ >::wait(), and wait_any().
| 
 | inline | 
Blocks until a specific request is fulfilled (or null).
| [in] | idx | The index of the request that is to be waited for. | 
true, if the corresponding request was fulfilled by this call, or false, if the corresponding request was already null prior to this call. Definition at line 1156 of file dist.hpp.
References get_request(), get_status(), and FEAT::Dist::Request::wait().
| 
 | inline | 
Blocks until a specific request is fulfilled (or null).
| [in] | idx | The index of the request that is to be waited for. | 
| [out] | status | A transient reference to the Status object that receives information about the request, if it was fulfilled by this call. | 
true, if the corresponding request was fulfilled by this call, or false, if the corresponding request was already null prior to this call. Definition at line 1179 of file dist.hpp.
References get_request(), and FEAT::Dist::Request::wait().
| 
 | private | 
internal vector of Request objects
Definition at line 643 of file dist.hpp.
Referenced by active_count(), cancel(), clear(), compress(), empty(), free(), get_request(), is_null(), operator=(), operator[](), push_back(), reserve(), resize(), and size().
| 
 | private | 
internal vector of Status objects
Definition at line 645 of file dist.hpp.
Referenced by clear(), compress(), get_status(), operator=(), push_back(), reserve(), resize(), test_any(), and wait_any().