KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
A template class for handling communication related to global pointers. More...
#include <pointer_communicator.h>
Public Member Functions | |
Type Definitions | |
KRATOS_CLASS_POINTER_DEFINITION (GlobalPointerCommunicator) | |
Pointer definition of GlobalPointerCommunicator. More... | |
Life Cycle | |
GlobalPointerCommunicator (const DataCommunicator &rComm, GlobalPointersVector< TPointerDataType > &rGpList) | |
Default constructor. More... | |
template<class TIteratorType > | |
GlobalPointerCommunicator (const DataCommunicator &rComm, TIteratorType itBegin, TIteratorType itEnd) | |
Constructor with iterator range for global pointers. More... | |
template<class TFunctorType > | |
GlobalPointerCommunicator (const DataCommunicator &rComm, TFunctorType rFunctor) | |
Constructor with functor for generating global pointers. More... | |
template<class TFunctorType > | |
GlobalPointerCommunicator (TFunctorType rFunctor) | |
Constructor with functor and default data communicator. More... | |
virtual | ~GlobalPointerCommunicator () |
Destructor. More... | |
template<class TFunctorType > | |
ResultsProxy< TPointerDataType, TFunctorType > | Apply (TFunctorType &&UserFunctor) |
Applies a user-provided function to the global pointers and return a proxy to the results. More... | |
template<class TFunctorType > | |
void | Update (TFunctorType &rUserFunctor, GlobalPointersUnorderedMap< TPointerDataType, typename ResultsProxy< TPointerDataType, TFunctorType >::TSendType > &rNonLocalData) |
Updates the non-local data using a user-provided function. More... | |
Access | |
const DataCommunicator & | GetDataCommunicator () const |
Returns the data communicator. More... | |
Input and output | |
virtual std::string | Info () const |
Turn back information as a string. More... | |
virtual void | PrintInfo (std::ostream &rOStream) const |
Print information about this object. More... | |
virtual void | PrintData (std::ostream &rOStream) const |
Print object's data. More... | |
Protected Member Functions | |
Protected Operators | |
template<class TIteratorType > | |
void | AddPointers (TIteratorType begin, TIteratorType end) |
Adds global pointers to the communicator. More... | |
void | ComputeCommunicationPlan () |
Computes the communication plan for the communicator. More... | |
Protected Attributes | |
Protected static Member Variables | |
std::unordered_map< int, GlobalPointersVector< TPointerDataType > > | mNonLocalPointers |
const DataCommunicator & | mrDataCommunicator |
Non local pointers stored as map with rank as key. More... | |
A template class for handling communication related to global pointers.
This class manages communication related to global pointers of a specified type. It is responsible for creating a communication plan for sending/receiving global pointers, and for applying a user-provided function to global pointers.
TPointerDataType | The datatype for the pointer. |
|
inline |
Default constructor.
rComm | The data communicator. |
rGpList | List of global pointers to be added. |
|
inline |
Constructor with iterator range for global pointers.
TIteratorType | Iterator type. |
rComm | The data communicator. |
itBegin | Beginning of the range. |
itEnd | End of the range. |
|
inline |
Constructor with functor for generating global pointers.
TFunctorType | Functor type. |
rComm | The data communicator. |
rFunctor | The functor for generating global pointers. |
|
inline |
Constructor with functor and default data communicator.
TFunctorType | Functor type. |
rFunctor | The functor for generating global pointers. |
|
inlinevirtual |
Destructor.
|
inlineprotected |
Adds global pointers to the communicator.
This function adds the global pointers from the provided range to the communicator. It only adds the pointers that are not on the current rank. After adding the pointers, it ensures that no repeated information is stored.
TIteratorType | Iterator type. |
begin | Beginning of the range of global pointers. |
end | End of the range of global pointers. |
|
inline |
Applies a user-provided function to the global pointers and return a proxy to the results.
TFunctorType | Functor type. |
UserFunctor | The user-provided function. |
|
inlineprotected |
Computes the communication plan for the communicator.
This function computes the communication plan based on the ranks of the non-local pointers. It determines the scheduling for the communication, which is stored in the 'mColors' member variable.
|
inline |
Returns the data communicator.
|
inlinevirtual |
Turn back information as a string.
Kratos::GlobalPointerCommunicator< TPointerDataType >::KRATOS_CLASS_POINTER_DEFINITION | ( | GlobalPointerCommunicator< TPointerDataType > | ) |
Pointer definition of GlobalPointerCommunicator.
|
inlinevirtual |
Print object's data.
|
inlinevirtual |
Print information about this object.
|
inline |
Updates the non-local data using a user-provided function.
TFunctorType | Functor type. |
rUserFunctor | The user-provided function. |
rNonLocalData | Non-local data to be updated. |
|
protected |
|
protected |
Non local pointers stored as map with rank as key.