]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
[Bug fix] faces duplication during partitioning akr/tmp
authorAnida Khizar <anida.khizar@cea.fr>
Mon, 27 Mar 2023 13:32:39 +0000 (15:32 +0200)
committerAnida Khizar <anida.khizar@cea.fr>
Mon, 27 Mar 2023 13:32:39 +0000 (15:32 +0200)
src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx

index cc4aed453b9aa2a0954d933990582d4d13146b06..43419d3f75e24e9ced734a438c4c36b66e701834 100644 (file)
@@ -489,8 +489,6 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle
       //initial face mesh known : in my domain
       if (meshesCastFrom[iold] != 0)
         {
-//          std::cerr << "NUMBER OF FACES = " << meshesCastFrom[iold]->getNumberOfCells() <<  std::endl;
-//          WriteUMesh("OrigMesh.med",meshesCastFrom[iold],true);
           for (mcIdType ielem=0; ielem<meshesCastFrom[iold]->getNumberOfCells(); ielem++)
             {
               vector<mcIdType> nodes;
@@ -522,7 +520,6 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle
           
               for (map<int,mcIdType>::iterator iter=faces.begin(); iter!=faces.end(); iter++)
                 {
-//                  std::cerr << "TREATING FACE " << iter->first << " " << boundaryElem->findIdFirstEqual(iter->first) << std::endl;
                   if (iter->second==ToIdType(nodes.size()))
                     //cvw eligible but may be have to be face of a cell of this->getMesh()[inew]?
                     //it is not sure here...
@@ -600,10 +597,8 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle
           MEDCoupling::MEDCouplingUMesh *umesh=splitMeshes[inew][iold];
           if (umesh!=0)
             if (umesh->getNumberOfCells()>0)
-              {
                 myMeshes.push_back(umesh);
-//                WriteUMesh("mesh_"+std::to_string(inew)+".med",umesh,true);
-              }
+
         }
 
       MEDCoupling::MEDCouplingUMesh *bndMesh = 0;
@@ -614,25 +609,28 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle
           bndMesh =
             ((MEDCoupling::MEDCouplingUMesh *)_mesh[inew]->buildBoundaryMesh(/*keepCoords=*/true));
           if (bndMesh->getNumberOfCells()>0)
-            {
-//              WriteUMesh("boundary_mesh_"+std::to_string(inew)+".med",bndMesh,true);
               myMeshes.push_back( bndMesh );
-            }
         }
 
-//      for(int loc_mesh = 0;loc_mesh < myMeshes.size(); loc_mesh++)
-//        WriteUMesh("mesh_"+std::to_string(inew)+"_"+std::to_string(loc_mesh)+".med",myMeshes[loc_mesh],true);
-
       if (myMeshes.size()>0)
         {
           // Need to merge faces that are both in the initial set of faces and in the boundary mesh
           // which is the last element in myMeshes:
-          for (int iold2 = 0; iold2 < nbOldDomain-1; iold2++)
-            myMeshes[iold2]->tryToShareSameCoordsPermute(*bndMesh, 1.e-10);
-          vector<const MEDCoupling::MEDCouplingUMesh*> myMeshes_c;
-          for (auto & e: myMeshes) myMeshes_c.push_back(e);
-          meshesCastTo[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords(myMeshes_c);
-          MCAuto<DataArrayIdType> tmp = meshesCastTo[inew]->zipConnectivityTraducer(2);
+          if(bndMesh)
+            {
+              for (int iold2 = 0; iold2 < (int)myMeshes.size()-1; iold2++)
+                myMeshes[iold2]->tryToShareSameCoordsPermute(*bndMesh, 1.e-10);
+              vector<const MEDCoupling::MEDCouplingUMesh*> myMeshes_c;
+              for (auto & mesh: myMeshes) myMeshes_c.push_back(mesh);
+              meshesCastTo[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshesOnSameCoords(myMeshes_c);
+              MCAuto<DataArrayIdType> tmp = meshesCastTo[inew]->zipConnectivityTraducer(2);
+            }
+          else
+            {
+              vector<const MEDCoupling::MEDCouplingUMesh*> myMeshes_c;
+              for (auto & mesh: myMeshes) myMeshes_c.push_back(mesh);
+              meshesCastTo[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshes(myMeshes_c);
+            }
           meshesCastTo[inew]->sortCellsInMEDFileFrmt()->decrRef();
         }
       else