1 #ifndef MPI_GraphGridEnvironment_H
2 #define MPI_GraphGridEnvironment_H
5 #include "MPI_DirectionalGridEnvironment.h"
8 #include "MPI_IOFile.h"
11 #include "functions_array.h"
34 template<tUCInt N,tUCInt D=1>
40 MPI_Group *mGroup,*mParentGroup;
64 MPI_Group_free(mGroup);
67 if (mParentGroup!=
null) {
68 MPI_Group_free(mParentGroup);
88 const tString& fileDescriptor) {
92 std::array<tInteger,N> gridsNumber;
93 std::array<tInteger,N> coreIndices;
94 std::map<tUCInt,tMPICoreId> dirNeighbors;
96 tBoolean isInGraphGridEnv=
false;
101 gridsNumber,coreIndices,dirNeighbors,
104 return New(parent,nCores,gridsNumber,coreIndices,dirNeighbors);
116 const tMPICoreId& nCores,
117 const std::array<tInteger,N>& gridsNumber,
118 const std::array<tInteger,N>& coreIndices,
119 const std::map<tUCInt,tMPICoreId>& dirNeighbors) {
131 p->mParentGroup=
new MPI_Group();
132 MPI_Comm_group(parent.
getWorld(),p->mParentGroup);
135 std::valarray<tMPICoreId> processRanks(nCores);
137 for(
auto& Pk:processRanks) {Pk=i;i++;}
139 p->mGroup=
new MPI_Group();
140 MPI_Group_incl(*p->mParentGroup,nCores,&processRanks[0],p->mGroup);
143 MPI_Comm_create(parent.
getWorld(),*p->mGroup,&p->getWorld());
146 if (p->getWorld()==MPI_COMM_NULL) {
155 p->setGridSize(gridsNumber);
156 p->setIndices(coreIndices);
157 p->setDirectionalNeighbors(dirNeighbors);
194 std::array<tInteger,N>& gridsNumber,
195 std::array<tInteger,N>& coreIndices,
196 std::map<tUCInt,tMPICoreId>& dirNeighbors,
197 tBoolean& isCoreInGrid);
212 const tInteger& nFullCores,
213 const tInteger& fullId,
214 const std::map<tUCInt,Q>& isDirNeighborFull,
215 const tString& fileName);
222 #include "MPI_GraphGridEnvironment.hpp"
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is a grid Environment of templated dimension N=1,2,3.
Definition: MPI_DirectionalGridEnvironment.h:30
virtual void initialize()
initialize the environment
Definition: MPI_DirectionalGridEnvironment.h:303
This class is a Environment class to define MPI world.
Definition: MPI_Environment.h:36
const tMPIComm & getWorld() const
get the world of the environment for reading
Definition: MPI_Environment.h:165
This class is a cart Environment of templated dimension N.
Definition: MPI_GraphGridEnvironment.h:35
MPI_GraphGridEnvironment()
create a root environment
Definition: MPI_GraphGridEnvironment.h:50
virtual ~MPI_GraphGridEnvironment(void)
destroy
Definition: MPI_GraphGridEnvironment.h:62
static tBoolean SaveGridCartFile(const MPI_DirectionalGridEnvironment< N, D > &env, const tInteger &nFullCores, const tInteger &fullId, const std::map< tUCInt, Q > &isDirNeighborFull, const tString &fileName)
save the grid cart file
Definition: MPI_GraphGridEnvironment.hpp:170
static CORE_UniquePointer< MPI_GraphGridEnvironment< N > > New(const MPI_Environment &parent, const tMPICoreId &nCores, const std::array< tInteger, N > &gridsNumber, const std::array< tInteger, N > &coreIndices, const std::map< tUCInt, tMPICoreId > &dirNeighbors)
create a new cart environment
Definition: MPI_GraphGridEnvironment.h:115
static CORE_UniquePointer< MPI_GraphGridEnvironment< N > > New(const MPI_Environment &parent, const tString &fileDescriptor)
create a new cart environment
Definition: MPI_GraphGridEnvironment.h:87
static tBoolean LoadGridCartFile(const tString &fileName, const MPI_Environment &env, tMPICoreId &nCores, std::array< tInteger, N > &gridsNumber, std::array< tInteger, N > &coreIndices, std::map< tUCInt, tMPICoreId > &dirNeighbors, tBoolean &isCoreInGrid)
save the grid cart file
Definition: MPI_GraphGridEnvironment.hpp:5
virtual void initialize()
initialize the environment
Definition: MPI_GraphGridEnvironment.h:165