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);
}
void MeshCollectionDriver::readMEDFileData(const ParaMEDMEM::MEDFileData* filedata)
{
- for (int i=0; i<filedata->getMeshes()->getNumberOfMeshes(); i++)
- {
- ParaMEDMEM::MEDFileUMesh *mfm = dynamic_cast<ParaMEDMEM::MEDFileUMesh *>(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<nbDomains; i++)
+ {
+ ParaMEDMEM::MEDFileUMesh *mfm = dynamic_cast<ParaMEDMEM::MEDFileUMesh *>(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
readData(mfm,idomain);
mfm->decrRef();
}
+
void MeshCollectionDriver::readData(ParaMEDMEM::MEDFileUMesh* mfm, int idomain) const
{
std::vector<int> nonEmpty=mfm->getNonEmptyLevels();
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);
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);