ECOGEN 6.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{
41 public:
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,
57 const int& numberSlopeVariables,
58 const int& numberTransportVariables,
59 const int& dim);
60 void computeDt(double& dt);
61 void computePMax(double& pMax, double& pMaxWall);
62 void computeSum(double& var);
63 void finalize(const int& lvlMax);
64 void stopRun();
65
66 //Methodes pour toutes les variables primitives
68 void finalizePersistentCommunicationsPrimitives(const int& lvlMax);
69 void communicationsPrimitives(Eos** eos, int lvl, Prim type = vecPhases);
70
71 //Methodes pour toutes les slopes
73 void finalizePersistentCommunicationsSlopes(const int& lvlMax);
74 void communicationsSlopes(int lvl);
75
76 //Methodes pour une variable scalar
79
80 //Methodes pour une variable vectorielle
82 void finalizePersistentCommunicationsVector(const int& lvlMax);
83 void communicationsVector(Variable nameVector, const int& dim, int lvl, int num = 0, int index = -1);
84
85 //Methodes pour toutes les variables transports
87 void finalizePersistentCommunicationsTransports(const int& lvlMax);
88 void communicationsTransports(int lvl);
89
90 //Methodes pour les variables AMR
92 const int& numberPrimitiveVariables, const int& numberSlopeVariables, const int& numberTransportVariables, const int& dim, const int& lvlMax);
93 void initializePersistentCommunicationsLvlAMR(const int& lvlMax);
95
96 void clearRequestsAndBuffers(int lvl);
97 void updatePersistentCommunicationsAMR(const int& dim);
98 void updatePersistentCommunicationsLvlAMR(int lvl, const int& dim);
99 void finalizeAMR(const int& lvlMax);
100
101 void initializePersistentCommunicationsXi(const int& lvl, const int& number);
102 void finalizePersistentCommunicationsXi(const int& lvlMax);
103 void communicationsXi(int lvl);
104
105 void initializePersistentCommunicationsSplit(const int& lvl, const int& number);
106 void finalizePersistentCommunicationsSplit(const int& lvlMax);
107 void communicationsSplit(int lvl);
108
111 void communicationsNumberGhostCells(int lvl);
112
113 private:
115 std::vector<TypeMeshContainer<Cell*>> m_elementsToSend;
116 std::vector<TypeMeshContainer<Cell*>> m_elementsToReceive;
121 int m_numberPrimitiveVariables; /*Number of primitive variables to send (phases + mixture + transports)*/
122 int m_numberSlopeVariables; /*Number of slope variables to send (phases + mixture + transports)*/
123 int m_numberTransportVariables; /*Number of transport variables to send*/
124
125 std::vector<double**> m_bufferReceive;
126 std::vector<double**> m_bufferSend;
127 std::vector<double**> m_bufferReceiveSlopes;
128 std::vector<double**> m_bufferSendSlopes;
129 std::vector<double**> m_bufferReceiveScalar;
130 std::vector<double**> m_bufferSendScalar;
131 std::vector<double**> m_bufferReceiveVector;
132 std::vector<double**> m_bufferSendVector;
133 std::vector<double**> m_bufferReceiveTransports;
134 std::vector<double**> m_bufferSendTransports;
135 std::vector<double**> m_bufferReceiveXi;
136 std::vector<double**> m_bufferSendXi;
137 std::vector<bool**> m_bufferReceiveSplit;
138 std::vector<bool**> m_bufferSendSplit;
143
144 std::vector<MPI_Request**> m_reqSend;
145 std::vector<MPI_Request**> m_reqReceive;
146 std::vector<MPI_Request**> m_reqSendSlopes;
147 std::vector<MPI_Request**> m_reqReceiveSlopes;
148 std::vector<MPI_Request**> m_reqSendScalar;
149 std::vector<MPI_Request**> m_reqReceiveScalar;
150 std::vector<MPI_Request**> m_reqSendVector;
151 std::vector<MPI_Request**> m_reqReceiveVector;
152 std::vector<MPI_Request**> m_reqSendTransports;
153 std::vector<MPI_Request**> m_reqReceiveTransports;
154 std::vector<MPI_Request**> m_reqSendXi;
155 std::vector<MPI_Request**> m_reqReceiveXi;
156 std::vector<MPI_Request**> m_reqSendSplit;
157 std::vector<MPI_Request**> m_reqReceiveSplit;
162};
163
164extern Parallel parallel;
165extern int rankCpu;
166extern int Ncpu;
167
168#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:40
@ vecPhases
Definition Tools.h:41
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:194
Variable
Enumeration for the flow variables.
Definition Tools.h:163
Base class for a mesh cell.
Definition Cell.h:59
General class for Equation of State (EOS).
Definition Eos.h:62
Definition Parallel.h:40
void initializePersistentCommunications(const int &numberPrimitiveVariables, const int &numberSlopeVariables, const int &numberTransportVariables, const int &dim)
Definition Parallel.cpp:178
int * m_bufferNumberSlopesToReceiveFromNeighbour
Definition Parallel.h:142
TypeMeshContainer< Cell * > & getElementsToSend(int neighbour)
Definition Parallel.cpp:170
void initializePersistentCommunicationsLvlAMR(const int &lvlMax)
Definition Parallel.cpp:660
void communicationsVector(Variable nameVector, const int &dim, int lvl, int num=0, int index=-1)
Definition Parallel.cpp:500
void communicationsPrimitives(Eos **eos, int lvl, Prim type=vecPhases)
Definition Parallel.cpp:317
void initializePersistentCommunicationsVector(const int &dim)
Definition Parallel.cpp:446
std::vector< double ** > m_bufferSend
Definition Parallel.h:126
std::vector< bool ** > m_bufferReceiveSplit
Definition Parallel.h:137
void communicationsTransports(int lvl)
Definition Parallel.cpp:594
std::vector< MPI_Request ** > m_reqReceiveSlopes
Definition Parallel.h:147
void stopRun()
Definition Parallel.cpp:253
void communicationsSplit(int lvl)
Definition Parallel.cpp:1151
MPI_Request ** m_reqNumberElementsToSendToNeighbor
Definition Parallel.h:158
MPI_Request ** m_reqNumberSlopesToSendToNeighbor
Definition Parallel.h:160
std::vector< MPI_Request ** > m_reqSend
Definition Parallel.h:144
void addSlopesToReceive(int neighbour)
Definition Parallel.cpp:145
int * m_bufferNumberElementsToReceiveFromNeighbour
Definition Parallel.h:140
void finalizePersistentCommunicationsVector(const int &lvlMax)
Definition Parallel.cpp:470
std::vector< MPI_Request ** > m_reqReceiveScalar
Definition Parallel.h:149
void initializePersistentCommunicationsAMR(const int &numberPrimitiveVariables, const int &numberSlopeVariables, const int &numberTransportVariables, const int &dim, const int &lvlMax)
Definition Parallel.cpp:632
MPI_Request ** m_reqNumberSlopesToReceiveFromNeighbour
Definition Parallel.h:161
void initializePersistentCommunicationsNumberGhostCells()
Definition Parallel.cpp:1189
std::vector< TypeMeshContainer< Cell * > > m_elementsToReceive
Definition Parallel.h:116
void addElementToReceive(int neighbour, Cell *cell)
Definition Parallel.cpp:133
std::vector< MPI_Request ** > m_reqSendSlopes
Definition Parallel.h:146
void finalizePersistentCommunicationsScalar(const int &lvlMax)
void computePMax(double &pMax, double &pMaxWall)
Definition Parallel.cpp:209
std::vector< bool ** > m_bufferSendSplit
Definition Parallel.h:138
std::vector< double ** > m_bufferReceiveXi
Definition Parallel.h:135
std::vector< double ** > m_bufferReceiveTransports
Definition Parallel.h:133
std::vector< MPI_Request ** > m_reqReceiveXi
Definition Parallel.h:155
void initializePersistentCommunicationsSplit(const int &lvl, const int &number)
Definition Parallel.cpp:1098
int * m_numberSlopesToSendToNeighbour
Definition Parallel.h:119
int * m_numberSlopesToReceiveFromNeighbour
Definition Parallel.h:120
void communicationsSlopes(int lvl)
Definition Parallel.cpp:408
void communicationsXi(int lvl)
Definition Parallel.cpp:1060
void finalizePersistentCommunicationsTransports(const int &lvlMax)
Definition Parallel.cpp:564
std::vector< double ** > m_bufferReceive
Definition Parallel.h:125
void finalizePersistentCommunicationsNumberGhostCells()
Definition Parallel.cpp:1247
std::vector< MPI_Request ** > m_reqSendScalar
Definition Parallel.h:148
std::vector< double ** > m_bufferSendScalar
Definition Parallel.h:130
void computeSum(double &var)
Definition Parallel.cpp:218
void addElementToSend(int neighbour, Cell *cell)
Definition Parallel.cpp:125
void communicationsNumberGhostCells(int lvl)
Definition Parallel.cpp:1279
Parallel()
Definition Parallel.cpp:40
int * m_bufferNumberSlopesToSendToNeighbor
Definition Parallel.h:141
void initializePersistentCommunicationsXi(const int &lvl, const int &number)
Definition Parallel.cpp:1008
std::vector< TypeMeshContainer< Cell * > > m_elementsToSend
Definition Parallel.h:115
int m_numberTransportVariables
Definition Parallel.h:123
void finalizePersistentCommunicationsSlopes(const int &lvlMax)
Definition Parallel.cpp:378
int * m_numberElementsToReceiveFromNeighbour
Definition Parallel.h:118
std::vector< double ** > m_bufferSendTransports
Definition Parallel.h:134
std::vector< double ** > m_bufferReceiveVector
Definition Parallel.h:131
std::vector< MPI_Request ** > m_reqSendVector
Definition Parallel.h:150
int * m_bufferNumberElementsToSendToNeighbor
Definition Parallel.h:139
void finalizeAMR(const int &lvlMax)
Definition Parallel.cpp:995
void initializePersistentCommunicationsSlopes()
Definition Parallel.cpp:354
void finalizePersistentCommunicationsPrimitives(const int &lvlMax)
Definition Parallel.cpp:287
std::vector< MPI_Request ** > m_reqReceiveVector
Definition Parallel.h:151
std::vector< double ** > m_bufferReceiveScalar
Definition Parallel.h:129
void updatePersistentCommunicationsLvlAMR(int lvl, const int &dim)
Definition Parallel.cpp:887
std::vector< MPI_Request ** > m_reqReceiveTransports
Definition Parallel.h:153
void finalize(const int &lvlMax)
Definition Parallel.cpp:226
void initializePersistentCommunicationsFromLvl0AMR(const int &lvlMax)
Definition Parallel.cpp:773
void clearElementsAndSlopesToSendAndReceivePLusNeighbour()
Definition Parallel.cpp:157
void initializePersistentCommunicationsScalar()
std::vector< MPI_Request ** > m_reqSendXi
Definition Parallel.h:154
std::vector< double ** > m_bufferSendVector
Definition Parallel.h:132
void addSlopesToSend(int neighbour)
Definition Parallel.cpp:141
int m_numberPrimitiveVariables
Definition Parallel.h:121
void finalizePersistentCommunicationsXi(const int &lvlMax)
Definition Parallel.cpp:1032
std::vector< double ** > m_bufferSendXi
Definition Parallel.h:136
void initializePersistentCommunicationsTransports()
Definition Parallel.cpp:539
void deleteSlopesToSend(int neighbour)
Definition Parallel.cpp:149
std::vector< MPI_Request ** > m_reqReceiveSplit
Definition Parallel.h:157
~Parallel()
Definition Parallel.cpp:44
void computeDt(double &dt)
Definition Parallel.cpp:201
void deleteSlopesToReceive(int neighbour)
Definition Parallel.cpp:153
void setNeighbour(const int neighbour)
Definition Parallel.cpp:121
std::vector< MPI_Request ** > m_reqReceive
Definition Parallel.h:145
std::vector< MPI_Request ** > m_reqSendTransports
Definition Parallel.h:152
void initialization()
Definition Parallel.cpp:48
bool * m_isNeighbour
Definition Parallel.h:114
void finalizePersistentCommunicationsSplit(const int &lvlMax)
Definition Parallel.cpp:1123
std::vector< double ** > m_bufferSendSlopes
Definition Parallel.h:128
TypeMeshContainer< Cell * > & getElementsToReceive(int neighbour)
Definition Parallel.cpp:174
void updatePersistentCommunicationsAMR(const int &dim)
Definition Parallel.cpp:863
MPI_Request ** m_reqNumberElementsToReceiveFromNeighbour
Definition Parallel.h:159
std::vector< double ** > m_bufferReceiveSlopes
Definition Parallel.h:127
int m_numberSlopeVariables
Definition Parallel.h:122
void initializePersistentCommunicationsPrimitives()
Definition Parallel.cpp:264
int * m_numberElementsToSendToNeighbour
Definition Parallel.h:117
std::vector< MPI_Request ** > m_reqSendSplit
Definition Parallel.h:156
void clearRequestsAndBuffers(int lvl)
Definition Parallel.cpp:815