From f9c7c49c63d158dfcd4dab51fac770e52ab13f0b Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 16 Mar 2017 11:39:50 +0100 Subject: [PATCH] On the road --- src/MEDLoader/MEDFileField.cxx | 264 ++++++++++++++++----------------- src/MEDLoader/MEDFileField.hxx | 47 +++--- 2 files changed, 152 insertions(+), 159 deletions(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 43b0b19b4..8da7ed67b 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -1909,7 +1909,7 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileAnyTypeField1TSWithoutSDA * std::size_t MEDFileFieldPerMesh::getHeapMemorySizeWithoutChildren() const { - return _mesh_name.capacity()+_field_pm_pt.capacity()*sizeof(MCAuto< MEDFileFieldPerMeshPerType >); + return _field_pm_pt.capacity()*sizeof(MCAuto< MEDFileFieldPerMeshPerType >); } std::vector MEDFileFieldPerMesh::getDirectChildrenWithNull() const @@ -1936,7 +1936,7 @@ MEDFileFieldPerMesh *MEDFileFieldPerMesh::deepCopy(MEDFileAnyTypeField1TSWithout void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) const { std::string startLine(bkOffset,' '); - oss << startLine << "## Field part (" << id << ") lying on mesh \"" << _mesh_name << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl; + oss << startLine << "## Field part (" << id << ") lying on mesh \"" << getMeshName() << "\", Mesh iteration=" << _mesh_iteration << ". Mesh order=" << _mesh_order << "." << std::endl; oss << startLine << "## Field is defined on " << _field_pm_pt.size() << " types." << std::endl; int i=0; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) @@ -1952,7 +1952,6 @@ void MEDFileFieldPerMesh::simpleRepr(int bkOffset, std::ostream& oss, int id) co void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) { - _mesh_name=mesh->getName(); mesh->getTime(_mesh_iteration,_mesh_order); } @@ -2088,6 +2087,16 @@ int MEDFileFieldPerMesh::getNumberOfComponents() const return _father->getNumberOfComponents(); } +std::string MEDFileFieldPerMesh::getMeshName() const +{ + return _father->getMeshName(); +} + +void MEDFileFieldPerMesh::setMeshName(const std::string& meshName) +{ + _father->setMeshName(meshName); +} + bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const { for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) @@ -2348,9 +2357,9 @@ bool MEDFileFieldPerMesh::changeMeshNames(const std::vector< std::pair >::const_iterator it=modifTab.begin();it!=modifTab.end();it++) { - if((*it).first==_mesh_name) + if((*it).first==getMeshName()) { - _mesh_name=(*it).second; + setMeshName((*it).second); return true; } } @@ -2383,7 +2392,7 @@ void MEDFileFieldPerMesh::convertMedBallIntoClassic() bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob) { - if(_mesh_name!=meshName) + if(getMeshName()!=meshName) return false; std::set typesToKeep; for(std::size_t i=0;igetPartDefAtLevel(mmu->getRelativeLevOnGeoType(typmai2[iter0->current()]),typmai2[iter0->current()]); _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[iter0->current()],nasc,pd)); if(nbProfile>0) - _mesh_name=name0; + setMeshName(name0); else - _mesh_name=name1; + setMeshName(name1); } } if(MFFPMIter::IsPresenceOfNode(entities)) @@ -3080,7 +3089,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith if(mmu) pd=mmu->getPartDefAtLevel(1,INTERP_KERNEL::NORM_ERROR); _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_NODES,INTERP_KERNEL::NORM_ERROR,nasc,pd)); - _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1); + setMeshName(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE)); } } if(!entities) @@ -3092,7 +3101,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith if(nbPfl>0) { _field_pm_pt.push_back(MEDFileFieldPerMeshPerTypeDyn::NewOnRead(fid,this,entities,*it,nasc)); - _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1); + setMeshName(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE)); } } } @@ -4271,7 +4280,7 @@ MEDFileFieldNameScope::MEDFileFieldNameScope() { } -MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName):_name(fieldName) +MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName, const std::string& meshName):_name(fieldName),_mesh_name(meshName) { } @@ -4309,6 +4318,21 @@ void MEDFileFieldNameScope::copyNameScope(const MEDFileFieldNameScope& other) _dt_unit=other._dt_unit; } +/*! + * Returns the mesh name. + * \return std::string - a string holding the mesh name. + * \throw If \c _field_per_mesh.empty() + */ +std::string MEDFileFieldNameScope::getMeshName() const +{ + return _mesh_name; +} + +void MEDFileFieldNameScope::setMeshName(const std::string& meshName) +{ + _mesh_name=meshName; +} + //= MEDFileAnyTypeField1TSWithoutSDA void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other) @@ -4410,7 +4434,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi return ret; } -MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2) +MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName,meshName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2) { } @@ -4431,26 +4455,6 @@ int MEDFileAnyTypeField1TSWithoutSDA::getDimension() const return ret; } -/*! - * Returns the mesh name. - * \return std::string - a string holding the mesh name. - * \throw If \c _field_per_mesh.empty() - */ -std::string MEDFileAnyTypeField1TSWithoutSDA::getMeshName() const -{ - if(_field_per_mesh.empty()) - throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshName : No field set !"); - return _field_per_mesh[0]->getMeshName(); -} - -void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const std::string& newMeshName) -{ - std::string oldName(getMeshName()); - std::vector< std::pair > v(1); - v[0].first=oldName; v[0].second=newMeshName; - changeMeshNames(v); -} - bool MEDFileAnyTypeField1TSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; @@ -4653,13 +4657,9 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector */ std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { - int meshId=0; - if(!mname.empty()) - meshId=getMeshIdFromMeshName(mname); - else - if(_field_per_mesh.empty()) - throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); - return _field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs); + if(_field_per_mesh.empty()) + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); + return _field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); } /*! @@ -4706,11 +4706,12 @@ std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSD int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& mname, std::vector& levs) const { levs.clear(); - int meshId=getMeshIdFromMeshName(mname); std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls, locs; - _field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs); + if(_field_per_mesh.empty()) + throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels : This is empty !"); + _field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); if(types.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getNonEmptyLevels : 'this' is empty !"); std::set st(types.begin(),types.end()); @@ -4780,8 +4781,9 @@ void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCe */ MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) { - int mid=getMeshIdFromMeshName(mName); - return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId); + if(_field_per_mesh.empty()) + throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !"); + return _field_per_mesh[0]->getLeafGivenTypeAndLocId(typ,locId); } /*! @@ -4792,8 +4794,9 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGive */ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const { - int mid=getMeshIdFromMeshName(mName); - return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId); + if(_field_per_mesh.empty()) + throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId : This is empty !"); + return _field_per_mesh[0]->getLeafGivenTypeAndLocId(typ,locId); } /*! @@ -4827,6 +4830,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe std::string tmp(mesh->getName()); if(tmp.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !"); + setMeshName(tmp); std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin(); int i=0; for(;it!=_field_per_mesh.end();it++,i++) @@ -5016,25 +5020,22 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id med_int nmesh; med_bool localMesh; med_int meshnumdt,meshnumit; - INTERP_KERNEL::AutoPtr meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt)); - MEDFILESAFECALLERRD0(MEDfield23ComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit)); + //MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt)); + //MEDFILESAFECALLERRD0(MEDfield23ComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit)); // to check with Adrien for legacy MED files + MEDFILESAFECALLERRD0(MEDfieldComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt,&meshnumdt,&meshnumit)); if(_iteration!=numdt || _order!=numit) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !"); - _field_per_mesh.resize(nmesh); + _field_per_mesh.resize(1); // MEDFileMesh *mm(0); if(ms) { - std::string meshNameCpp(MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1)); - mm=ms->getMeshWithName(meshNameCpp); + mm=ms->getMeshWithName(getMeshName()); } // - for(int i=0;iloadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); + _field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); } void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) @@ -5069,7 +5070,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::unloadArrays() std::size_t MEDFileAnyTypeField1TSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - return _dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MCAuto< MEDFileFieldPerMesh >); + return _mesh_name.capacity()+_dt_unit.capacity()+_field_per_mesh.capacity()*sizeof(MCAuto< MEDFileFieldPerMesh >); } std::vector MEDFileAnyTypeField1TSWithoutSDA::getDirectChildrenWithNull() const @@ -5103,6 +5104,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const MEDCouplingFie // TypeOfField type=field->getTypeOfField(); std::vector dummy; + if(mesh) + setMeshName(mesh->getName()); int start=copyTinyInfoFrom(field,arr); int pos=addNewEntryIfNecessary(mesh); if(type!=ON_NODES) @@ -5217,6 +5220,8 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDou throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !"); std::string name(field->getName()); setName(name.c_str()); + if(field->getMesh()) + setMeshName(field->getMesh()->getName()); setDtUnit(field->getTimeUnit()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !"); @@ -5489,9 +5494,8 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; - int meshId=getMeshIdFromMeshName(mesh->getName()); bool isPfl=false; - MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); + MCAuto ret=_field_per_mesh[0]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc); switch(renumPol) { case 0: @@ -5567,8 +5571,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); - int meshId=getMeshIdFromMeshName(mesh->getName().c_str()); - MCAuto ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); + MCAuto ret=_field_per_mesh[0]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); ret->setName(nasc.getName().c_str()); return ret.retn(); } @@ -5630,9 +5633,9 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh * return code; } -MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos) +MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos) { - return new MEDFileField1TSWithoutSDA(fieldName,csit,iteration,order,infos); + return new MEDFileField1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos); } /*! @@ -5671,13 +5674,10 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fie */ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { - int meshId=0; - if(!mname.empty()) - meshId=getMeshIdFromMeshName(mname); - else + if(mname.empty()) if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); - std::vector< std::vector< std::pair > > ret0=_field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs); + std::vector< std::vector< std::pair > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); int nbOfRet=ret0.size(); std::vector< std::vector > ret(nbOfRet); for(int i=0;i& infos):MEDFileField1TSTemplateWithoutSDA(fieldName,csit,iteration,order) +MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSTemplateWithoutSDA(fieldName,meshName,csit,iteration,order) { DataArrayDouble *arr(getOrCreateAndGetArrayTemplate()); arr->setInfoAndChangeNbOfCompo(infos); @@ -5787,17 +5787,17 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const //= MEDFileIntField1TSWithoutSDA -MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos) +MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos) { - return new MEDFileIntField1TSWithoutSDA(fieldName,csit,iteration,order,infos); + return new MEDFileIntField1TSWithoutSDA(fieldName,meshName,csit,iteration,order,infos); } MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileField1TSTemplateWithoutSDA() { } -MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, - const std::vector& infos):MEDFileField1TSTemplateWithoutSDA(fieldName,csit,iteration,order) +MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, + const std::vector& infos):MEDFileField1TSTemplateWithoutSDA(fieldName,meshName,csit,iteration,order) { DataArrayInt *arr(getOrCreateAndGetArrayTemplate()); arr->setInfoAndChangeNbOfCompo(infos); @@ -5895,19 +5895,19 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i med_field_type typcha; // std::vector infos; - std::string dtunit,fieldName; - LocateField2(fid,0,true,fieldName,typcha,infos,dtunit); + std::string dtunit,fieldName,meshName; + LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName); MCAuto ret; switch(typcha) { case MED_FLOAT64: { - ret=MEDFileField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } default: @@ -5946,20 +5946,20 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { med_field_type typcha; std::vector infos; - std::string dtunit; + std::string dtunit,meshName; int iii=-1; - int nbSteps=LocateField(fid,fieldName,iii,typcha,infos,dtunit); + int nbSteps=LocateField(fid,fieldName,iii,typcha,infos,dtunit,meshName); MCAuto ret; switch(typcha) { case MED_FLOAT64: { - ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector()); + ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,-1/*iteration*/,-1/*order*/,std::vector()); break; } default: @@ -5968,6 +5968,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i throw INTERP_KERNEL::Exception(oss.str()); } } + ret->setMeshName(meshName); ret->setDtUnit(dtunit.c_str()); ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos); // @@ -6086,20 +6087,20 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i { med_field_type typcha; std::vector infos; - std::string dtunit; + std::string dtunit,meshName; int iii(-1); - int nbOfStep2(LocateField(fid,fieldName,iii,typcha,infos,dtunit)); + int nbOfStep2(LocateField(fid,fieldName,iii,typcha,infos,dtunit,meshName)); MCAuto ret; switch(typcha) { case MED_FLOAT64: { - ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector()); + ret=MEDFileField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); break; } case MED_INT32: { - ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector()); + ret=MEDFileIntField1TSWithoutSDA::New(fieldName,meshName,-1,iteration,order,std::vector()); break; } default: @@ -6171,7 +6172,7 @@ MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWitho } } -int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut) +int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName) { if(checkFieldId) { @@ -6183,16 +6184,17 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c } } int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); - INTERP_KERNEL::AutoPtr comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE); - INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE); - INTERP_KERNEL::AutoPtr dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); - INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - INTERP_KERNEL::AutoPtr nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); + INTERP_KERNEL::AutoPtr comp(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); + INTERP_KERNEL::AutoPtr unit(MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE)); + INTERP_KERNEL::AutoPtr dtunit(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); + INTERP_KERNEL::AutoPtr nomcha(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); + INTERP_KERNEL::AutoPtr nomMaa(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_bool localMesh; int nbOfStep; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep)); fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE); dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE); + meshName=MEDLoaderBase::buildStringFromFortran(nomMaa,MED_NAME_SIZE); infos.clear(); infos.resize(ncomp); for(int j=0;j& infos, std::string& dtunitOut) +int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName) { int nbFields=MEDnField(fid); bool found=false; @@ -6213,8 +6215,8 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fieldNam int nbOfStep2(-1); for(int i=0;i& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileFieldNameScope(fieldName),_infos(infos) +MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) +try:MEDFileFieldNameScope(fieldName,meshName),_infos(infos) { setDtUnit(dtunit.c_str()); loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll,ms,entities); @@ -7681,7 +7684,7 @@ catch(INTERP_KERNEL::Exception& e) std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const { - std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto)); + std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto)); for(std::vector::const_iterator it=_infos.begin();it!=_infos.end();it++) ret+=(*it).capacity(); return ret; @@ -7940,21 +7943,6 @@ MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS return *_time_steps[getTimeStepPos(iteration,order)]; } -std::string MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshName() const -{ - if(_time_steps.empty()) - throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getMeshName : not time steps !"); - return _time_steps[0]->getMeshName(); -} - -void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMeshName) -{ - std::string oldName(getMeshName()); - std::vector< std::pair > v(1); - v[0].first=oldName; v[0].second=newMeshName; - changeMeshNames(v); -} - bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair >& modifTab) { bool ret=false; @@ -8062,7 +8050,8 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAutogetName().c_str()); + setName(tse2->getName()); + setMeshName(tse2->getMeshName()); setInfo(tse2->getInfo()); } checkThatComponentsMatch(tse2->getInfo()); @@ -8103,12 +8092,12 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR { case MED_FLOAT64: { - _time_steps[i]=MEDFileField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); break; } case MED_INT32: { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); break; } default: @@ -8569,7 +8558,9 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) { - _name=field->getName(); + setName(field->getName()); + if(field->getMesh()) + setMeshName(field->getMesh()->getName()); if(_name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !"); if(!arr) @@ -8676,16 +8667,16 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) +MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) { - return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); + return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); } MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA() { } -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) +MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) { } @@ -8699,8 +8690,8 @@ try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) catch(INTERP_KERNEL::Exception& e) { throw e; } -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) +MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) +try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } catch(INTERP_KERNEL::Exception& e) @@ -8790,8 +8781,9 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr med_field_type typcha; std::vector infos; std::string dtunit; + std::string meshName; int i(-1); - MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit); + MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit,meshName); MCAuto ret; switch(typcha) { @@ -8811,6 +8803,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr throw INTERP_KERNEL::Exception(oss.str()); } } + ret->setMeshName(meshName); ret->setDtUnit(dtunit.c_str()); return ret.retn(); } @@ -8820,8 +8813,8 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr med_field_type typcha; // std::vector infos; - std::string dtunit,fieldName; - MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit); + std::string dtunit,fieldName,meshName; + MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName); MCAuto ret; switch(typcha) { @@ -8841,6 +8834,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr throw INTERP_KERNEL::Exception(oss.str()); } } + ret->setMeshName(meshName); ret->setDtUnit(dtunit.c_str()); return ret.retn(); } @@ -8885,21 +8879,21 @@ catch(INTERP_KERNEL::Exception& e) //= MEDFileIntFieldMultiTSWithoutSDA -MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) +MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) { - return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); + return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); } MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA() { } -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName) +MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) { } -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) +MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) +try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } catch(INTERP_KERNEL::Exception& e) @@ -10930,18 +10924,18 @@ try:MEDFileFieldGlobsReal(fid) for(int i=0;i infos; - std::string fieldName,dtunit; - int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,i,false,fieldName,typcha,infos,dtunit)); + std::string fieldName,dtunit,meshName; + int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,i,false,fieldName,typcha,infos,dtunit,meshName)); switch(typcha) { case MED_FLOAT64: { - _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); + _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); break; } case MED_INT32: { - _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); + _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities); break; } default: diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 81ec25452..f2c3b324c 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -363,7 +363,8 @@ namespace MEDCoupling int getOrder() const; int getMeshIteration() const { return _mesh_iteration; } int getMeshOrder() const { return _mesh_order; } - std::string getMeshName() const { return _mesh_name; } + std::string getMeshName() const; + void setMeshName(const std::string& meshName); int getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; bool presenceOfStructureElements() const; @@ -411,9 +412,8 @@ namespace MEDCoupling static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); - MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_name(meshName),_mesh_iteration(meshIt),_mesh_order(meshOrd) { } + MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { } private: - std::string _mesh_name; int _mesh_iteration; int _mesh_order; MEDFileAnyTypeField1TSWithoutSDA *_father; @@ -558,15 +558,18 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT MEDFileFieldNameScope(); - MEDLOADER_EXPORT MEDFileFieldNameScope(const std::string& fieldName); + MEDLOADER_EXPORT MEDFileFieldNameScope(const std::string& fieldName, const std::string& meshName); MEDLOADER_EXPORT std::string getName() const; MEDLOADER_EXPORT void setName(const std::string& fieldName); MEDLOADER_EXPORT std::string getDtUnit() const; MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit); MEDLOADER_EXPORT void copyNameScope(const MEDFileFieldNameScope& other); + MEDLOADER_EXPORT std::string getMeshName() const; + MEDLOADER_EXPORT void setMeshName(const std::string& meshName); protected: std::string _name; std::string _dt_unit; + std::string _mesh_name; }; class MEDFileMeshes; @@ -578,14 +581,12 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(); - MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order); + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order); MEDLOADER_EXPORT int getIteration() const { return _iteration; } MEDLOADER_EXPORT int getOrder() const { return _order; } MEDLOADER_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; } MEDLOADER_EXPORT void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; } MEDLOADER_EXPORT int getDimension() const; - MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getMeshIteration() const; MEDLOADER_EXPORT int getMeshOrder() const; @@ -686,7 +687,7 @@ namespace MEDCoupling class MEDFileField1TSTemplateWithoutSDA : public MEDFileAnyTypeField1TSWithoutSDA { protected: - MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order) { } + MEDFileField1TSTemplateWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order):MEDFileAnyTypeField1TSWithoutSDA(fieldName,meshName,csit,iteration,order) { } MEDFileField1TSTemplateWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA() { } public: MEDLOADER_EXPORT void setArray(DataArray *arr); @@ -714,10 +715,10 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax); MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); - MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); - MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const; @@ -732,7 +733,7 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA(); - MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; @@ -740,7 +741,7 @@ namespace MEDCoupling MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const; protected: - MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector& infos); + MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT static const char TYPE_STR[]; }; @@ -830,8 +831,8 @@ namespace MEDCoupling MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); public: - MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); - MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut); + MEDLOADER_EXPORT static int LocateField2(med_idt fid, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName); + MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector& infos, std::string& dtunitOut, std::string& meshName); public: MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; public: @@ -946,9 +947,9 @@ namespace MEDCoupling { protected: MEDFileAnyTypeFieldMultiTSWithoutSDA(); - MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName); + MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName); MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); - MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -967,8 +968,6 @@ namespace MEDCoupling MEDLOADER_EXPORT int getTimeStepPos(int iteration, int order) const; MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const; MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order); - MEDLOADER_EXPORT std::string getMeshName() const; - MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getNumberOfTS() const; MEDLOADER_EXPORT void eraseEmptyTS(); @@ -1031,7 +1030,7 @@ namespace MEDCoupling class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; @@ -1039,8 +1038,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const; protected: - MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName); - MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName); + MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; @@ -1051,15 +1050,15 @@ namespace MEDCoupling class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT const char *getTypeStr() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const; protected: - MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName); - MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName); + MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); med_field_type getMEDFileFieldType() const { return MED_INT32; } MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; -- 2.39.2