From d7d1a008216cf3705ecef1fba9393e4443c39f5d Mon Sep 17 00:00:00 2001 From: Anida Khizar Date: Fri, 24 Mar 2023 16:31:37 +0100 Subject: [PATCH] [Partial load] Adding more tests --- resources/CMakeLists.txt | 2 + resources/SimpleTest2D.med | Bin 14999 -> 22464 bytes resources/SimpleTest3D.med | Bin 0 -> 16098 bytes resources/Test2DMultiGeoType.med | Bin 0 -> 8678 bytes src/ParaMEDMEMTest/ParaMEDMEMTest.hxx | 8 +- .../ParaMEDMEMTest_MEDLoader.cxx | 230 +++++++++++++++++- 6 files changed, 227 insertions(+), 13 deletions(-) create mode 100644 resources/SimpleTest3D.med create mode 100644 resources/Test2DMultiGeoType.med diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 12135b962..6a3a63e72 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -40,6 +40,8 @@ SET(MED_other_FILES Test3D.med Test3Dpoly.med SimpleTest2D.med + SimpleTest3D.med + Test2DMultiGeoType.med UnitTetraDegenT.med DegenEdgeXY.med DegenFaceXYZ.med diff --git a/resources/SimpleTest2D.med b/resources/SimpleTest2D.med index d4cfcd75c87e7025954eef419e8368460dadbb4e..3c890eba6fe0847b7e0893d3d1a4c751472cf3e1 100644 GIT binary patch literal 22464 zcmeHP4Qv$06`nhDwtF0g5CZ`kbNn>WBm~=-AKOs-d_Vrd-m~w{6b!{UviT{tL*t;B ziqa$%Z3*;;mZnkC#!{poHXDa3BR40H*em&ncaEwzBzVR1w!N8)7;MNY)0t{rhzZZl6DW*H8LkRM zoZj2FO>Ncw>vm2A9%@L`?PLzdGN&<4##bw$aJ0EHs01Uv+Ff>eUG_HeO4+>n#jf&)%ARVu?$|}fyz2x z4V%DiBF$3HoV+()ERvqFS}`!U<(g_m1J60_GDow%DEWnNApUQ-E zB32vX{oV_lK6sxQ>pfTOVi{0SA`5=r(Bxu=pn$*Kz!3}n#>1WkX;@Iv)se?aH3dsH z9*wXbDBxc%Xj1-<856=jp+m{&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*4qVAKoI~hkM2QaG!V|-YVXQ zz2be?C*Fts;(a(E-iQ0e`|yBxA086#!$I*r91`!t!{U9&{ecg;SMVYC3_cuId>>}T z`*1|O4@brOFel!JdGS6R6Ys-u@jfhw_u+(iA5Mz*VNtvfOX7W47VpDp@jg5z-iH0-?sQR}ma$no37^weS6{l4HR>i97->RtUufl2%toFca53KgU z|5*>@$8#fwuOo(Sf3!3BMD2T?L3KLuUlVQWqMA{zko?z*gwf1LlS=fpQwsknG8a_C z|4c|(Chgc7bG$T@WWukaRx8Ob*VGG#MwOt6=%sQojN$GwT=dLaO!c)bteDb?P|3aD zxH_G_t8f2c@4#RtfA?oI#nX3ZdJkrL4-5_T4fXV9`g;2MGyMYt2YL>LbqSlk*mtyQ SLs&ZL|2CD4x|-gtJ@8+KiyiO) literal 0 HcmV?d00001 diff --git a/resources/Test2DMultiGeoType.med b/resources/Test2DMultiGeoType.med new file mode 100644 index 0000000000000000000000000000000000000000..dc6cf553338c9ba054a633a1674dfa0371df2d0a GIT binary patch literal 8678 zcmeGhTWl0n^v-O%tlO2g*eZg+7DG})FuU7DyG7FOc4xa=c4n5D-HKJyq7aCrvDgwT zKN=DhZ4B|p@F5|_X!vL~=nt3_j2esq8uUjcX$c<`Q6w6EP%(J#%sI0=JF^elVyx~> z+B19ax#xZEIWzaQcrk=eE2`2^hb0F%ZJ2|pQkkmdg93G|kY&aLQSw}3aPA}JI zh{ge)4RG`5jX`^n#*2y6xP(+$#r3Qq#6cH4Y*7q%lR9b>-7Fo1r#$JjHq3|#$$|)4 z5EG&zBnu+GxanNjUXS9Ytz~Aa8rVLxb0rgy4M7KU{{L3f)ccx9O}Ud&Fg%Y;kTQcaDx0EH07N2`A-lyR5N)vro>ZPSn{MUs}$zkpJ1?E7_9ja z4V&Fs^oedq3ec4DKN>=S&RwPVOhuIa{s{ zbiP40=CHkT@cMUTI*0B3-JUDt?wl=WZmzvS`g0~mFP{HxX5R&>NM)2~0sG@=A6G~7 z;u_R5EM9soVk;vJI(1wz9n#X4wB?Y-)XGCll!ut=DU)KVr%Z}cvS$ z9SwxDGkCR&a6Hdz7IIPP99$d7_9;-X*VF8rh}AiGzM2q=I%i&vm%ZARQmq=6WrPk7;c~z4SX;E;p`!IuUD)`?TC{GR-~9Y5Bp?*f;Yg zB_uhzp;0Gf&ybnnQSHr~kYhSx_WPq)dk;)uf1~}Z7N7ZH{v)mzdaQn6X)muSEhL+l z0_@C8h(*0KuMrnq>h7JN!=X!%EjfQ0Y*V&!d5DEik#{bR94qBhG%do?r^qMZQ}2TI zsrc-VlXFVJYjDokhcrt;H~rYghBXC0gB9adOT&9Gvp-()eSUK$xE451yLJzkaxWD_ z8wg9g_dK}wCD>`NpD70ag()TzWe2S@xu(VHm zp-1p8XrI=PpA~15ve_%8-S>e31b}k|!yla*osCGe1arg_3yX;)Z6tdIMXtj8hmCWT z>2l!BU+qO2<5yGK_?5j5WM!` z=sk-=`^58Y|HPNEcr-%rN=~Cb`qLk)jk``kOu3e0L61!E;6rL8O4b*!pbKRD+S){qpT4DOOFYCM{NySK#9u7owYGg4yKJA1U9 z4*<`ty8`P&{$R+P-m~2+Zhg)h@O%BfHeYL7u*Dnj1zNlh1w#H%YxX+2*u8||B56zE N8w4~~1^y2$@D~~_qM-l) literal 0 HcmV?d00001 diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx b/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx index b26be7356..3223aaf48 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx @@ -86,7 +86,10 @@ class ParaMEDMEMTest : public CppUnit::TestFixture CPPUNIT_TEST(testFabienAPI2); // 3 procs CPPUNIT_TEST(testParallelLoad1); // 2 procs - CPPUNIT_TEST(testParallelLoad2); // 2 procs + CPPUNIT_TEST(testParallelLoad2); // 3 procs + CPPUNIT_TEST(testParallelLoad3); // 2 procs + CPPUNIT_TEST(testParallelLoad4); // 2 procs + CPPUNIT_TEST(testParallelLoad5); // 2 procs CPPUNIT_TEST_SUITE_END(); public: @@ -152,6 +155,9 @@ public: void testParallelLoad1(); void testParallelLoad2(); + void testParallelLoad3(); + void testParallelLoad4(); + void testParallelLoad5(); std::string getTmpDirectory(); std::string makeTmpFile( const std::string&, const std::string& = "" ); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx index 2420a4fa0..1de4cd0b9 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx @@ -35,7 +35,7 @@ using namespace MEDCoupling; -MEDCouplingUMesh* genLocMesh(int rk) +MEDCouplingUMesh* genLocMesh2D(int rk) { int nxTot=4,nyTot=2; int nx=2,ny=2; @@ -66,21 +66,95 @@ MEDCouplingUMesh* genLocMesh(int rk) return ret.retn(); } -MEDCouplingFieldDouble *genLocField(int rank) +MEDCouplingUMesh* genLocMeshMultipleTypes1() { - MCAuto mesh = genLocMesh(rank); + MCAuto ret= MEDCouplingUMesh::New("mesh",2); + double coords[10] = {0.,1., 0.,2., 1.,2., 0.,3., 1.,3.}; + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(5,2); + std::copy(coords,coords+10,myCoords->getPointer()); + ret->setCoords(myCoords); + myCoords->decrRef(); + mcIdType conn[7]={0,2,1, 1,2,4,3}; + ret->allocateCells(2); + ret->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn); + ret->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+3); + ret->finishInsertingCells(); + return ret.retn(); +} + +MEDCouplingUMesh* genLocMeshMultipleTypes2() +{ + MCAuto ret= MEDCouplingUMesh::New("mesh",2); + double coords[10] = {0.,0., 1.,0., 0.,1., 1.,1., 1.,2.}; + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(5,2); + std::copy(coords,coords+10,myCoords->getPointer()); + ret->setCoords(myCoords); + myCoords->decrRef(); + mcIdType conn[7]={2,3,4, 0,1,3,2}; + ret->allocateCells(2); + ret->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn); + ret->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+3); + ret->finishInsertingCells(); + return ret.retn(); +} + +MEDCouplingUMesh* genLocMeshMultipleTypes3() +{ + MCAuto ret= MEDCouplingUMesh::New("mesh",2); + double coords[16] = {1.,0., 2.,0., 1.,1., 2.,1., 1.,2., 2.,2., 1.,3., 2.,3.}; + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(8,2); + std::copy(coords,coords+16,myCoords->getPointer()); + ret->setCoords(myCoords); + myCoords->decrRef(); + mcIdType conn[14]={0,1,3, 0,3,2, 2,3,5,4, 4,5,7,6}; + ret->allocateCells(4); + ret->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn); + ret->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3); + ret->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+6); + ret->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+10); + ret->finishInsertingCells(); + return ret.retn(); +} + +MEDCouplingFieldDouble *genLocFieldCells(int rank) +{ + MCAuto mesh = genLocMesh2D(rank); MCAuto f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("field"); f1->setMesh(mesh); MCAuto array(DataArrayDouble::New()); - double* values = new double[4]; + array->alloc(4,2); + std::vector values; if(rank == 0) - values[0]= 0.,values[1]=10.,values[2]=40.,values[3]=50.; + values = { 0., 10., 20., 30., 80., 90., 100., 110.}; else - values[0]=20.,values[1]=30.,values[2]=60.,values[3]=70.; - array->useArray(values,true, DeallocType::CPP_DEALLOC,4,1); - array->setInfoOnComponent(0,"s"); + values = { 40., 50., 60., 70., 120., 130., 140., 150.}; + std::copy(values.data(),values.data()+8,array->getPointer()); + array->setInfoOnComponent(0,""); + f1->setArray(array); + return f1.retn(); +} + +MEDCouplingFieldDouble *genLocFieldNodes(int rank) +{ + MCAuto mesh = genLocMesh2D(rank); + MCAuto f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); + f1->setName("field"); + f1->setMesh(mesh); + + MCAuto array(DataArrayDouble::New()); + array->alloc(9,2); + std::vector values; + if(rank == 0) + values= { 0., 10., 20., 30., 40., 50., 100., 110., 120., 130., 140., 150., 200., 210., 220., 230., 240., 250. }; + else + values= { 40., 50., 60., 70., 80., 90., 140., 150., 160., 170., 180., 190., 240., 250., 260., 270., 280., 290. }; + std::copy(values.data(),values.data()+18,array->getPointer()); + array->setInfoOnComponent(0,""); f1->setArray(array); return f1.retn(); } @@ -104,13 +178,120 @@ void ParaMEDMEMTest::testParallelLoad1() std::string filename=INTERP_TEST::getResourceFile("SimpleTest2D.med"); MCAuto mu = ParaMEDFileUMesh::ParaNew(distrib, MPI_COMM_WORLD, MPI_INFO_NULL, filename, "mesh"); - MCAuto meshRef = genLocMesh(rank); + MCAuto meshRef = genLocMesh2D(rank); CPPUNIT_ASSERT(mu->getMeshAtLevel(0)->isEqual(meshRef,1e-12)); MPI_Barrier(MPI_COMM_WORLD); } - void ParaMEDMEMTest::testParallelLoad2() +{ + int size; + int rank; + MPI_Comm_size(MPI_COMM_WORLD,&size); + MPI_Comm_rank(MPI_COMM_WORLD,&rank); + // + if(size!=3) + return ; + + std::map> distrib; + // independant numerotation for each geometric type! + if (rank == 0) + distrib = { {INTERP_KERNEL::NORM_TRI3,{3}} , {INTERP_KERNEL::NORM_QUAD4,{2}} }; + else if(rank == 1) + distrib = { {INTERP_KERNEL::NORM_TRI3,{2}} , {INTERP_KERNEL::NORM_QUAD4,{0}} }; + else + distrib= { {INTERP_KERNEL::NORM_TRI3,{0,1}} , {INTERP_KERNEL::NORM_QUAD4,{1,3}} }; + + std::string filename=INTERP_TEST::getResourceFile("Test2DMultiGeoType.med"); + MCAuto mu = ParaMEDFileUMesh::ParaNew(distrib, MPI_COMM_WORLD, MPI_INFO_NULL, filename, "mesh"); + MEDCouplingUMesh *meshRef; + if(rank==0) + meshRef=genLocMeshMultipleTypes1(); + else if(rank==1) + meshRef=genLocMeshMultipleTypes2(); + else + meshRef=genLocMeshMultipleTypes3(); + int equal = (int)mu->getMeshAtLevel(0)->isEqual(meshRef,1e-12); + int allEqual = -1; + MPI_Allreduce(&equal, &allEqual, 1, MPI_INT,MPI_SUM,MPI_COMM_WORLD); + CPPUNIT_ASSERT(allEqual==3); + meshRef->decrRef(); + MPI_Barrier(MPI_COMM_WORLD); +} + +void ParaMEDMEMTest::testParallelLoad3() +{ + int size; + int rank; + MPI_Comm_size(MPI_COMM_WORLD,&size); + MPI_Comm_rank(MPI_COMM_WORLD,&rank); + // + if(size!=2) + return ; + + std::map> distrib; + if (rank == 0) + { + std::vector distribCells = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,48,49,50,51,52,53,54,55,56,57, + 58,59,60,61,62,63,64,65,66,67,68,69,70,71,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118, + 119,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167}; + distrib = { {INTERP_KERNEL::NORM_TETRA4,distribCells} }; + } + else + { + std::vector distribCells = {24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,72,73,74,75,76,77,78,79,80, + 81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142, + 143,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191}; + distrib = { {INTERP_KERNEL::NORM_TETRA4,distribCells} }; + } + + std::string filename=INTERP_TEST::getResourceFile("SimpleTest3D.med"); + MCAuto mu = ParaMEDFileUMesh::ParaNew(distrib, MPI_COMM_WORLD, MPI_INFO_NULL, filename, "mesh"); + MCAuto mesh = mu->getMeshAtLevel(0); + + double nodalConnec[480] = {14, 1, 7, 18, 24, 14, 7, 6, 18, 24, 14, 6, 0, 18, 24, 14, 0, 1, 18, 24, 14, 1, 0, 19, 24, 14, 0, 2, 19, 24, 14, 2, 3, 19, 24, + 14, 3, 1, 19, 24, 14, 1, 3, 20, 24, 14, 3, 9, 20, 24, 14, 9, 7, 20, 24, 14, 7, 1, 20, 24, 14, 0, 6, 21, 24, 14, 6, 8, 21, 24, 14, 8, 2, 21, 24, + 14, 2, 0, 21, 24, 14, 7, 9, 22, 24, 14, 9, 8, 22, 24, 14, 8, 6, 22, 24, 14, 6, 7, 22, 24, 14, 2, 8, 23, 24, 14, 8, 9, 23, 24, 14, 9, 3, 23, 24, + 14, 3, 2, 23, 24, 14, 3, 9, 25, 31, 14, 9, 8, 25, 31, 14, 8, 2, 25, 31, 14, 2, 3, 25, 31, 14, 3, 2, 26, 31, 14, 2, 4, 26, 31, 14, 4, 5, 26, 31, + 14, 5, 3, 26, 31, 14, 3, 5, 27, 31, 14, 5, 11, 27, 31, 14, 11, 9, 27, 31, 14, 9, 3, 27, 31, 14, 2, 8, 28, 31, 14, 8, 10, 28, 31, 14, 10, 4, 28, 31, + 14, 4, 2, 28, 31, 14, 9, 11, 29, 31, 14, 11, 10, 29, 31, 14, 10, 8, 29, 31, 14, 8, 9, 29, 31, 14, 4, 10, 30, 31, 14, 10, 11, 30, 31, 14, 11, 5, 30, 31, + 14, 5, 4, 30, 31, 14, 7, 13, 32, 38, 14, 13, 12, 32, 38, 14, 12, 6, 32, 38, 14, 6, 7, 32, 38, 14, 7, 6, 33, 38, 14, 6, 8, 33, 38, 14, 8, 9, 33, 38, + 14, 9, 7, 33, 38, 14, 7, 9, 34, 38, 14, 9, 15, 34, 38, 14, 15, 13, 34, 38, 14, 13, 7, 34, 38, 14, 6, 12, 35, 38, 14, 12, 14, 35, 38, 14, 14, 8, 35, 38, + 14, 8, 6, 35, 38, 14, 13, 15, 36, 38, 14, 15, 14, 36, 38, 14, 14, 12, 36, 38, 14, 12, 13, 36, 38, 14, 8, 14, 37, 38, 14, 14, 15, 37, 38, 14, 15, 9, 37, 38, + 14, 9, 8, 37, 38, 14, 9, 15, 39, 45, 14, 15, 14, 39, 45, 14, 14, 8, 39, 45, 14, 8, 9, 39, 45, 14, 9, 8, 40, 45, 14, 8, 10, 40, 45, 14, 10, 11, 40, 45, + 14, 11, 9, 40, 45, 14, 9, 11, 41, 45, 14, 11, 17, 41, 45, 14, 17, 15, 41, 45, 14, 15, 9, 41, 45, 14, 8, 14, 42, 45, 14, 14, 16, 42, 45, 14, 16, 10, 42, 45, + 14, 10, 8, 42, 45, 14, 15, 17, 43, 45, 14, 17, 16, 43, 45, 14, 16, 14, 43, 45, 14, 14, 15, 43, 45, 14, 10, 16, 44, 45, 14, 16, 17, 44, 45, 14, 17, 11, 44, 45, + 14, 11, 10, 44, 45}; + DataArrayIdType *nodalConnecRef=DataArrayIdType::New(); + nodalConnecRef->alloc(480,1); + std::copy(nodalConnec,nodalConnec+480,nodalConnecRef->getPointer()); + CPPUNIT_ASSERT(mesh->getNodalConnectivity()->isEqual(*nodalConnecRef)); + nodalConnecRef->decrRef(); + + std::vector coords(138); + if(rank == 0) + coords = {0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 2.0, 0.0, 2.0, 2.0, 0.0, 0.0, 4.0, 0.0, 2.0, 4.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 2.0, 0.0, 2.0, + 2.0, 2.0, 2.0, 2.0, 0.0, 4.0, 2.0, 2.0, 4.0, 2.0, 0.0, 0.0, 4.0, 2.0, 0.0, 4.0, 0.0, 2.0, 4.0, 2.0, 2.0, 4.0, 0.0, 4.0, 4.0, 2.0, 4.0, 4.0, 1.0, 0.0, + 1.0, 1.0, 1.0, 0.0, 2.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 1.0, 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ArrayDouble::New(); + coordsRef->alloc(46,3); + std::copy(coords.data(),coords.data()+138,coordsRef->getPointer()); + CPPUNIT_ASSERT(mesh->getCoords()->isEqual(*coordsRef,1e-12)); + coordsRef->decrRef(); + + MPI_Barrier(MPI_COMM_WORLD); +} + +void ParaMEDMEMTest::testParallelLoad4() { int size; int rank; @@ -127,9 +308,34 @@ void ParaMEDMEMTest::testParallelLoad2() distrib = {2,3,6,7}; std::string filename=INTERP_TEST::getResourceFile("SimpleTest2D.med"); - MCAuto f1TS = ParaMEDFileField1TS::ParaNew(MPI_COMM_WORLD, MPI_INFO_NULL,filename,"field","mesh",distrib,ON_CELLS); - MCAuto fieldRef = genLocField(rank); + MCAuto f1TS = ParaMEDFileField1TS::ParaNew(MPI_COMM_WORLD, MPI_INFO_NULL,filename,"fieldOnCells","mesh",distrib,ON_CELLS); + MCAuto fieldRef = genLocFieldCells(rank); CPPUNIT_ASSERT(f1TS->getUndergroundDataArray()->isEqual(*fieldRef->getArray(),1e-12)); MPI_Barrier(MPI_COMM_WORLD); } +void ParaMEDMEMTest::testParallelLoad5() +{ + int size; + int rank; + MPI_Comm_size(MPI_COMM_WORLD,&size); + MPI_Comm_rank(MPI_COMM_WORLD,&rank); + // + if(size!=2) + return ; + + std::vector distrib; + if (rank == 0) + distrib = {0,1,2,5,6,7,10,11,12}; //c++ type of indexing: index starts from zero! + else + distrib = {2,3,4,7,8,9,12,13,14}; + + std::string filename=INTERP_TEST::getResourceFile("SimpleTest2D.med"); + MCAuto f1TS = ParaMEDFileField1TS::ParaNew(MPI_COMM_WORLD, MPI_INFO_NULL,filename,"fieldOnNodes","mesh",distrib,ON_NODES); + MCAuto fieldRef = genLocFieldNodes(rank); + CPPUNIT_ASSERT(f1TS->getUndergroundDataArray()->isEqual(*fieldRef->getArray(),1e-12)); + MPI_Barrier(MPI_COMM_WORLD); +} + + + -- 2.39.2