63 std::shared_ptr<GridBuilder> builder,
65 : para(std::
move(para)), builder(std::
move(builder)), communicator(communicator)
69std::array<ProcessNeighbor27, 4>
74 const int level,
const int direction)
const
76 VF_LOG_INFO(
"Communication: reorder send indices in direction {}", direction);
96 int direction,
int level)
const
98 VF_LOG_INFO(
"Reorder send indices for communication after fine to coarse: level: {} direction: {}", level, direction);
100 const ICells& fineToCoarse = para->getParH(level)->fineToCoarse;
101 if (para->getParH(level)->coarseToFine.numberOfCells == 0 || fineToCoarse.
numberOfCells == 0)
102 VF_LOG_CRITICAL(
"reorderSendIndicesForCommAfterFtoC(): para->getParH(level)->intCF needs to be initialized "
103 "before calling this function");
107 const uint numberOfSendIndices = builder->getNumberOfSendIndices(direction, level);
133 VF_LOG_CRITICAL(
"reorderSendIndicesForCommAfterFtoC(): incorrect number of nodes");
134 VF_LOG_CRITICAL(
"numberOfSendNodesAfterFtoC = {}, sendIndicesOther.size() = {}, numberOfSendIndices = {}",
137 return sendIndicesForCommAfterFtoCPositions;
143 const std::vector<uint>& sendIndicesForCommAfterFtoCPositions)
const
150 recvNeighbor.rankNeighbor, sendIndicesForCommAfterFtoCPositions.data(),
151 (
int)sendIndicesForCommAfterFtoCPositions.size(),
sendNeighbor.rankNeighbor);
155 auto it = std::unique(
167 uint* indices,
const int direction,
const int level,
170 VF_LOG_INFO(
"Reorder recv indices for communication after fine to coarse: level: {} direction: {}", level, direction);
173 VF_LOG_WARNING(
"ReorderRecvIndicesForCommAfterFtoC(): sendIndicesForCommAfterFtoCPositions is empty.");
175 const uint numberOfRecvIndices = builder->getNumberOfReceiveIndices(direction, level);
194 VF_LOG_CRITICAL(
"reorderRecvIndicesForCommAfterFtoC(): incorrect number of nodes");
195 VF_LOG_CRITICAL(
"numberOfRecvNodesAfterFtoC = {}, recvIndicesOther.size() = {}, numberOfRecvIndices = {}",
201 const uint numberOfNodes)
205 neighborAfterFtoC.numberOfFs = vf::lbm::dir::NUMBER_Of_DIRECTIONS * numberOfNodes;
214 const uint* neighborX = para->getParH(level)->neighborX;
215 const uint* neighborY = para->getParH(level)->neighborY;
216 const uint* neighborZ = para->getParH(level)->neighborZ;
218 for (
uint x = 0;
x < para->getParH(level)->coarseToFine.numberOfCells;
x++) {
219 const uint sparseIndex = para->getParH(level)->coarseToFine.coarseCellIndices[
x];
#define VF_LOG_CRITICAL(...)
#define VF_LOG_WARNING(...)
void reorderRecvIndicesForCommAfterFtoC(uint *recvIndices, int direction, int level, const std::vector< uint > &recvIndicesForCommAfterFtoCPositions) const
Reorder the receive indices in the same way that the send indices were reordered.
static std::vector< uint > findIndicesNotInCommAfterFtoC(uint numberOfIndices, const uint *indices, const std::vector< uint > &indicesAfterFtoC)
Find all indices which are not part of the communication after the interpolation from fine to coarse.
std::vector< uint > reorderSendIndicesForCommAfterFtoC(uint *indices, int direction, int level) const
The send indices are reordered for the communication after the interpolation from fine to coarse.
static ProcessNeighbor27 makeProcessNeighborToCommAfterFtoC(const ProcessNeighbor27 &neighbor, uint numberOfNodes)
Initializes pointers for reduced communication after the interpolation from fine to coarse by copying...
virtual std::array< ProcessNeighbor27, 4 > initCommunicationArraysForCommAfterFinetoCoarse(const ProcessNeighbor27 &sendNeighborHost, const ProcessNeighbor27 &sendNeighborDevice, const ProcessNeighbor27 &recvNeighborHost, const ProcessNeighbor27 &recvNeighborDevice, int level, int direction) const
Initialize the arrays for the communication after the interpolation from fine to coarse.
std::vector< uint > aggregateCoarseNodesForCtoF(int level) const
Aggregate all nodes in the coarse cells for the interpolation in coarse to fine.
IndexRearrangementForStreams(std::shared_ptr< Parameter > para, std::shared_ptr< GridBuilder > builder, vf::parallel::Communicator &communicator)
std::vector< uint > exchangeIndicesForCommAfterFtoC(const ProcessNeighbor27 &sendNeighbor, const ProcessNeighbor27 &recvNeighbor, const std::vector< uint > &sendIndicesForCommAfterFtoCPositions) const
send sendIndicesForCommAfterFtoCPositions to receiving process and receive recvIndicesForCommAfterFto...
An abstract class for communication between processes in parallel computation.
virtual int getProcessID() const =0
virtual void receiveSend(uint *buffer_receive, int size_buffer_recv, int neighbor_rank_recv, const uint *buffer_send, int size_buffer_send, int neighbor_rank_send) const =0
std::shared_ptr< T > SPtr
bool indexInVector(const std::vector< uint > &vector, uint index)
bool indexInArray(const uint *array, uint numberOfElements, uint index)