From: eap Date: Fri, 22 May 2015 18:12:45 +0000 (+0300) Subject: 0022875: debug X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a3ac171770788f88268f7af0d41914d14c070e1;p=tools%2Fmedcoupling.git 0022875: debug --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx index ff0bb1944..3185a5495 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx @@ -52,8 +52,16 @@ MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const ParaMEDMEM::MEDFileData* filedata, int ndomains, const std::string& library,bool creates_boundary_faces, bool create_joints, bool mesure_memory) { + ParaDomainSelector parallelizer(mesure_memory); _input_collection=new MeshCollection(); - _input_collection->getDriver()->readMEDFileData(filedata); + _input_collection->setParaDomainSelector( ¶llelizer ); + _input_collection->retrieveDriver()->readMEDFileData(filedata); + + MEDPARTITIONER::ParallelTopology* aPT = + (MEDPARTITIONER::ParallelTopology*) _input_collection->getTopology(); + aPT->setGlobalNumerotationDefault( _input_collection->getParaDomainSelector() ); + _input_collection->prepareFieldDescriptions(); + createPartitionCollection(ndomains, library, creates_boundary_faces, create_joints, mesure_memory); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index 1fdad2f40..0ce114712 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -122,6 +122,7 @@ namespace MEDPARTITIONER //getting a pointer to topology Topology* getTopology() const ; ParaDomainSelector* getParaDomainSelector() const { return _domain_selector; } + void setParaDomainSelector(ParaDomainSelector* pds) { _domain_selector = pds; } //setting a new topology void setTopology(Topology* topology); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 2e2408266..e440100f2 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -87,14 +87,33 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) void MeshCollectionDriver::readMEDFileData(const ParaMEDMEM::MEDFileData* filedata) { - for (int i=0; igetMeshes()->getNumberOfMeshes(); i++) - { - ParaMEDMEM::MEDFileUMesh *mfm = dynamic_cast(filedata->getMeshes()->getMeshAtPos(i)); - readData(mfm,i); - if (i==0) - _collection->setName(filedata->getMeshes()->getMeshAtPos(i)->getName()); - mfm->decrRef(); - } + const int nbDomains = filedata->getMeshes()->getNumberOfMeshes(); + _collection->getMesh() .resize( nbDomains, 0 ); + _collection->getFaceMesh() .resize( nbDomains, 0 ); + _collection->getCellFamilyIds().resize( nbDomains, 0 ); + _collection->getFaceFamilyIds().resize( nbDomains, 0 ); + + for (int i=0; i(filedata->getMeshes()->getMeshAtPos(i)); + readData(mfm,i); + if ( mfm && mfm->getMeshDimension() > 0 ) + _collection->setNonEmptyMesh( i ); + } + + ParallelTopology* aPT = new ParallelTopology(_collection->getMesh()); + _collection->setTopology(aPT); + if ( nbDomains > 0 ) + { + _collection->setName( filedata->getMeshes()->getMeshAtPos(0)->getName() ); + _collection->setDomainNames( _collection->getName() ); + } + if ( ParaDomainSelector* domainSelector = _collection->getParaDomainSelector() ) + if ( _collection->isParallelMode() ) + { + //to know nb of cells on each proc to compute global cell ids from locally global + domainSelector->gatherNbOf(_collection->getMesh()); + } } void MeshCollectionDriver::readFileData(std::string file,std::string meshname,int idomain) const @@ -103,6 +122,7 @@ void MeshCollectionDriver::readFileData(std::string file,std::string meshname,in readData(mfm,idomain); mfm->decrRef(); } + void MeshCollectionDriver::readData(ParaMEDMEM::MEDFileUMesh* mfm, int idomain) const { std::vector nonEmpty=mfm->getNonEmptyLevels(); @@ -297,9 +317,9 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile size_t found=(*it).first.find(key); if (found==std::string::npos) continue; - ParaMEDMEM::MEDCouplingFieldDouble* field=0; - field=getField(key, (*it).first, (*it).second, mfm, idomain); - nbfFieldFound++; + ParaMEDMEM::MEDCouplingFieldDouble* field=0; + field=getField(key, (*it).first, (*it).second, mfm, idomain); + nbfFieldFound++; try { MEDLoader::WriteField(distfilename,field,false); @@ -340,8 +360,8 @@ ParaMEDMEM::MEDFileData* MeshCollectionDriver::getMEDFileData() size_t found=(*it).first.find(key); if (found==std::string::npos) continue; - ParaMEDMEM::MEDCouplingFieldDouble* field=0; - field=getField(key, (*it).first, (*it).second, mfm, i); + ParaMEDMEM::MEDCouplingFieldDouble* field=0; + field=getField(key, (*it).first, (*it).second, mfm, i); ParaMEDMEM::MEDFileField1TS* f1ts(ParaMEDMEM::MEDFileField1TS::New()); f1ts->setFieldNoProfileSBT(field); fieldsMTS->pushBackTimeStep(f1ts);