VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
OneDistributionFullVectorConnector.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
33//=======================================================================================
34#ifndef OneDistributionFullVectorConnector_H
35#define OneDistributionFullVectorConnector_H
36
37#include <vector>
38
39#include "Block3D.h"
40#include "D3Q27System.h"
41#include "EsoTwist3D.h"
42//#include "EsoTwistD3Q27System.h"
43#include "LBMKernel.h"
44#include "FullVectorConnector.h"
45#include "EsoSplit.h"
48
52{
53public:
55 int sendDir);
56
57 void init() override;
58
59 void fillData() override
60 {
62 }
63
64 void distributeData() override
65 {
67 }
68
69protected:
70 inline void updatePointers() override;
71 inline void fillData(vector_type &sdata, int &index, int x1, int x2, int x3) override;
72 inline void distributeData(vector_type &rdata, int &index, int x1, int x2, int x3) override;
73
74private:
78
80};
83{
84 splitA = dynamicPointerCast<EsoSplit>(this->fDis)->getSplitA();
85 splitB = dynamicPointerCast<EsoSplit>(this->fDis)->getSplitB();
86 split0 = dynamicPointerCast<EsoSplit>(this->fDis)->getSplit0();
87}
89inline void OneDistributionFullVectorConnector::fillData(vector_type &sdata, int &index, int x1, int x2, int x3)
90{
91 using namespace vf::lbm::dir;
92
93 sdata[index++] = (*this->splitA)(eP00, x1, x2, x3);
94 sdata[index++] = (*this->splitA)(e0P0, x1, x2, x3);
95 sdata[index++] = (*this->splitA)(e00P, x1, x2, x3);
96 sdata[index++] = (*this->splitA)(ePP0, x1, x2, x3);
97 sdata[index++] = (*this->splitA)(eMP0, x1 + 1, x2, x3);
98 sdata[index++] = (*this->splitA)(eP0P, x1, x2, x3);
99 sdata[index++] = (*this->splitA)(eM0P, x1 + 1, x2, x3);
100 sdata[index++] = (*this->splitA)(e0PP, x1, x2, x3);
101 sdata[index++] = (*this->splitA)(e0MP, x1, x2 + 1, x3);
102 sdata[index++] = (*this->splitA)(ePPP, x1, x2, x3);
103 sdata[index++] = (*this->splitA)(eMPP, x1 + 1, x2, x3);
104 sdata[index++] = (*this->splitA)(ePMP, x1, x2 + 1, x3);
105 sdata[index++] = (*this->splitA)(eMMP, x1 + 1, x2 + 1, x3);
106
107 sdata[index++] = (*this->splitB)(eM00, x1 + 1, x2, x3);
108 sdata[index++] = (*this->splitB)(e0M0, x1, x2 + 1, x3);
109 sdata[index++] = (*this->splitB)(e00M, x1, x2, x3 + 1);
110 sdata[index++] = (*this->splitB)(eMM0, x1 + 1, x2 + 1, x3);
111 sdata[index++] = (*this->splitB)(ePM0, x1, x2 + 1, x3);
112 sdata[index++] = (*this->splitB)(eM0M, x1 + 1, x2, x3 + 1);
113 sdata[index++] = (*this->splitB)(eP0M, x1, x2, x3 + 1);
114 sdata[index++] = (*this->splitB)(e0MM, x1, x2 + 1, x3 + 1);
115 sdata[index++] = (*this->splitB)(e0PM, x1, x2, x3 + 1);
116 sdata[index++] = (*this->splitB)(eMMM, x1 + 1, x2 + 1, x3 + 1);
117 sdata[index++] = (*this->splitB)(ePMM, x1, x2 + 1, x3 + 1);
118 sdata[index++] = (*this->splitB)(eMPM, x1 + 1, x2, x3 + 1);
119 sdata[index++] = (*this->splitB)(ePPM, x1, x2, x3 + 1);
120
121 sdata[index++] = (*this->split0)(x1, x2, x3);
122}
124inline void OneDistributionFullVectorConnector::distributeData(vector_type &rdata, int &index, int x1, int x2, int x3)
125{
126 using namespace vf::lbm::dir;
127
128 (*this->splitA)(eP00, x1, x2, x3) = rdata[index++];
129 (*this->splitA)(e0P0, x1, x2, x3) = rdata[index++];
130 (*this->splitA)(e00P, x1, x2, x3) = rdata[index++];
131 (*this->splitA)(ePP0, x1, x2, x3) = rdata[index++];
132 (*this->splitA)(eMP0, x1 + 1, x2, x3) = rdata[index++];
133 (*this->splitA)(eP0P, x1, x2, x3) = rdata[index++];
134 (*this->splitA)(eM0P, x1 + 1, x2, x3) = rdata[index++];
135 (*this->splitA)(e0PP, x1, x2, x3) = rdata[index++];
136 (*this->splitA)(e0MP, x1, x2 + 1, x3) = rdata[index++];
137 (*this->splitA)(ePPP, x1, x2, x3) = rdata[index++];
138 (*this->splitA)(eMPP, x1 + 1, x2, x3) = rdata[index++];
139 (*this->splitA)(ePMP, x1, x2 + 1, x3) = rdata[index++];
140 (*this->splitA)(eMMP, x1 + 1, x2 + 1, x3) = rdata[index++];
141
142 (*this->splitB)(eM00, x1 + 1, x2, x3) = rdata[index++];
143 (*this->splitB)(e0M0, x1, x2 + 1, x3) = rdata[index++];
144 (*this->splitB)(e00M, x1, x2, x3 + 1) = rdata[index++];
145 (*this->splitB)(eMM0, x1 + 1, x2 + 1, x3) = rdata[index++];
146 (*this->splitB)(ePM0, x1, x2 + 1, x3) = rdata[index++];
147 (*this->splitB)(eM0M, x1 + 1, x2, x3 + 1) = rdata[index++];
148 (*this->splitB)(eP0M, x1, x2, x3 + 1) = rdata[index++];
149 (*this->splitB)(e0MM, x1, x2 + 1, x3 + 1) = rdata[index++];
150 (*this->splitB)(e0PM, x1, x2, x3 + 1) = rdata[index++];
151 (*this->splitB)(eMMM, x1 + 1, x2 + 1, x3 + 1) = rdata[index++];
152 (*this->splitB)(ePMM, x1, x2 + 1, x3 + 1) = rdata[index++];
153 (*this->splitB)(eMPM, x1 + 1, x2, x3 + 1) = rdata[index++];
154 (*this->splitB)(ePPM, x1, x2, x3 + 1) = rdata[index++];
155
156 (*this->split0)(x1, x2, x3) = rdata[index++];
157}
158
159#endif // OneDistributionFullVectorConnector_H
160
SPtr< CbArray3D< T, IndexClass > > CbArray3DPtr
Definition CbArray3D.h:147
SPtr< CbArray4D< T, IndexClass > > CbArray4DPtr
Definition CbArray4D.h:121
Exchange data between blocks.
VectorTransmitterPtr receiver
VectorTransmitterPtr sender
std::shared_ptr< T > SPtr
void init() override
Iniitializes connector.
VectorTransmitter::value_type vector_type
SPtr< TbTransmitter< CbVector< real > > > VectorTransmitterPtr