ECOGEN 4.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
Parallel.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef PARALLEL_H
32#define PARALLEL_H
33
34#include <mpi.h>
35#include "../Tools.h"
36#include "../Models/Phase.h"
37#include "../Order1/Cell.h"
38
40{
41public:
42 Parallel();
43 ~Parallel();
44
45 void initialization();
46 void setNeighbour(const int neighbour);
47 void addElementToSend(int neighbour, Cell* cell);
48 void addElementToReceive(int neighbour, Cell* cell);
49 void addSlopesToSend(int neighbour);
50 void addSlopesToReceive(int neighbour);
51 void deleteSlopesToSend(int neighbour);
52 void deleteSlopesToReceive(int neighbour);
56 void initializePersistentCommunications(const int& numberPrimitiveVariables, const int& numberSlopeVariables, const int& numberTransportVariables, const int& dim);
57 void computeDt(double& dt);
58 void computePMax(double& pMax, double& pMaxWall);
59 void computeSum(double& var);
60 void finalize(const int& lvlMax);
61 void stopRun();
62 bool verifyStateCPUs();
63
64 //Methodes pour toutes les variables primitives
66 void finalizePersistentCommunicationsPrimitives(const int& lvlMax);
67 void communicationsPrimitives(Eos** eos, int lvl, Prim type = vecPhases);
68
69 //Methodes pour toutes les slopes
71 void finalizePersistentCommunicationsSlopes(const int& lvlMax);
72 void communicationsSlopes(int lvl);
73
74 //Methodes pour une variable scalar
76 void finalizePersistentCommunicationsScalar(const int& lvlMax);
77
78 //Methodes pour une variable vectorielle
80 void finalizePersistentCommunicationsVector(const int& lvlMax);
81 void communicationsVector(Variable nameVector, const int& dim, int lvl, int num = 0, int index = -1);
82
83 //Methodes pour toutes les variables transports
85 void finalizePersistentCommunicationsTransports(const int& lvlMax);
86 void communicationsTransports(int lvl);
87
88 //Methodes pour les variables AMR
89 void initializePersistentCommunicationsAMR(const int& numberPrimitiveVariables, const int& numberSlopeVariables, const int& numberTransportVariables, const int& dim, const int& lvlMax);
90 void initializePersistentCommunicationsLvlAMR(const int& lvlMax);
91 void clearRequestsAndBuffers(int lvl);
92 void updatePersistentCommunicationsAMR(const int& dim);
93 void updatePersistentCommunicationsLvlAMR(int lvl, const int& dim);
94 void finalizeAMR(const int& lvlMax);
95
97 void finalizePersistentCommunicationsXi(const int& lvlMax);
98 void communicationsXi(int lvl);
99
101 void finalizePersistentCommunicationsSplit(const int& lvlMax);
102 void communicationsSplit(int lvl);
103
106 void communicationsNumberGhostCells(int lvl);
107
108private:
109
111 std::vector<TypeMeshContainer<Cell*>> m_elementsToSend;
112 std::vector<TypeMeshContainer<Cell*>> m_elementsToReceive;
117 int m_numberPrimitiveVariables; /*Number of primitive variables to send (phases + mixture + transports)*/
118 int m_numberSlopeVariables; /*Number of slope variables to send (phases + mixture + transports)*/
119 int m_numberTransportVariables; /*Number of transport variables to send*/
120
121 std::vector<double**> m_bufferReceive;
122 std::vector<double**> m_bufferSend;
123 std::vector<double**> m_bufferReceiveSlopes;
124 std::vector<double**> m_bufferSendSlopes;
125 std::vector<double**> m_bufferReceiveScalar;
126 std::vector<double**> m_bufferSendScalar;
127 std::vector<double**> m_bufferReceiveVector;
128 std::vector<double**> m_bufferSendVector;
129 std::vector<double**> m_bufferReceiveTransports;
130 std::vector<double**> m_bufferSendTransports;
131 std::vector<double**> m_bufferReceiveXi;
132 std::vector<double**> m_bufferSendXi;
133 std::vector<bool**> m_bufferReceiveSplit;
134 std::vector<bool**> m_bufferSendSplit;
139
140 std::vector<MPI_Request**> m_reqSend;
141 std::vector<MPI_Request**> m_reqReceive;
142 std::vector<MPI_Request**> m_reqSendSlopes;
143 std::vector<MPI_Request**> m_reqReceiveSlopes;
144 std::vector<MPI_Request**> m_reqSendScalar;
145 std::vector<MPI_Request**> m_reqReceiveScalar;
146 std::vector<MPI_Request**> m_reqSendVector;
147 std::vector<MPI_Request**> m_reqReceiveVector;
148 std::vector<MPI_Request**> m_reqSendTransports;
149 std::vector<MPI_Request**> m_reqReceiveTransports;
150 std::vector<MPI_Request**> m_reqSendXi;
151 std::vector<MPI_Request**> m_reqReceiveXi;
152 std::vector<MPI_Request**> m_reqSendSplit;
153 std::vector<MPI_Request**> m_reqReceiveSplit;
158
159};
160
161extern Parallel parallel;
162extern int rankCpu;
163extern int Ncpu;
164
165#endif // PARALLEL_H
int rankCpu
Definition Parallel.cpp:36
int Ncpu
Definition Parallel.cpp:36
Parallel parallel
Definition Parallel.cpp:35
Prim
Enumeration for the primitive-variable type (usefull for second order, slopes, etc....
Definition Tools.h:39
@ vecPhases
Definition Tools.h:39
std::vector< Type > TypeMeshContainer
Template for the type of the mesh container (std::list for now, but may change to something else if w...
Definition Tools.h:83
Variable
Enumeration for the flow variables.
Definition Tools.h:78
Base class for a mesh cell.
Definition Cell.h:59
General class for Equation of State (EOS).
Definition Eos.h:54
Definition Parallel.h:40
void initializePersistentCommunications(const int &numberPrimitiveVariables, const int &numberSlopeVariables, const int &numberTransportVariables, const int &dim)
Definition Parallel.cpp:223
int * m_bufferNumberSlopesToReceiveFromNeighbour
Definition Parallel.h:138
TypeMeshContainer< Cell * > & getElementsToSend(int neighbour)
Definition Parallel.cpp:209
void initializePersistentCommunicationsLvlAMR(const int &lvlMax)
Definition Parallel.cpp:750
void communicationsVector(Variable nameVector, const int &dim, int lvl, int num=0, int index=-1)
Definition Parallel.cpp:596
void communicationsPrimitives(Eos **eos, int lvl, Prim type=vecPhases)
Definition Parallel.cpp:368
void initializePersistentCommunicationsVector(const int &dim)
Definition Parallel.cpp:547
std::vector< double ** > m_bufferSend
Definition Parallel.h:122
std::vector< bool ** > m_bufferReceiveSplit
Definition Parallel.h:133
void communicationsTransports(int lvl)
Definition Parallel.cpp:685
std::vector< MPI_Request ** > m_reqReceiveSlopes
Definition Parallel.h:143
void stopRun()
Definition Parallel.cpp:292
void initializePersistentCommunicationsXi()
Definition Parallel.cpp:1101
void communicationsSplit(int lvl)
Definition Parallel.cpp:1241
MPI_Request ** m_reqNumberElementsToSendToNeighbor
Definition Parallel.h:154
MPI_Request ** m_reqNumberSlopesToSendToNeighbor
Definition Parallel.h:156
std::vector< MPI_Request ** > m_reqSend
Definition Parallel.h:140
void addSlopesToReceive(int neighbour)
Definition Parallel.cpp:175
int * m_bufferNumberElementsToReceiveFromNeighbour
Definition Parallel.h:136
void finalizePersistentCommunicationsVector(const int &lvlMax)
Definition Parallel.cpp:570
std::vector< MPI_Request ** > m_reqReceiveScalar
Definition Parallel.h:145
void initializePersistentCommunicationsAMR(const int &numberPrimitiveVariables, const int &numberSlopeVariables, const int &numberTransportVariables, const int &dim, const int &lvlMax)
Definition Parallel.cpp:723
MPI_Request ** m_reqNumberSlopesToReceiveFromNeighbour
Definition Parallel.h:157
void initializePersistentCommunicationsNumberGhostCells()
Definition Parallel.cpp:1279
std::vector< TypeMeshContainer< Cell * > > m_elementsToReceive
Definition Parallel.h:112
void addElementToReceive(int neighbour, Cell *cell)
Definition Parallel.cpp:160
std::vector< MPI_Request ** > m_reqSendSlopes
Definition Parallel.h:142
void finalizePersistentCommunicationsScalar(const int &lvlMax)
Definition Parallel.cpp:519
void computePMax(double &pMax, double &pMaxWall)
Definition Parallel.cpp:251
std::vector< bool ** > m_bufferSendSplit
Definition Parallel.h:134
std::vector< double ** > m_bufferReceiveXi
Definition Parallel.h:131
std::vector< double ** > m_bufferReceiveTransports
Definition Parallel.h:129
std::vector< MPI_Request ** > m_reqReceiveXi
Definition Parallel.h:151
int * m_numberSlopesToSendToNeighbour
Definition Parallel.h:115
int * m_numberSlopesToReceiveFromNeighbour
Definition Parallel.h:116
void communicationsSlopes(int lvl)
Definition Parallel.cpp:455
void communicationsXi(int lvl)
Definition Parallel.cpp:1152
void finalizePersistentCommunicationsTransports(const int &lvlMax)
Definition Parallel.cpp:658
std::vector< double ** > m_bufferReceive
Definition Parallel.h:121
void finalizePersistentCommunicationsNumberGhostCells()
Definition Parallel.cpp:1310
std::vector< MPI_Request ** > m_reqSendScalar
Definition Parallel.h:144
std::vector< double ** > m_bufferSendScalar
Definition Parallel.h:126
void computeSum(double &var)
Definition Parallel.cpp:260
void addElementToSend(int neighbour, Cell *cell)
Definition Parallel.cpp:152
void communicationsNumberGhostCells(int lvl)
Definition Parallel.cpp:1336
Parallel()
Definition Parallel.cpp:40
bool verifyStateCPUs()
Definition Parallel.cpp:301
int * m_bufferNumberSlopesToSendToNeighbor
Definition Parallel.h:137
std::vector< TypeMeshContainer< Cell * > > m_elementsToSend
Definition Parallel.h:111
int m_numberTransportVariables
Definition Parallel.h:119
void finalizePersistentCommunicationsSlopes(const int &lvlMax)
Definition Parallel.cpp:429
int * m_numberElementsToReceiveFromNeighbour
Definition Parallel.h:114
std::vector< double ** > m_bufferSendTransports
Definition Parallel.h:130
std::vector< double ** > m_bufferReceiveVector
Definition Parallel.h:127
std::vector< MPI_Request ** > m_reqSendVector
Definition Parallel.h:146
int * m_bufferNumberElementsToSendToNeighbor
Definition Parallel.h:135
void finalizeAMR(const int &lvlMax)
Definition Parallel.cpp:1088
void initializePersistentCommunicationsSlopes()
Definition Parallel.cpp:406
void initializePersistentCommunicationsSplit()
Definition Parallel.cpp:1190
void finalizePersistentCommunicationsPrimitives(const int &lvlMax)
Definition Parallel.cpp:342
std::vector< MPI_Request ** > m_reqReceiveVector
Definition Parallel.h:147
std::vector< double ** > m_bufferReceiveScalar
Definition Parallel.h:125
void updatePersistentCommunicationsLvlAMR(int lvl, const int &dim)
Definition Parallel.cpp:990
std::vector< MPI_Request ** > m_reqReceiveTransports
Definition Parallel.h:149
void finalize(const int &lvlMax)
Definition Parallel.cpp:268
void clearElementsAndSlopesToSendAndReceivePLusNeighbour()
Definition Parallel.cpp:196
void initializePersistentCommunicationsScalar()
Definition Parallel.cpp:493
std::vector< MPI_Request ** > m_reqSendXi
Definition Parallel.h:150
std::vector< double ** > m_bufferSendVector
Definition Parallel.h:128
void addSlopesToSend(int neighbour)
Definition Parallel.cpp:168
int m_numberPrimitiveVariables
Definition Parallel.h:117
void finalizePersistentCommunicationsXi(const int &lvlMax)
Definition Parallel.cpp:1126
std::vector< double ** > m_bufferSendXi
Definition Parallel.h:132
void initializePersistentCommunicationsTransports()
Definition Parallel.cpp:635
void deleteSlopesToSend(int neighbour)
Definition Parallel.cpp:182
std::vector< MPI_Request ** > m_reqReceiveSplit
Definition Parallel.h:153
~Parallel()
Definition Parallel.cpp:44
void computeDt(double &dt)
Definition Parallel.cpp:243
void deleteSlopesToReceive(int neighbour)
Definition Parallel.cpp:189
void setNeighbour(const int neighbour)
Definition Parallel.cpp:145
std::vector< MPI_Request ** > m_reqReceive
Definition Parallel.h:141
std::vector< MPI_Request ** > m_reqSendTransports
Definition Parallel.h:148
void initialization()
Definition Parallel.cpp:48
bool * m_isNeighbour
Definition Parallel.h:110
void finalizePersistentCommunicationsSplit(const int &lvlMax)
Definition Parallel.cpp:1215
std::vector< double ** > m_bufferSendSlopes
Definition Parallel.h:124
TypeMeshContainer< Cell * > & getElementsToReceive(int neighbour)
Definition Parallel.cpp:216
void updatePersistentCommunicationsAMR(const int &dim)
Definition Parallel.cpp:968
MPI_Request ** m_reqNumberElementsToReceiveFromNeighbour
Definition Parallel.h:155
std::vector< double ** > m_bufferReceiveSlopes
Definition Parallel.h:123
int m_numberSlopeVariables
Definition Parallel.h:118
void initializePersistentCommunicationsPrimitives()
Definition Parallel.cpp:319
int * m_numberElementsToSendToNeighbour
Definition Parallel.h:113
std::vector< MPI_Request ** > m_reqSendSplit
Definition Parallel.h:152
void clearRequestsAndBuffers(int lvl)
Definition Parallel.cpp:894