From: SONOLET Aymeric Date: Mon, 15 Apr 2024 08:07:02 +0000 (+0200) Subject: wip: fixing parallel related headers, const and using errors X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4d48e7370e0a3f5fb35f24daa6c0f6abefc1324a;p=tools%2Fmedcoupling.git wip: fixing parallel related headers, const and using errors --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx index 243d0d588..1c737c3c7 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx @@ -19,6 +19,7 @@ #include "MEDPARTITIONER_PTScotchGraph.hxx" #include "MEDPARTITIONER_Graph.hxx" +#include "MEDPARTITIONER_Utils.hxx" #include "MCIdType.hxx" #include "MEDCouplingSkyLineArray.hxx" diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx index ad8d3105d..b1cd85bd4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx @@ -27,6 +27,7 @@ #include "MEDPARTITIONER_Utils.hxx" #include "MEDCouplingUMesh.hxx" +#include "MEDCouplingSkyLineArray.hxx" #include "MCIdType.hxx" #include @@ -107,7 +108,7 @@ bool MEDPARTITIONER::ParaDomainSelector::isOnDifferentHosts() const //bug: (isOnDifferentHosts here and there) is not (isOnDifferentHosts somewhere) //return string(name_here) != string(name_there); - int const sum_same = -1; + int sum_same = -1; int same = 1; if (std::string(name_here) != std::string(name_there)) same=0; diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index 66e6dc077..1fc7c1825 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -63,7 +63,7 @@ std::vector MEDPARTITIONER::SendAndReceiveVectorOfString(const std: MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); } - int const recSize=0; + int recSize=0; if (rank == target) { MPI_Recv(&recSize, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status); @@ -655,7 +655,7 @@ void MEDPARTITIONER::TestPersistantMpiRingOnCommSplit(int size, int nb) double temps_debut=MPI_Wtime(); int const rank=MyGlobals::_Rank; MPI_Comm newcomm; - int const color=1; + int color=1; int const rankMax=4; if (rank>=rankMax) color=MPI_UNDEFINED; diff --git a/src/MEDPartitioner/medpartitioner_para.cxx b/src/MEDPartitioner/medpartitioner_para.cxx index 3d2173443..33af294b4 100644 --- a/src/MEDPartitioner/medpartitioner_para.cxx +++ b/src/MEDPartitioner/medpartitioner_para.cxx @@ -39,6 +39,7 @@ */ +#include "MEDPARTITIONER_Utils.hxx" #include diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index b3cf296ac..6e6e8e6bc 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -33,6 +33,7 @@ #include "MEDFileEntities.hxx" #include "med.h" #include "NormalizedGeometricTypes" +#include "MEDLoader.hxx" #include @@ -44,7 +45,7 @@ using namespace MEDCoupling; void checkDistribution(const MPI_Comm& com, mcIdType totalNumberOfElements, const std::vector& distrib) { mcIdType nbEltsInDistribLoc = distrib.size(); - mcIdType const nbEltsInDistribTot = -1; + mcIdType nbEltsInDistribTot = -1; #ifdef HAVE_MPI MPI_Allreduce(&nbEltsInDistribLoc, &nbEltsInDistribTot, 1, MPI_LONG, MPI_SUM, com); #else diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.hxx b/src/ParaMEDLoader/ParaMEDFileMesh.hxx index 92eb1fdba..10582e78a 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.hxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.hxx @@ -28,6 +28,7 @@ #include #include "MEDCouplingRefCountObject.hxx" #include "NormalizedGeometricTypes" +#include "MCIdType.hxx" namespace MEDCoupling { diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx b/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx index 1e75abb67..f65270b87 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccess.cxx @@ -292,7 +292,7 @@ namespace MEDCoupling // ArrayOfSendRequests for the call to SendRequestIds int MPIAccess::sendRequestIdsSize() { - int const size = 0; + int size = 0; for (int i = 0 ; i < _processor_group_size ; i++ ) size += (int)_send_requests[ i ].size() ; return size ; @@ -317,7 +317,7 @@ namespace MEDCoupling // ArrayOfRecvRequests for the call to RecvRequestIds int MPIAccess::recvRequestIdsSize() { - int const size = 0 ; + int size = 0 ; for (int i = 0 ; i < _processor_group_size ; i++ ) size += (int)_recv_requests[ i ].size() ; return size ; @@ -408,7 +408,7 @@ namespace MEDCoupling int MPItag = newRecvTag( datatype, source , aMethodIdent , false , RequestId ) ; sts = _comm_interface.recv(buffer, count, datatype, source, MPItag, *_intra_communicator , MPIStatus( RequestId ) ) ; - int const outcount = 0 ; + int outcount = 0 ; if ( sts == MPI_SUCCESS ) { MPI_Datatype datatype2 = MPIDatatype( RequestId ) ; diff --git a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx index 80322405b..55f04c602 100644 --- a/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccess/MPIAccessDEC.cxx @@ -341,7 +341,7 @@ namespace MEDCoupling { return allToAllTime( sendbuf, sendcount, sendtype , recvbuf, recvcount, recvtype ) ; } - int const sts = 0; + int sts = 0; int target ; int sendoffset = 0 ; int recvoffset = 0 ; @@ -403,7 +403,7 @@ namespace MEDCoupling return allToAllvTime( sendbuf, sendcounts, sdispls, sendtype , recvbuf, recvcounts, rdispls, recvtype ) ; } - int const sts = 0; + int sts = 0; int target ; int SendRequestId ; int RecvRequestId ; @@ -518,7 +518,7 @@ namespace MEDCoupling int MPIAccessDEC::allToAllTime( void* sendbuf, int sendcount , MPI_Datatype sendtype , void* recvbuf, int recvcount , MPI_Datatype recvtype ) { - int const sts = 0; + int sts = 0; int target ; int sendoffset = 0 ; int SendTimeRequestId ; @@ -638,7 +638,7 @@ namespace MEDCoupling void* recvbuf, int* recvcounts, int* rdispls, MPI_Datatype recvtype ) { - int const sts = 0; + int sts = 0; int target ; int SendTimeRequestId ; int SendDataRequestId ; diff --git a/src/ParaMEDMEM/NonCoincidentDEC.hxx b/src/ParaMEDMEM/NonCoincidentDEC.hxx index 81a2c4bf8..95ba91ebf 100644 --- a/src/ParaMEDMEM/NonCoincidentDEC.hxx +++ b/src/ParaMEDMEM/NonCoincidentDEC.hxx @@ -21,10 +21,11 @@ #define __NONCOINCIDENTDEC_HXX__ #include "DEC.hxx" +#include "ProcessorGroup.hxx" struct _fvm_locator_t; -using InterpolationMethod = enum {NN}; +typedef enum {NN} InterpolationMethod; namespace MEDCoupling { diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index d81d0c25a..21bc60160 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -40,6 +40,7 @@ #include "MEDCouplingUMesh.hxx" #include "InterpolationOptions.hxx" #include "ElementLocator.hxx" +#include "MEDCouplingFieldDouble.hxx" #include diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index dafbf796c..480bf8189 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -312,7 +312,7 @@ void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdTy { std::size_t const grpSize=_group.size(); std::fill(count,count+grpSize,0); - std::size_t const szz=0; + std::size_t szz=0; int const myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) { diff --git a/src/ParaMEDMEM/OverlapMapping.hxx b/src/ParaMEDMEM/OverlapMapping.hxx index 92a3054e6..688408320 100644 --- a/src/ParaMEDMEM/OverlapMapping.hxx +++ b/src/ParaMEDMEM/OverlapMapping.hxx @@ -25,6 +25,9 @@ #include "MEDCouplingMemArray.hxx" #include "OverlapElementLocator.hxx" +#include +#include + //#define DEC_DEBUG namespace MEDCoupling @@ -34,7 +37,7 @@ namespace MEDCoupling class MEDCouplingFieldDouble; using namespace std; - using SparseDoubleVec = int; + typedef map SparseDoubleVec; /*! * Internal class, not part of the public API. diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index e0bf51dd1..c4b396180 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -235,8 +235,8 @@ namespace MEDCoupling double ParaFIELD::getVolumeIntegral(int icomp, bool isWAbs) const { CommInterface const comm_interface = _topology->getProcGroup()->getCommInterface(); - double const integral=_field->integral(icomp,isWAbs); - double const total=0.; + double integral=_field->integral(icomp,isWAbs); + double total=0.; const MPI_Comm* comm = (dynamic_cast(_topology->getProcGroup()))->getComm(); comm_interface.allReduce(&integral, &total, 1, MPI_DOUBLE, MPI_SUM, *comm); diff --git a/src/ParaMEDMEM/ParaSkyLineArray.cxx b/src/ParaMEDMEM/ParaSkyLineArray.cxx index 4ab66fa90..93da4bd78 100644 --- a/src/ParaMEDMEM/ParaSkyLineArray.cxx +++ b/src/ParaMEDMEM/ParaSkyLineArray.cxx @@ -123,7 +123,7 @@ MCAuto ParaSkyLineArray::equiRedistribute(mcIdType nbOfEntitie } MCAuto idxOfSameIds(aggregatedIdsSort->indexOfSameConsecutiveValueGroups()); // - MCAuto const globalIdsOut(aggregatedIdsSort->buildUnique()); + MCAuto globalIdsOut(aggregatedIdsSort->buildUnique()); MCAuto skOut(MEDCouplingSkyLineArray::New(indicesSorted,valuesSorted)); skOut = skOut->groupPacks(idxOfSameIds);//group partial packs coming from different procs skOut = skOut->uniqueNotSortedByPack();//remove duplicates diff --git a/src/ParaMEDMEM/ParaUMesh.cxx b/src/ParaMEDMEM/ParaUMesh.cxx index 315d345b2..bfb7d5acc 100644 --- a/src/ParaMEDMEM/ParaUMesh.cxx +++ b/src/ParaMEDMEM/ParaUMesh.cxx @@ -85,7 +85,7 @@ MCAuto ParaUMesh::getCellIdsLyingOnNodesTrue(const DataArrayIdT int size; ci.commSize(comm,&size); std::unique_ptr nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]); - mcIdType const nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples()); + mcIdType nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples()); ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm); std::vector< MCAuto > tabs(size); //store for each proc the local nodeids intercepted by current proc @@ -154,7 +154,7 @@ MCAuto ParaUMesh::getCellIdsLyingOnNodesFalse(const DataArrayId int size; ci.commSize(comm,&size); std::unique_ptr nbOfElems(new mcIdType[size]),nbOfElems2(new mcIdType[size]),nbOfElems3(new mcIdType[size]); - mcIdType const nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples()); + mcIdType nbOfNodeIdsLoc(globalNodeIds->getNumberOfTuples()); ci.allGather(&nbOfNodeIdsLoc,1,MPI_ID_TYPE,nbOfElems.get(),1,MPI_ID_TYPE,comm); // loop to avoid to all procs to have all the nodes per proc int const nbOfCollectiveCalls = 1;// this parameter controls the memory peak diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx index b1d417d90..19d149ad2 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #ifndef WIN32 #include diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 58e7552aa..6f0ab00a7 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -521,7 +521,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta { string const master = filename_xml1; - ostringstream const strstream; + ostringstream strstream; strstream <containsMyRank()) { string const master= filename_xml2; - ostringstream const strstream; + ostringstream strstream; strstream << master<<(rank-nproc_source+1)<<".med"; string const fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; @@ -725,7 +725,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t { string const master = filename_xml1; - ostringstream const strstream; + ostringstream strstream; strstream <containsMyRank()) { string const master= filename_xml2; - ostringstream const strstream; + ostringstream strstream; strstream << master<<(rank-nproc_source+1)<<".med"; string const fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; @@ -894,7 +894,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta { string const master = filename_xml1; - ostringstream const strstream; + ostringstream strstream; strstream <containsMyRank()) { string const master= filename_xml2; - ostringstream const strstream; + ostringstream strstream; strstream << master << ".med"; std::string const fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; @@ -1853,7 +1853,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() MPI_Barrier(MPI_COMM_WORLD); double targetCoords[8]={ 0.,0., 1., 0., 0., 1., 1., 1. }; CommInterface const comm; - int const grpIds[2]={0,1}; + int grpIds[2]={0,1}; MPI_Group grp,group_world; comm.commGroup(MPI_COMM_WORLD,&group_world); comm.groupIncl(group_world,2,grpIds,&grp); @@ -2149,7 +2149,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA { string const master = filename_xml1; - ostringstream const strstream; + ostringstream strstream; strstream <containsMyRank()) { string const master= filename_xml2; - ostringstream const strstream; + ostringstream strstream; strstream << master<<(rank-nproc_source+1)<<".med"; string const fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx index ddc1247f9..31ad920c2 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx @@ -242,7 +242,7 @@ void ParaMEDMEMTest::testParallelLoad2() meshRef=genLocMeshMultipleTypes3(); //checking that all 3 procs have correctly loaded their part int equal = (int)mesh->isEqual(meshRef,1e-12); - int const allEqual = -1; + int allEqual = -1; MPI_Allreduce(&equal, &allEqual, 1, MPI_INT,MPI_SUM,MPI_COMM_WORLD); CPPUNIT_ASSERT(allEqual==3); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx index 7aee3f88d..a6d21ff65 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx @@ -93,7 +93,7 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() { if (source_group.containsMyRank()) { string const master = filename_xml1; - ostringstream const strstream; + ostringstream strstream; strstream <