1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #include "MEDFileField.hxx"
22 #include "MEDFileMesh.hxx"
23 #include "MEDLoaderBase.hxx"
24 #include "MEDLoaderTraits.hxx"
25 #include "MEDFileSafeCaller.txx"
26 #include "MEDFileFieldOverView.hxx"
27 #include "MEDFileBlowStrEltUp.hxx"
28 #include "MEDFileFieldVisitor.hxx"
30 #include "MEDCouplingFieldDiscretization.hxx"
32 #include "InterpKernelAutoPtr.hxx"
33 #include "CellModel.hxx"
38 extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
39 extern med_geometry_type typmainoeud[1];
40 extern med_geometry_type typmai3[INTERP_KERNEL::NORM_MAXTYPE];
42 using namespace MEDCoupling;
46 MEDFileFields *MEDFileFields::New()
48 return new MEDFileFields;
51 MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll)
53 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
54 return New(fid,loadAll);
57 MEDFileFields *MEDFileFields::NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities)
59 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
60 return NewAdv(fid,loadAll,entities);
63 MEDFileFields *MEDFileFields::NewAdv(med_idt fid, bool loadAll, const MEDFileEntities *entities)
65 return new MEDFileFields(fid,loadAll,0,entities);
68 MEDFileFields *MEDFileFields::NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll)
70 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
71 return NewWithDynGT(fid,se,loadAll);
74 MEDFileFields *MEDFileFields::NewWithDynGT(med_idt fid, const MEDFileStructureElements *se, bool loadAll)
77 throw INTERP_KERNEL::Exception("MEDFileFields::NewWithDynGT : null struct element pointer !");
78 INTERP_KERNEL::AutoCppPtr<MEDFileEntities> entities(MEDFileEntities::BuildFrom(*se));
79 return new MEDFileFields(fid,loadAll,0,entities);
82 MEDFileFields *MEDFileFields::New(med_idt fid, bool loadAll)
84 return new MEDFileFields(fid,loadAll,0,0);
87 MEDFileFields *MEDFileFields::LoadPartOf(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
89 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
90 return new MEDFileFields(fid,loadAll,ms,0);
93 MEDFileFields *MEDFileFields::LoadSpecificEntities(const std::string& fileName, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> >& entities, bool loadAll)
95 MEDFileUtilities::CheckFileForRead(fileName);
96 INTERP_KERNEL::AutoCppPtr<MEDFileEntities> ent(new MEDFileStaticEntities(entities));
97 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
98 return new MEDFileFields(fid,loadAll,0,ent);
101 std::size_t MEDFileFields::getHeapMemorySizeWithoutChildren() const
103 std::size_t ret(MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren());
104 ret+=_fields.capacity()*sizeof(MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA>);
108 std::vector<const BigMemoryObject *> MEDFileFields::getDirectChildrenWithNull() const
110 std::vector<const BigMemoryObject *> ret;
111 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
112 ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)*it);
116 MEDFileFields *MEDFileFields::deepCopy() const
118 MCAuto<MEDFileFields> ret(shallowCpy());
120 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
122 if((const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
123 ret->_fields[i]=(*it)->deepCopy();
125 ret->deepCpyGlobs(*this);
129 MEDFileFields *MEDFileFields::shallowCpy() const
131 return new MEDFileFields(*this);
135 * This method scans for all fields in \a this which time steps ids are common. Time step are discriminated by the pair of integer (iteration,order) whatever
136 * the double time value. If all returned time steps are \b exactly those for all fields in \a this output parameter \a areThereSomeForgottenTS will be set to false.
137 * If \a areThereSomeForgottenTS is set to true, only the sorted intersection of time steps present for all fields in \a this will be returned.
139 * \param [out] areThereSomeForgottenTS - indicates to the caller if there is some time steps in \a this that are not present for all fields in \a this.
140 * \return the sorted list of time steps (specified with a pair of integer iteration first and order second) present for all fields in \a this.
142 * \sa MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps, MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps
144 std::vector< std::pair<int,int> > MEDFileFields::getCommonIterations(bool& areThereSomeForgottenTS) const
146 std::set< std::pair<int,int> > s;
148 areThereSomeForgottenTS=false;
149 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
151 if(!(const MEDFileAnyTypeFieldMultiTSWithoutSDA*)*it)
153 std::vector< std::pair<int,int> > v=(*it)->getIterations();
154 std::set< std::pair<int,int> > s1; std::copy(v.begin(),v.end(),std::inserter(s1,s1.end()));
156 { s=s1; firstShot=false; }
159 std::set< std::pair<int,int> > s2; std::set_intersection(s.begin(),s.end(),s1.begin(),s1.end(),std::inserter(s2,s2.end()));
161 areThereSomeForgottenTS=true;
165 std::vector< std::pair<int,int> > ret;
166 std::copy(s.begin(),s.end(),std::back_insert_iterator< std::vector< std::pair<int,int> > >(ret));
170 int MEDFileFields::getNumberOfFields() const
172 return (int)_fields.size();
175 std::vector<std::string> MEDFileFields::getFieldsNames() const
177 std::vector<std::string> ret(_fields.size());
179 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
181 const MEDFileAnyTypeFieldMultiTSWithoutSDA *f=(*it);
188 std::ostringstream oss; oss << "MEDFileFields::getFieldsNames : At rank #" << i << " field is not defined !";
189 throw INTERP_KERNEL::Exception(oss.str());
195 std::vector<std::string> MEDFileFields::getMeshesNames() const
197 std::vector<std::string> ret;
198 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
200 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
202 ret.push_back(cur->getMeshName());
207 std::string MEDFileFields::simpleRepr() const
209 std::ostringstream oss;
210 oss << "(*****************)\n(* MEDFileFields *)\n(*****************)\n\n";
215 void MEDFileFields::simpleRepr(int bkOffset, std::ostream& oss) const
217 int nbOfFields(getNumberOfFields());
218 std::string startLine(bkOffset,' ');
219 oss << startLine << "There are " << nbOfFields << " fields in this :" << std::endl;
221 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
223 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
226 oss << startLine << " - # "<< i << " has the following name : \"" << cur->getName() << "\"." << std::endl;
230 oss << startLine << " - not defined !" << std::endl;
234 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
236 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur=(*it);
237 std::string chapter(17,'0'+i);
238 oss << startLine << chapter << std::endl;
241 cur->simpleRepr(bkOffset+2,oss,i);
245 oss << startLine << " - not defined !" << std::endl;
247 oss << startLine << chapter << std::endl;
249 simpleReprGlobs(oss);
252 MEDFileFields::MEDFileFields()
256 MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
257 try:MEDFileFieldGlobsReal(fid)
259 med_int nbFields(MEDnField(fid));
260 _fields.resize(nbFields);
261 med_field_type typcha;
262 for(int i=0;i<nbFields;i++)
264 std::vector<std::string> infos;
265 std::string fieldName,dtunit,meshName;
266 int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,i,false,fieldName,typcha,infos,dtunit,meshName));
271 _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
276 _fields[i]=MEDFileInt32FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
281 _fields[i]=MEDFileInt64FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
286 _fields[i]=MEDFileFloatFieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
291 if(sizeof(med_int)==sizeof(int))
293 _fields[i]=MEDFileInt32FieldMultiTSWithoutSDA::New(fid,fieldName,meshName,typcha,infos,nbOfStep,dtunit,loadAll,ms,entities);
299 std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << FileNameFromFID(fid) << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !";
300 throw INTERP_KERNEL::Exception(oss.str());
304 loadAllGlobals(fid,entities);
306 catch(INTERP_KERNEL::Exception& e)
311 void MEDFileFields::writeLL(med_idt fid) const
314 writeGlobals(fid,*this);
315 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
317 const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt=*it;
320 std::ostringstream oss; oss << "MEDFileFields::write : at rank #" << i << "/" << _fields.size() << " field is empty !";
321 throw INTERP_KERNEL::Exception(oss.str());
323 elt->writeLL(fid,*this);
328 * This method alloc the arrays and load potentially huge arrays contained in this field.
329 * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
330 * This method can be also called to refresh or reinit values from a file.
332 * \throw If the fileName is not set or points to a non readable MED file.
334 void MEDFileFields::loadArrays()
336 if(getFileName().empty())
337 throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !");
338 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
339 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
341 MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
343 elt->loadBigArraysRecursively(fid,*elt);
348 * This method behaves as MEDFileFields::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
349 * But once data loaded once, this method does nothing.
351 * \throw If the fileName is not set or points to a non readable MED file.
352 * \sa MEDFileFields::loadArrays, MEDFileFields::unloadArrays
354 void MEDFileFields::loadArraysIfNecessary()
356 if(!getFileName().empty())
358 MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
359 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
361 MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
363 elt->loadBigArraysRecursivelyIfNecessary(fid,*elt);
369 * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
370 * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
371 * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileFields::unloadArraysWithoutDataLoss instead.
373 * \sa MEDFileFields::loadArrays, MEDFileFields::loadArraysIfNecessary, MEDFileFields::unloadArraysWithoutDataLoss
375 void MEDFileFields::unloadArrays()
377 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
379 MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
386 * This method potentially releases big data arrays if \a this is coming from a file. If \a this has been built from scratch this method will have no effect.
387 * This method is the symmetrical method of MEDFileFields::loadArraysIfNecessary.
388 * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
390 * \sa MEDFileFields::loadArraysIfNecessary
392 void MEDFileFields::unloadArraysWithoutDataLoss()
394 if(!getFileName().empty())
398 std::vector<std::string> MEDFileFields::getPflsReallyUsed() const
400 std::vector<std::string> ret;
401 std::set<std::string> ret2;
402 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
404 std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
405 for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
406 if(ret2.find(*it2)==ret2.end())
415 std::vector<std::string> MEDFileFields::getLocsReallyUsed() const
417 std::vector<std::string> ret;
418 std::set<std::string> ret2;
419 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
421 std::vector<std::string> tmp((*it)->getLocsReallyUsed2());
422 for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
423 if(ret2.find(*it2)==ret2.end())
432 std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
434 std::vector<std::string> ret;
435 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
437 std::vector<std::string> tmp((*it)->getPflsReallyUsedMulti2());
438 ret.insert(ret.end(),tmp.begin(),tmp.end());
443 std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
445 std::vector<std::string> ret;
446 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
448 std::vector<std::string> tmp((*it)->getLocsReallyUsed2());
449 ret.insert(ret.end(),tmp.begin(),tmp.end());
454 void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
456 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
457 (*it)->changePflsRefsNamesGen2(mapOfModif);
460 void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
462 for(std::vector< MCAuto< MEDFileAnyTypeFieldMultiTSWithoutSDA > >::iterator it=_fields.begin();it!=_fields.end();it++)
463 (*it)->changeLocsRefsNamesGen2(mapOfModif);
466 void MEDFileFields::resize(int newSize)
468 _fields.resize(newSize);
471 void MEDFileFields::pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields)
473 for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fields.begin();it!=fields.end();it++)
477 void MEDFileFields::pushField(MEDFileAnyTypeFieldMultiTS *field)
480 throw INTERP_KERNEL::Exception("MEDFileFields::pushMesh : invalid input pointer ! should be different from 0 !");
481 _fields.push_back(field->getContent());
482 appendGlobs(*field,1e-12);
485 void MEDFileFields::setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field)
488 throw INTERP_KERNEL::Exception("MEDFileFields::setFieldAtPos : invalid input pointer ! should be different from 0 !");
489 if(i>=(int)_fields.size())
491 _fields[i]=field->getContent();
492 appendGlobs(*field,1e-12);
495 void MEDFileFields::destroyFieldAtPos(int i)
497 destroyFieldsAtPos(&i,&i+1);
500 void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds)
502 std::vector<bool> b(_fields.size(),true);
503 for(const int *i=startIds;i!=endIds;i++)
505 if(*i<0 || *i>=(int)_fields.size())
507 std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !";
508 throw INTERP_KERNEL::Exception(oss.str());
512 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
514 for(std::size_t i=0;i<_fields.size();i++)
516 fields[j++]=_fields[i];
520 void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step)
522 static const char msg[]="MEDFileFields::destroyFieldsAtPos2";
523 mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg));
524 std::vector<bool> b(_fields.size(),true);
526 for(int i=0;i<nbOfEntriesToKill;i++,k+=step)
528 if(k<0 || k>=(int)_fields.size())
530 std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos2 : Invalid given id in input (" << k << ") should be in [0," << _fields.size() << ") !";
531 throw INTERP_KERNEL::Exception(oss.str());
535 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(std::count(b.begin(),b.end(),true));
537 for(std::size_t i=0;i<_fields.size();i++)
539 fields[j++]=_fields[i];
543 bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
546 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
548 MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
550 ret=cur->changeMeshNames(modifTab) || ret;
556 * \param [in] meshName the name of the mesh that will be renumbered.
557 * \param [in] oldCode is of format returned by MEDCouplingUMesh::getDistributionOfTypes. And for each *i* oldCode[3*i+2] gives the position (MEDFileUMesh::PutInThirdComponentOfCodeOffset).
558 * This code corresponds to the distribution of types in the corresponding mesh.
559 * \param [in] newCode idem to param \a oldCode except that here the new distribution is given.
560 * \param [in] renumO2N the old to new renumber array.
561 * \return If true a renumbering has been performed. The structure in \a this has been modified. If false, nothing has been done: it is typically the case if \a meshName is not referred by any
564 bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N)
567 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
569 MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts(*it);
572 ret=fmts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,*this) || ret;
579 * Return an extraction of \a this using \a extractDef map to specify the extraction.
580 * The keys of \a extractDef is level relative to max ext of \a mm mesh.
582 * \return A new object that the caller is responsible to deallocate.
584 MEDFileFields *MEDFileFields::extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef, MEDFileMesh *mm) const
587 throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !");
588 MCAuto<MEDFileFields> fsOut(MEDFileFields::New());
589 int nbFields(getNumberOfFields());
590 for(int i=0;i<nbFields;i++)
592 MCAuto<MEDFileAnyTypeFieldMultiTS> fmts(getFieldAtPos(i));
595 std::ostringstream oss; oss << "MEDFileFields::extractPart : at pos #" << i << " field is null !";
596 throw INTERP_KERNEL::Exception(oss.str());
598 MCAuto<MEDFileAnyTypeFieldMultiTS> fmtsOut(fmts->extractPart(extractDef,mm));
599 fsOut->pushField(fmtsOut);
604 void MEDFileFields::accept(MEDFileFieldVisitor& visitor) const
606 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
607 if((*it).isNotNull())
609 visitor.newFieldEntry(*it);
610 (*it)->accept(visitor);
611 visitor.endFieldEntry(*it);
618 PFLData():_add_pts_in_pfl(0) { }
619 PFLData(const MCAuto<DataArrayIdType>& mat, const MCAuto<DataArrayIdType>& pfl, mcIdType nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { }
620 std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } }
621 mcIdType getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; }
622 MCAuto<DataArrayIdType> getProfile() const { return _pfl; }
623 MCAuto<DataArrayIdType> getMatrix() const { return _matrix; }
625 MCAuto<DataArrayIdType> _matrix;
626 MCAuto<DataArrayIdType> _pfl;
627 mcIdType _add_pts_in_pfl;
630 class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor
633 MEDFileFieldLin2QuadVisitor(const MEDFileUMesh *lin, const MEDFileUMesh *quad, const MEDFileFieldGlobsReal *linGlobs, MEDFileFields* outFs):_lin(lin),_quad(quad),_lin_globs(linGlobs),_out_fs(outFs),_gt(INTERP_KERNEL::NORM_ERROR),_1ts_update_requested(false) { }
634 void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(field->getMeshName()!=_lin->getName()) return; _cur_fmts=MEDFileFieldMultiTS::New(); }
635 void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) { if(_cur_fmts.isNotNull()) { if(_cur_fmts->getNumberOfTS()>0) _out_fs->pushField(_cur_fmts); } }
637 void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
638 void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts);
640 void newMeshEntry(const MEDFileFieldPerMesh *fpm);
641 void endMeshEntry(const MEDFileFieldPerMesh *fpm) { }
643 void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt);
644 void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) { }
646 void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
648 void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes);
650 const MEDFileUMesh *_lin;
651 const MEDFileUMesh *_quad;
652 const MEDFileFieldGlobsReal *_lin_globs;
653 MEDFileFields *_out_fs;
654 MCAuto<MEDFileFieldMultiTS> _cur_fmts;
655 MCAuto<MEDFileField1TS> _cur_f1ts;
656 INTERP_KERNEL::NormalizedCellType _gt;
657 // Info on 1TS modification
658 bool _1ts_update_requested;
659 // Cache of matrix to compute faster the values on newly created points
660 std::map< std::string, PFLData > _cache;
661 std::vector<std::string> _pfls_to_be_updated;
664 void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd)
666 if(_cur_f1ts.isNull())
668 if(pmptpd->getType()!=ON_NODES)
669 throw INTERP_KERNEL::Exception("Not managed yet for ON_CELLS ON_GAUSS_NE and ON_GAUSS_PT");
670 _1ts_update_requested=true;
671 MEDFileAnyTypeField1TSWithoutSDA *ct(_cur_f1ts->contentNotNullBase());
672 int locId(pmptpd->getFather()->locIdOfLeaf(pmptpd));
673 MEDFileFieldPerMeshPerTypePerDisc *pmtdToModify(ct->getLeafGivenMeshAndTypeAndLocId(_lin->getName(),_gt,locId));
674 std::string pflName(pmptpd->getProfile());
675 _pfls_to_be_updated.push_back(pflName);
676 std::map< std::string, PFLData >::iterator itCache(_cache.find(pflName));
677 if(itCache!=_cache.end())
679 updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl());
682 MCAuto<DataArrayIdType> pfl;
684 pfl=DataArrayIdType::Range(0,pmptpd->getNumberOfVals(),1);
686 pfl=_lin_globs->getProfile(pflName)->deepCopy();
688 MCAuto<MEDCouplingUMesh> mesh3D(_lin->getMeshAtLevel(0)),mesh3DQuadratic(_quad->getMeshAtLevel(0));
689 MCAuto<DataArrayIdType> cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true));
690 MCAuto<MEDCouplingUMesh> mesh3DQuadraticRestricted(mesh3DQuadratic->buildPartOfMySelf(cellIds->begin(),cellIds->end(),true));
691 MCAuto<DataArrayIdType> mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds());
692 mesh3DQuadraticRestrictedNodeIds->checkMonotonic(true);
693 MCAuto<DataArrayIdType> newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl));
694 MCAuto<MEDCoupling1SGTUMesh> allSeg3;
696 MCAuto<DataArrayIdType> a,b,c,d;
697 MCAuto<MEDCouplingUMesh> seg3Tmp(mesh3DQuadraticRestricted->explodeIntoEdges(a,b,c,d));
698 allSeg3=MEDCoupling1SGTUMesh::New(seg3Tmp);
700 if(allSeg3->getCellModelEnum()!=INTERP_KERNEL::NORM_SEG3)
701 throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc : invalid situation where SEG3 expected !");
702 MCAuto<DataArrayIdType> midPts,cellSeg3Ids,matrix;
704 DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity());
705 nodeConn->rearrange(3);
707 std::vector<std::size_t> v(1,2);
708 midPts=nodeConn->keepSelectedComponents(v);
710 cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds);
712 std::vector<std::size_t> v(2); v[0]=0; v[1]=1;
713 MCAuto<DataArrayIdType> tmp(nodeConn->keepSelectedComponents(v));
714 matrix=tmp->selectByTupleId(cellSeg3Ids->begin(),cellSeg3Ids->end());
716 nodeConn->rearrange(1);
718 MCAuto<DataArrayIdType> pflq;
721 std::vector<const DataArrayIdType *> vs(2);
722 vs[0]=pfl; vs[1]=newPtsIds;
723 pflq=DataArrayIdType::Aggregate(vs);
724 pflq->setName(pflName);
726 PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples());
727 _cache[pflName]=pdata;
728 updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl());
731 void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes)
733 pmtd->incrementNbOfVals(deltaNbNodes);
736 void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt)
738 const MEDFileFieldPerMeshPerType *pmpt2(dynamic_cast<const MEDFileFieldPerMeshPerType *>(pmpt));
740 throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry : not managed for structure elements !");
741 if(pmpt2->getNumberOfLoc()!=1)
742 throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypeEntry : not managed for multi discr per timestep !");
743 _gt=pmpt->getGeoType();
746 void MEDFileFieldLin2QuadVisitor::newMeshEntry(const MEDFileFieldPerMesh *fpm)
748 if(fpm->getMeshName()!=_lin->getName())
749 throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newMeshEntry : mismatch into meshName !");
752 void MEDFileFieldLin2QuadVisitor::newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts)
754 _1ts_update_requested=false; _pfls_to_be_updated.clear();
757 const MEDFileField1TSWithoutSDA *tsd(dynamic_cast<const MEDFileField1TSWithoutSDA *>(ts));
760 MCAuto<MEDFileAnyTypeField1TSWithoutSDA> contentCpy(ts->deepCopy());
761 MCAuto<MEDFileField1TSWithoutSDA> contentCpy2(DynamicCastSafe<MEDFileAnyTypeField1TSWithoutSDA,MEDFileField1TSWithoutSDA>(contentCpy));
762 if(contentCpy2.isNull())
764 _cur_f1ts=MEDFileField1TS::New(*contentCpy2,true);
765 _cur_f1ts->deepCpyGlobs(*_lin_globs);
768 void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts)
770 if(_cur_f1ts.isNull())
772 if(_1ts_update_requested)
774 MCAuto<DataArrayIdType> matrix,oldPfl;
775 for(std::vector<std::string>::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++)
777 std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it));
778 if(it2==_cache.end())
779 throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::endTimeStepEntry : invalid situation !");
780 matrix=(*it2).second.getMatrix();
783 int locId(_cur_f1ts->getProfileId(*it));
784 oldPfl.takeRef(_cur_f1ts->getProfile(*it));
786 std::vector<int> locToKill(1,locId);
787 _cur_f1ts->killProfileIds(locToKill);
789 _cur_f1ts->appendProfile((*it2).second.getProfile());
791 DataArrayDouble *arr(_cur_f1ts->getUndergroundDataArray());
792 MCAuto<DataArrayDouble> res;
794 std::vector<std::size_t> v(1,0),v2(1,1);
795 MCAuto<DataArrayIdType> pts0(matrix->keepSelectedComponents(v));
796 MCAuto<DataArrayIdType> pts1(matrix->keepSelectedComponents(v2));
797 if(oldPfl.isNotNull())
799 pts0=oldPfl->findIdForEach(pts0->begin(),pts0->end());
800 pts1=oldPfl->findIdForEach(pts1->begin(),pts1->end());
802 MCAuto<DataArrayDouble> part0(arr->selectByTupleId(*pts0));
803 MCAuto<DataArrayDouble> part1(arr->selectByTupleId(*pts1));
804 res=DataArrayDouble::Add(part0,part1);
805 res->applyLin(0.5,0.);
807 res=DataArrayDouble::Aggregate(arr,res);
808 _cur_f1ts->setArray(res);
810 if(_cur_fmts.isNotNull())
811 { _cur_fmts->pushBackTimeStep(_cur_f1ts); }
812 _1ts_update_requested=false;
816 * \a newQuad is expected to be the result of MEDFileUMesh::linearToQuadratic of \a oldLin
818 MCAuto<MEDFileFields> MEDFileFields::linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const
820 if(!oldLin || !newQuad)
821 throw INTERP_KERNEL::Exception("MEDFileFields::linearToQuadratic : input meshes must be non NULL !");
822 MCAuto<MEDFileFields> ret(MEDFileFields::New());
823 for(int i=0;i<oldLin->getNumberOfMeshes();i++)
825 MEDFileMesh *mm(oldLin->getMeshAtPos(i));
828 MEDFileUMesh *mmu(dynamic_cast<MEDFileUMesh *>(mm));
831 MEDFileMesh *mmq(newQuad->getMeshWithName(mmu->getName()));
832 MEDFileUMesh *mmqu(dynamic_cast<MEDFileUMesh *>(mmq));
835 std::ostringstream oss; oss << "MEDFileFields::linearToQuadratic : mismatch of name between input meshes for name \"" << mmu->getName() << "\"";
836 throw INTERP_KERNEL::Exception(oss.str());
838 MEDFileFieldLin2QuadVisitor vis(mmu,mmqu,this,ret);
844 MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const
846 if(i<0 || i>=(int)_fields.size())
848 std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !";
849 throw INTERP_KERNEL::Exception(oss.str());
851 const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i];
854 MCAuto<MEDFileAnyTypeFieldMultiTS> ret;
855 const MEDFileFieldMultiTSWithoutSDA *fmtsC(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(fmts));
856 const MEDFileInt32FieldMultiTSWithoutSDA *fmtsC2(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(fmts));
857 const MEDFileInt64FieldMultiTSWithoutSDA *fmtsC4(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(fmts));
858 const MEDFileFloatFieldMultiTSWithoutSDA *fmtsC3(dynamic_cast<const MEDFileFloatFieldMultiTSWithoutSDA *>(fmts));
860 ret=MEDFileFieldMultiTS::New(*fmtsC,false);
862 ret=MEDFileInt32FieldMultiTS::New(*fmtsC2,false);
864 ret=MEDFileInt64FieldMultiTS::New(*fmtsC4,false);
866 ret=MEDFileFloatFieldMultiTS::New(*fmtsC3,false);
869 std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : At pos #" << i << " field is neither double (FLOAT64) nor float (FLOAT32) nor integer (INT32) nor integer (INT64) !";
870 throw INTERP_KERNEL::Exception(oss.str());
872 ret->shallowCpyGlobs(*this);
877 * Return a shallow copy of \a this reduced to the fields ids defined in [ \a startIds , endIds ).
878 * This method is accessible in python using __getitem__ with a list in input.
879 * \return a new object that the caller should deal with.
881 MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endIds) const
883 MCAuto<MEDFileFields> ret=shallowCpy();
884 std::size_t sz=std::distance(startIds,endIds);
885 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > fields(sz);
887 for(const int *i=startIds;i!=endIds;i++,j++)
889 if(*i<0 || *i>=(int)_fields.size())
891 std::ostringstream oss; oss << "MEDFileFields::buildSubPart : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !";
892 throw INTERP_KERNEL::Exception(oss.str());
894 fields[j]=_fields[*i];
900 MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& fieldName) const
902 return getFieldAtPos(getPosFromFieldName(fieldName));
906 * This method removes, if any, fields in \a this having no time steps.
907 * If there is one or more than one such field in \a this true is returned and those fields will not be referenced anymore in \a this.
909 * If false is returned \a this does not contain such fields. If false is returned this method can be considered as const.
911 bool MEDFileFields::removeFieldsWithoutAnyTimeStep()
913 std::vector<MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > newFields;
914 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
916 const MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
919 if(elt->getNumberOfTS()>0)
920 newFields.push_back(*it);
923 if(_fields.size()==newFields.size())
930 * This method returns a new object containing part of \a this fields lying on mesh name specified by the input parameter \a meshName.
931 * This method can be seen as a filter applied on \a this, that returns an object containing
932 * reduced the list of fields compared to those in \a this. The returned object is a new object but the object on which it lies are only
933 * shallow copied from \a this.
935 * \param [in] meshName - the name of the mesh on w
936 * \return a new object that the caller should deal with.
938 MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const
940 MCAuto<MEDFileFields> ret(MEDFileFields::New());
941 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
943 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
946 if(cur->getMeshName()==meshName)
949 MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> cur2(const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(cur));
950 ret->_fields.push_back(cur2);
953 ret->shallowCpyOnlyUsedGlobs(*this);
958 * This method returns a new object containing part of \a this fields lying ** exactly ** on the time steps specified by input parameter \a timeSteps.
959 * Input time steps are specified using a pair of integer (iteration, order).
960 * This method can be seen as a filter applied on \a this, that returns an object containing the same number of fields than those in \a this,
961 * but for each multitimestep only the time steps in \a timeSteps are kept.
962 * Typically the input parameter \a timeSteps comes from the call of MEDFileFields::getCommonIterations.
964 * The returned object points to shallow copy of elements in \a this.
966 * \param [in] timeSteps - the time steps given by a vector of pair of integers (iteration,order)
967 * \throw If there is a field in \a this that is \b not defined on a time step in the input \a timeSteps.
968 * \sa MEDFileFields::getCommonIterations, MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps
970 MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
972 MCAuto<MEDFileFields> ret(MEDFileFields::New());
973 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
975 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
978 MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisLyingOnSpecifiedTimeSteps(timeSteps);
979 ret->_fields.push_back(elt);
981 ret->shallowCpyOnlyUsedGlobs(*this);
986 * \sa MEDFileFields::getCommonIterations, MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps
988 MEDFileFields *MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
990 MCAuto<MEDFileFields> ret=MEDFileFields::New();
991 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
993 const MEDFileAnyTypeFieldMultiTSWithoutSDA *cur(*it);
996 MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt=cur->partOfThisNotLyingOnSpecifiedTimeSteps(timeSteps);
997 if(elt->getNumberOfTS()!=0)
998 ret->_fields.push_back(elt);
1000 ret->shallowCpyOnlyUsedGlobs(*this);
1004 bool MEDFileFields::presenceOfStructureElements() const
1006 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
1007 if((*it).isNotNull())
1008 if((*it)->presenceOfStructureElements())
1013 void MEDFileFields::killStructureElements()
1015 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
1016 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
1017 if((*it).isNotNull())
1019 if((*it)->presenceOfStructureElements())
1021 if(!(*it)->onlyStructureElements())
1023 (*it)->killStructureElements();
1035 void MEDFileFields::keepOnlyStructureElements()
1037 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
1038 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
1039 if((*it).isNotNull())
1041 if((*it)->presenceOfStructureElements())
1043 if(!(*it)->onlyStructureElements())
1044 (*it)->keepOnlyStructureElements();
1051 void MEDFileFields::keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName)
1053 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
1054 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
1055 if((*it).isNotNull())
1057 if((*it)->getMeshName()!=meshName)
1059 std::vector< std::pair<std::string,std::string> > ps;
1060 (*it)->getMeshSENames(ps);
1061 std::pair<std::string,std::string> p(meshName,seName);
1062 if(std::find(ps.begin(),ps.end(),p)!=ps.end())
1063 (*it)->keepOnlyOnSE(seName);
1069 void MEDFileFields::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
1071 for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
1072 if((*it).isNotNull())
1073 (*it)->getMeshSENames(ps);
1076 void MEDFileFields::blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses)
1078 MEDFileBlowStrEltUp::DealWithSE(this,ms,ses);
1081 MCAuto<MEDFileFields> MEDFileFields::partOfThisOnStructureElements() const
1083 MCAuto<MEDFileFields> ret(deepCopy());
1084 ret->keepOnlyStructureElements();
1088 MCAuto<MEDFileFields> MEDFileFields::partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const
1090 MCAuto<MEDFileFields> ret(deepCopy());
1091 ret->keepOnlyOnMeshSE(meshName,seName);
1095 void MEDFileFields::aggregate(const MEDFileFields& other)
1097 int nbFieldsToAdd(other.getNumberOfFields());
1098 std::vector<std::string> fsn(getFieldsNames());
1099 for(int i=0;i<nbFieldsToAdd;i++)
1101 MCAuto<MEDFileAnyTypeFieldMultiTS> elt(other.getFieldAtPos(i));
1102 std::string name(elt->getName());
1103 if(std::find(fsn.begin(),fsn.end(),name)!=fsn.end())
1105 std::ostringstream oss; oss << "MEDFileFields::aggregate : name \"" << name << "\" already appears !";
1106 throw INTERP_KERNEL::Exception(oss.str());
1112 MEDFileFieldsIterator *MEDFileFields::iterator()
1114 return new MEDFileFieldsIterator(this);
1117 int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const
1119 std::string tmp(fieldName);
1120 std::vector<std::string> poss;
1121 for(unsigned int i=0;i<_fields.size();i++)
1123 const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]);
1126 std::string fname(f->getName());
1130 poss.push_back(fname);
1133 std::ostringstream oss; oss << "MEDFileFields::getPosFromFieldName : impossible to find field '" << tmp << "' in this ! Possibilities are : ";
1134 std::copy(poss.begin(),poss.end(),std::ostream_iterator<std::string>(oss,", "));
1136 throw INTERP_KERNEL::Exception(oss.str());
1139 MEDFileFieldsIterator::MEDFileFieldsIterator(MEDFileFields *fs):_fs(fs),_iter_id(0),_nb_iter(0)
1144 _nb_iter=fs->getNumberOfFields();
1148 MEDFileFieldsIterator::~MEDFileFieldsIterator()
1152 MEDFileAnyTypeFieldMultiTS *MEDFileFieldsIterator::nextt()
1154 if(_iter_id<_nb_iter)
1156 MEDFileFields *fs(_fs);
1158 return fs->getFieldAtPos(_iter_id++);