X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FMEDFileFieldRepresentationTree.cxx;h=540464cea1af7563cc70845f33df3cae59767bfb;hb=f671e69102c5ae8e2194509a6b719fae0b06d26c;hp=433e3c656f81bf9e1237c8fb311c40ba52fcd531;hpb=631f010fa69b15e8928a8a0d553b976e91307e5f;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 433e3c65..540464ce 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -995,6 +995,13 @@ void MEDFileFieldRepresentationTree::feedSIL(vtkMutableDirectedGraph* sil, vtkId } } +std::string MEDFileFieldRepresentationTree::getActiveMeshName() const +{ + int dummy0(0),dummy1(0),dummy2(0); + const MEDFileFieldRepresentationLeaves& leaf(getTheSingleActivated(dummy0,dummy1,dummy2)); + return leaf.getMeshName(); +} + std::string MEDFileFieldRepresentationTree::feedSILForFamsAndGrps(vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector& names) const { int dummy0(0),dummy1(0),dummy2(0); @@ -1101,52 +1108,15 @@ int MEDFileFieldRepresentationTree::getMaxNumberOfTimeSteps() const /*! * */ -void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts) +void MEDFileFieldRepresentationTree::loadInMemory(MEDCoupling::MEDFileFields *fields, MEDCoupling::MEDFileMeshes *meshes) { - if(isMEDOrSauv) - { - if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1)) - { - _ms=MEDFileMeshes::New(fileName); - _fields=MEDFileFields::New(fileName,false);//false is important to not read the values - } - else - { -#ifdef MEDREADER_USE_MPI - _ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName); - int nbMeshes(_ms->getNumberOfMeshes()); - for(int i=0;igetMeshAtPos(i)); - MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); - if(tmp2) - MCAuto tmp3(tmp2->zipCoords()); - } - _fields=MEDFileFields::LoadPartOf(fileName,false,_ms);//false is important to not read the values -#else - std::ostringstream oss; oss << "MEDFileFieldRepresentationTree::loadMainStructureOfFile : request for iPart/nbOfParts=" << iPart << "/" << nbOfParts << " whereas Plugin not compiled with MPI !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); -#endif - } - } - else - { - MCAuto sr(MEDCoupling::SauvReader::New(fileName)); - MCAuto mfd(sr->loadInMEDFileDS()); - _ms=mfd->getMeshes(); _ms->incrRef(); - int nbMeshes(_ms->getNumberOfMeshes()); - for(int i=0;igetMeshAtPos(i)); - MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); - if(tmp2) - tmp2->forceComputationOfParts(); - } - _fields=mfd->getFields(); - if((MEDCoupling::MEDFileFields *)_fields) - _fields->incrRef(); - } - if(!((MEDCoupling::MEDFileFields *)_fields)) + _fields=fields; _ms=meshes; + if(_fields.isNotNull()) + _fields->incrRef(); + if(_ms.isNotNull()) + _ms->incrRef(); + // + if(_fields.isNull()) { _fields=BuildFieldFromMeshes(_ms); } @@ -1256,6 +1226,56 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam this->computeFullNameInLeaves(); } +void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts) +{ + MCAuto ms; + MCAuto fields; + if(isMEDOrSauv) + { + if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1)) + { + ms=MEDFileMeshes::New(fileName); + fields=MEDFileFields::New(fileName,false);//false is important to not read the values + } + else + { +#ifdef MEDREADER_USE_MPI + ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName); + int nbMeshes(ms->getNumberOfMeshes()); + for(int i=0;igetMeshAtPos(i)); + MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); + if(tmp2) + MCAuto tmp3(tmp2->zipCoords()); + } + fields=MEDFileFields::LoadPartOf(fileName,false,ms);//false is important to not read the values +#else + std::ostringstream oss; oss << "MEDFileFieldRepresentationTree::loadMainStructureOfFile : request for iPart/nbOfParts=" << iPart << "/" << nbOfParts << " whereas Plugin not compiled with MPI !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); +#endif + } + } + else + { + MCAuto sr(MEDCoupling::SauvReader::New(fileName)); + MCAuto mfd(sr->loadInMEDFileDS()); + ms=mfd->getMeshes(); ms->incrRef(); + int nbMeshes(ms->getNumberOfMeshes()); + for(int i=0;igetMeshAtPos(i)); + MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); + if(tmp2) + tmp2->forceComputationOfParts(); + } + fields=mfd->getFields(); + if(fields.isNotNull()) + fields->incrRef(); + } + loadInMemory(fields,ms); +} + void MEDFileFieldRepresentationTree::removeEmptyLeaves() { std::vector< std::vector< std::vector< MEDFileFieldRepresentationLeaves > > > newSD;