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::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor > Class Template Reference

Proxy class to update local and non-local data. More...

#include <pointer_map_communicator.h>

Collaboration diagram for Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >:

Public Types

Type definitions
using ProxyType = ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >
 
using TGPMapCommunicator = GlobalPointerMapCommunicator< TPointerDataType, TValueDataType >
 
using GlobalPointerType = GlobalPointer< TPointerDataType >
 
using DataVectorType = std::vector< TValueDataType >
 

Public Member Functions

Life cycle
 ApplyProxy (const TApplyFunctor &rApplyFunctor, TGPMapCommunicator &rPointerCommunicator)
 Construct a new Apply Proxy object. More...
 
Public operations
void Assign (GlobalPointerType &rGlobalPointer, const TValueDataType &rValue)
 Assigns value of the GlobalPointer. More...
 
void SendAndApplyRemotely ()
 This method does all the communication. More...
 

Friends

Friend class definitions
class GlobalPointerMapCommunicator< TPointerDataType, TValueDataType >
 

Detailed Description

template<class TPointerDataType, class TValueDataType, class TApplyFunctor>
class Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >

Proxy class to update local and non-local data.

This class is used to update local and non-local data with given TApplyFunctor and TApplyFunctor is used to update local TPointerDataType data, Data belonging to remote gps will be stored, and applied after communication in their owning rank.

Example:

  1. Initial values Node id Rank TEMPERATURE 1 0 10 2 1 20 3 2 5
  2. Apply Update method with following Global Pointer map Rank: 0 Map Key (using node id) TEMPERATURE 1 5 2 10

    Rank: 1 Map Key (using node id) TEMPERATURE 1 6 3 2

    Rank: 2 Empty Global Pointer map

  3. Resulting values after SendAndApplyRemotely method call Node id Rank TEMPERATURE 1 0 10 + 5 + 6 = 21 2 1 20 + 10 = 30 3 2 5 + 2 = 7

Signature of TApplyFunctor: void(TPointerDataType& rPointerDataTypeObject, const TValueDataType& NewValue)

Template Parameters
TPointerDataType
TValueDataType
TApplyFunctor

Member Typedef Documentation

◆ DataVectorType

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
using Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::DataVectorType = std::vector<TValueDataType>

◆ GlobalPointerType

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
using Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::GlobalPointerType = GlobalPointer<TPointerDataType>

◆ ProxyType

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
using Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::ProxyType = ApplyProxy<TPointerDataType, TValueDataType, TApplyFunctor>

◆ TGPMapCommunicator

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
using Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::TGPMapCommunicator = GlobalPointerMapCommunicator<TPointerDataType, TValueDataType>

Constructor & Destructor Documentation

◆ ApplyProxy()

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::ApplyProxy ( const TApplyFunctor &  rApplyFunctor,
TGPMapCommunicator rPointerCommunicator 
)
inline

Construct a new Apply Proxy object.

Parameters
rApplyFunctorThread safe update lambda method
rPointerCommunicatorMap communicator

Member Function Documentation

◆ Assign()

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
void Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::Assign ( GlobalPointerType rGlobalPointer,
const TValueDataType &  rValue 
)
inline

Assigns value of the GlobalPointer.

This method assigns gp value by rValue using mrApplyFunctor in the case if given rGlobalPointer is a local gp, otherwise mrNonLocalGlobalPointerMapsVector and mrNonLocalDataValueMapsVector are used to store new gp and value, which will be used in mpi communication.

In the case of serial job, this method calls AssignLocalData, where no checks are done to ensure gps are local because all gps are local.

In case of distributed job, this method calls AssignLocalAndRemoteData where checks are performed to identify gps are local or non-local, based on that mrApplyFunctor methods are called or values corresponding to remote gps are stored.

This does not have additional cost in serial run (except for function pointer call)

See also
GlobalPointerMapCommunicator
Parameters
rGPGlobal pointer of the destination
rValueValue to be used in assigning

◆ SendAndApplyRemotely()

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
void Kratos::ApplyProxy< TPointerDataType, TValueDataType, TApplyFunctor >::SendAndApplyRemotely ( )
inline

This method does all the communication.

This method should be called once (or least amount of times) since this involves doing mpi communication to update remote gp values.

This does not have any cost in the serial run.

Ghost mesh synchronization needs to be done afterwards.

Friends And Related Function Documentation

◆ GlobalPointerMapCommunicator< TPointerDataType, TValueDataType >

template<class TPointerDataType , class TValueDataType , class TApplyFunctor >
friend class GlobalPointerMapCommunicator< TPointerDataType, TValueDataType >
friend

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