X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileField.cxx;h=ded7e99dd4468ba3b7c14b05aca2b2965782a7b2;hb=e8d23862df98c569db3f255e0fce1dcb6d832f53;hp=006f36603610dbb6770ddfe6caf2709c65d78774;hpb=ed70213dcec0c84ce2853088db411dc63b100f40;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 006f36603..ded7e99dd 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -432,7 +432,7 @@ std::vector MEDFileFieldPerMeshPerTypePerDisc::getDirec MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const { - MCAuto ret=new MEDFileFieldPerMeshPerTypePerDisc(*this); + MCAuto ret(new MEDFileFieldPerMeshPerTypePerDisc(*this)); ret->_father=father; return ret.retn(); } @@ -537,12 +537,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); std::string fieldName(nasc.getName()),meshName(getMeshName()); - int iteration(getIteration()),order(getOrder()); + int iteration(getIteration()),order(getOrder()),profilesize,nbi; TypeOfField type(getType()); - INTERP_KERNEL::NormalizedCellType geoType(getGeoType()); - int profilesize,nbi; med_geometry_type mgeoti; - med_entity_type menti(MEDFileFieldPerMeshPerTypeCommon::ConvertIntoMEDFileType(type,geoType,mgeoti)); + med_entity_type menti; + _father->entriesForMEDfile(type,mgeoti,menti); int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); _profile=MEDLoaderBase::buildStringFromFortran(pflname,MED_NAME_SIZE); _localization=MEDLoaderBase::buildStringFromFortran(locname,MED_NAME_SIZE); @@ -577,9 +576,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF std::string fieldName(nasc.getName()),meshName(getMeshName()); int iteration(getIteration()),order(getOrder()); TypeOfField type(getType()); - INTERP_KERNEL::NormalizedCellType geoType(getGeoType()); med_geometry_type mgeoti; - med_entity_type menti(MEDFileFieldPerMeshPerTypeCommon::ConvertIntoMEDFileType(type,geoType,mgeoti)); + med_entity_type menti; + _father->entriesForMEDfile(type,mgeoti,menti); if(_start>_end) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : internal error in range !"); if(_start==_end) @@ -648,10 +647,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::simpleRepr(int bkOffset, std::ostream& o const char startLine[]=" ## "; std::string startLine2(bkOffset,' '); startLine2+=startLine; - MEDCouplingFieldDiscretization *tmp=MEDCouplingFieldDiscretization::New(_type); + INTERP_KERNEL::AutoCppPtr tmp(MEDCouplingFieldDiscretization::New(_type)); oss << startLine2 << "Localization #" << id << "." << std::endl; oss << startLine2 << " Type=" << tmp->getRepr() << "." << std::endl; - delete tmp; oss << startLine2 << " This type discretization lies on profile : \"" << _profile << "\" and on the following localization : \"" << _localization << "\"." << std::endl; oss << startLine2 << " This type discretization has " << _end-_start << " tuples (start=" << _start << ", end=" << _end << ")." << std::endl; oss << startLine2 << " This type discretization has " << (_end-_start)/_nval << " integration points." << std::endl; @@ -776,10 +774,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { TypeOfField type=getType(); - INTERP_KERNEL::NormalizedCellType geoType=getGeoType(); + INTERP_KERNEL::NormalizedCellType geoType(getGeoType()); med_geometry_type mgeoti; - med_entity_type menti=MEDFileFieldPerMeshPerTypeCommon::ConvertIntoMEDFileType(type,geoType,mgeoti); - const DataArray *arr=getOrCreateAndGetArray(); + med_entity_type menti; + _father->entriesForMEDfile(getType(),mgeoti,menti); + const DataArray *arr(getOrCreateAndGetArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !"); if(!arr->isAllocated()) @@ -1604,6 +1603,11 @@ INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const return _geo_type; } +void MEDFileFieldPerMeshPerType::entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const +{ + ent=MEDFileFieldPerMeshPerTypeCommon::ConvertIntoMEDFileType(mct,_geo_type,gt); +} + void MEDFileFieldPerMeshPerType::getDimension(int& dim) const { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); @@ -1716,11 +1720,22 @@ int MEDFileFieldPerMeshPerTypeDyn::getDynGT() const return _se->getDynGT(); } +std::string MEDFileFieldPerMeshPerTypeDyn::getModelName() const +{ + return _se->getName(); +} + void MEDFileFieldPerMeshPerTypeDyn::getDimension(int& dim) const { throw INTERP_KERNEL::Exception("not implemented yet !"); } +void MEDFileFieldPerMeshPerTypeDyn::entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const +{ + gt=getDynGT(); + ent=MED_STRUCT_ELEMENT; +} + INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypeDyn::getGeoType() const { throw INTERP_KERNEL::Exception("not implemented yet !"); @@ -1732,14 +1747,13 @@ void MEDFileFieldPerMeshPerTypeDyn::simpleRepr(int bkOffset, std::ostream& oss, std::string startLine2(bkOffset,' '); std::string startLine3(startLine2); startLine3+=startLine; - oss << startLine3 << "Entry geometry type #" << id << " is lying on geometry type " << getDynGT() << "." << std::endl; + oss << startLine3 << "Entry geometry type #" << id << " is lying on geometry STRUCTURE_ELEMENT type " << getDynGT() << "." << std::endl; oss << startLine3 << "Entry is defined on " << _field_pm_pt_pd.size() << " localizations." << std::endl; int i=0; for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) { - const MEDFileFieldPerMeshPerTypePerDisc *cur=(*it); - if(cur) - cur->simpleRepr(bkOffset,oss,i); + if((*it).isNotNull()) + (*it)->simpleRepr(bkOffset,oss,i); else { oss << startLine2 << " ## " << "Localization #" << i << " is empty !" << std::endl; @@ -1752,9 +1766,12 @@ std::string MEDFileFieldPerMeshPerTypeDyn::getGeoTypeRepr() const throw INTERP_KERNEL::Exception("not implemented yet !"); } -MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerTypeDyn::deepCopy(MEDFileFieldPerMesh *father) const +MEDFileFieldPerMeshPerTypeDyn *MEDFileFieldPerMeshPerTypeDyn::deepCopy(MEDFileFieldPerMesh *father) const { - throw INTERP_KERNEL::Exception("not implemented yet !"); + MCAuto ret(new MEDFileFieldPerMeshPerTypeDyn(*this)); + ret->setFather(father); + ret->deepCopyElements(); + return ret.retn(); } void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const @@ -1967,6 +1984,94 @@ bool MEDFileFieldPerMesh::presenceOfMultiDiscPerGeoType() const return false; } +bool MEDFileFieldPerMesh::presenceOfStructureElements() const +{ + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(pt) + return true; + } + return false; +} + +bool MEDFileFieldPerMesh::onlyStructureElements() const +{ + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(!pt) + return false; + } + return true; +} + +void MEDFileFieldPerMesh::killStructureElements() +{ + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(!pt) + res.push_back(*it); + } + } + _field_pm_pt=res; +} + +void MEDFileFieldPerMesh::keepOnlyStructureElements() +{ + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(pt) + res.push_back(*it); + } + } + _field_pm_pt=res; +} + +void MEDFileFieldPerMesh::keepOnlyOnSE(const std::string& seName) +{ + std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res; + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(!pt) + throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::keepOnlyOnSE : presence of non SE !"); + if(pt->getModelName()==seName) + res.push_back(*it); + } + } + _field_pm_pt=res; +} + +void MEDFileFieldPerMesh::getMeshSENames(std::vector< std::pair >& ps) const +{ + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + if((*it).isNotNull()) + { + const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast((const MEDFileFieldPerMeshPerTypeCommon *)*it)); + if(pt) + { + ps.push_back(std::pair(getMeshName(),pt->getModelName())); + } + else + throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getMeshSENames : presence of a non structure element part !"); + } + } +} + DataArray *MEDFileFieldPerMesh::getOrCreateAndGetArray() { if(!_father) @@ -2837,6 +2942,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); } } } @@ -4967,6 +5073,52 @@ bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const return false; } +bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfStructureElements() const +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) + return true; + return false; +} + +bool MEDFileAnyTypeField1TSWithoutSDA::onlyStructureElements() const +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + if(!(*it)->onlyStructureElements()) + return false; + return true; +} + +void MEDFileAnyTypeField1TSWithoutSDA::killStructureElements() +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->killStructureElements(); +} + +void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyStructureElements() +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyStructureElements(); +} + +void MEDFileAnyTypeField1TSWithoutSDA::keepOnlyOnSE(const std::string& seName) +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyOnSE(seName); +} + +void MEDFileAnyTypeField1TSWithoutSDA::getMeshSENames(std::vector< std::pair >& ps) const +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + (*it)->getMeshSENames(ps); +} + MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char MSG0[]="MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh : the field is too complex to be able to be extracted with \"field\" method ! Call getFieldOnMeshAtLevel method instead to deal with complexity !"; @@ -5396,17 +5548,17 @@ MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():MEDFileField1TSTemplateWi { } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const +MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const { MCAuto ret(new MEDFileField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const +MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const { - MCAuto ret=static_cast(shallowCpy()); - if((const DataArrayDouble *)_arr) + MCAuto ret(shallowCpy()); + if(_arr.isNotNull()) ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -5495,17 +5647,17 @@ DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::v return getUndergroundDataArrayTemplate(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const +MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const { MCAuto ret(new MEDFileIntField1TSWithoutSDA(*this)); ret->deepCpyLeavesFrom(*this); return ret.retn(); } -MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const +MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const { - MCAuto ret=static_cast(shallowCpy()); - if((const DataArrayInt *)_arr) + MCAuto ret(shallowCpy()); + if(_arr.isNotNull()) ret->_arr=_arr->deepCopy(); return ret.retn(); } @@ -6813,7 +6965,7 @@ void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const contentNotNull()->setFieldProfile(field,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull()); } -MEDFileAnyTypeField1TS *MEDFileField1TS::shallowCpy() const +MEDFileField1TS *MEDFileField1TS::shallowCpy() const { return new MEDFileField1TS(*this); } @@ -6925,7 +7077,7 @@ MEDFileIntField1TS::MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other { } -MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const +MEDFileIntField1TS *MEDFileIntField1TS::shallowCpy() const { return new MEDFileIntField1TS(*this); } @@ -7402,6 +7554,97 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part return buildFromTimeStepIds(ids->begin(),ids->end()); } +bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const +{ + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) + return true; + return false; +} + +bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const +{ + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + if(!(*it)->onlyStructureElements()) + return false; + return true; +} + +void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements() +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + { + if((*it)->presenceOfStructureElements()) + { + if(!(*it)->onlyStructureElements()) + { + (*it)->killStructureElements(); + ret.push_back(*it); + } + } + else + { + ret.push_back(*it); + } + } + _time_steps=ret; +} + +void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements() +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + { + if((*it)->presenceOfStructureElements()) + { + if(!(*it)->onlyStructureElements()) + (*it)->keepOnlyStructureElements(); + ret.push_back(*it); + } + } + _time_steps=ret; +} + +void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName) +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + (*it)->keepOnlyOnSE(seName); +} + +void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair >& ps) const +{ + std::vector< std::pair > ps2; + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + { + (*it)->getMeshSENames(ps2); + break; + } + if(ps2.empty()) + throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !"); + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + { + std::vector< std::pair > ps3; + (*it)->getMeshSENames(ps3); + if(ps2!=ps3) + throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !"); + } + for(std::vector< std::pair >::const_iterator it=ps2.begin();it!=ps2.end();it++) + { + std::vector< std::pair >::iterator it2(std::find(ps.begin(),ps.end(),*it)); + if(it2==ps.end()) + ps.push_back(*it); + } +} + bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const { for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) @@ -10894,6 +11137,109 @@ MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std:: return ret.retn(); } +bool MEDFileFields::presenceOfStructureElements() const +{ + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + if((*it)->presenceOfStructureElements()) + return true; + return false; +} + +void MEDFileFields::killStructureElements() +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + { + if((*it)->presenceOfStructureElements()) + { + if(!(*it)->onlyStructureElements()) + { + (*it)->killStructureElements(); + ret.push_back(*it); + } + } + else + { + ret.push_back(*it); + } + } + _fields=ret; +} + +void MEDFileFields::keepOnlyStructureElements() +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + { + if((*it)->presenceOfStructureElements()) + { + if(!(*it)->onlyStructureElements()) + (*it)->keepOnlyStructureElements(); + ret.push_back(*it); + } + } + _fields=ret; +} + +void MEDFileFields::keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName) +{ + std::vector< MCAuto > ret; + for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + { + if((*it)->getMeshName()!=meshName) + continue; + std::vector< std::pair > ps; + (*it)->getMeshSENames(ps); + std::pair p(meshName,seName); + if(std::find(ps.begin(),ps.end(),p)!=ps.end()) + (*it)->keepOnlyOnSE(seName); + ret.push_back(*it); + } + _fields=ret; +} + +void MEDFileFields::getMeshSENames(std::vector< std::pair >& ps) const +{ + for(std::vector< MCAuto >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + (*it)->getMeshSENames(ps); +} + +MCAuto MEDFileFields::partOfThisOnStructureElements() const +{ + MCAuto ret(deepCopy()); + ret->keepOnlyStructureElements(); + return ret; +} + +MCAuto MEDFileFields::partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const +{ + MCAuto ret(deepCopy()); + ret->keepOnlyOnMeshSE(meshName,seName); + return ret; +} + +void MEDFileFields::aggregate(const MEDFileFields& other) +{ + int nbFieldsToAdd(other.getNumberOfFields()); + std::vector fsn(getFieldsNames()); + for(int i=0;i elt(other.getFieldAtPos(i)); + std::string name(elt->getName()); + if(std::find(fsn.begin(),fsn.end(),name)!=fsn.end()) + { + std::ostringstream oss; oss << "MEDFileFields::aggregate : name \"" << name << "\" already appears !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + pushField(elt); + } +} + MEDFileFieldsIterator *MEDFileFields::iterator() { return new MEDFileFieldsIterator(this);