VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
FindNeighbors.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 FIND_NEIGHBORS_H
35#define FIND_NEIGHBORS_H
36
37#include <map>
38
39#include <lbm/constants/D3Q27.h>
40
41#include "Parameter/Parameter.h"
42
43namespace vf::gpu {
44
52
53const std::map<const size_t, const countersForPointerChasing> mapForPointerChasing =
54{
55
56 {vf::lbm::dir::d000, countersForPointerChasing{0, 0, 0, 0}},
57 {vf::lbm::dir::dP00, countersForPointerChasing{0, 1, 0, 0}},
58 {vf::lbm::dir::dM00, countersForPointerChasing{1, 0, 1, 1}},
59 {vf::lbm::dir::d0P0, countersForPointerChasing{0, 0, 1, 0}},
60 {vf::lbm::dir::d0M0, countersForPointerChasing{1, 1, 0, 1}},
61 {vf::lbm::dir::d00P, countersForPointerChasing{0, 0, 0, 1}},
62 {vf::lbm::dir::d00M, countersForPointerChasing{1, 1, 1, 0}},
63
64 {vf::lbm::dir::dPP0, countersForPointerChasing{0, 1, 1, 0}},
65 {vf::lbm::dir::dMM0, countersForPointerChasing{1, 0, 0, 1}},
66 {vf::lbm::dir::dPM0, countersForPointerChasing{1, 2, 0, 1}},
67 {vf::lbm::dir::dMP0, countersForPointerChasing{1, 0, 2, 1}},
68 {vf::lbm::dir::dP0P, countersForPointerChasing{0, 1, 0, 1}},
69 {vf::lbm::dir::dM0M, countersForPointerChasing{1, 0, 1, 0}},
70 {vf::lbm::dir::dP0M, countersForPointerChasing{1, 2, 1, 0}},
71 {vf::lbm::dir::dM0P, countersForPointerChasing{1, 0, 1, 2}},
72 {vf::lbm::dir::d0PP, countersForPointerChasing{0, 0, 1, 1}},
73 {vf::lbm::dir::d0MM, countersForPointerChasing{1, 1, 0, 0}},
74 {vf::lbm::dir::d0PM, countersForPointerChasing{1, 1, 2, 0}},
75 {vf::lbm::dir::d0MP, countersForPointerChasing{1, 1, 0, 2}},
76
77 {vf::lbm::dir::dPPP, countersForPointerChasing{0, 1, 1, 1}},
78 {vf::lbm::dir::dMPP, countersForPointerChasing{1, 0, 2, 2}},
79 {vf::lbm::dir::dPMP, countersForPointerChasing{1, 2, 0, 2}},
80 {vf::lbm::dir::dMMP, countersForPointerChasing{1, 0, 0, 2}},
81 {vf::lbm::dir::dPPM, countersForPointerChasing{1, 2, 2, 0}},
82 {vf::lbm::dir::dMPM, countersForPointerChasing{1, 0, 2, 0}},
83 {vf::lbm::dir::dPMM, countersForPointerChasing{1, 2, 0, 0}},
84 {vf::lbm::dir::dMMM, countersForPointerChasing{1, 0, 0, 0}}
85};
86
87// Only use for fluid nodes!
88inline uint getNeighborIndex(LBMSimulationParameter* parH, const uint position, const int direction)
89{
90 uint nodeIndex = position;
91
92 if (mapForPointerChasing.at(direction).counterInverse != 0) {
94 }
95
96 for (uint x = 0; x < mapForPointerChasing.at(direction).counterX; x++) {
98 }
99
100 for (uint y = 0; y < mapForPointerChasing.at(direction).counterY; y++) {
102 }
103
104 for (uint z = 0; z < mapForPointerChasing.at(direction).counterZ; z++) {
106 }
107
108 return nodeIndex;
109}
110
111}
112
113#endif
114
std::shared_ptr< T > SPtr
unsigned int uint
Definition DataTypes.h:47
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43
const std::map< const size_t, const countersForPointerChasing > mapForPointerChasing
uint getNeighborIndex(LBMSimulationParameter *parH, const uint position, const int direction)
struct holds and manages the LB-parameter of the simulation
Definition Parameter.h:74
uint * neighborX
store the neighbors in +X, +Y, +Z, and in diagonal negative direction
Definition Parameter.h:93