VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
cpuTreeInfo.h
Go to the documentation of this file.
1/*--------------------------------*- VM2D -*-----------------*---------------*\
2| ## ## ## ## #### ##### | | Version 1.14 |
3| ## ## ### ### ## ## ## ## | VM2D: Vortex Method | 2026/03/06 |
4| ## ## ## # ## ## ## ## | for 2D Flow Simulation *----------------*
5| #### ## ## ## ## ## | Open Source Code |
6| ## ## ## ###### ##### | https://www.github.com/vortexmethods/VM2D |
7| |
8| Copyright (C) 2017-2026 I. Marchevsky, K. Sokol, E. Ryatina, A. Kolganova |
9*-----------------------------------------------------------------------------*
10| File name: cpuTreeInfo.h |
11| Info: Source code of VM2D |
12| |
13| This file is part of VM2D. |
14| VM2D is free software: you can redistribute it and/or modify it |
15| under the terms of the GNU General Public License as published by |
16| the Free Software Foundation, either version 3 of the License, or |
17| (at your option) any later version. |
18| |
19| VM2D is distributed in the hope that it will be useful, but WITHOUT |
20| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
21| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
22| for more details. |
23| |
24| You should have received a copy of the GNU General Public License |
25| along with VM2D. If not, see <http://www.gnu.org/licenses/>. |
26\*---------------------------------------------------------------------------*/
27
39#ifndef CPUTREEINFO_H
40#define CPUTREEINFO_H
41
42#include "Vortex2D.h"
43#include "Gpudefs.h"
44
45namespace VM2D
46{
47
48
50 //\brief Структура, хранящая данные и указатели на массивы на GPU для оптимизации итерационного решения СЛАУ на GPU
51 //
52 //\author Марчевский Илья Константинович
53 //\author Сокол Ксения Сергеевна
54 //\author Рятина Евгения Павловна
55 //\author Колганова Александра Олеговна
56 //
57 //\Version 1.14
58 //\date 6 марта 2026 г.
59 //*/
60 //struct infoForMatVecMul
61 //{
62 // std::vector<int> nClosePanels; ///количество листьев дерева (панелей), находящихся в ближней зоне
63 // std::vector<int> nFarCells; ///количество ячеек, находящихся в дальней зоне
64
65 // std::vector<int> closePrefixSum; ///префиксная сумма для ближней зоны
66 // std::vector<int> farPrefixSum; ///префиксная сумма для дальней зоны
67
68 // Point2D* i00D; ///указатель на GPU, хранящий влияние панелей из ближней зоны
69 // Point2D* i01D; ///аналог i00D, но используется для кусочно-линейной схемы
70 // Point2D* i10D; ///аналог i00D, но используется для кусочно-линейной схемы
71 // Point2D* i11D; ///аналог i00D, но используется для кусочно-линейной схемы
72
73 // int* nClosePanelsD; ///количество листьев дерева (панелей), находящихся в ближней зоне
74 // int* nFarCellsD; ///количество ячеек, находящихся в дальней зоне
75
76 // int* closeCellsIdxD; ///индексы ячеек ближней зоны
77 // int* farCellsIdxD; ///индексы ячеек дальней зоны
78
79 // int* closePrefixSumD; ///префиксная сумма для ближней зоны
80 // int* farPrefixSumD; ///префиксная сумма для дальней зоны
81 //};
82
83
97 {
98 public:
99 //int nObject;
100 //int nNode;
101
102 //bool duplicateObj;
103 //double* objectD;
104 std::vector<Point2D> object;
105 std::vector<double> gamma;
106
110
111 //int sizeOfElement;
112 //int offsetOfPointInElement;
113
114 std::vector<int> mass; //массы (единица для точечного вихря, число вихрей для ячейки)
115
116 Point2D maxr, minr; //габаритный прямоугольник
117 std::vector<Point2D> moms;//мультипольные моменты всех ячеек; хранятся в виде <mom_0x, mom_0y=0, mom_1x, mom_1y, ..., mom_px, mom_py>, <для второй ячейки> ...
118 std::vector<Point2D> ED; //к-ты локальных разложений
119
120 //For Morton tree
121 std::vector<unsigned int> mortonCodesKeyUnsort;
122 std::vector<unsigned int> mortonCodesKey;
123
124 std::vector<int> mortonCodesIdxUnsort; //0 1 2 3 ... nbodies-1
125 std::vector<int> mortonCodesIdx;
126
127 std::vector<int> levelUnsort;
128 std::vector<int> levelSort;
129
130 std::vector<int> indexUnsort; //0 1 2 3 ... nbodies-2
131 std::vector<int> indexSort;
132 std::vector<int> indexSortT;
133
134 std::vector<Point2D> center; //Положения внутренних узлов в дерева Карраса
135 std::vector<Point4D> lowerupper; //Левый нижний и правый верхний углы ячейки
136 std::vector<Point4D> gabForLeaves; //Левый нижний и правый верхний углы листа
137
138 std::vector<int> parent; //Номер ячейки-родителя
139 std::vector<std::pair<int, int>> child; //Потомки внутренних ячеек (в одной ячейке храним сразу два целых числа)
140 std::vector<std::pair<int, int>> range; //Диапазон частиц во внутренней ячейке (в одной ячейке храним сразу два целых числа)
141
142 //void* sortObjectsBufferD;
143 //int sortObjectsBufferSizeInBytes;
144
145 //void* sortInternalCellsBufferD;
146 //int sortInternalCellsBufferSizeInBytes;
147
148 //const int nBlock;
149 //int reservedMemorySizeItems;
150
151 //infoForMatVecMul matVecMulInfo;
152
153 CpuTreeInfo(tree_T treeType_, object_T objectType_, scheme_T schemeType_);
154 ~CpuTreeInfo();
155
156 float Update(const std::vector<Vortex2D>& vtx, double eps);
157// void UpdatePanelGeometry(int nObject_, double4* gabForLeavesD_);
158
159// void UpdatePanelFreeVortexIntensity(const double* dev_ptr_freeVortexSheet, const double* dev_ptr_freeVortexSheetLin);//функция нулит attached vortex sheet
160// void UpdatePanelAttachedVortexIntensity(const double* dev_ptr_attachedVortexSheet, const double* dev_ptr_attachedVortexSheetLin);//функция нулит free vortex sheet
161// void UpdatePanelAttachedSourceIntensity(const double* dev_ptr_attachedSourceSheet, const double* dev_ptr_attachedSourceSheetLin);
162// void UpdatePanelFreeAndAttachedVortexIntensity(const double* dev_ptr_freeVortexSheet, const double* dev_ptr_freeVortexSheetLin, const double* dev_ptr_attachedVortexSheet, const double* dev_ptr_attachedVortexSheetLin);
163
164// void MemoryAllocateForGMRES();
165// void MemoryFreeForGMRES();
166
167// void MemoryAllocate(int nCudaObject);
168
169// bool IsInitialized() const;
172
173 int Delta(int i, int j) const;
174 void Summ12();
175 void CalcAABB();
176 float Build();
177 float UpwardTraversal(int order);
178 float DownwardTraversalVorticesToPoints(CpuTreeInfo& cntrTree, Point2D* velD, double* epsastD, double eps2, double theta, int order, bool calcRadius);
179
180
181// float DownwardTraversalVorticesToPoints(CudaTreeInfo& cntrTree, Point2D* velD, double* epsastD, double eps2, double theta, int order, bool calcRadius);
182// float DownwardTraversalVorticesToPanels(CudaTreeInfo& cntrTree, double* rhsD, double* rhsLinD, double theta, int order);
183// float DownwardTraversalPanelsToPoints(CudaTreeInfo& cntrTree, Point2D* velD, double eps2, double theta, int order);
184// float DownwardTraversalGMRES(double* resD, double* resLinD, double theta, int order, int iter);
185
186// float I1I2CalculationWrapper(double minRd, double* __restrict I1D, Point2D* __restrict I2D, double* __restrict epsastD);
187// float I0I3CalculationWrapper(double minRd, float* __restrict I0D, Point2Df* __restrict I3D, double* __restrict epsastD, const double* __restrict meanEpsD, int nPan, double* __restrict panD, double* __restrict visstrD);
188// void RadixSortMortonCodes(int beginBit = 0, int endBit = 2 * codeLength);
189// void RadixSortInternalCells(int beginBit = 0, int endBit = 2 * codeLength);
190 };
191
192}
193
194
195#endif
Описание констант и параметров для взаимодействия с графическим ускорителем
object_T
Definition Gpudefs.h:146
tree_T
Definition Gpudefs.h:139
scheme_T
Definition Gpudefs.h:151
Заголовочный файл с описанием класса Vortex2D.
Структура, хранящая данные и указатели на массивы на GPU для оптимизации итерационного решения СЛАУ н...
Definition cpuTreeInfo.h:97
std::vector< std::pair< int, int > > range
std::vector< Point2D > moms
float Update(const std::vector< Vortex2D > &vtx, double eps)
float DownwardTraversalVorticesToPoints(CpuTreeInfo &cntrTree, Point2D *velD, double *epsastD, double eps2, double theta, int order, bool calcRadius)
std::vector< int > levelUnsort
std::vector< unsigned int > mortonCodesKeyUnsort
std::vector< int > parent
std::vector< int > indexSort
std::vector< unsigned int > mortonCodesKey
std::vector< Point2D > object
float UpwardTraversal(int order)
std::vector< int > mortonCodesIdx
std::vector< double > gamma
void RadixSortInternalCells()
std::vector< Point2D > center
std::vector< Point4D > gabForLeaves
std::vector< Point2D > ED
std::vector< int > levelSort
std::vector< int > indexSortT
std::vector< Point4D > lowerupper
std::vector< int > mass
std::vector< int > indexUnsort
std::vector< int > mortonCodesIdxUnsort
int Delta(int i, int j) const
std::vector< std::pair< int, int > > child