From 5bcd6f4b8cb23129c8c1494b882b341e30152dfb Mon Sep 17 00:00:00 2001 From: cvw Date: Mon, 19 Mar 2012 12:44:11 +0000 Subject: [PATCH] *** empty log message *** --- .../MEDPARTITIONER_MeshCollection.cxx | 92 ++++++++++++------- 1 file changed, 59 insertions(+), 33 deletions(-) diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 447c908b2..5ac9f9586 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -99,8 +99,6 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection _joint_finder(0) { std::vector > > new2oldIds(initialCollection.getTopology()->nbDomain()); - if (MyGlobals::_Verbose>10) - std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl; castCellMeshes(initialCollection, new2oldIds); //defining the name for the collection and the underlying meshes @@ -110,6 +108,8 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection //treating faces ///////////////// + if (MyGlobals::_Verbose>0) + MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose messages if (MyGlobals::_Is0verbose) std::cout<<"treating faces"<0) + MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose messages if (MyGlobals::_Is0verbose) { if (isParallelMode()) @@ -143,12 +144,15 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection "faceFamily"); //treating groups + if (MyGlobals::_Verbose>0) + MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose messages if (MyGlobals::_Is0verbose) std::cout << "treating groups" << std::endl; _family_info=initialCollection.getFamilyInfo(); _group_info=initialCollection.getGroupInfo(); - //treating fields + if (MyGlobals::_Verbose>0) + MPI_Barrier(MPI_COMM_WORLD); //synchronize verbose messages if (MyGlobals::_Is0verbose) std::cout << "treating fields" << std::endl; castAllFields(initialCollection,"cellFieldDouble"); @@ -163,6 +167,8 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialCollection, std::vector > >& new2oldIds) { + if (MyGlobals::_Verbose>10) + std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl; if (_topology==0) throw INTERP_KERNEL::Exception("Topology has not been defined on call to castCellMeshes"); @@ -178,7 +184,7 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle { splitMeshes[inew].resize(nbOldDomain, (ParaMEDMEM::MEDCouplingUMesh*)0); } - + for (int iold=0; ioldisMyDomain(iold)) @@ -226,6 +232,7 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle } } #endif + //fusing the split meshes if (MyGlobals::_Verbose>200) std::cout << "proc " << rank << " : castCellMeshes fusing" << std::endl; @@ -233,7 +240,7 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle { std::vector meshes; - for (int i=0;i<(int)splitMeshes[inew].size();i++) + for (int i=0; i<(int)splitMeshes[inew].size(); i++) if (splitMeshes[inew][i]!=0) if (splitMeshes[inew][i]->getNumberOfCells()>0) meshes.push_back(splitMeshes[inew][i]); @@ -391,22 +398,31 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle using std::pair; using std::make_pair; + if (MyGlobals::_Verbose>10) + std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes" << std::endl; + if (_topology==0) + throw INTERP_KERNEL::Exception("Topology has not been defined on call to castFaceMeshes"); + + int nbNewDomain=_topology->nbDomain(); + int nbOldDomain=initialCollection.getTopology()->nbDomain(); + vector& meshesCastFrom=initialCollection.getFaceMesh(); vector& meshesCastTo=this->getFaceMesh(); vector< vector > splitMeshes; - int newSize=_topology->nbDomain(); - int fromSize=meshesCastFrom.size(); - splitMeshes.resize(newSize); - for (int inew=0;inewisMyDomain(iold)) continue; + if (isParallelMode() && !initialCollection._domain_selector->isMyDomain(iold)) continue; + if (MyGlobals::_Verbose>400) + std::cout<<"proc "<getNumberOfCells(); ielem++) @@ -461,7 +479,7 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle } //creating the splitMeshes from the face ids - for (int inew=0;inew<_topology->nbDomain();inew++) + for (int inew=0; inewgetNumberOfCells() > 0) { @@ -485,45 +503,51 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle } } - // send/receive stuff -#ifdef HAVE_MP2 +#ifdef HAVE_MPI2 + //send/receive stuff if (isParallelMode()) { ParaMEDMEM::MEDCouplingUMesh *empty=CreateEmptyMEDCouplingUMesh(); - for (int iold=0; ioldisMyDomain(iold) && !_domain_selector->isMyDomain(inew)) + if (initialCollection._domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew)) { if (splitMeshes[inew][iold] != 0) { _domain_selector->sendMesh(*(splitMeshes[inew][iold]), _domain_selector->getProcessorID(inew)); + //std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes send " <getNumberOfCells()<sendMesh(*(empty), _domain_selector->getProcessorID(inew)); + //std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes sen0 " <isMyDomain(iold) && _domain_selector->isMyDomain(inew)) + if (!initialCollection._domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew)) _domain_selector->recvMesh(splitMeshes[inew][iold], _domain_selector->getProcessorID(iold)); + int nb=0; + if (splitMeshes[inew][iold]) + nb=splitMeshes[inew][iold]->getNumberOfCells(); + //std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes recv "<getNumberOfCells()<decrRef(); } #endif - //recollecting the bits of splitMeshes to fuse them into one - if (MyGlobals::_Verbose>300) std::cout<<"proc "<200) + std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes fusing" << std::endl; + meshesCastTo.resize(nbNewDomain); + for (int inew=0; inew myMeshes; - for (int iold=0; ioldgetNumberOfCells()>0) - { + if (umesh->getNumberOfCells()>0) myMeshes.push_back(umesh); - } } if (myMeshes.size()>0) @@ -535,10 +559,12 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle ParaMEDMEM::MEDCouplingUMesh *empty=CreateEmptyMEDCouplingUMesh(); meshesCastTo[inew]=empty; } - for (int iold=0; iolddecrRef(); } + if (MyGlobals::_Verbose>300) + std::cout << "proc " << MyGlobals::_Rank << " : castFaceMeshes end fusing" << std::endl; } void MEDPARTITIONER::MeshCollection::remapIntField(const ParaMEDMEM::MEDCouplingUMesh& sourceMesh, -- 2.39.2