From: ageay Date: Wed, 17 Jul 2013 15:19:56 +0000 (+0000) Subject: On the road of last imps for MEDReader X-Git-Tag: B4KillOfAutomake~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=70f0c145690b0ce4da3a13728acc5b0b03c011fa;p=modules%2Fmed.git On the road of last imps for MEDReader --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 4d3851f14..35426735e 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -415,7 +415,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCpy(ME } MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField atype, int profileIt) throw(INTERP_KERNEL::Exception) -try:_type(atype),_father(fath) +try:_type(atype),_father(fath),_profile_it(profileIt) { } catch(INTERP_KERNEL::Exception& e) @@ -441,7 +441,7 @@ const MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerTypePerDisc::getFather() return _father; } -void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception) +void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception) { INTERP_KERNEL::AutoPtr locname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr pflname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); @@ -454,7 +454,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i int profilesize,nbi; med_geometry_type mgeoti; med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti); - _nval=MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,profileIt,MED_COMPACT_PFLMODE, + _nval=MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi); _profile=MEDLoaderBase::buildStringFromFortran(pflname,MED_NAME_SIZE); _localization=MEDLoaderBase::buildStringFromFortran(locname,MED_NAME_SIZE); @@ -473,7 +473,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i } } -void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception) +void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception) { std::string fieldName=nasc.getName(); std::string meshName=getMeshName(); @@ -1452,31 +1452,32 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_geometry_type mgeoti; - med_entity_type menti=ConvertIntoMEDFileType(type,geoType,mgeoti); + med_entity_type menti; + menti=ConvertIntoMEDFileType(type,geoType,mgeoti); int nbProfiles=MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName); _field_pm_pt_pd.resize(nbProfiles); for(int i=0;i >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++) - { - (*it)->loadOnlyStructureOfDataRecursively(fid,pflId+1,start,nasc);//tony - } + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); } void MEDFileFieldPerMeshPerType::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception) { - int pflId=0; - for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++) - { - (*it)->loadBigArray(fid,pflId+1,nasc);//tony - } + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + (*it)->loadBigArray(fid,nasc); } void MEDFileFieldPerMeshPerType::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception) @@ -2341,18 +2342,13 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); for(int i=0;i0) + int nbProfile =MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[i],_mesh_csit,meshName,pflName,locName); + int nbProfile2=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[i],_mesh_csit,meshName,pflName,locName); + if(nbProfile>0 || nbProfile2>0) { _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_CELLS,typmai2[i],nasc)); _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1); } - nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[i],_mesh_csit,meshName,pflName,locName); - if(nbProfile>0) - { - _field_pm_pt.push_back(MEDFileFieldPerMeshPerType::NewOnRead(fid,this,ON_GAUSS_NE,typmai2[i],nasc)); - _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1); - } } int nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,_mesh_csit,meshName,pflName,locName); if(nbProfile>0) @@ -8302,6 +8298,11 @@ std::vector< std::vector > MEDFileAnyTypeFieldMult throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !"); if(cmps[i]->isCompatibleWithNodesDiscr(*it2)) ret[i].push_back(*it2); + else + { + std::vector ret0(1,*it2); + ret.push_back(ret0); + } } } return ret; diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 7afac4bf0..66393419a 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -105,8 +105,8 @@ namespace ParaMEDMEM void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const throw(INTERP_KERNEL::Exception); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception); const MEDFileFieldPerMeshPerType *getFather() const; - void loadOnlyStructureOfDataRecursively(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception); - void loadBigArray(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception); + void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception); + void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception); void setNewStart(int newValueOfStart) throw(INTERP_KERNEL::Exception); int getIteration() const; int getOrder() const; @@ -162,6 +162,7 @@ namespace ParaMEDMEM std::string _localization; //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT mutable int _loc_id; + mutable int _profile_it; public: mutable int _tmp_work1; }; diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index d531e4dd7..d77b36f13 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -322,7 +322,8 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::simplifyMeOnCellEntity(cons std::vector< std::pair< INTERP_KERNEL::NormalizedCellType, std::vector > >::iterator it0(std::find_if(m.begin(),m.end(),CmpGeo((*it).getGeo()))); if(it0==m.end()) m.push_back(std::pair< INTERP_KERNEL::NormalizedCellType, std::vector >((*it).getGeo(),std::vector(1,i))); - (*it0).second.push_back(i); + else + (*it0).second.push_back(i); } if(m.size()==_items.size()) { @@ -398,7 +399,7 @@ bool MEDFileField1TSStructItem::isFullyOnExactlyOneLev(const MEDFileMeshStruct * { if(!(*it).getPflName().empty()) return false; - INTERP_KERNEL::NormalizedCellType gt; + INTERP_KERNEL::NormalizedCellType gt((*it).getGeo()); if(gts.find(gt)!=gts.end()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::isFullyOnExactlyOneLev : internal error !"); gts.insert(gt); @@ -528,7 +529,7 @@ MEDFileField1TSStructItem MEDFileField1TSStruct::BuildItemFrom(const MEDFileAnyT bool isFirst=true; for(std::size_t i=0;i