X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FMEDFileFieldRepresentationTree.cxx;h=540464cea1af7563cc70845f33df3cae59767bfb;hb=f24ad457e027761c8df0671ba283a27af1ae3511;hp=10064334a68e4be4f6bb410007f8729a5488b474;hpb=a4e89b15c2faff6341ab9c3d78abc6213de10fee;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 10064334..540464ce 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2015 CEA/DEN, EDF R&D +// Copyright (C) 2010-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,7 @@ #include "vtkInformationQuadratureSchemeDefinitionVectorKey.h" #include "vtkInformationIntegerKey.h" #include "vtkInformation.h" +#include "vtkDataArrayTemplate.h" #include "vtkIdTypeArray.h" #include "vtkDoubleArray.h" #include "vtkIntArray.h" @@ -177,6 +178,7 @@ vtkIdTypeArray *ELGACmp::createNew(const MEDCoupling::MEDFileFieldGlobsReal *glo _loc_names=locNames; _elgas=elgas; _defs.push_back(defs); + return elga; } void ELGACmp::appendELGAIfAny(vtkDataSet *ds) const @@ -419,7 +421,7 @@ void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, vtkQuadratureSchemeDefinition *def(vtkQuadratureSchemeDefinition::New()); double *shape(new double[nbGaussPt*nbGaussPt]); std::size_t dummy; - const double *gsCoords(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(ct,dummy)); + const double *gsCoords(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(ct,dummy));//GetLocsFromGeometricType const double *refCoords(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(ct,dummy)); const double *weights(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(ct,dummy)); std::vector gsCoords2(gsCoords,gsCoords+nbGaussPt*dim),refCoords2(refCoords,refCoords+nbGaussPt*dim); @@ -993,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); @@ -1099,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); } @@ -1254,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;