Skip to content
Snippets Groups Projects
Commit cdb1ec19 authored by Konstantin Kutscher's avatar Konstantin Kutscher
Browse files

optimized same level connectors

parent 3f0166a6
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,6 @@ public:
virtual void sendData()=0;
virtual void prepareForReceive() {}
virtual value_type& receiveData()=0;
virtual void saveData() {}
//data-access
inline value_type& getData() { return this->data; }
......
......@@ -8,6 +8,8 @@
#include "Block3D.h"
#include "LBMKernelETD3Q27.h"
#include "EsoTwistD3Q27System.h"
#include "basics/container/CbArray3D.h"
#include "basics/container/CbArray4D.h"
//daten werden in einen vector (dieser befindet sich im transmitter) kopiert
......@@ -17,10 +19,10 @@
class D3Q27ETFullVectorConnector : public RemoteBlock3DConnector
{
public:
D3Q27ETFullVectorConnector( Block3DPtr block
D3Q27ETFullVectorConnector(Block3DPtr block
, VectorTransmitterPtr sender
, VectorTransmitterPtr receiver
, int sendDir);
, int sendDir);
void init();
......@@ -28,11 +30,91 @@ public:
void distributeReceiveVectors();
protected:
void fillData(EsoTwist3DPtr fFrom, int& index, const int& x1, const int& x2, const int& x3);
void distributeData(EsoTwist3DPtr fTo, int& index, const int& x1, const int& x2, const int& x3);
inline void fillData(vector_type& sdata, int& index, int x1, int x2, int x3);
inline void distributeData(vector_type& rdata, int& index, int x1, int x2, int x3);
private:
int maxX1;
int maxX2;
int maxX3;
CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr localDistributions;
CbArray4D <LBMReal, IndexerX4X3X2X1>::CbArray4DPtr nonLocalDistributions;
CbArray3D <LBMReal, IndexerX3X2X1>::CbArray3DPtr zeroDistributions;
EsoTwist3DPtr fDis;
};
//////////////////////////////////////////////////////////////////////////
inline void D3Q27ETFullVectorConnector::fillData(vector_type& sdata, int& index, int x1, int x2, int x3)
{
//vector_type& sdata = sender->getData();
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3);
sdata[index++] = (*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1);
sdata[index++] = (*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1);
sdata[index++] = (*this->zeroDistributions)(x1, x2, x3);
}
//////////////////////////////////////////////////////////////////////////
inline void D3Q27ETFullVectorConnector::distributeData(vector_type& rdata, int& index, int x1, int x2, int x3)
{
//vector_type& rdata = receiver->getData();
(*this->localDistributions)(D3Q27System::ET_E, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_N, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_T, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_NE, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_NW, x1 + 1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TE, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TW, x1 + 1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TN, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TS, x1, x2 + 1, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TNE, x1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TNW, x1 + 1, x2, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TSE, x1, x2 + 1, x3) = rdata[index++];
(*this->localDistributions)(D3Q27System::ET_TSW, x1 + 1, x2 + 1, x3) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_W, x1 + 1, x2, x3) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_S, x1, x2 + 1, x3) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_B, x1, x2, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_SW, x1 + 1, x2 + 1, x3) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_SE, x1, x2 + 1, x3) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BW, x1 + 1, x2, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BE, x1, x2, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BS, x1, x2 + 1, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BN, x1, x2, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BSW, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BSE, x1, x2 + 1, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BNW, x1 + 1, x2, x3 + 1) = rdata[index++];
(*this->nonLocalDistributions)(D3Q27System::ET_BNE, x1, x2, x3 + 1) = rdata[index++];
(*this->zeroDistributions)(x1, x2, x3) = rdata[index++];
}
#endif //D3Q27VECTORCONNECTOR_H
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment