Salome HOME
[EDF23724] : Get rid of DataArrayMedInt class not castable into DataArrayInt32 nor...
[tools/medcoupling.git] / src / MEDLoader / MEDFileFieldMultiTS.cxx
1 // Copyright (C) 2017-2021  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #include "MEDFileFieldMultiTS.hxx"
22 #include "MEDFileFieldVisitor.hxx"
23 #include "MEDFileSafeCaller.txx"
24 #include "MEDLoaderBase.hxx"
25 #include "MEDFileField.txx"
26
27 #include "MEDCouplingFieldDouble.hxx"
28 #include "MEDCouplingFieldTemplate.hxx"
29
30 #include <sstream>
31
32 using namespace MEDCoupling;
33
34 template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<Int32>;
35 template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<Int64>;
36 template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<float>;
37 template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<double>;
38 template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<Int32>;
39 template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>;
40 template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<float>;
41 template class MEDCoupling::MEDFileTemplateFieldMultiTS<Int32>;
42 template class MEDCoupling::MEDFileTemplateFieldMultiTS<Int64>;
43 template class MEDCoupling::MEDFileTemplateFieldMultiTS<float>;
44 template class MEDCoupling::MEDFileTemplateFieldMultiTS<double>;
45 template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<Int32>;
46 template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<Int64>;
47 template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<float>;
48
49 extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype);
50   
51 //= MEDFileAnyTypeFieldMultiTSWithoutSDA
52
53 MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
54 {
55 }
56
57 MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileFieldNameScope(fieldName,meshName)
58 {
59 }
60
61 /*!
62  * \param [in] fieldId field id in C mode
63  */
64 MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
65 {
66   med_field_type typcha;
67   std::string dtunitOut,meshName;
68   int nbOfStep(MEDFileAnyTypeField1TS::LocateField2(fid,fieldId,false,_name,typcha,_infos,dtunitOut,meshName));
69   setMeshName(meshName);
70   setDtUnit(dtunitOut.c_str());
71   loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities);
72 }
73
74 MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
75 try:MEDFileFieldNameScope(fieldName,meshName),_infos(infos)
76 {
77   setDtUnit(dtunit.c_str());
78   loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll,ms,entities);
79 }
80 catch(INTERP_KERNEL::Exception& e)
81 {
82     throw e;
83 }
84
85 std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
86 {
87   std::size_t ret(_mesh_name.capacity()+_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MCAuto<MEDFileField1TSWithoutSDA>));
88   for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
89     ret+=(*it).capacity();
90   return ret;
91 }
92
93 std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
94 {
95   std::vector<const BigMemoryObject *> ret;
96   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
97     ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
98   return ret;
99 }
100
101 /*!
102  * If one of the id in [ \a startIds , \a endIds ) points to a null element, there is not throw. Simply, this empty element is added as if it were not
103  * NULL.
104  */
105 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const
106 {
107   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
108   ret->setInfo(_infos);
109   int sz=(int)_time_steps.size();
110   for(const int *id=startIds;id!=endIds;id++)
111     {
112       if(*id>=0 && *id<sz)
113         {
114           const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[*id];
115           MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
116           if(tse)
117             {
118               tse->incrRef();
119               tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
120             }
121           ret->pushBackTimeStep(tse2);
122         }
123       else
124         {
125           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << std::distance(startIds,id) << " value is " << *id;
126           oss << " ! Should be in [0," << sz << ") !";
127           throw INTERP_KERNEL::Exception(oss.str());
128         }
129     }
130   if(ret->getNumberOfTS()>0)
131     ret->synchronizeNameScope();
132   ret->copyNameScope(*this);
133   return ret.retn();
134 }
135
136 /*!
137  * If one of the id in the input range points to a null element, there is not throw. Simply, this empty element is added as if it were not
138  * NULL.
139  */
140 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
141 {
142   static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
143   mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
144   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
145   ret->setInfo(_infos);
146   std::size_t sz=_time_steps.size();
147   std::size_t j=bg;
148   for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
149     {
150       if(j<sz)
151         {
152           const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
153           MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
154           if(tse)
155             {
156               tse->incrRef();
157               tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
158             }
159           ret->pushBackTimeStep(tse2);
160         }
161       else
162         {
163           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << i << " value is " << j;
164           oss << " ! Should be in [0," << sz << ") !";
165           throw INTERP_KERNEL::Exception(oss.str());
166         }
167     }
168   if(ret->getNumberOfTS()>0)
169     ret->synchronizeNameScope();
170   ret->copyNameScope(*this);
171   return ret.retn();
172 }
173
174 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
175 {
176   int id=0;
177   MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
178   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
179     {
180       const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
181       if(!cur)
182         continue;
183       std::pair<int,int> p(cur->getIteration(),cur->getOrder());
184       if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end())
185         ids->pushBackSilent(id);
186     }
187   return buildFromTimeStepIds(ids->begin(),ids->end());
188 }
189
190 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
191 {
192   int id=0;
193   MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
194   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
195     {
196       const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
197       if(!cur)
198         continue;
199       std::pair<int,int> p(cur->getIteration(),cur->getOrder());
200       if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end())
201         ids->pushBackSilent(id);
202     }
203   return buildFromTimeStepIds(ids->begin(),ids->end());
204 }
205
206 bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const
207 {
208   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
209     if((*it).isNotNull())
210       if((*it)->presenceOfStructureElements())
211         return true;
212   return false;
213 }
214
215 bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const
216 {
217   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
218     if((*it).isNotNull())
219       if(!(*it)->onlyStructureElements())
220         return false;
221   return true;
222 }
223
224 void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements()
225 {
226   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
227   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
228     if((*it).isNotNull())
229       {
230         if((*it)->presenceOfStructureElements())
231           {
232             if(!(*it)->onlyStructureElements())
233               {
234                 (*it)->killStructureElements();
235                 ret.push_back(*it);
236               }
237           }
238         else
239           {
240             ret.push_back(*it);
241           }
242       }
243   _time_steps=ret;
244 }
245
246 void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyStructureElements()
247 {
248   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
249   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
250     if((*it).isNotNull())
251       {
252         if((*it)->presenceOfStructureElements())
253           {
254             if(!(*it)->onlyStructureElements())
255               (*it)->keepOnlyStructureElements();
256             ret.push_back(*it);
257           }
258       }
259   _time_steps=ret;
260 }
261
262 void MEDFileAnyTypeFieldMultiTSWithoutSDA::keepOnlyOnSE(const std::string& seName)
263 {
264   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret;
265   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
266     if((*it).isNotNull())
267       (*it)->keepOnlyOnSE(seName);
268 }
269
270 void MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames(std::vector< std::pair<std::string,std::string> >& ps) const
271 {
272   std::vector< std::pair<std::string,std::string> > ps2;
273   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
274     if((*it).isNotNull())
275       {
276         (*it)->getMeshSENames(ps2);
277         break;
278       }
279   if(ps2.empty())
280     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : this appears to not contain SE only !");
281   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
282     if((*it).isNotNull())
283       {
284         std::vector< std::pair<std::string,std::string> > ps3;
285         (*it)->getMeshSENames(ps3);
286         if(ps2!=ps3)
287           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshSENames : For the moment only homogeneous SE def through time managed !");
288       }
289   for(std::vector< std::pair<std::string,std::string> >::const_iterator it=ps2.begin();it!=ps2.end();it++)
290     {
291       std::vector< std::pair<std::string,std::string> >::iterator it2(std::find(ps.begin(),ps.end(),*it));
292       if(it2==ps.end())
293         ps.push_back(*it);
294     }
295 }
296
297 bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
298 {
299   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
300     {
301       const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
302       if(!cur)
303         continue;
304       if(cur->presenceOfMultiDiscPerGeoType())
305         return true;
306     }
307   return false;
308 }
309
310 const std::vector<std::string>& MEDFileAnyTypeFieldMultiTSWithoutSDA::getInfo() const
311 {
312   return _infos;
313 }
314
315 void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector<std::string>& info)
316 {
317   _infos=info;
318 }
319
320 int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
321 {
322   int ret=0;
323   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
324     {
325       const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
326       if(pt->isDealingTS(iteration,order))
327         return ret;
328     }
329   std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
330   std::vector< std::pair<int,int> > vp=getIterations();
331   for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
332     oss << "(" << (*it2).first << "," << (*it2).second << ") ";
333   throw INTERP_KERNEL::Exception(oss.str());
334 }
335
336 const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const
337 {
338   return *_time_steps[getTimeStepPos(iteration,order)];
339 }
340
341 MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order)
342 {
343   return *_time_steps[getTimeStepPos(iteration,order)];
344 }
345
346 bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
347 {
348   bool ret(false);
349   for(std::vector< std::pair<std::string,std::string> >::const_iterator it=modifTab.begin();it!=modifTab.end();it++)
350     {
351       if((*it).first==getMeshName())
352         {
353           setMeshName((*it).second);
354           ret=true;
355         }
356     }
357   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
358     {
359       MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
360       if(cur)
361         ret=cur->changeMeshNames(modifTab) || ret;
362     }
363   return ret;
364 }
365
366 /*!
367  * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
368  */
369 DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const
370 {
371   return getTimeStepEntry(iteration,order).getUndergroundDataArray();
372 }
373
374 /*!
375  * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
376  */
377 DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<mcIdType,mcIdType> > >& entries) const
378 {
379   return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
380 }
381
382 bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<mcIdType>& oldCode, const std::vector<mcIdType>& newCode, const DataArrayIdType *renumO2N,
383                                                                        MEDFileFieldGlobsReal& glob)
384 {
385   bool ret=false;
386   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
387     {
388       MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
389       if(f1ts)
390         ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
391     }
392   return ret;
393 }
394
395 void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const
396 {
397   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
398     if((*it).isNotNull())
399       {
400         visitor.newTimeStepEntry(*it);
401         (*it)->accept(visitor);
402         visitor.endTimeStepEntry(*it);
403       }
404 }
405
406 void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
407 {
408   std::string startLine(bkOffset,' ');
409   oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]";
410   if(fmtsId>=0)
411     oss << " (" << fmtsId << ")";
412   oss << " has the following name: \"" << _name << "\"." << std::endl;
413   oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
414   for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
415     {
416       oss << startLine << "  -  \"" << *it << "\"" << std::endl;
417     }
418   int i=0;
419   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
420     {
421       std::string chapter(17,(char)('0'+i));
422       oss << startLine << chapter << std::endl;
423       const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
424       if(cur)
425         cur->simpleRepr(bkOffset+2,oss,i);
426       else
427         oss << startLine << "  Field on one time step #" << i << " is not defined !" << std::endl;
428       oss << startLine << chapter << std::endl;
429     }
430 }
431
432 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const
433 {
434   std::size_t sz=_time_steps.size();
435   std::vector< std::pair<int,int> > ret(sz);
436   ret1.resize(sz);
437   for(std::size_t i=0;i<sz;i++)
438     {
439       const MEDFileAnyTypeField1TSWithoutSDA *f1ts=_time_steps[i];
440       if(f1ts)
441         {
442           ret1[i]=f1ts->getTime(ret[i].first,ret[i].second);
443         }
444       else
445         {
446           std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeSteps : At rank #" << i << " time step is not defined. Invoke eraseEmptyTS method !";
447           throw INTERP_KERNEL::Exception(oss.str());
448         }
449     }
450   return ret;
451 }
452
453 void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MCAuto<MEDFileAnyTypeField1TSWithoutSDA>& tse)
454 {
455   MEDFileAnyTypeField1TSWithoutSDA *tse2(tse);
456   if(!tse2)
457     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input content object is null !");
458   checkCoherencyOfType(tse2);
459   if(_time_steps.empty())
460     {
461       setName(tse2->getName());
462       setMeshName(tse2->getMeshName());
463       setInfo(tse2->getInfo());
464     }
465   checkThatComponentsMatch(tse2->getInfo());
466   if(getDtUnit().empty() && !tse->getDtUnit().empty())
467     setDtUnit(tse->getDtUnit());
468   _time_steps.push_back(tse);
469 }
470
471 void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
472 {
473   std::size_t nbOfCompo=_infos.size();
474   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
475     {
476       MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
477       if(cur)
478         {
479           if((cur->getInfo()).size()!=nbOfCompo)
480             {
481               std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope : Mismatch in the number of components of parts ! Should be " << nbOfCompo;
482               oss << " ! but the field at iteration=" << cur->getIteration() << " order=" << cur->getOrder() << " has " << (cur->getInfo()).size() << " components !";
483               throw INTERP_KERNEL::Exception(oss.str());
484             }
485           cur->copyNameScope(*this);
486         }
487     }
488 }
489
490 void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
491 {
492   _time_steps.resize(nbPdt);
493   //
494   INTERP_KERNEL::AutoCppPtr<MEDFileEntities> entitiesFast;
495   const MEDFileEntities *entitiesForSubInstances(entities);
496   MEDFileCapability mfcap(fid);
497   if( ( !entities || entities->areAllStaticPresentAndNoDyn() ) && mfcap.isFastReader())
498     {// no entities
499       med_int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
500       INTERP_KERNEL::AutoPtr<med_entity_type> types(new med_entity_type[nentitype]);
501       med_int usedbyncs;
502       MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types,&usedbyncs));
503       std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesFastP;
504       for(int i=0;i<nentitype;i++)
505         {
506           med_int ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
507           INTERP_KERNEL::AutoPtr<med_geometry_type> geotypes(new med_geometry_type[ngeotype]);
508           med_int geousedbyncs;
509           MEDFILESAFECALLERRD0(MEDfieldGeometryType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i],geotypes,&geousedbyncs));
510           for(med_int j=0;j<ngeotype;j++)
511             {
512               std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j]));
513               entitiesFastP.push_back(p);
514             }
515         }
516       entitiesFast=new MEDFileStaticEntities(entitiesFastP);
517       entitiesForSubInstances=entitiesFast;
518     }
519   for(int i=0;i<nbPdt;i++)
520     {
521       std::vector< std::pair<int,int> > ts;
522       med_int numdt=0,numo=0;
523       med_float dt=0.0;
524       MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt));
525       switch(fieldTyp)
526       {
527         case MED_FLOAT64:
528           {
529             _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
530             break;
531           }
532         case MED_INT32:
533           {
534             _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
535             break;
536           }
537         case MED_INT64:
538           {
539             _time_steps[i]=MEDFileInt64Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
540             break;
541           }
542         case MED_FLOAT32:
543           {
544             _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
545             break;
546           }
547         case MED_INT:
548           {
549             if(sizeof(med_int)==sizeof(int))
550               {
551                 _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
552                 break;
553               }
554           }
555         default:
556           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32, INT64 !");
557       }
558       if(loadAll)
559         _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances);
560       else
561         _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entitiesForSubInstances,&mfcap);
562     }
563   synchronizeNameScope();
564 }
565
566 void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const
567 {
568   if(_time_steps.empty())
569     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
570   checkThatNbOfCompoOfTSMatchThis();
571   std::vector<std::string> infos(getInfo());
572   std::size_t nbComp=infos.size();
573   INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
574   INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
575   for(unsigned int i=0;i<nbComp;i++)
576     {
577       std::string info=infos[i];
578       std::string c,u;
579       MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
580       MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
581       MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
582     }
583   if(_name.empty())
584     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
585   MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),ToMedInt(nbComp),comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
586   std::size_t nbOfTS=_time_steps.size();
587   for(std::size_t i=0;i<nbOfTS;i++)
588     _time_steps[i]->writeLL(fid,opts,*this);
589 }
590
591 void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
592 {
593   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
594     {
595       MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
596       if(elt)
597         elt->loadBigArraysRecursively(fid,nasc);
598     }
599 }
600
601 void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
602 {
603   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
604     {
605       MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
606       if(elt)
607         elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
608     }
609 }
610
611 void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
612 {
613   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
614     {
615       MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
616       if(elt)
617         elt->unloadArrays();
618     }
619 }
620
621 int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
622 {
623   return (int)_time_steps.size();
624 }
625
626 void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
627 {
628   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  > newTS;
629   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
630     {
631       const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
632       if(tmp)
633         newTS.push_back(*it);
634     }
635   _time_steps=newTS;
636 }
637
638 void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
639 {
640   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
641   int maxId=(int)_time_steps.size();
642   int ii=0;
643   std::set<int> idsToDel;
644   for(const int *id=startIds;id!=endIds;id++,ii++)
645     {
646       if(*id>=0 && *id<maxId)
647         {
648           idsToDel.insert(*id);
649         }
650       else
651         {
652           std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds : At pos #" << ii << " request for id=" << *id << " not in [0," << maxId << ") !";
653           throw INTERP_KERNEL::Exception(oss.str());
654         }
655     }
656   for(int iii=0;iii<maxId;iii++)
657     if(idsToDel.find(iii)==idsToDel.end())
658       newTS.push_back(_time_steps[iii]);
659   _time_steps=newTS;
660 }
661
662 void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
663 {
664   static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
665   mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
666   if(nbOfEntriesToKill==0)
667     return ;
668   std::size_t sz=_time_steps.size();
669   std::vector<bool> b(sz,true);
670   int j=bg;
671   for(mcIdType i=0;i<nbOfEntriesToKill;i++,j+=step)
672     b[j]=false;
673   std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
674   for(std::size_t i=0;i<sz;i++)
675     if(b[i])
676       newTS.push_back(_time_steps[i]);
677   _time_steps=newTS;
678 }
679
680 int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const
681 {
682   int ret=0;
683   std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : "; 
684   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
685     {
686       const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
687       if(tmp)
688         {
689           int it2,ord;
690           tmp->getTime(it2,ord);
691           if(it2==iteration && order==ord)
692             return ret;
693           else
694             oss << "(" << it2 << ","  << ord << "), ";
695         }
696     }
697   throw INTERP_KERNEL::Exception(oss.str());
698 }
699
700 int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const
701 {
702   int ret=0;
703   std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
704   oss.precision(15);
705   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA>  >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
706     {
707       const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
708       if(tmp)
709         {
710           int it2,ord;
711           double ti=tmp->getTime(it2,ord);
712           if(fabs(time-ti)<eps)
713             return ret;
714           else
715             oss << ti << ", ";
716         }
717     }
718   throw INTERP_KERNEL::Exception(oss.str());
719 }
720
721 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
722 {
723   std::size_t lgth=_time_steps.size();
724   std::vector< std::pair<int,int> > ret(lgth);
725   for(std::size_t i=0;i<lgth;i++)
726     _time_steps[i]->fillIteration(ret[i]);
727   return ret;
728 }
729
730 /*!
731  * This method has 3 inputs 'iteration' 'order' 'mname'. 'mname' can be null if the user is the general case where there is only one meshName lying on 'this'
732  * This method returns two things.
733  * - The absolute dimension of 'this' in first parameter. 
734  * - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative
735  *   to the first output parameter. The values in 'levs' will be returned in decreasing order.
736  *
737  * This method is designed for MEDFileFieldMultiTS instances that have a discritization ON_CELLS, ON_GAUSS_NE and ON_GAUSS.
738  * Only these 3 discretizations will be taken into account here.
739  *
740  * If 'this' is empty this method will throw an INTERP_KERNEL::Exception.
741  * If there is \b only node fields defined in 'this' -1 is returned and 'levs' output parameter will be empty. In this
742  * case the caller has to know the underlying mesh it refers to. By default it is the level 0 of the corresponding mesh.
743  *
744  * This method is useful to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'.
745  * It is possible (even if it is not common) that the highest level in 'this' were not equal to the meshDimension of the underlying mesh in 'this'.
746  * 
747  * Let's consider the typical following case :
748  * - a mesh 'm1' has a meshDimension 3 and has the following non empty levels
749  * [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2
750  * - 'f1' lies on 'm1' and is defined on 3D and 1D cells for example
751  *   TETRA4 and SEG2
752  * - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2
753  *
754  * In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1])
755  * 
756  * To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev
757  * To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev
758  * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
759  * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev
760  */
761 int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
762 {
763   return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
764 }
765
766 const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const
767 {
768   if(pos<0 || pos>=(int)_time_steps.size())
769     {
770       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
771       throw INTERP_KERNEL::Exception(oss.str());
772     }
773   const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
774   if(item==0)
775     {
776       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
777       oss << "\nTry to use following method eraseEmptyTS !";
778       throw INTERP_KERNEL::Exception(oss.str());
779     }
780   return item;
781 }
782
783 MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos)
784 {
785   if(pos<0 || pos>=(int)_time_steps.size())
786     {
787       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
788       throw INTERP_KERNEL::Exception(oss.str());
789     }
790   MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
791   if(item==0)
792     {
793       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
794       oss << "\nTry to use following method eraseEmptyTS !";
795       throw INTERP_KERNEL::Exception(oss.str());
796     }
797   return item;
798 }
799
800 std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
801 {
802   std::vector<std::string> ret;
803   std::set<std::string> ret2;
804   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
805     {
806       std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
807       for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
808         if(ret2.find(*it2)==ret2.end())
809           {
810             ret.push_back(*it2);
811             ret2.insert(*it2);
812           }
813     }
814   return ret;
815 }
816
817 std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
818 {
819   std::vector<std::string> ret;
820   std::set<std::string> ret2;
821   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
822     {
823       std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
824       for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
825         if(ret2.find(*it2)==ret2.end())
826           {
827             ret.push_back(*it2);
828             ret2.insert(*it2);
829           }
830     }
831   return ret;
832 }
833
834 std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
835 {
836   std::vector<std::string> ret;
837   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
838     {
839       std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
840       ret.insert(ret.end(),tmp.begin(),tmp.end());
841     }
842   return ret;
843 }
844
845 std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
846 {
847   std::vector<std::string> ret;
848   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
849     {
850       std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
851       ret.insert(ret.end(),tmp.begin(),tmp.end());
852     }
853   return ret;
854 }
855
856 void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
857 {
858   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
859     (*it)->changePflsRefsNamesGen2(mapOfModif);
860 }
861
862 void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
863 {
864   for(std::vector< MCAuto< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
865     (*it)->changeLocsRefsNamesGen2(mapOfModif);
866 }
867
868 std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
869 {
870   std::size_t lgth=_time_steps.size();
871   std::vector< std::vector<TypeOfField> > ret(lgth);
872   for(std::size_t i=0;i<lgth;i++)
873     _time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
874   return ret;
875 }
876
877 /*!
878  * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
879  */
880 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
881 {
882   return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
883 }
884
885 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCopy() const
886 {
887   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
888   std::size_t i=0;
889   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
890     {
891       if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
892         ret->_time_steps[i]=(*it)->deepCopy();
893     }
894   return ret.retn();
895 }
896
897 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
898 {
899   std::size_t sz(_infos.size()),sz2(_time_steps.size());
900   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
901   std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
902   for(std::size_t i=0;i<sz;i++)
903     {
904       ret[i]=shallowCpy();
905       ret[i]->_infos.resize(1); ret[i]->_infos[0]=_infos[i];
906     }
907   for(std::size_t i=0;i<sz2;i++)
908     {
909       std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
910       if(ret1.size()!=sz)
911         {
912           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !";
913           throw INTERP_KERNEL::Exception(oss.str());
914         }
915       ts[i]=ret1;
916     }
917   for(std::size_t i=0;i<sz;i++)
918     for(std::size_t j=0;j<sz2;j++)
919       ret[i]->_time_steps[j]=ts[j][i];
920   return ret;
921 }
922
923 /*!
924  * This method splits into discretization each time steps in \a this.
925  * ** WARNING ** the returned instances are not compulsory defined on the same time steps series !
926  */
927 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
928 {
929   std::size_t sz(_time_steps.size());
930   std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
931   for(std::size_t i=0;i<sz;i++)
932     {
933       const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
934       if(!timeStep)
935         {
936           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !"; 
937           throw INTERP_KERNEL::Exception(oss.str());
938         }
939       items[i]=timeStep->splitDiscretizations();  
940     }
941   //
942   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
943   std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
944   std::vector< TypeOfField > types;
945   for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
946     for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
947       {
948         std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
949         if(ts.size()!=1)
950           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !");
951         std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]);
952         if(it2==types.end())
953           types.push_back(ts[0]);
954       }
955   ret.resize(types.size()); ret2.resize(types.size());
956   for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
957     for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
958       {
959         TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0];
960         std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
961         ret2[pos].push_back(*it1);
962       }
963   for(std::size_t i=0;i<types.size();i++)
964     {
965       MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
966       for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
967         elt->pushBackTimeStep(*it1);//also updates infos in elt
968       ret[i]=elt;
969       elt->MEDFileFieldNameScope::operator=(*this);
970     }
971   return ret;
972 }
973
974 /*!
975  * Contrary to splitDiscretizations method this method makes the hypothesis that the times series are **NOT** impacted by the splitting of multi discretization.
976  */
977 std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
978 {
979   std::size_t sz(_time_steps.size());
980   std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
981   std::size_t szOut(std::numeric_limits<std::size_t>::max());
982   for(std::size_t i=0;i<sz;i++)
983     {
984       const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
985       if(!timeStep)
986         {
987           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : time step #" << i << " is null !";
988           throw INTERP_KERNEL::Exception(oss.str());
989         }
990       items[i]=timeStep->splitMultiDiscrPerGeoTypes();
991       if(szOut==std::numeric_limits<std::size_t>::max())
992         szOut=items[i].size();
993       else
994         if(items[i].size()!=szOut)
995           throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : The splitting per discretization is expected to be same among time steps !");
996     }
997   if(szOut==std::numeric_limits<std::size_t>::max())
998     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
999   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
1000   for(std::size_t i=0;i<szOut;i++)
1001     {
1002       MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
1003       for(std::size_t j=0;j<sz;j++)
1004         elt->pushBackTimeStep(items[j][i]);
1005       ret[i]=elt;
1006       elt->MEDFileFieldNameScope::operator=(*this);
1007     }
1008   return ret;
1009 }
1010
1011 void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
1012 {
1013   setName(field->getName());
1014   if(field->getMesh())
1015     setMeshName(field->getMesh()->getName());
1016   if(_name.empty())
1017     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
1018   if(!arr)
1019     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : no array set !");
1020   _infos=arr->getInfoOnComponents();
1021 }
1022
1023 void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const
1024 {
1025   static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : invalid ";
1026   if(_name!=field->getName())
1027     {
1028       std::ostringstream oss; oss << MSG << "name ! should be \"" << _name;
1029       oss << "\" and it is set in input field to \"" << field->getName() << "\" !";
1030       throw INTERP_KERNEL::Exception(oss.str());
1031     }
1032   if(!arr)
1033     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
1034   checkThatComponentsMatch(arr->getInfoOnComponents());
1035 }
1036
1037 void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::vector<std::string>& compos) const
1038 {
1039   static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkThatComponentsMatch : ";
1040   if(getInfo().size()!=compos.size())
1041     {
1042       std::ostringstream oss; oss << MSG << "mismatch of number of components between this (" << getInfo().size() << ") and ";
1043       oss << " number of components of element to append (" << compos.size() << ") !";
1044       throw INTERP_KERNEL::Exception(oss.str());
1045     }
1046   if(_infos!=compos)
1047     {
1048       std::ostringstream oss; oss << MSG << "components have same size but are different ! should be \"";
1049       std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
1050       oss << " But compo in input fields are : ";
1051       std::copy(compos.begin(),compos.end(),std::ostream_iterator<std::string>(oss,", "));
1052       oss << " !";
1053       throw INTERP_KERNEL::Exception(oss.str());
1054     }
1055 }
1056
1057 void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const
1058 {
1059   std::size_t sz=_infos.size();
1060   int j=0;
1061   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
1062     {
1063       const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
1064       if(elt)
1065         if(elt->getInfo().size()!=sz)
1066           {
1067             std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis : At pos #" << j << " the number of components is equal to ";
1068             oss << elt->getInfo().size() << " whereas it is expected to be equal to " << sz << " !";
1069             throw INTERP_KERNEL::Exception(oss.str());
1070           }
1071     }
1072 }
1073
1074 void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
1075 {
1076   if(!field)
1077     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
1078   if(!_time_steps.empty())
1079     checkCoherencyOfTinyInfo(field,arr);
1080   MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(createNew1TSWithoutSDAEmptyInstance());
1081   {
1082     MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*field));
1083     obj->setFieldNoProfileSBT(field->timeDiscrSafe(),ft,arr,glob,*this);
1084   }
1085   copyTinyInfoFrom(field,arr);
1086   _time_steps.push_back(obj);
1087 }
1088
1089 void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
1090 {
1091   if(!field)
1092     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
1093   if(!_time_steps.empty())
1094     checkCoherencyOfTinyInfo(field,arr);
1095   MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(createNew1TSWithoutSDAEmptyInstance());
1096   {
1097     MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field));
1098     obj->setFieldProfile(field->timeDiscrSafe(),ft,arr,mesh,meshDimRelToMax,profile,glob,*this,smartPflKiller);
1099   }
1100   copyTinyInfoFrom(field,arr);
1101   setMeshName(obj->getMeshName());
1102   _time_steps.push_back(obj);
1103 }
1104
1105 void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ts)
1106 {
1107   int sz=(int)_time_steps.size();
1108   if(i<0 || i>=sz)
1109     {
1110       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !";
1111       throw INTERP_KERNEL::Exception(oss.str());
1112     }
1113   const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
1114   if(tsPtr)
1115     {
1116       if(tsPtr->getNumberOfComponents()!=_infos.size())
1117         {
1118           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() <<  " !";
1119           throw INTERP_KERNEL::Exception(oss.str());
1120         }
1121     }
1122   _time_steps[i]=ts;
1123 }
1124
1125 //= MEDFileFieldMultiTSWithoutSDA
1126
1127 /*!
1128  * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially
1129  * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller.
1130  */
1131 std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
1132 {
1133   const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order);
1134   const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
1135   if(!myF1TSC)
1136     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2 : mismatch of type of field expecting FLOAT64 !");
1137   return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
1138 }
1139
1140 MEDFileInt32FieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
1141 {
1142   MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> ret(new MEDFileInt32FieldMultiTSWithoutSDA);
1143   ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
1144   int i=0;
1145   for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
1146     {
1147       const MEDFileAnyTypeField1TSWithoutSDA *eltToConv(*it);
1148       if(eltToConv)
1149         {
1150           const MEDFileField1TSWithoutSDA *eltToConvC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(eltToConv);
1151           if(!eltToConvC)
1152             throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::convertToInt : presence of an invalid 1TS type ! Should be of type FLOAT64 !");
1153           MCAuto<MEDFileAnyTypeField1TSWithoutSDA> elt=eltToConvC->convertToInt();
1154           ret->setIteration(i,elt);
1155         }
1156     }
1157   return ret.retn();
1158 }
1159
1160 //= MEDFileAnyTypeFieldMultiTS
1161
1162 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
1163 {
1164 }
1165
1166 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
1167 try:MEDFileFieldGlobsReal(fid)
1168 {
1169   _content=BuildContentFrom(fid,loadAll,ms);
1170   loadGlobals(fid);
1171 }
1172 catch(INTERP_KERNEL::Exception& e)
1173 {
1174     throw e;
1175 }
1176
1177 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
1178 {
1179   med_field_type typcha;
1180   std::vector<std::string> infos;
1181   std::string dtunit;
1182   std::string meshName;
1183   int i(-1);
1184   MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit,meshName);
1185   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
1186   switch(typcha)
1187   {
1188     case MED_FLOAT64:
1189       {
1190         ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1191         break;
1192       }
1193     case MED_INT32:
1194       {
1195         ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1196         break;
1197       }
1198     case MED_INT64:
1199       {
1200         ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1201         break;
1202       }
1203     case MED_FLOAT32:
1204       {
1205         ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1206         break;
1207       }
1208     case MED_INT:
1209       {
1210         if(sizeof(med_int)==sizeof(int))
1211           {
1212             ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1213             break;
1214           }
1215       }
1216     default:
1217       {
1218         std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !";
1219         throw INTERP_KERNEL::Exception(oss.str());
1220       }
1221   }
1222   ret->setMeshName(meshName);
1223   ret->setDtUnit(dtunit.c_str());
1224   return ret.retn();
1225 }
1226
1227 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
1228 {
1229   med_field_type typcha;
1230   //
1231   std::vector<std::string> infos;
1232   std::string dtunit,fieldName,meshName;
1233   MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName);
1234   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
1235   switch(typcha)
1236   {
1237     case MED_FLOAT64:
1238       {
1239         ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1240         break;
1241       }
1242     case MED_INT32:
1243       {
1244         ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1245         break;
1246       }
1247     case MED_INT64:
1248       {
1249         ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1250         break;
1251       }
1252     case MED_FLOAT32:
1253       {
1254         ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1255         break;
1256       }
1257     case MED_INT:
1258       {
1259         if(sizeof(med_int)==sizeof(int))
1260           {
1261             ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1262             break;
1263           }
1264       }
1265     default:
1266       {
1267         std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !";
1268         throw INTERP_KERNEL::Exception(oss.str());
1269       }
1270   }
1271   ret->setMeshName(meshName);
1272   ret->setDtUnit(dtunit.c_str());
1273   return ret.retn();
1274 }
1275
1276 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c)
1277 {
1278   if(!c)
1279     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
1280   if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
1281     {
1282       MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
1283       ret->_content=c;  c->incrRef();
1284       return ret.retn();
1285     }
1286   if(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(c))
1287     {
1288       MCAuto<MEDFileInt32FieldMultiTS> ret(MEDFileInt32FieldMultiTS::New());
1289       ret->_content=c;  c->incrRef();
1290       return ret.retn();
1291     }
1292   if(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(c))
1293     {
1294       MCAuto<MEDFileInt64FieldMultiTS> ret(MEDFileInt64FieldMultiTS::New());
1295       ret->_content=c;  c->incrRef();
1296       return ret.retn();
1297     }
1298   if(dynamic_cast<const MEDFileFloatFieldMultiTSWithoutSDA *>(c))
1299     {
1300       MCAuto<MEDFileFloatFieldMultiTS> ret(MEDFileFloatFieldMultiTS::New());
1301       ret->_content=c;  c->incrRef();
1302       return ret.retn();
1303     }
1304   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 FLOAT32 and INT32 has been built but not intercepted !");
1305 }
1306
1307 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
1308 {
1309   MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c));
1310   std::string fileName(FileNameFromFID(fid));
1311   ret->setFileName(fileName);
1312   return ret;
1313 }
1314
1315 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
1316 try:MEDFileFieldGlobsReal(fid)
1317 {
1318   _content=BuildContentFrom(fid,fieldName,loadAll,ms,entities);
1319   loadGlobals(fid);
1320 }
1321 catch(INTERP_KERNEL::Exception& e)
1322 {
1323     throw e;
1324 }
1325
1326 //= MEDFileAnyTypeFieldMultiTS
1327
1328 /*!
1329  * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of the first field
1330  * that has been read from a specified MED file.
1331  *  \param [in] fileName - the name of the MED file to read.
1332  *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
1333  *          is to delete this field using decrRef() as it is no more needed.
1334  *  \throw If reading the file fails.
1335  */
1336 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
1337 {
1338   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
1339   return New(fid,loadAll);
1340 }
1341
1342 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll)
1343 {
1344   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,0));
1345   MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
1346   ret->loadGlobals(fid);
1347   return ret.retn();
1348 }
1349
1350 /*!
1351  * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of a given field
1352  * that has been read from a specified MED file.
1353  *  \param [in] fileName - the name of the MED file to read.
1354  *  \param [in] fieldName - the name of the field to read.
1355  *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
1356  *          is to delete this field using decrRef() as it is no more needed.
1357  *  \throw If reading the file fails.
1358  *  \throw If there is no field named \a fieldName in the file.
1359  */
1360 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
1361 {
1362   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
1363   return New(fid,fieldName,loadAll);
1364 }
1365
1366 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
1367 {
1368   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
1369   MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
1370   ret->loadGlobals(fid);
1371   return ret.retn();
1372 }
1373
1374 /*!
1375  * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
1376  * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
1377  *
1378  * \warning this is a shallow copy constructor
1379  */
1380 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
1381 {
1382   if(!shallowCopyOfContent)
1383     {
1384       const MEDFileAnyTypeFieldMultiTSWithoutSDA *otherPtr(&other);
1385       otherPtr->incrRef();
1386       _content=const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(otherPtr);
1387     }
1388   else
1389     {
1390       _content=other.shallowCpy();
1391     }
1392 }
1393
1394 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase()
1395 {
1396   MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
1397   if(!ret)
1398     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : content is expected to be not null !");
1399   return ret;
1400 }
1401
1402 const MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() const
1403 {
1404   const MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
1405   if(!ret)
1406     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : const content is expected to be not null !");
1407   return ret;
1408 }
1409
1410 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsed() const
1411 {
1412   return contentNotNullBase()->getPflsReallyUsed2();
1413 }
1414
1415 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsed() const
1416 {
1417   return contentNotNullBase()->getLocsReallyUsed2();
1418 }
1419
1420 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsedMulti() const
1421 {
1422   return contentNotNullBase()->getPflsReallyUsedMulti2();
1423 }
1424
1425 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsedMulti() const
1426 {
1427   return contentNotNullBase()->getLocsReallyUsedMulti2();
1428 }
1429
1430 void MEDFileAnyTypeFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
1431 {
1432   contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
1433 }
1434
1435 void MEDFileAnyTypeFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
1436 {
1437   contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
1438 }
1439
1440 int MEDFileAnyTypeFieldMultiTS::getNumberOfTS() const
1441 {
1442   return contentNotNullBase()->getNumberOfTS();
1443 }
1444
1445 void MEDFileAnyTypeFieldMultiTS::eraseEmptyTS()
1446 {
1447   contentNotNullBase()->eraseEmptyTS();
1448 }
1449
1450 void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
1451 {
1452   contentNotNullBase()->eraseTimeStepIds(startIds,endIds);
1453 }
1454
1455 void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step)
1456 {
1457   contentNotNullBase()->eraseTimeStepIds2(bg,end,step);
1458 }
1459
1460 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
1461 {
1462   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
1463   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1464   ret->_content=c;
1465   return ret.retn();
1466 }
1467
1468 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
1469 {
1470   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
1471   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1472   ret->_content=c;
1473   return ret.retn();
1474 }
1475
1476 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getIterations() const
1477 {
1478   return contentNotNullBase()->getIterations();
1479 }
1480
1481 void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts)
1482 {
1483   for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
1484     pushBackTimeStep(*it);
1485 }
1486
1487 void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts)
1488 {
1489   if(!fmts)
1490     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !");
1491   int nbOfTS(fmts->getNumberOfTS());
1492   for(int i=0;i<nbOfTS;i++)
1493     {
1494       MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
1495       pushBackTimeStep(elt);
1496     }
1497 }
1498
1499 void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts)
1500 {
1501   if(!f1ts)
1502     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
1503   checkCoherencyOfType(f1ts);
1504   f1ts->incrRef();
1505   MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
1506   MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
1507   c->incrRef();
1508   MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
1509   if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content))
1510     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !");
1511   _content->pushBackTimeStep(cSafe);
1512   appendGlobs(*f1ts,1e-12);
1513 }
1514
1515 void MEDFileAnyTypeFieldMultiTS::synchronizeNameScope()
1516 {
1517   contentNotNullBase()->synchronizeNameScope();
1518 }
1519
1520 int MEDFileAnyTypeFieldMultiTS::getPosOfTimeStep(int iteration, int order) const
1521 {
1522   return contentNotNullBase()->getPosOfTimeStep(iteration,order);
1523 }
1524
1525 int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const
1526 {
1527   return contentNotNullBase()->getPosGivenTime(time,eps);
1528 }
1529
1530 int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
1531 {
1532   return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
1533 }
1534
1535 std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFieldAvailable() const
1536 {
1537   return contentNotNullBase()->getTypesOfFieldAvailable();
1538 }
1539
1540 std::vector< std::vector< std::pair<mcIdType,mcIdType> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
1541 {
1542   return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1543 }
1544
1545 std::string MEDFileAnyTypeFieldMultiTS::getName() const
1546 {
1547   return contentNotNullBase()->getName();
1548 }
1549
1550 void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name)
1551 {
1552   contentNotNullBase()->setName(name);
1553 }
1554
1555 std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const
1556 {
1557   return contentNotNullBase()->getDtUnit();
1558 }
1559
1560 void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit)
1561 {
1562   contentNotNullBase()->setDtUnit(dtUnit);
1563 }
1564
1565 void MEDFileAnyTypeFieldMultiTS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
1566 {
1567   contentNotNullBase()->simpleRepr(bkOffset,oss,fmtsId);
1568 }
1569
1570 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getTimeSteps(std::vector<double>& ret1) const
1571 {
1572   return contentNotNullBase()->getTimeSteps(ret1);
1573 }
1574
1575 std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const
1576 {
1577   return contentNotNullBase()->getMeshName();
1578 }
1579
1580 void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName)
1581 {
1582   contentNotNullBase()->setMeshName(newMeshName);
1583 }
1584
1585 bool MEDFileAnyTypeFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
1586 {
1587   return contentNotNullBase()->changeMeshNames(modifTab);
1588 }
1589
1590 const std::vector<std::string>& MEDFileAnyTypeFieldMultiTS::getInfo() const
1591 {
1592   return contentNotNullBase()->getInfo();
1593 }
1594
1595 bool MEDFileAnyTypeFieldMultiTS::presenceOfMultiDiscPerGeoType() const
1596 {
1597   return contentNotNullBase()->presenceOfMultiDiscPerGeoType();
1598 }
1599
1600 void MEDFileAnyTypeFieldMultiTS::setInfo(const std::vector<std::string>& info)
1601 {
1602   return contentNotNullBase()->setInfo(info);
1603 }
1604
1605 int MEDFileAnyTypeFieldMultiTS::getNumberOfComponents() const
1606 {
1607   const std::vector<std::string> ret=getInfo();
1608   return (int)ret.size();
1609 }
1610
1611 void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const
1612 {
1613   writeGlobals(fid,*this);
1614   contentNotNullBase()->writeLL(fid,*this);
1615 }
1616
1617 /*!
1618  * This method alloc the arrays and load potentially huge arrays contained in this field.
1619  * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
1620  * This method can be also called to refresh or reinit values from a file.
1621  * 
1622  * \throw If the fileName is not set or points to a non readable MED file.
1623  */
1624 void MEDFileAnyTypeFieldMultiTS::loadArrays()
1625 {
1626   if(getFileName().empty())
1627     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
1628   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
1629   contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
1630 }
1631
1632 /*!
1633  * This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
1634  * But once data loaded once, this method does nothing.
1635  * 
1636  * \throw If the fileName is not set or points to a non readable MED file.
1637  * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::unloadArrays
1638  */
1639 void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary()
1640 {
1641   if(!getFileName().empty())
1642     {
1643       MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
1644       contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
1645     }
1646 }
1647
1648 /*!
1649  * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
1650  * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
1651  * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss instead.
1652  * 
1653  * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary, MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss
1654  */
1655 void MEDFileAnyTypeFieldMultiTS::unloadArrays()
1656 {
1657   contentNotNullBase()->unloadArrays();
1658 }
1659
1660 /*!
1661  * 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.
1662  * This method is the symmetrical method of MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary.
1663  * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
1664  * 
1665  * \sa MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
1666  */
1667 void MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss()
1668 {
1669   if(!getFileName().empty())
1670     contentNotNullBase()->unloadArrays();
1671 }
1672
1673 std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
1674 {
1675   std::ostringstream oss;
1676   contentNotNullBase()->simpleRepr(0,oss,-1);
1677   simpleReprGlobs(oss);
1678   return oss.str();
1679 }
1680
1681 std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySizeWithoutChildren() const
1682 {
1683   return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren();
1684 }
1685
1686 std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTS::getDirectChildrenWithNull() const
1687 {
1688   std::vector<const BigMemoryObject *> ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull());
1689   ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content);
1690   return ret;
1691 }
1692
1693 /*!
1694  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of components in \a this.
1695  * The returned instances are deep copy of \a this except that for globals that are shared with those contained in \a this.
1696  * ** WARNING ** do no forget to rename the output instances to avoid to write n-times in the same MED file field !
1697  */
1698 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const
1699 {
1700   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1701   if(!content)
1702     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
1703   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
1704   std::size_t sz(contentsSplit.size());
1705   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1706   for(std::size_t i=0;i<sz;i++)
1707     {
1708       ret[i]=shallowCpy();
1709       ret[i]->_content=contentsSplit[i];
1710     }
1711   return ret;
1712 }
1713
1714 /*!
1715  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this.
1716  * The returned instances are shallow copied of \a this included globals that are shared with those contained in \a this.
1717  */
1718 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const
1719 {
1720   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1721   if(!content)
1722     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !");
1723   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
1724   std::size_t sz(contentsSplit.size());
1725   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1726   for(std::size_t i=0;i<sz;i++)
1727     {
1728       ret[i]=shallowCpy();
1729       ret[i]->_content=contentsSplit[i];
1730     }
1731   return ret;
1732 }
1733
1734 /*!
1735  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this.
1736  * The returned instances are shallow copied of \a this included globals that are shared with those contained in \a this.
1737  */
1738 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const
1739 {
1740   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1741   if(!content)
1742     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !");
1743   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
1744   std::size_t sz(contentsSplit.size());
1745   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1746   for(std::size_t i=0;i<sz;i++)
1747     {
1748       ret[i]=shallowCpy();
1749       ret[i]->_content=contentsSplit[i];
1750     }
1751   return ret;
1752 }
1753
1754 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const
1755 {
1756   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1757   if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
1758     ret->_content=_content->deepCopy();
1759   ret->deepCpyGlobs(*this);
1760   return ret.retn();
1761 }
1762
1763 MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
1764 {
1765   return _content;
1766 }
1767
1768 /*!
1769  * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
1770  *  \param [in] iteration - the iteration number of a required time step.
1771  *  \param [in] order - the iteration order number of required time step.
1772  *  \return MEDFileField1TS * or MEDFileInt32Field1TS *- a new instance of MEDFileField1TS or MEDFileInt32Field1TS. The caller is to
1773  *          delete this field using decrRef() as it is no more needed.
1774  *  \throw If there is no required time step in \a this field.
1775  */
1776 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const
1777 {
1778   int pos=getPosOfTimeStep(iteration,order);
1779   return getTimeStepAtPos(pos);
1780 }
1781
1782 /*!
1783  * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
1784  *  \param [in] time - the time of the time step of interest.
1785  *  \param [in] eps - a precision used to compare time values.
1786  *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
1787  *          delete this field using decrRef() as it is no more needed.
1788  *  \throw If there is no required time step in \a this field.
1789  */
1790 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const
1791 {
1792   int pos=getPosGivenTime(time,eps);
1793   return getTimeStepAtPos(pos);
1794 }
1795
1796 /*!
1797  * This method groups not null items in \a vectFMTS per time step series. Two time series are considered equal if the list of their pair of integers iteration,order are equal.
1798  * The float64 value of time attached to the pair of integers are not considered here.
1799  * WARNING the returned pointers are not incremented. The caller is \b not responsible to deallocate them ! This method only reorganizes entries in \a vectFMTS.
1800  *
1801  * \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
1802  * \throw If there is a null pointer in \a vectFMTS.
1803  */
1804 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS)
1805 {
1806   static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries : presence of null instance in input vector !";
1807   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1808   std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
1809   while(!lstFMTS.empty())
1810     {
1811       std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
1812       MEDFileAnyTypeFieldMultiTS *curIt(*it);
1813       if(!curIt)
1814         throw INTERP_KERNEL::Exception(msg);
1815       std::vector< std::pair<int,int> > refIts=curIt->getIterations();
1816       std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
1817       elt.push_back(curIt); it=lstFMTS.erase(it);
1818       while(it!=lstFMTS.end())
1819         {
1820           curIt=*it;
1821           if(!curIt)
1822             throw INTERP_KERNEL::Exception(msg);
1823           std::vector< std::pair<int,int> > curIts=curIt->getIterations();
1824           if(refIts==curIts)
1825             { elt.push_back(curIt); it=lstFMTS.erase(it); }
1826           else
1827             it++;
1828         }
1829       ret.push_back(elt);
1830     }
1831   return ret;
1832 }
1833
1834 /*!
1835  * This method splits the input list \a vectFMTS considering the aspect of the geometrical support over time.
1836  * All returned instances in a subvector can be safely loaded, rendered along time
1837  * All items must be defined on the same time step ids ( see MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries method ).
1838  * Each item in \a vectFMTS is expected to have one and exactly one spatial discretization along time.
1839  * All items in \a vectFMTS must lie on the mesh (located by meshname and time step) and compatible with the input mesh \a mesh (having the same name than those in items).
1840  * All items in \a vectFMTS whose spatial discretization is not ON_NODES will appear once.
1841  * For items in \a vectFMTS that are ON_NODES it is possible to appear several times (more than once or once) in the returned vector.
1842  *
1843  * \param [in] vectFMTS - list of multi times step part all defined each on a same spatial discretization along time and pointing to a mesh whose name is equal to \c mesh->getName().
1844  * \param [in] mesh - the mesh shared by all items in \a vectFMTS across time.
1845  * \param [out] fsc - A vector having same size than returned vector. It specifies the support comporator of the corresponding vector of MEDFileAnyTypeFieldMultiTS in returned vector of vector.
1846  * \return - A vector of vector of objects that contains the same pointers (objects) than thoose in \a vectFMTS except that there are organized differently. So pointers included in returned vector of vector should \b not been dealt by the caller.
1847  *
1848  * \throw If an element in \a vectFMTS has not only one spatial discretization set.
1849  * \throw If an element in \a vectFMTS change of spatial discretization along time.
1850  * \throw If an element in \a vectFMTS lies on a mesh with meshname different from those in \a mesh.
1851  * \thorw If some elements in \a vectFMTS do not have the same times steps.
1852  * \throw If mesh is null.
1853  * \throw If an element in \a vectFMTS is null.
1854  * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
1855  */
1856 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc)
1857 {
1858   static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !";
1859   if(!mesh)
1860     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : input mesh is null !");
1861   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1862   if(vectFMTS.empty())
1863     return ret;
1864   std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
1865   MEDFileAnyTypeFieldMultiTS *frstElt(*it);
1866   if(!frstElt)
1867     throw INTERP_KERNEL::Exception(msg);
1868   std::size_t i=0;
1869   std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNotNodes;
1870   std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNodes;
1871   for(;it!=vectFMTS.end();it++,i++)
1872     {
1873       if(!(*it))
1874         throw INTERP_KERNEL::Exception(msg);
1875       TypeOfField tof0,tof1;
1876       if(CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1)>0)
1877         {
1878           if(tof1!=ON_NODES)
1879             vectFMTSNotNodes.push_back(*it);
1880           else
1881             vectFMTSNodes.push_back(*it);
1882         }
1883       else
1884         vectFMTSNotNodes.push_back(*it);
1885     }
1886   std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
1887   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
1888   ret=retCell;
1889   for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
1890     {
1891       i=0;
1892       bool isFetched(false);
1893       for(std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> >::const_iterator it0=retCell.begin();it0!=retCell.end();it0++,i++)
1894         {
1895           if((*it0).empty())
1896             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !");
1897           if(cmps[i]->isCompatibleWithNodesDiscr(*it2))
1898             { ret[i].push_back(*it2); isFetched=true; }
1899         }
1900       if(!isFetched)
1901         {
1902           std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
1903           MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
1904           ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
1905         }
1906     }
1907   fsc=cmps;
1908   return ret;
1909 }
1910
1911 /*!
1912  * WARNING no check here. The caller must be sure that all items in vectFMTS are coherent each other in time steps, only one same spatial discretization and not ON_NODES.
1913  * \param [out] cmps - same size than the returned vector.
1914  */
1915 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps)
1916 {
1917   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1918   std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
1919   while(!lstFMTS.empty())
1920     {
1921       std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
1922       MEDFileAnyTypeFieldMultiTS *ref(*it);
1923       std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
1924       elt.push_back(ref); it=lstFMTS.erase(it);
1925       MCAuto<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
1926       MCAuto<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
1927       while(it!=lstFMTS.end())
1928         {
1929           MEDFileAnyTypeFieldMultiTS *curIt(*it);
1930           if(cmp->isEqual(curIt))
1931             { elt.push_back(curIt); it=lstFMTS.erase(it); }
1932           else
1933             it++;
1934         }
1935       ret.push_back(elt); cmps.push_back(cmp);
1936     }
1937   return ret;
1938 }
1939
1940 /*!
1941  * This method scan the two main structs along time of \a f0 and \a f1 to see if there are all lying on the same mesh along time than those in \a mesh.
1942  * \a f0 and \a f1 must be defined each only on a same spatial discretization even if this can be different each other.
1943  *
1944  * \throw If \a f0 or \a f1 has not only one spatial discretization set.
1945  * \throw If \a f0 or \a f1 change of spatial discretization along time.
1946  * \throw If \a f0 or \a f1 on a mesh with meshname different from those in \a mesh.
1947  * \thorw If \a f0 and \a f1 do not have the same times steps.
1948  * \throw If mesh is null.
1949  * \throw If \a f0 or \a f1 is null.
1950  * \sa MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport
1951  */
1952 int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1)
1953 {
1954   if(!mesh)
1955     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : input mesh is null !");
1956   if(!f0 || !f1)
1957     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : presence of null instance in fields over time !");
1958   if(f0->getMeshName()!=mesh->getName())
1959     {
1960       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh \""<< f0->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
1961       throw INTERP_KERNEL::Exception(oss.str());
1962     }
1963   if(f1->getMeshName()!=mesh->getName())
1964     {
1965       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
1966       throw INTERP_KERNEL::Exception(oss.str());
1967     }
1968   int nts=f0->getNumberOfTS();
1969   if(nts!=f1->getNumberOfTS())
1970     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !");
1971   if(nts==0)
1972     return nts;
1973   for(int i=0;i<nts;i++)
1974     {
1975       MCAuto<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
1976       MCAuto<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
1977       std::vector<TypeOfField> tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable());
1978       if(tofs0.size()!=1 || tofs1.size()!=1)
1979         throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !");
1980       if(i!=0)
1981         {
1982           if(tof0!=tofs0[0] || tof1!=tofs1[0])
1983             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : Across times steps MEDFileAnyTypeFieldMultiTS instances have to keep the same unique spatial discretization !");
1984         }
1985       else
1986         { tof0=tofs0[0]; tof1=tofs1[0]; }
1987       if(f0cur->getMeshIteration()!=mesh->getIteration() || f0cur->getMeshOrder()!=mesh->getOrder())
1988         {
1989           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh time step (" << f0cur->getMeshIteration() << ","<< f0cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
1990           throw INTERP_KERNEL::Exception(oss.str());
1991         }
1992       if(f1cur->getMeshIteration()!=mesh->getIteration() || f1cur->getMeshOrder()!=mesh->getOrder())
1993         {
1994           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh time step (" << f1cur->getMeshIteration() << ","<< f1cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !";
1995           throw INTERP_KERNEL::Exception(oss.str());
1996         }
1997       if(f0cur->getIteration()!=f1cur->getIteration() || f0cur->getOrder()!=f1cur->getOrder())
1998         {
1999           std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : all the time steps must be the same ! it is not the case (" << f0cur->getIteration() << "," << f0cur->getOrder() << ")!=(" << f1cur->getIteration() << "," << f1cur->getOrder() << ") !";
2000           throw INTERP_KERNEL::Exception(oss.str());
2001         }
2002     }
2003   return nts;
2004 }
2005
2006 template<class T>
2007 MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2008 {
2009   MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
2010   if(f1tss.empty())
2011     throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !");
2012   std::size_t sz(f1tss.size()),i(0);
2013   std::vector< typename MLFieldTraits<T>::F1TSWSDAType const *> f1tsw(sz);
2014   for(typename std::vector< typename MLFieldTraits<T>::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++)
2015     {
2016       typename MLFieldTraits<T>::F1TSType const *elt(*it);
2017       if(!elt)
2018         throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !");
2019       f1tsw[i]=dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType const *>(elt->contentNotNullBase());
2020     }
2021   typename MLFieldTraits<T>::F1TSWSDAType *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
2022   if(!retc)
2023     throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !");
2024   retc->aggregate(f1tsw,dts);
2025   ret->setDtUnit(f1tss[0]->getDtUnit());
2026   return DynamicCast<typename MLFieldTraits<T>::F1TSType , MEDFileAnyTypeField1TS>(ret);
2027 }
2028
2029 template<class T>
2030 MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2031 {
2032   MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
2033   if(fmtss.empty())
2034     throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !");
2035   std::size_t sz(fmtss.size());
2036   for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2037     {
2038       typename MLFieldTraits<T>::FMTSType const *elt(*it);
2039       if(!elt)
2040         throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !");
2041     }
2042   int nbTS(fmtss[0]->getNumberOfTS());
2043   for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2044     if((*it)->getNumberOfTS()!=nbTS)
2045       throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !");
2046   for(int iterTS=0;iterTS<nbTS;iterTS++)
2047     {
2048       std::size_t i(0);
2049       std::vector< typename MLFieldTraits<T>::F1TSType const *> f1tss(sz);
2050       std::vector< MCAuto<typename MLFieldTraits<T>::F1TSType> > f1tss2(sz);
2051       for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++)
2052         { f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; }
2053       MCAuto<MEDFileAnyTypeField1TS> f1ts(AggregateHelperF1TS<T>(f1tss,dts));
2054       ret->pushBackTimeStep(f1ts);
2055       ret->setDtUnit(f1ts->getDtUnit());
2056     }
2057   return DynamicCast<typename MLFieldTraits<T>::FMTSType , MEDFileAnyTypeFieldMultiTS>(ret);
2058 }
2059
2060 /*!
2061  * \a dts and \a ftmss are expected to have same size.
2062  */
2063 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2064 {
2065   if(fmtss.empty())
2066     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
2067   std::size_t sz(fmtss.size());
2068   std::vector<const MEDFileFieldMultiTS *> fmtss1;
2069   std::vector<const MEDFileInt32FieldMultiTS *> fmtss2;
2070   std::vector<const MEDFileInt64FieldMultiTS *> fmtss3;
2071   for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2072     {
2073       if(!(*it))
2074         throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !");
2075       const MEDFileFieldMultiTS *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(*it));
2076       if(elt1)
2077         {
2078           fmtss1.push_back(elt1);
2079           continue;
2080         }
2081       const MEDFileInt32FieldMultiTS *elt2(dynamic_cast<const MEDFileInt32FieldMultiTS *>(*it));
2082       if(elt2)
2083         {
2084           fmtss2.push_back(elt2);
2085           continue;
2086         }
2087       const MEDFileInt64FieldMultiTS *elt3(dynamic_cast<const MEDFileInt64FieldMultiTS *>(*it));
2088       if(elt3)
2089         {
2090           fmtss3.push_back(elt3);
2091           continue;
2092         }
2093       throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !");
2094     }
2095   if(fmtss1.size()!=sz && fmtss2.size()!=sz && fmtss3.size()!=sz)
2096     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !");
2097   if(fmtss1.size()==sz)
2098     return AggregateHelperFMTS<double>(fmtss1,dts);
2099   if(fmtss2.size()!=sz)
2100     return AggregateHelperFMTS<Int32>(fmtss2,dts);
2101   if(fmtss3.size()!=sz)
2102     return AggregateHelperFMTS<Int64>(fmtss3,dts);
2103   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !");
2104 }
2105
2106 MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator()
2107 {
2108   return new MEDFileAnyTypeFieldMultiTSIterator(this);
2109 }
2110
2111 //= MEDFileFieldMultiTS
2112
2113 MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const
2114 {
2115   return new MEDFileFieldMultiTS(*this);
2116 }
2117
2118 /*!
2119  * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
2120  * following the given input policy.
2121  *
2122  * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
2123  *                            By default (true) the globals are deeply copied.
2124  * \return MEDFileInt32FieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
2125  */
2126 MEDFileInt32FieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
2127 {
2128   MCAuto<MEDFileInt32FieldMultiTS> ret;
2129   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
2130   if(content)
2131     {
2132       const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
2133       if(!contc)
2134         throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
2135       MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> newc(contc->convertToInt());
2136       ret=static_cast<MEDFileInt32FieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileInt32FieldMultiTSWithoutSDA *)newc));
2137     }
2138   else
2139     ret=MEDFileInt32FieldMultiTS::New();
2140   if(isDeepCpyGlobs)
2141     ret->deepCpyGlobs(*this);
2142   else
2143     ret->shallowCpyGlobs(*this);
2144   return ret.retn();
2145 }
2146
2147 MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
2148 try:MEDFileTemplateFieldMultiTS<double>(fid,loadAll,ms)
2149 {
2150 }
2151 catch(INTERP_KERNEL::Exception& e)
2152 { throw e; }
2153
2154 MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
2155 try:MEDFileTemplateFieldMultiTS<double>(fid,fieldName,loadAll,ms,entities)
2156 {
2157 }
2158 catch(INTERP_KERNEL::Exception& e)
2159 { throw e; }
2160
2161 MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<double>(other,shallowCopyOfContent)
2162 {
2163 }
2164
2165 std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
2166 {
2167   return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2168 }
2169
2170 //= MEDFileAnyTypeFieldMultiTSIterator
2171
2172 MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
2173 {
2174   if(fmts)
2175     {
2176       fmts->incrRef();
2177       _nb_iter=fmts->getNumberOfTS();
2178     }
2179 }
2180
2181 MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() 
2182 {
2183 }
2184
2185 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt()
2186 {
2187   if(_iter_id<_nb_iter)
2188     {
2189       MEDFileAnyTypeFieldMultiTS *fmts(_fmts);
2190       if(fmts)
2191         return fmts->getTimeStepAtPos(_iter_id++);
2192       else
2193         return 0;
2194     }
2195   else
2196     return 0;
2197 }
2198
2199 //= MEDFileInt32FieldMultiTS