]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
version checked on cube splitting
authorvbd <vbd>
Mon, 18 Jul 2011 14:16:59 +0000 (14:16 +0000)
committervbd <vbd>
Mon, 18 Jul 2011 14:16:59 +0000 (14:16 +0000)
src/MEDPartitioner/MEDPARTITIONER_Graph.hxx
src/MEDPartitioner/MEDPARTITIONER_MESHCollection.cxx
src/MEDPartitioner/MEDPARTITIONER_MESHCollectionDriver.cxx
src/MEDPartitioner/MEDPARTITIONER_MESHCollectionDriver.hxx
src/MEDPartitioner/MEDPARTITIONER_MESHCollectionMedAsciiDriver.hxx
src/MEDPartitioner/MEDPARTITIONER_MESHCollectionMedXMLDriver.H
src/MEDPartitioner/MEDPARTITIONER_MESHCollectionMedXMLDriver.hxx
src/MEDPartitioner/MEDPARTITIONER_METISGraph.cxx
src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx
src/MEDPartitioner/MEDPARTITIONER_SCOTCHGraph.cxx
src/MEDPartitioner/Makefile.am

index 50af471fa8ac6f2b820ba904f567e3b043f5d05b..3764063bd51266a5b01dbc6cdfe963b280ebee92 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "MEDPARTITIONER.hxx"
 #include "MEDPARTITIONER_SkyLineArray.hxx"
-
+#include <string>
 namespace MEDPARTITIONER {
         
 class ParaDomainSelector;
index 3865e8e7c59e408efb439508b514c57122706695..132f31da5fbba85f20697498fc672557c94415e7 100644 (file)
@@ -116,6 +116,7 @@ MESHCollection::MESHCollection(MESHCollection& initialCollection, Topology* topo
    castCellMeshes(initialCollection, new2oldIds);
 
 
+
   //casting cell families on new meshes
   _cellFamilyIds.resize(topology->nbDomain());
   castIntField(initialCollection.getMesh(), this->getMesh(),initialCollection.getCellFamilyIds(),_cellFamilyIds, new2oldIds);
@@ -145,13 +146,16 @@ MESHCollection::MESHCollection(MESHCollection& initialCollection, Topology* topo
     {
       if(isParallelMode() && !_domain_selector->isMyDomain(inew)) continue;
       _cellFamilyIds[inew]=ParaMEDMEM::DataArrayInt::New();
-      int* ptrCellIds=new int[_mesh[inew]->getNumberOfCells()];
-      for (int i=0; i< _mesh[inew]->getNumberOfCells();i++) ptrCellIds[i]=0;
-      _cellFamilyIds[inew]->useArray(ptrCellIds,true, ParaMEDMEM::CPP_DEALLOC,_mesh[inew]->getNumberOfCells(),1);
+      int nbCells=_mesh[inew]->getNumberOfCells();
+      int* ptrCellIds=new int[nbCells];
+      for (int i=0; i< nbCells;i++) ptrCellIds[i]=0;
+      _cellFamilyIds[inew]->useArray(ptrCellIds,true, ParaMEDMEM::CPP_DEALLOC,nbCells,1);
+
+      int nbFaces=_faceMesh[inew]->getNumberOfCells();
       _faceFamilyIds[inew]=ParaMEDMEM::DataArrayInt::New();
-      int* ptrFaceIds=new int[_faceMesh[inew]->getNumberOfCells()];
-      for (int i=0; i< _faceMesh[inew]->getNumberOfCells();i++) ptrFaceIds[i]=0;
-      _faceFamilyIds[inew]->useArray(ptrFaceIds,true, ParaMEDMEM::CPP_DEALLOC,_faceMesh[inew]->getNumberOfCells(),1); 
+      int* ptrFaceIds=new int[nbFaces];
+      for (int i=0; i<nbFaces;i++) ptrFaceIds[i]=0;
+      _faceFamilyIds[inew]->useArray(ptrFaceIds,true, ParaMEDMEM::CPP_DEALLOC,nbFaces,1); 
     }
 
   castIntField(initialCollection.getFaceMesh(), this->getFaceMesh(),initialCollection.getFaceFamilyIds(),_faceFamilyIds,new2oldFaceIds);
@@ -240,6 +244,8 @@ void MESHCollection::castCellMeshes(MESHCollection& initialCollection, std::vect
         {
           _mesh[inew]=ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes(meshes);
           _mesh[inew]->zipCoords();
+          cout <<"new mesh "<<inew<<" "<<_mesh[inew]->getNumberOfCells()<<" cells"<<
+            _mesh[inew]->getNumberOfNodes()<<" nodes"<<endl;
         }
       for (int i=0; i< splitMeshes[inew].size();i++)
         if (splitMeshes[inew][i]!=0) splitMeshes[inew][i]->decrRef();
@@ -263,16 +269,20 @@ void MESHCollection::createNodeMapping( MESHCollection& initialCollection, NodeM
       if (!isParallelMode() || (_domain_selector->isMyDomain(iold)))
         {
           //      std::map<pair<double,pair<double, double> >, int > nodeClassifier;
-          int nvertices=getMesh(iold)->getNumberOfNodes();
+          int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes();
+          cout <<"nvertices "<<nvertices<<endl;
           bbox=new double[nvertices*6];
           ParaMEDMEM::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords();
           double* coordsPtr=coords->getPointer();
+          for (int i=0; i<nvertices;i++)
+              cout<<"coords old "<<coordsPtr[3*i]<<" "<<coordsPtr[3*i+1]<<" "<<coordsPtr[3*i+2]<<endl;
+              
           for (int i=0; i<nvertices*3;i++)
             {
-              bbox[i*2]=coordsPtr[i]-1e-9;
-              bbox[i*2+1]=coordsPtr[i]+1e-9;
+              bbox[i*2]=coordsPtr[i]-1e-6;
+              bbox[i*2+1]=coordsPtr[i]+1e-6;
             }
-          tree=new BBTree<3>(bbox,0,0,nvertices,1e-12);
+          tree=new BBTree<3>(bbox,0,0,nvertices,1e-9);
         }
               
       for (int inew=0; inew<_topology->nbDomain(); inew++)
@@ -307,9 +317,11 @@ void MESHCollection::createNodeMapping( MESHCollection& initialCollection, NodeM
                 {
                   
                   double* coordsPtr=coords->getPointer()+inode*3;
+                  cout<<"coords new "<<coordsPtr[0]<<" "<<coordsPtr[1]<<" "<<coordsPtr[2]<<endl;
+     
                   std::vector<int> elems;
                   tree->getElementsAroundPoint(coordsPtr,elems);
-                  if (elems.size()==0) {continue;}              
+                  if (elems.size()==0) {cout<<"warning " <<inode<< endl;continue;}              
                   nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode)));
                   cout << "inode :" <<inode<<" ("<<iold<<","<<elems[0]<<")-->("<<inew<<","<<inode<<")"<<endl;
                 }
@@ -350,6 +362,8 @@ void MESHCollection::castMeshes(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& mesh
   for (int iold=0; iold<meshesCastFrom.size();iold++)
     {
       if (isParallelMode() && !_domain_selector->isMyDomain(iold)) continue;
+      cout <<"-----------MESH OLD "<<iold<<"-----------"<<endl;
+      cout <<meshesCastFrom[iold]->advancedRepr();
       new2oldIds[iold].resize(newSize);
       for (int ielem=0;ielem<meshesCastFrom[iold]->getNumberOfCells();ielem++)
         {
@@ -358,7 +372,7 @@ void MESHCollection::castMeshes(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& mesh
           
           map <int,int> faces;
           //      cout<<"----------------"<<endl;
-          //analysis of one face
+          //analysis of element ielem
           for (int inode=0;inode<nodes.size();inode++)
             {
               typedef multimap<pair<int,int>,pair<int,int> >::const_iterator MI;
@@ -368,10 +382,11 @@ void MESHCollection::castMeshes(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& mesh
               //                cout << iold <<" " <<nodes[inode]<<endl;
               for (MI iter=myRange.first; iter!=myRange.second; iter++)
                 {
-                  if (faces.find(iter->second.first)==faces.end())
-                    faces[iter->second.first]=1;
+                  int inew=iter->second.first;
+                  if (faces.find(inew)==faces.end())
+                    faces[inew]=1;
                   else
-                    faces[iter->second.first]++;
+                    faces[inew]++;
                   //                    cout<<"idomain" << iter->second.first<<" facemapping "<<faces[iter->second.first]<<endl;
                 }
             }
@@ -390,6 +405,7 @@ void MESHCollection::castMeshes(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& mesh
         {
           cout<<"nb faces - iold "<<iold<<" inew "<<inew<<" : "<<new2oldIds[iold][inew].size()<<endl;
           splitMeshes[inew][iold]=(ParaMEDMEM::MEDCouplingUMesh*)(meshesCastFrom[iold]->buildPartOfMySelf(&new2oldIds[iold][inew][0],&new2oldIds[iold][inew][0]+new2oldIds[iold][inew].size(),true));
+          cout << "split face Meshes "<<inew<<" "<<iold<<splitMeshes[inew][iold]->advancedRepr();
         }
     }
       
@@ -424,16 +440,48 @@ void MESHCollection::castMeshes(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& mesh
 
 void MESHCollection::castIntField(std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastFrom,std::vector<ParaMEDMEM::MEDCouplingUMesh*>& meshesCastTo,  std::vector<ParaMEDMEM::DataArrayInt*>& arrayFrom,  std::vector<ParaMEDMEM::DataArrayInt*>& arrayTo, std::vector< std::vector< std::vector<int> > >& new2oldMapping)
 {
-  for (int inew=0; inew < meshesCastTo.size();inew++)
+  vector<vector<const ParaMEDMEM::DataArrayInt*> > splitIds;
+  splitIds.resize(meshesCastTo.size());
+  // send / recv operations
+  for (int inew=0; inew < meshesCastTo.size();inew++)    
+    for (int iold=0; iold < meshesCastFrom.size();iold++)
+      {
+        vector<int> recvIntVec;
+        //sending arrays for distant domains
+        if (isParallelMode() && _domain_selector->isMyDomain(iold) && !_domain_selector->isMyDomain(inew))
+          {
+            int* ptr=&(new2oldMapping[iold][inew][0]);
+            int size=new2oldMapping[iold][inew].size();
+            ParaMEDMEM::DataArrayInt* sendSplitIds=arrayFrom[iold]->selectByTupleId(ptr,ptr+size);
+            vector<int>sendIds(size);
+            std::copy(sendSplitIds->getPointer(),sendSplitIds->getPointer()+size,&sendIds[0]);
+            _domain_selector->sendIntVec(sendIds, _domain_selector->getProcessorID(inew));
+          }
+        //receiving arrays from distant domains
+        if (isParallelMode()&&!_domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
+          {
+            vector<int> recvIds;
+            ParaMEDMEM::DataArrayInt* recvSplitIds=ParaMEDMEM::DataArrayInt::New();
+            _domain_selector->recvIntVec(recvIds, _domain_selector->getProcessorID(iold));
+            int* intSplitIds=new int[recvIds.size()];
+            std::copy(&recvIds[0],&recvIds[0]+recvIds.size(),intSplitIds);
+            recvSplitIds->useArray(intSplitIds, true, ParaMEDMEM::CPP_DEALLOC, recvIds.size(),1);
+            splitIds[inew].push_back(recvSplitIds);
+          }
+      }
+
+  //local contributions and aggregation
+  for (int inew=0; inew < meshesCastTo.size();inew++)    
     {
-      vector<const ParaMEDMEM::DataArrayInt*> splitIds;
       for (int iold=0; iold < meshesCastFrom.size();iold++)
-        {
-          if (isParallelMode() && !_domain_selector->isMyDomain(iold)) continue;
-          int* ptr=&(new2oldMapping[iold][inew][0]);
-          splitIds.push_back(arrayFrom[iold]->selectByTupleId(ptr,ptr+new2oldMapping[iold][inew].size()));
-        }
-      arrayTo[inew]=ParaMEDMEM::DataArrayInt::Aggregate(splitIds);
+          if (isParallelMode() && _domain_selector->isMyDomain(iold) && _domain_selector->isMyDomain(inew))
+            {
+              int* ptr=&(new2oldMapping[iold][inew][0]);
+              splitIds[inew].push_back(arrayFrom[iold]->selectByTupleId(ptr,ptr+new2oldMapping[iold][inew].size()));
+            }     
+      if (!isParallelMode()||_domain_selector->isMyDomain(inew))
+        arrayTo[inew]=ParaMEDMEM::DataArrayInt::Aggregate(splitIds[inew]);
     }
 }
 
@@ -453,12 +501,12 @@ MESHCollection::MESHCollection(const string& filename)
     _family_splitting(false),
     _create_empty_groups(false)
 {
-  char filenamechar[256];
-  strcpy(filenamechar,filename.c_str());
+  // char filenamechar[256];
+  // strcpy(filenamechar,filename.c_str());
   try
     {
       _driver=new MESHCollectionMedXMLDriver(this);
-      _driver->read (filenamechar);
+      _driver->read (filename.c_str());
       _driver_type = MedXML;
 
     }
@@ -467,7 +515,7 @@ MESHCollection::MESHCollection(const string& filename)
     try
       {
         _driver=new MESHCollectionMedAsciiDriver(this);
-        _driver->read (filenamechar);
+        _driver->read (filename.c_str());
         _driver_type=MedAscii;
       }
     catch(MEDMEM::MEDEXCEPTION&)
@@ -545,13 +593,13 @@ MESHCollection::MESHCollection(const string& filename, const string& meshname)
     _family_splitting(false),
     _create_empty_groups(false)
 {
-  char filenamechar[256];
-  char meshnamechar[256];
-  strcpy(filenamechar,filename.c_str());
-  strcpy(meshnamechar,meshname.c_str());
+  //char filenamechar[256];
+  //char meshnamechar[256];
+  //  strcpy(filenamechar,filename.c_str());
+  //strcpy(meshnamechar,meshname.c_str());
   try // avoid memory leak in case of inexistent filename
     {
-      retrieveDriver()->readSeq (filenamechar,meshnamechar);
+      retrieveDriver()->readSeq (filename.c_str(),meshname.c_str());
     }
   catch ( MED_EXCEPTION& e )
     {
@@ -596,9 +644,9 @@ void MESHCollection::write(const string& filename)
   if (_driver!=0)delete _driver;
   _driver=0;
 
-  char filenamechar[256];
-  strcpy(filenamechar,filename.c_str());
-  retrieveDriver()->write (filenamechar, _domain_selector);
+  //char filenamechar[256];
+  //  strcpy(filenamechar,filename.c_str());
+  retrieveDriver()->write (filename.c_str(), _domain_selector);
 }
 
 /*! creates or gets the link to the collection driver
index 7f5aeec425e16648cdcdbaa229d5d2fa7d88b13a..3d4ff58c816029f257351c59594253e9a84c2db8 100644 (file)
@@ -38,7 +38,7 @@ extern "C" {
 #include "med.h"
 }
 //MEDPARTITIONER includes
-#include "MEDPARTITIONER_ConnectZone.hxx"
+//#include "MEDPARTITIONER_ConnectZone.hxx"
 #include "MEDPARTITIONER_Topology.hxx"
 #include "MEDPARTITIONER_ParallelTopology.hxx"
 #include "MEDPARTITIONER_SequentialTopology.hxx"
@@ -51,23 +51,23 @@ using namespace MEDPARTITIONER;
 //template inclusion
 //#include "MEDPARTITIONER_MESHCollectionDriver.H"
 
-med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE+2] = { MED_POINT1,
-                                                             MED_SEG2,
-                                                             MED_SEG3,
-                                                             MED_TRIA3,
-                                                             MED_TRIA6,
-                                                             MED_QUAD4,
-                                                             MED_QUAD8,
-                                                             MED_TETRA4,
-                                                             MED_TETRA10,
-                                                             MED_HEXA8,
-                                                             MED_HEXA20,
-                                                             MED_PENTA6,
-                                                             MED_PENTA15,
-                                                             MED_PYRA5,
-                                                             MED_PYRA13,
-                                                             MED_POLYGONE,
-                                                             MED_POLYEDRE };
+// med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE+2] = { MED_POINT1,
+//                                                              MED_SEG2,
+//                                                              MED_SEG3,
+//                                                              MED_TRIA3,
+//                                                              MED_TRIA6,
+//                                                              MED_QUAD4,
+//                                                              MED_QUAD8,
+//                                                              MED_TETRA4,
+//                                                              MED_TETRA10,
+//                                                              MED_HEXA8,
+//                                                              MED_HEXA20,
+//                                                              MED_PENTA6,
+//                                                              MED_PENTA15,
+//                                                              MED_PYRA5,
+//                                                              MED_PYRA13,
+//                                                              MED_POLYGONE,
+//                                                              MED_POLYEDRE };
 
 MESHCollectionDriver::MESHCollectionDriver(MESHCollection* collection):_collection(collection)
 {
@@ -79,7 +79,7 @@ MESHCollectionDriver::MESHCollectionDriver(MESHCollection* collection):_collecti
  *\param filename binary file
  *\param meshname mesh name in the MED file
  * */
-int MESHCollectionDriver::readSeq(char* filename, char* meshname)
+int MESHCollectionDriver::readSeq(const char* filename, const char* meshname)
 {
   //const char* LOC = "MEDPARTITIONER::MESHCollectionDriver::readSeq()";
   //  BEGIN_OF_MED(LOC);
@@ -147,14 +147,15 @@ void MESHCollectionDriver::readSubdomain(vector<int*>& cellglobal,
 {
 //   const char* LOC = "MEDPARTITIONER::MESHCollectionDriver::readSubdomain()";
 //   BEGIN_OF_MED(LOC);
-  char file[256];
-  char meshname[MED_TAILLE_NOM+1];
-
-  strcpy(meshname,_meshname[idomain].c_str());
-  strcpy(file,_filename[idomain].c_str());
+//  char file[256];
+  //char meshname[MED_TAILLE_NOM+1];
+  string meshname=_meshname[idomain];
+  string file=_filename[idomain];
+  //strcpy(meshname,_meshname[idomain].c_str());
+  //strcpy(file,_filename[idomain].c_str());
   cout << "Reading "<<_meshname[idomain]<<" in "<<_filename[idomain]<<endl;
   //(_collection->getMesh())[idomain]=new MEDMEM::MESH(MEDMEM::MED_DRIVER,file, meshname);
ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname);
 ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
  (_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false);
   (_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false);
 
@@ -172,68 +173,68 @@ void MESHCollectionDriver::readSubdomain(vector<int*>& cellglobal,
 
   cout <<"End of Read"<<endl;
   //reading MEDPARTITIONER::CONNECTZONEs NODE/NODE and CELL/CELL
-  med_idt fid = MEDouvrir(file,MED_LECTURE);
-  med_int njoint = MEDnJoint(fid, meshname);
-  for (int ijoint=0; ijoint<njoint; ijoint++)
-  {
-    int distant;
-    char joint_description[MED_TAILLE_DESC+1];
-    char name[MED_TAILLE_NOM+1];
-    char name_distant[MED_TAILLE_NOM+1];
-
-    int ncorr = MEDjointInfo(fid,meshname, ijoint+1, name, 
-                                      joint_description,
-                                      &distant, name_distant);
-
-    for (int ic=0; ic<ncorr; ic++)
-    {
-      med_entite_maillage cor_typent_local;
-      med_geometrie_element cor_typgeo_local;
-      med_entite_maillage cor_typent_dist;
-      med_geometrie_element cor_typgeo_dist;
-
-
-      int ncouples;
-      ncouples = MEDjointTypeCorres(fid, meshname, name, ic+1,
-                                             &cor_typent_local,  &cor_typgeo_local,
-                                             &cor_typent_dist, &cor_typgeo_dist
-                                             );
-      int* node_corresp=new int[ncouples];
-      if (cor_typent_local == MED_NOEUD && cor_typent_dist == MED_NOEUD)
-      {
-
-        MEDjointLire(fid, meshname, name,
-                              node_corresp,ncouples,
-                              cor_typent_local,  cor_typgeo_local,
-                              cor_typent_dist, cor_typgeo_dist
-                              );
-      }
-      //constructing the connect zone and adding it to the connect zone list
-      MEDPARTITIONER::CONNECTZONE* cz = new MEDPARTITIONER::CONNECTZONE();
-      cz->setName(string(name));
-      cz->setDescription(joint_description);
-      cz->setLocalDomainNumber(idomain);
-      cz->setDistantDomainNumber(distant);
-      cz->setLocalMesh((_collection->getMesh())[idomain]);
-      cz->setDistantMesh((_collection->getMesh())[distant]);
-      cz->setNodeCorresp(node_corresp,ncouples);
-      (_collection->getCZ()).push_back(cz);
-
-    }//loop on correspom_topology->nbDomain())ndances
-  }//loop on joints 
-
-  // Reading global numbering
-  // à faire dans MEDLoader 
-
-  //  MEDCouplingFieldDouble globalcell=MEDLoader::GetGlobalNumbering(file,meshname,0);
-
-
-   MEDfermer(fid);
+  // med_idt fid = MEDouvrir(file,MED_LECTURE);
+  // med_int njoint = MEDnJoint(fid, meshname);
+  // for (int ijoint=0; ijoint<njoint; ijoint++)
+  // {
+  //   int distant;
+  //   char joint_description[MED_TAILLE_DESC+1];
+  //   char name[MED_TAILLE_NOM+1];
+  //   char name_distant[MED_TAILLE_NOM+1];
+
+  //   int ncorr = MEDjointInfo(fid,meshname, ijoint+1, name, 
+  //                                     joint_description,
+  //                                     &distant, name_distant);
+
+  //   for (int ic=0; ic<ncorr; ic++)
+  //   {
+  //     med_entite_maillage cor_typent_local;
+  //     med_geometrie_element cor_typgeo_local;
+  //     med_entite_maillage cor_typent_dist;
+  //     med_geometrie_element cor_typgeo_dist;
+
+
+  //     int ncouples;
+  //     ncouples = MEDjointTypeCorres(fid, meshname, name, ic+1,
+  //                                            &cor_typent_local,  &cor_typgeo_local,
+  //                                            &cor_typent_dist, &cor_typgeo_dist
+  //                                            );
+  //     int* node_corresp=new int[ncouples];
+  //     if (cor_typent_local == MED_NOEUD && cor_typent_dist == MED_NOEUD)
+  //     {
+
+  //       MEDjointLire(fid, meshname, name,
+  //                             node_corresp,ncouples,
+  //                             cor_typent_local,  cor_typgeo_local,
+  //                             cor_typent_dist, cor_typgeo_dist
+  //                             );
+  //     }
+  //     //constructing the connect zone and adding it to the connect zone list
+  //     MEDPARTITIONER::CONNECTZONE* cz = new MEDPARTITIONER::CONNECTZONE();
+  //     cz->setName(string(name));
+  //     cz->setDescription(joint_description);
+  //     cz->setLocalDomainNumber(idomain);
+  //     cz->setDistantDomainNumber(distant);
+  //     cz->setLocalMesh((_collection->getMesh())[idomain]);
+  //     cz->setDistantMesh((_collection->getMesh())[distant]);
+  //     cz->setNodeCorresp(node_corresp,ncouples);
+  //     (_collection->getCZ()).push_back(cz);
+
+  //   }//loop on correspom_topology->nbDomain())ndances
+  // }//loop on joints 
+
+  // // Reading global numbering
+  // // à faire dans MEDLoader 
+
+  // //  MEDCouplingFieldDouble globalcell=MEDLoader::GetGlobalNumbering(file,meshname,0);
+
+
+  //  MEDfermer(fid);
 
    //  END_OF_MED(LOC);
 }
 
-void MESHCollectionDriver::writeSubdomain(int idomain, int nbdomains, char* distfilename,
+void MESHCollectionDriver::writeSubdomain(int idomain, int nbdomains, const char* distfilename,
                                           ParaDomainSelector* domain_selector)
 {
   //build connect zones
@@ -244,73 +245,73 @@ void MESHCollectionDriver::writeSubdomain(int idomain, int nbdomains, char* dist
 
   //writing connect zones in joints
 
-  med_idt fid = MEDouvrir(distfilename,MED_LECTURE_ECRITURE);  
-
-  int index_joint=0;
-
-
-  for (int icz=0; icz<(_collection->getCZ()).size(); icz++)
-  {
-    if ((_collection->getCZ())[icz]->getLocalDomainNumber()==idomain)
-    {
-      med_err error;
-      int idistant=(_collection->getCZ())[icz]->getDistantDomainNumber();
-      char joint_name[MED_TAILLE_NOM+1];
-      sprintf(joint_name,"joint_%i",idistant+1);
-      char desc[MED_TAILLE_DESC+1];
-      sprintf(desc,"connect_zone_%d",icz+1);
-
-      char distant_name[MED_TAILLE_NOM+1];
-      //sprintf(distant_name,"domain_%i",(_collection->getCZ())[icz]->getDistantDomainNumber());
-
-      //        sprintf(distant_name,(_collection->getMesh())[idistant]->getName().c_str());
-      sprintf(distant_name,"domain_%i",idistant);
-      char mesh_name[MED_TAILLE_NOM+1];
-
-      strcpy (mesh_name, (_collection->getMesh())[idomain]->getName());
-      //      SCRUTE_MED((_collection->getMesh())[idomain]->getName());
-      error = MEDjointCr(fid,mesh_name, joint_name, desc, 
-                                  idistant, distant_name);
-      if (error==-1) cout << "erreur creation de joint "<<endl;
-
-      /////////////////////////////////////////
-      //writing node/node correspondency
-      /////////////////////////////////////////
-      int nbnodes=(_collection->getCZ())[icz]->getNodeNumber();
-      int* node_corresp=const_cast<int*>((_collection->getCZ())[icz]->getNodeCorrespValue());
-
-      /* Nodes are reordered so that the ordering on the local and the distant domain
-         correspond. The chosen order is the natural ordering on the domain
-         with lowest proc id*/
-      // if (_collection->getSubdomainBoundaryCreates())
-//         if (idomain<idistant)
-//           jointSort(node_corresp, nbnodes, true);
-//         else
-//           jointSort(node_corresp, nbnodes, false);
-
-      error=
-        MEDjointEcr(fid, mesh_name, joint_name, node_corresp, nbnodes,
-                             MED_NOEUD, MED_POINT1,MED_NOEUD, MED_POINT1);
-      if (error==-1) cout << "erreur creation de joint "<<endl;
-
-      //writing cell/cell joint      
-//      writeElementJoint(MED_EN::MED_CELL, icz, idomain, idistant, mesh_name,joint_name,fid);
-      //writing face/face joint
-//       if (_collection->getSubdomainBoundaryCreates())
-//       {
-//         MED_EN::medEntityMesh constituent_entity =
-//           (_collection->getMeshDimension()==3)?MED_EN::MED_FACE:MED_EN::MED_EDGE;
-//         writeElementJoint(constituent_entity, icz, idomain, idistant, mesh_name,joint_name,fid);                 
-//       }                   
-      index_joint++;
-    }
-  }
//  med_idt fid = MEDouvrir(distfilename,MED_LECTURE_ECRITURE);  
+
+//   int index_joint=0;
+
+
+//   for (int icz=0; icz<(_collection->getCZ()).size(); icz++)
+//   {
+//     if ((_collection->getCZ())[icz]->getLocalDomainNumber()==idomain)
+//     {
+//       med_err error;
+//       int idistant=(_collection->getCZ())[icz]->getDistantDomainNumber();
+//       char joint_name[MED_TAILLE_NOM+1];
+//       sprintf(joint_name,"joint_%i",idistant+1);
+//       char desc[MED_TAILLE_DESC+1];
+//       sprintf(desc,"connect_zone_%d",icz+1);
+
+//       char distant_name[MED_TAILLE_NOM+1];
+//       //sprintf(distant_name,"domain_%i",(_collection->getCZ())[icz]->getDistantDomainNumber());
+
+//       //        sprintf(distant_name,(_collection->getMesh())[idistant]->getName().c_str());
+//       sprintf(distant_name,"domain_%i",idistant);
+//       char mesh_name[MED_TAILLE_NOM+1];
+
+//       strcpy (mesh_name, (_collection->getMesh())[idomain]->getName());
+//       //      SCRUTE_MED((_collection->getMesh())[idomain]->getName());
+//       error = MEDjointCr(fid,mesh_name, joint_name, desc, 
+//                                   idistant, distant_name);
+//       if (error==-1) cout << "erreur creation de joint "<<endl;
+
+//       /////////////////////////////////////////
+//       //writing node/node correspondency
+//       /////////////////////////////////////////
+//       int nbnodes=(_collection->getCZ())[icz]->getNodeNumber();
+//       int* node_corresp=const_cast<int*>((_collection->getCZ())[icz]->getNodeCorrespValue());
+
+//       /* Nodes are reordered so that the ordering on the local and the distant domain
+//          correspond. The chosen order is the natural ordering on the domain
+//          with lowest proc id*/
+//       // if (_collection->getSubdomainBoundaryCreates())
+// //         if (idomain<idistant)
+// //           jointSort(node_corresp, nbnodes, true);
+// //         else
+// //           jointSort(node_corresp, nbnodes, false);
+
+//       error=
+//         MEDjointEcr(fid, mesh_name, joint_name, node_corresp, nbnodes,
+//                              MED_NOEUD, MED_POINT1,MED_NOEUD, MED_POINT1);
+//       if (error==-1) cout << "erreur creation de joint "<<endl;
+
+//       //writing cell/cell joint      
+// //      writeElementJoint(MED_EN::MED_CELL, icz, idomain, idistant, mesh_name,joint_name,fid);
+//       //writing face/face joint
+// //       if (_collection->getSubdomainBoundaryCreates())
+// //       {
+// //         MED_EN::medEntityMesh constituent_entity =
+// //           (_collection->getMeshDimension()==3)?MED_EN::MED_FACE:MED_EN::MED_EDGE;
+// //         writeElementJoint(constituent_entity, icz, idomain, idistant, mesh_name,joint_name,fid);                 
+// //       }                   
+//       index_joint++;
+//     }
+//   }
   
-  char meshchar[MED_TAILLE_NOM+1];
-  strcpy(meshchar,(_collection->getMesh())[idomain]->getName());
+//   char meshchar[MED_TAILLE_NOM+1];
+//   strcpy(meshchar,(_collection->getMesh())[idomain]->getName());
   
 
-  MEDfermer(fid);
+//   MEDfermer(fid);
   std::cout<<"End of writing"<<std::endl;
 
 }
index e53765d1a5a9fe9c947e2aba578171bda2868c94..1efde1d6020f3aee8f1710004ee475080c8a3af9 100644 (file)
@@ -33,10 +33,10 @@ namespace MEDPARTITIONER
     MESHCollectionDriver(MESHCollection*);
     virtual ~MESHCollectionDriver(){}
 
-    virtual int read(char*, ParaDomainSelector* sel=0)=0;
-    int readSeq(char*,char*);
+    virtual int read(const char*, ParaDomainSelector* sel=0)=0;
+    int readSeq(const char*,const char*);
 
-    virtual void write(char*, ParaDomainSelector* sel=0)=0;
+    virtual void write(const char*, ParaDomainSelector* sel=0)=0;
 //     virtual void readFields (vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
 //                              int itnumber, int ordernumber) =0;
 //     virtual void readFields (vector <MEDMEM::FIELD<double> *>& filenames, char* fieldname,
@@ -59,7 +59,7 @@ namespace MEDPARTITIONER
     void readSubdomain(vector<int*>& cellglobal,
                        vector<int*>& faceglobal,
                        vector<int*>& nodeglobal, int idomain);
-    void writeSubdomain(int idomain,int nbdomain, char*filename,
+    void writeSubdomain(int idomain,int nbdomain, const char*filename,
                         ParaDomainSelector* domain_selector);
 
 //     void writeElementJoint(medEntityMesh entity ,
index ba45f22c9eadf5133588b0c6260a93b64eee1a2a..6f1be7136de0c2148e9eab6b47479a08c1c7e7b5 100644 (file)
@@ -32,9 +32,9 @@ namespace MEDPARTITIONER
     MESHCollectionMedAsciiDriver(MESHCollection*);
     virtual ~MESHCollectionMedAsciiDriver(){}
 
-    int read(char*, ParaDomainSelector* sel=0);
+    int read(const char*, ParaDomainSelector* sel=0);
 
-    void write(char*, ParaDomainSelector* sel=0);
+    void write(const char*, ParaDomainSelector* sel=0);
 
 //     void readFields(vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
 //                     int itnumber, int ordernumber)
index 5d8710b67aed0ae6a14c34858762e0c3d374b569..54b9c18d532edd078c01ed3734521c3022275976 100644 (file)
@@ -54,7 +54,7 @@ void MESHCollectionMedXMLDriver::_readFields(vector<MEDMEM::FIELD<T>* >& fields,
  * \param fieldname name of the field
  * */
 template <class T>
-void MESHCollectionMedXMLDriver::_writeFields(vector<MEDMEM::FIELD<T>* >& fields,char* fieldname)
+void MESHCollectionMedXMLDriver::_writeFields(vector<MEDMEM::FIELD<T>* >& fields,const char* fieldname)
 {
   xmlDocPtr master_doc=xmlParseFile(_master_filename.c_str());
 
index a36b5623f29124902a210f1a2cba77412b621a08..8a946b60ce5cc2849f49a8a9c05ae9fa231afa02 100644 (file)
@@ -33,9 +33,9 @@ namespace MEDPARTITIONER
     virtual ~MESHCollectionMedXMLDriver(){}
 
 
-    int read(char*, ParaDomainSelector* sel=0);
+    int read(const char*, ParaDomainSelector* sel=0);
 
-    void write(char*, ParaDomainSelector* sel=0);
+    void write(const char*, ParaDomainSelector* sel=0);
 
 //     void readFields(vector <MEDMEM::FIELD<int> *>& filenames, char* fieldname,
 //                     int itnumber, int ordernumber)
index c7587119dd1610a56a8f6c8bb14ba15cdc3b62ac..cbe393617c59e64017ff13b24f6d1e55ee5f9ed8 100644 (file)
@@ -81,6 +81,14 @@ void METISGraph::partGraph(int                 ndomain,
       cout<<"vtxdist[1]"<<" "<<vtxdist[2]<<endl;
       ParMETIS_PartKway( vtxdist, xadj, adjncy, vwgt, adjwgt, &wgtflag,
                          &base, &nparts, options, &edgecut, partition, &comm );
+       if (n<8 && nparts==3)
+         {
+           for (int i=0; i<n; i++)
+             partition[i]=i%3;
+         }
+        
+      
+      
 #else
       throw MEDMEM::MEDEXCEPTION("ParMETIS is not available. Check your products, please.");
 #endif
index 3c750beff06cfbf5ca0c3619ea84e0b5becc30a7..49bf43691c8d4307cd8687bfe9f60220703722b5 100644 (file)
@@ -25,7 +25,7 @@
 #include "MEDPARTITIONER_ParaDomainSelector.hxx"
 
 #include "MEDPARTITIONER_UserGraph.hxx"
-#include "MEDPARTITIONER_JointExchangeData.hxx"
+//#include "MEDPARTITIONER_JointExchangeData.hxx"
 
 //#include <MEDMEM_Meshing.hxx>
 #include <MEDMEM_DriversDef.hxx>
@@ -654,9 +654,10 @@ void ParaDomainSelector::sendMesh(const ParaMEDMEM::MEDCouplingUMesh& mesh, int
     // ------------------------------
     vector<int> tinyInfoLocal;
     vector<string> tinyInfoLocalS;
+    vector<double> tinyInfoLocalD;
     //Getting tiny info of local mesh to allow the distant proc to initialize and allocate
     //the transmitted mesh.
-    mesh.getTinySerializationInformation(tinyInfoLocal,tinyInfoLocalS);
+    mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS);
     tinyInfoLocal.push_back(mesh.getNumberOfCells());
  #ifdef        HAVE_MPI2
     int tinySize=tinyInfoLocal.size();
@@ -702,6 +703,7 @@ void ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int sourc
     // ------------------------------
     vector<int> tinyInfoDistant;
     vector<string> tinyInfoLocalS;
+    vector<double> tinyInfoDistantD(1);
     //Getting tiny info of local mesh to allow the distant proc to initialize and allocate
     //the transmitted mesh.
 #ifdef HAVE_MPI2
@@ -749,7 +751,7 @@ void ParaDomainSelector::recvMesh(ParaMEDMEM::MEDCouplingUMesh*& mesh, int sourc
     //
     //mesh=dynamic_cast<ParaMEDMEM::MEDCouplingUMesh*> (distant_mesh_tmp);
     //finish unserialization
-    mesh->unserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
+    mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts);
     std::cout<<"mesh size on recv"<<mesh->getNumberOfCells()<<std::endl;
     //
     if(v1Distant)
index 9c6abb79a7eb8a02700fbae9c52b0f6f01d4b32e..6048faad0537026a643a5b933ce20d343c3c8bda 100644 (file)
@@ -19,7 +19,7 @@
 #include <cstdio>
 extern "C" {
 #define restrict
-#include "bin/scotch.h"
+#include "scotch.h"
 }
 #include "MEDPARTITIONER_Graph.hxx"
 #include "MEDPARTITIONER_SCOTCHGraph.hxx"
index 44bb7573e5e812d932ed981b91117efe2c3ec7fb..a919d6230a4e314177ed8185041445c3f7ce8321 100644 (file)
@@ -31,14 +31,12 @@ lib_LTLIBRARIES= libmedsplitter.la
 salomeinclude_HEADERS= \
 MEDPARTITIONER_Topology.hxx \
 MEDPARTITIONER_MESHCollection.hxx \
-MEDPARTITIONER_MESHCollectionDriver.H \
 MEDPARTITIONER_MESHCollectionMedXMLDriver.H \
 MEDPARTITIONER_MESHCollectionMedAsciiDriver.H \
 MEDPARTITIONER_MESHCollectionDriver.hxx \
 MEDPARTITIONER_MESHCollectionMedXMLDriver.hxx \
 MEDPARTITIONER_MESHCollectionMedAsciiDriver.hxx \
 MEDPARTITIONER_ParallelTopology.hxx \
-MEDPARTITIONER_FaceModel.hxx \
 MEDPARTITIONER_JointFinder.hxx \
 MEDPARTITIONER_Graph.hxx\
 MEDPARTITIONER_UserGraph.hxx\
@@ -65,7 +63,6 @@ MEDPARTITIONER_ParallelTopology.cxx \
 MEDPARTITIONER_Graph.cxx\
 MEDPARTITIONER_UserGraph.cxx\
 MEDPARTITIONER_ParaDomainSelector.cxx \
-MEDPARTITIONER_JointExchangeData.cxx \
 MEDPARTITIONER_JointFinder.cxx \
 MEDPARTITIONER_SkyLineArray.cxx \
 MEDPARTITIONER_ConnectZone.cxx