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.
Public Types | Public Member Functions | List of all members
Kratos::ResultsProxy< TPointerDataType, TFunctorType > Class Template Reference

A template class to proxy results, whether they are locally or remotely owned. More...

#include <pointer_communicator.h>

Collaboration diagram for Kratos::ResultsProxy< TPointerDataType, TFunctorType >:

Public Types

using TSendType = std::invoke_result_t< TFunctorType, GlobalPointer< TPointerDataType > & >
 Type alias for the result of applying the functor to a global pointer of TPointerDataType. More...
 

Public Member Functions

 ResultsProxy (int current_rank, GlobalPointersUnorderedMap< TPointerDataType, TSendType > NonLocalData, TFunctorType UserFunctor, GlobalPointerCommunicator< TPointerDataType > *pPointerComm)
 Constructor. More...
 
virtual ~ResultsProxy ()
 Destructor. More...
 
TSendType Get (GlobalPointer< TPointerDataType > &rGlobalPointer) const
 Returns the effect of "user_function(rGlobalPointer)" whether the rGlobalPointer is locally or remotely owned. More...
 
TSendType Get (const GlobalPointer< TPointerDataType > &rGlobalPointer) const
 Overload for constant GlobalPointer. More...
 
bool Has (GlobalPointer< TPointerDataType > &rGlobalPointer) const
 Checks if the node has the GlobalPointer. More...
 
bool Has (const GlobalPointer< TPointerDataType > &rGlobalPointer) const
 Overload for constant GlobalPointer. More...
 
void Update ()
 Updates the NonLocalData using the user functor and communicator. More...
 

Detailed Description

template<class TPointerDataType, class TFunctorType>
class Kratos::ResultsProxy< TPointerDataType, TFunctorType >

A template class to proxy results, whether they are locally or remotely owned.

This class acts as a proxy for results. It holds data in a map and applies the user-provided functor to it. If data is locally owned, it applies the functor directly. If the data is remotely owned, it retrieves it from the map.

Template Parameters
TPointerDataType- The datatype for the pointer.
TFunctorType- The functor type to be used in processing.

Member Typedef Documentation

◆ TSendType

template<class TPointerDataType , class TFunctorType >
using Kratos::ResultsProxy< TPointerDataType, TFunctorType >::TSendType = std::invoke_result_t<TFunctorType,GlobalPointer<TPointerDataType>&>

Type alias for the result of applying the functor to a global pointer of TPointerDataType.

Constructor & Destructor Documentation

◆ ResultsProxy()

template<class TPointerDataType , class TFunctorType >
Kratos::ResultsProxy< TPointerDataType, TFunctorType >::ResultsProxy ( int  current_rank,
GlobalPointersUnorderedMap< TPointerDataType, TSendType NonLocalData,
TFunctorType  UserFunctor,
GlobalPointerCommunicator< TPointerDataType > *  pPointerComm 
)
inline

Constructor.

Parameters
current_rankCurrent rank of the node.
NonLocalDataData that is not local to the node.
UserFunctorFunctor to be used for computation.
pPointerCommPointer to the communicator.

◆ ~ResultsProxy()

template<class TPointerDataType , class TFunctorType >
virtual Kratos::ResultsProxy< TPointerDataType, TFunctorType >::~ResultsProxy ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Get() [1/2]

template<class TPointerDataType , class TFunctorType >
TSendType Kratos::ResultsProxy< TPointerDataType, TFunctorType >::Get ( const GlobalPointer< TPointerDataType > &  rGlobalPointer) const
inline

Overload for constant GlobalPointer.

Parameters
rGlobalPointerThe constant pointer that is being checked.
Returns
The result of applying the functor to the pointer.

◆ Get() [2/2]

template<class TPointerDataType , class TFunctorType >
TSendType Kratos::ResultsProxy< TPointerDataType, TFunctorType >::Get ( GlobalPointer< TPointerDataType > &  rGlobalPointer) const
inline

Returns the effect of "user_function(rGlobalPointer)" whether the rGlobalPointer is locally or remotely owned.

Parameters
rGlobalPointerThe pointer that is being checked.
Returns
The result of applying the functor to the pointer.

◆ Has() [1/2]

template<class TPointerDataType , class TFunctorType >
bool Kratos::ResultsProxy< TPointerDataType, TFunctorType >::Has ( const GlobalPointer< TPointerDataType > &  rGlobalPointer) const
inline

Overload for constant GlobalPointer.

Parameters
rGlobalPointerThe constant pointer that is being checked.
Returns
True if the node has the pointer, otherwise False.

◆ Has() [2/2]

template<class TPointerDataType , class TFunctorType >
bool Kratos::ResultsProxy< TPointerDataType, TFunctorType >::Has ( GlobalPointer< TPointerDataType > &  rGlobalPointer) const
inline

Checks if the node has the GlobalPointer.

Parameters
rGlobalPointerThe pointer that is being checked.
Returns
True if the node has the pointer, otherwise False.

◆ Update()

template<class TPointerDataType , class TFunctorType >
void Kratos::ResultsProxy< TPointerDataType, TFunctorType >::Update ( )
inline

Updates the NonLocalData using the user functor and communicator.


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