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.
List of all members
Kratos::GlobalPointerCommunicator< TPointerDataType > Class Template Reference

A template class for handling communication related to global pointers. More...

#include <pointer_communicator.h>

Collaboration diagram for Kratos::GlobalPointerCommunicator< TPointerDataType >:

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 DataCommunicatorGetDataCommunicator () 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 DataCommunicatormrDataCommunicator
 Non local pointers stored as map with rank as key. More...
 

Detailed Description

template<class TPointerDataType>
class Kratos::GlobalPointerCommunicator< TPointerDataType >

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.

Template Parameters
TPointerDataTypeThe datatype for the pointer.

Constructor & Destructor Documentation

◆ GlobalPointerCommunicator() [1/4]

template<class TPointerDataType >
Kratos::GlobalPointerCommunicator< TPointerDataType >::GlobalPointerCommunicator ( const DataCommunicator rComm,
GlobalPointersVector< TPointerDataType > &  rGpList 
)
inline

Default constructor.

Parameters
rCommThe data communicator.
rGpListList of global pointers to be added.

◆ GlobalPointerCommunicator() [2/4]

template<class TPointerDataType >
template<class TIteratorType >
Kratos::GlobalPointerCommunicator< TPointerDataType >::GlobalPointerCommunicator ( const DataCommunicator rComm,
TIteratorType  itBegin,
TIteratorType  itEnd 
)
inline

Constructor with iterator range for global pointers.

Template Parameters
TIteratorTypeIterator type.
Parameters
rCommThe data communicator.
itBeginBeginning of the range.
itEndEnd of the range.

◆ GlobalPointerCommunicator() [3/4]

template<class TPointerDataType >
template<class TFunctorType >
Kratos::GlobalPointerCommunicator< TPointerDataType >::GlobalPointerCommunicator ( const DataCommunicator rComm,
TFunctorType  rFunctor 
)
inline

Constructor with functor for generating global pointers.

Template Parameters
TFunctorTypeFunctor type.
Parameters
rCommThe data communicator.
rFunctorThe functor for generating global pointers.

◆ GlobalPointerCommunicator() [4/4]

template<class TPointerDataType >
template<class TFunctorType >
Kratos::GlobalPointerCommunicator< TPointerDataType >::GlobalPointerCommunicator ( TFunctorType  rFunctor)
inline

Constructor with functor and default data communicator.

Template Parameters
TFunctorTypeFunctor type.
Parameters
rFunctorThe functor for generating global pointers.

◆ ~GlobalPointerCommunicator()

template<class TPointerDataType >
virtual Kratos::GlobalPointerCommunicator< TPointerDataType >::~GlobalPointerCommunicator ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ AddPointers()

template<class TPointerDataType >
template<class TIteratorType >
void Kratos::GlobalPointerCommunicator< TPointerDataType >::AddPointers ( TIteratorType  begin,
TIteratorType  end 
)
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.

Template Parameters
TIteratorTypeIterator type.
Parameters
beginBeginning of the range of global pointers.
endEnd of the range of global pointers.

◆ Apply()

template<class TPointerDataType >
template<class TFunctorType >
ResultsProxy< TPointerDataType, TFunctorType > Kratos::GlobalPointerCommunicator< TPointerDataType >::Apply ( TFunctorType &&  UserFunctor)
inline

Applies a user-provided function to the global pointers and return a proxy to the results.

Template Parameters
TFunctorTypeFunctor type.
Parameters
UserFunctorThe user-provided function.
Returns
A proxy to the results.

◆ ComputeCommunicationPlan()

template<class TPointerDataType >
void Kratos::GlobalPointerCommunicator< TPointerDataType >::ComputeCommunicationPlan ( )
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.

◆ GetDataCommunicator()

template<class TPointerDataType >
const DataCommunicator& Kratos::GlobalPointerCommunicator< TPointerDataType >::GetDataCommunicator ( ) const
inline

Returns the data communicator.

Returns
The data communicator.

◆ Info()

template<class TPointerDataType >
virtual std::string Kratos::GlobalPointerCommunicator< TPointerDataType >::Info ( ) const
inlinevirtual

Turn back information as a string.

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TPointerDataType >
Kratos::GlobalPointerCommunicator< TPointerDataType >::KRATOS_CLASS_POINTER_DEFINITION ( GlobalPointerCommunicator< TPointerDataType >  )

Pointer definition of GlobalPointerCommunicator.

◆ PrintData()

template<class TPointerDataType >
virtual void Kratos::GlobalPointerCommunicator< TPointerDataType >::PrintData ( std::ostream &  rOStream) const
inlinevirtual

Print object's data.

◆ PrintInfo()

template<class TPointerDataType >
virtual void Kratos::GlobalPointerCommunicator< TPointerDataType >::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

Print information about this object.

◆ Update()

template<class TPointerDataType >
template<class TFunctorType >
void Kratos::GlobalPointerCommunicator< TPointerDataType >::Update ( TFunctorType &  rUserFunctor,
GlobalPointersUnorderedMap< TPointerDataType, typename ResultsProxy< TPointerDataType, TFunctorType >::TSendType > &  rNonLocalData 
)
inline

Updates the non-local data using a user-provided function.

Template Parameters
TFunctorTypeFunctor type.
Parameters
rUserFunctorThe user-provided function.
rNonLocalDataNon-local data to be updated.

Member Data Documentation

◆ mNonLocalPointers

template<class TPointerDataType >
std::unordered_map<int, GlobalPointersVector< TPointerDataType > > Kratos::GlobalPointerCommunicator< TPointerDataType >::mNonLocalPointers
protected

◆ mrDataCommunicator

template<class TPointerDataType >
const DataCommunicator& Kratos::GlobalPointerCommunicator< TPointerDataType >::mrDataCommunicator
protected

Non local pointers stored as map with rank as key.


The documentation for this class was generated from the following file: