MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::sendrecv::FromMacro2MD< Cell_T, dim > Class Template Reference

SendReceiveBuffer for transfer of quantities from a macroscopic solver to the coupling cells. Derived from the class coupling::sendrecv::SendReceiveBuffer. More...

#include <FromMacro2MD.h>

Inheritance diagram for coupling::sendrecv::FromMacro2MD< Cell_T, dim >:
Collaboration diagram for coupling::sendrecv::FromMacro2MD< Cell_T, dim >:

Public Types

using Local_Container_T = coupling::datastructures::CellContainer<I02, dim>
 

Public Member Functions

 FromMacro2MD ()
 
virtual ~FromMacro2MD ()
 
template<class Container_T>
void sendFromMacro2MD (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Local_Container_T &dst, const Container_T &src)
 
template<class Container_T>
void bcastFromMacro2MD (std::vector< coupling::sendrecv::DataExchangeFromMacro2MD< dim > * > &dataExchangeFromCouplingCellServices, const Container_T &src, std::vector< Local_Container_T > dst)
 
template<class Container_T>
void sendFromMacro2MDNonBlocking (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 
void wait4SendFromMacro2MD (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Local_Container_T &cells)
 
- Public Member Functions inherited from coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >
 SendReceiveBuffer ()
 
virtual ~SendReceiveBuffer ()
 

Private Member Functions

template<class Container_T>
void writeToSendBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 
template<class Container_T>
void writeToSendBufferCollective (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 
void allocateReceiveBuffers (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void allocateReceiveBuffersCollective (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void readFromReceiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Local_Container_T &cells)
 
void readFromCollectiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Local_Container_T &cells)
 

Additional Inherited Members

- Protected Member Functions inherited from coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >
void deleteBuffers ()
 deletes the buffers
 
template<class Container_T>
void writeToSendBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 fills all information that needs to be sent from a coupling cell into the send-buffer.
 
void writeToBcastBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Cell_T &cell, I01 idx)
 fills all information that needs to be broadcast from a coupling cell into the broadcast-buffer.
 
void writeToReduceBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Cell_T &cell, I01 idx)
 fills all information that needs to be reduced to a coupling cell into the reduce-buffer.
 
template<class Container_T>
void readFromReceiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 
void readFromCollectiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, Cell_T &couplingCell, I01 idx)
 
void readFromReduceBuffer (coupling::sendrecv::DataExchangeFromMD2Macro< dim > &dataExchange, Cell_T &couplingCell, I01 idx)
 
void allocateReceiveBuffers (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void allocateBcastBufferForReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void allocateReduceBufferForReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void triggerSending (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void triggerBcasts (unsigned int rank)
 
void triggerReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void triggerReduce (unsigned int rank)
 
void waitAllOperations ()
 
void waitAllCollectiveOperations ()
 
void allocateRequests ()
 
void allocateBcastRequests (unsigned int thisRank)
 
void allocateReduceRequests (unsigned int thisRank)
 

Detailed Description

template<class Cell_T, unsigned int dim>
class coupling::sendrecv::FromMacro2MD< Cell_T, dim >

SendReceiveBuffer for transfer of quantities from a macroscopic solver to the coupling cells. Derived from the class coupling::sendrecv::SendReceiveBuffer.

extends the generic SendReceiveBuffer for transfer of quantities from a macroscopic solver to the coupling cells of the coupling tool (incl. ghost cells).

Template Parameters
Cell_Tcell type
dimNumber of dimensions; it can be 1, 2 or 3
Author
Philipp Neumann

Constructor & Destructor Documentation

◆ FromMacro2MD()

template<class Cell_T, unsigned int dim>
coupling::sendrecv::FromMacro2MD< Cell_T, dim >::FromMacro2MD ( )
inline

Constructor, just calling the constructor of the coupling::sendrecv::SendReceiveBuffer

◆ ~FromMacro2MD()

template<class Cell_T, unsigned int dim>
virtual coupling::sendrecv::FromMacro2MD< Cell_T, dim >::~FromMacro2MD ( )
inlinevirtual

Destructor

Member Function Documentation

◆ allocateReceiveBuffers()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::allocateReceiveBuffers ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange)
private

allocates the receive buffers for the macroscopic solver. Since we want to obtain data on the side of MaMiCo, we can just loop over all local coupling cells of the coupling tool and call allocateReceiveBuffers(...) of the SendReceiveBuffer for each respective cell.

Parameters
dataExchange

◆ readFromReceiveBuffer()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::readFromReceiveBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Local_Container_T & cells )
private

reads information from the receive buffer and stores the result in the coupling cells. Since this is a receive for the coupling cells on the side of the coupling tool, we can consider a Cartesian grid topology for the coupling cells. For each cell, readFromReceiveBuffer(...) of SendReceiveBuffer is called.

Parameters
dataExchange
cells

◆ sendFromMacro2MD()

template<class Cell_T, unsigned int dim>
template<class Container_T>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::sendFromMacro2MD ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Local_Container_T & dst,
const Container_T & src )

sends information from the local coupling cells of a macroscopic solver to the coupling cells of MaMico (ghost cells are also allowed). Since the macroscopic solver can have an arbitrary distribution of cells on the processes, the buffer for sending the cell data is provided to this function in terms of an array of coupling cells including the respective global cell indices. This function calls sendFromMacro2MDNonBlocking(..) and immediately subsequently wait4SendFromMacro2MD(...). Those two methods may alternatively be used, e.g., for "non-blocking" communication.

Parameters
dataExchange
dst
src

◆ sendFromMacro2MDNonBlocking()

template<class Cell_T, unsigned int dim>
template<class Container_T>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::sendFromMacro2MDNonBlocking ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Container_T & cells )

sends data from macro to MD. After returning, the data transfer may not be completely finished, similar to a IRecv/ISend-call by MPI. Please use wait4SendFromMacro2MD(...) to guarantee that the data transfer has been finished.

Parameters
dataExchange
cells

◆ wait4SendFromMacro2MD()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::wait4SendFromMacro2MD ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Local_Container_T & cells )

waits for the data transfer–instantiated by sendFromMacro2MDNonBlocking(..)–to be finished and fills the information into the coupling cells from Mamico.

Parameters
dataExchange
cells

◆ writeToSendBuffer()

template<class Cell_T, unsigned int dim>
template<class Container_T>
void coupling::sendrecv::FromMacro2MD< Cell_T, dim >::writeToSendBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Container_T & cells )
private

given a coupling cell container (from the macroscopic solver), the data from these cells are written to the send buffer.

Parameters
dataExchange
cells
globalCellIndices

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