Salome HOME
[EDF23738] : implementation in structure elements (SE) context of case of multiple...
[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 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileFieldMultiTSWithoutSDA::createNewWithSDA() const
1161 {
1162   MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
1163   return DynamicCast<MEDFileFieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
1164 }
1165
1166 //=
1167
1168 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileInt32FieldMultiTSWithoutSDA::createNewWithSDA() const
1169 {
1170   MCAuto<MEDFileInt32FieldMultiTS> ret(MEDFileInt32FieldMultiTS::New());
1171   return DynamicCast<MEDFileInt32FieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
1172 }
1173
1174 //=
1175
1176 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileInt64FieldMultiTSWithoutSDA::createNewWithSDA() const
1177 {
1178   MCAuto<MEDFileInt64FieldMultiTS> ret(MEDFileInt64FieldMultiTS::New());
1179   return DynamicCast<MEDFileInt64FieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
1180 }
1181
1182 //=
1183
1184 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileFloatFieldMultiTSWithoutSDA::createNewWithSDA() const
1185 {
1186   MCAuto<MEDFileFloatFieldMultiTS> ret(MEDFileFloatFieldMultiTS::New());
1187   return DynamicCast<MEDFileFloatFieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
1188 }
1189
1190 //= MEDFileAnyTypeFieldMultiTS
1191
1192 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
1193 {
1194 }
1195
1196 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
1197 try:MEDFileFieldGlobsReal(fid)
1198 {
1199   _content=BuildContentFrom(fid,loadAll,ms);
1200   loadGlobals(fid);
1201 }
1202 catch(INTERP_KERNEL::Exception& e)
1203 {
1204     throw e;
1205 }
1206
1207 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
1208 {
1209   med_field_type typcha;
1210   std::vector<std::string> infos;
1211   std::string dtunit;
1212   std::string meshName;
1213   int i(-1);
1214   MEDFileAnyTypeField1TS::LocateField(fid,fieldName,i,typcha,infos,dtunit,meshName);
1215   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
1216   switch(typcha)
1217   {
1218     case MED_FLOAT64:
1219       {
1220         ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1221         break;
1222       }
1223     case MED_INT32:
1224       {
1225         ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1226         break;
1227       }
1228     case MED_INT64:
1229       {
1230         ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1231         break;
1232       }
1233     case MED_FLOAT32:
1234       {
1235         ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1236         break;
1237       }
1238     case MED_INT:
1239       {
1240         if(sizeof(med_int)==sizeof(int))
1241           {
1242             ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
1243             break;
1244           }
1245       }
1246     default:
1247       {
1248         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] !";
1249         throw INTERP_KERNEL::Exception(oss.str());
1250       }
1251   }
1252   ret->setMeshName(meshName);
1253   ret->setDtUnit(dtunit.c_str());
1254   return ret.retn();
1255 }
1256
1257 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
1258 {
1259   med_field_type typcha;
1260   //
1261   std::vector<std::string> infos;
1262   std::string dtunit,fieldName,meshName;
1263   MEDFileAnyTypeField1TS::LocateField2(fid,0,true,fieldName,typcha,infos,dtunit,meshName);
1264   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret;
1265   switch(typcha)
1266   {
1267     case MED_FLOAT64:
1268       {
1269         ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1270         break;
1271       }
1272     case MED_INT32:
1273       {
1274         ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1275         break;
1276       }
1277     case MED_INT64:
1278       {
1279         ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1280         break;
1281       }
1282     case MED_FLOAT32:
1283       {
1284         ret=new MEDFileFloatFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1285         break;
1286       }
1287     case MED_INT:
1288       {
1289         if(sizeof(med_int)==sizeof(int))
1290           {
1291             ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
1292             break;
1293           }
1294       }
1295     default:
1296       {
1297         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] !";
1298         throw INTERP_KERNEL::Exception(oss.str());
1299       }
1300   }
1301   ret->setMeshName(meshName);
1302   ret->setDtUnit(dtunit.c_str());
1303   return ret.retn();
1304 }
1305
1306 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c)
1307 {
1308   if(!c)
1309     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
1310   if(dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(c))
1311     {
1312       MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
1313       ret->_content=c;  c->incrRef();
1314       return ret.retn();
1315     }
1316   if(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(c))
1317     {
1318       MCAuto<MEDFileInt32FieldMultiTS> ret(MEDFileInt32FieldMultiTS::New());
1319       ret->_content=c;  c->incrRef();
1320       return ret.retn();
1321     }
1322   if(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(c))
1323     {
1324       MCAuto<MEDFileInt64FieldMultiTS> ret(MEDFileInt64FieldMultiTS::New());
1325       ret->_content=c;  c->incrRef();
1326       return ret.retn();
1327     }
1328   if(dynamic_cast<const MEDFileFloatFieldMultiTSWithoutSDA *>(c))
1329     {
1330       MCAuto<MEDFileFloatFieldMultiTS> ret(MEDFileFloatFieldMultiTS::New());
1331       ret->_content=c;  c->incrRef();
1332       return ret.retn();
1333     }
1334   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 FLOAT32 and INT32 has been built but not intercepted !");
1335 }
1336
1337 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
1338 {
1339   MEDFileAnyTypeFieldMultiTS *ret(BuildNewInstanceFromContent(c));
1340   std::string fileName(FileNameFromFID(fid));
1341   ret->setFileName(fileName);
1342   return ret;
1343 }
1344
1345 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
1346 try:MEDFileFieldGlobsReal(fid)
1347 {
1348   _content=BuildContentFrom(fid,fieldName,loadAll,ms,entities);
1349   loadGlobals(fid);
1350 }
1351 catch(INTERP_KERNEL::Exception& e)
1352 {
1353     throw e;
1354 }
1355
1356 //= MEDFileAnyTypeFieldMultiTS
1357
1358 /*!
1359  * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of the first field
1360  * that has been read from a specified MED file.
1361  *  \param [in] fileName - the name of the MED file to read.
1362  *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
1363  *          is to delete this field using decrRef() as it is no more needed.
1364  *  \throw If reading the file fails.
1365  */
1366 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
1367 {
1368   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
1369   return New(fid,loadAll);
1370 }
1371
1372 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, bool loadAll)
1373 {
1374   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,loadAll,0));
1375   MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
1376   ret->loadGlobals(fid);
1377   return ret.retn();
1378 }
1379
1380 /*!
1381  * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of a given field
1382  * that has been read from a specified MED file.
1383  *  \param [in] fileName - the name of the MED file to read.
1384  *  \param [in] fieldName - the name of the field to read.
1385  *  \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
1386  *          is to delete this field using decrRef() as it is no more needed.
1387  *  \throw If reading the file fails.
1388  *  \throw If there is no field named \a fieldName in the file.
1389  */
1390 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
1391 {
1392   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
1393   return New(fid,fieldName,loadAll);
1394 }
1395
1396 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(med_idt fid, const std::string& fieldName, bool loadAll)
1397 {
1398   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c(BuildContentFrom(fid,fieldName,loadAll,0,0));
1399   MCAuto<MEDFileAnyTypeFieldMultiTS> ret(BuildNewInstanceFromContent(c,fid));
1400   ret->loadGlobals(fid);
1401   return ret.retn();
1402 }
1403
1404 /*!
1405  * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
1406  * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
1407  *
1408  * \warning this is a shallow copy constructor
1409  */
1410 MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent)
1411 {
1412   if(!shallowCopyOfContent)
1413     {
1414       const MEDFileAnyTypeFieldMultiTSWithoutSDA *otherPtr(&other);
1415       otherPtr->incrRef();
1416       _content=const_cast<MEDFileAnyTypeFieldMultiTSWithoutSDA *>(otherPtr);
1417     }
1418   else
1419     {
1420       _content=other.shallowCpy();
1421     }
1422 }
1423
1424 MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase()
1425 {
1426   MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
1427   if(!ret)
1428     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : content is expected to be not null !");
1429   return ret;
1430 }
1431
1432 const MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::contentNotNullBase() const
1433 {
1434   const MEDFileAnyTypeFieldMultiTSWithoutSDA *ret=_content;
1435   if(!ret)
1436     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS : const content is expected to be not null !");
1437   return ret;
1438 }
1439
1440 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsed() const
1441 {
1442   return contentNotNullBase()->getPflsReallyUsed2();
1443 }
1444
1445 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsed() const
1446 {
1447   return contentNotNullBase()->getLocsReallyUsed2();
1448 }
1449
1450 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getPflsReallyUsedMulti() const
1451 {
1452   return contentNotNullBase()->getPflsReallyUsedMulti2();
1453 }
1454
1455 std::vector<std::string> MEDFileAnyTypeFieldMultiTS::getLocsReallyUsedMulti() const
1456 {
1457   return contentNotNullBase()->getLocsReallyUsedMulti2();
1458 }
1459
1460 void MEDFileAnyTypeFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
1461 {
1462   contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
1463 }
1464
1465 void MEDFileAnyTypeFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
1466 {
1467   contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
1468 }
1469
1470 int MEDFileAnyTypeFieldMultiTS::getNumberOfTS() const
1471 {
1472   return contentNotNullBase()->getNumberOfTS();
1473 }
1474
1475 void MEDFileAnyTypeFieldMultiTS::eraseEmptyTS()
1476 {
1477   contentNotNullBase()->eraseEmptyTS();
1478 }
1479
1480 void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
1481 {
1482   contentNotNullBase()->eraseTimeStepIds(startIds,endIds);
1483 }
1484
1485 void MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds2(int bg, int end, int step)
1486 {
1487   contentNotNullBase()->eraseTimeStepIds2(bg,end,step);
1488 }
1489
1490 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPart(const int *startIds, const int *endIds) const
1491 {
1492   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds(startIds,endIds);
1493   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1494   ret->_content=c;
1495   return ret.retn();
1496 }
1497
1498 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::buildSubPartSlice(int bg, int end, int step) const
1499 {
1500   MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=contentNotNullBase()->buildFromTimeStepIds2(bg,end,step);
1501   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1502   ret->_content=c;
1503   return ret.retn();
1504 }
1505
1506 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getIterations() const
1507 {
1508   return contentNotNullBase()->getIterations();
1509 }
1510
1511 void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(const std::vector<MEDFileAnyTypeField1TS *>& f1ts)
1512 {
1513   for(std::vector<MEDFileAnyTypeField1TS *>::const_iterator it=f1ts.begin();it!=f1ts.end();it++)
1514     pushBackTimeStep(*it);
1515 }
1516
1517 void MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps(MEDFileAnyTypeFieldMultiTS *fmts)
1518 {
1519   if(!fmts)
1520     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::pushBackTimeSteps : Input fmts is NULL !");
1521   int nbOfTS(fmts->getNumberOfTS());
1522   for(int i=0;i<nbOfTS;i++)
1523     {
1524       MCAuto<MEDFileAnyTypeField1TS> elt(fmts->getTimeStepAtPos(i));
1525       pushBackTimeStep(elt);
1526     }
1527 }
1528
1529 void MEDFileAnyTypeFieldMultiTS::pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts)
1530 {
1531   if(!f1ts)
1532     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input pointer is NULL !");
1533   checkCoherencyOfType(f1ts);
1534   f1ts->incrRef();
1535   MCAuto<MEDFileAnyTypeField1TS> f1tsSafe(f1ts);
1536   MEDFileAnyTypeField1TSWithoutSDA *c=f1ts->contentNotNullBase();
1537   c->incrRef();
1538   MCAuto<MEDFileAnyTypeField1TSWithoutSDA> cSafe(c);
1539   if(!((MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content))
1540     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : no content in this !");
1541   _content->pushBackTimeStep(cSafe);
1542   appendGlobs(*f1ts,1e-12);
1543 }
1544
1545 void MEDFileAnyTypeFieldMultiTS::synchronizeNameScope()
1546 {
1547   contentNotNullBase()->synchronizeNameScope();
1548 }
1549
1550 int MEDFileAnyTypeFieldMultiTS::getPosOfTimeStep(int iteration, int order) const
1551 {
1552   return contentNotNullBase()->getPosOfTimeStep(iteration,order);
1553 }
1554
1555 int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const
1556 {
1557   return contentNotNullBase()->getPosGivenTime(time,eps);
1558 }
1559
1560 int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
1561 {
1562   return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
1563 }
1564
1565 std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFieldAvailable() const
1566 {
1567   return contentNotNullBase()->getTypesOfFieldAvailable();
1568 }
1569
1570 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
1571 {
1572   return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
1573 }
1574
1575 std::string MEDFileAnyTypeFieldMultiTS::getName() const
1576 {
1577   return contentNotNullBase()->getName();
1578 }
1579
1580 void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name)
1581 {
1582   contentNotNullBase()->setName(name);
1583 }
1584
1585 std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const
1586 {
1587   return contentNotNullBase()->getDtUnit();
1588 }
1589
1590 void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit)
1591 {
1592   contentNotNullBase()->setDtUnit(dtUnit);
1593 }
1594
1595 void MEDFileAnyTypeFieldMultiTS::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
1596 {
1597   contentNotNullBase()->simpleRepr(bkOffset,oss,fmtsId);
1598 }
1599
1600 std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTS::getTimeSteps(std::vector<double>& ret1) const
1601 {
1602   return contentNotNullBase()->getTimeSteps(ret1);
1603 }
1604
1605 std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const
1606 {
1607   return contentNotNullBase()->getMeshName();
1608 }
1609
1610 void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName)
1611 {
1612   contentNotNullBase()->setMeshName(newMeshName);
1613 }
1614
1615 bool MEDFileAnyTypeFieldMultiTS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
1616 {
1617   return contentNotNullBase()->changeMeshNames(modifTab);
1618 }
1619
1620 const std::vector<std::string>& MEDFileAnyTypeFieldMultiTS::getInfo() const
1621 {
1622   return contentNotNullBase()->getInfo();
1623 }
1624
1625 bool MEDFileAnyTypeFieldMultiTS::presenceOfMultiDiscPerGeoType() const
1626 {
1627   return contentNotNullBase()->presenceOfMultiDiscPerGeoType();
1628 }
1629
1630 void MEDFileAnyTypeFieldMultiTS::setInfo(const std::vector<std::string>& info)
1631 {
1632   return contentNotNullBase()->setInfo(info);
1633 }
1634
1635 int MEDFileAnyTypeFieldMultiTS::getNumberOfComponents() const
1636 {
1637   const std::vector<std::string> ret=getInfo();
1638   return (int)ret.size();
1639 }
1640
1641 void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const
1642 {
1643   writeGlobals(fid,*this);
1644   contentNotNullBase()->writeLL(fid,*this);
1645 }
1646
1647 /*!
1648  * This method alloc the arrays and load potentially huge arrays contained in this field.
1649  * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
1650  * This method can be also called to refresh or reinit values from a file.
1651  * 
1652  * \throw If the fileName is not set or points to a non readable MED file.
1653  */
1654 void MEDFileAnyTypeFieldMultiTS::loadArrays()
1655 {
1656   if(getFileName().empty())
1657     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
1658   MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
1659   contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
1660 }
1661
1662 /*!
1663  * This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
1664  * But once data loaded once, this method does nothing.
1665  * 
1666  * \throw If the fileName is not set or points to a non readable MED file.
1667  * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::unloadArrays
1668  */
1669 void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary()
1670 {
1671   if(!getFileName().empty())
1672     {
1673       MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(getFileName()));
1674       contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
1675     }
1676 }
1677
1678 /*!
1679  * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
1680  * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
1681  * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss instead.
1682  * 
1683  * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary, MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss
1684  */
1685 void MEDFileAnyTypeFieldMultiTS::unloadArrays()
1686 {
1687   contentNotNullBase()->unloadArrays();
1688 }
1689
1690 /*!
1691  * 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.
1692  * This method is the symmetrical method of MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary.
1693  * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
1694  * 
1695  * \sa MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
1696  */
1697 void MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss()
1698 {
1699   if(!getFileName().empty())
1700     contentNotNullBase()->unloadArrays();
1701 }
1702
1703 std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
1704 {
1705   std::ostringstream oss;
1706   contentNotNullBase()->simpleRepr(0,oss,-1);
1707   simpleReprGlobs(oss);
1708   return oss.str();
1709 }
1710
1711 std::size_t MEDFileAnyTypeFieldMultiTS::getHeapMemorySizeWithoutChildren() const
1712 {
1713   return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren();
1714 }
1715
1716 std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTS::getDirectChildrenWithNull() const
1717 {
1718   std::vector<const BigMemoryObject *> ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull());
1719   ret.push_back((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content);
1720   return ret;
1721 }
1722
1723 /*!
1724  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of components in \a this.
1725  * The returned instances are deep copy of \a this except that for globals that are shared with those contained in \a this.
1726  * ** WARNING ** do no forget to rename the output instances to avoid to write n-times in the same MED file field !
1727  */
1728 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitComponents() const
1729 {
1730   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1731   if(!content)
1732     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitComponents : no content in this ! Unable to split components !");
1733   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit=content->splitComponents();
1734   std::size_t sz(contentsSplit.size());
1735   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1736   for(std::size_t i=0;i<sz;i++)
1737     {
1738       ret[i]=shallowCpy();
1739       ret[i]->_content=contentsSplit[i];
1740     }
1741   return ret;
1742 }
1743
1744 /*!
1745  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of discretizations over time steps in \a this.
1746  * The returned instances are shallow copied of \a this included globals that are shared with those contained in \a this.
1747  */
1748 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitDiscretizations() const
1749 {
1750   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1751   if(!content)
1752     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitDiscretizations : no content in this ! Unable to split discretizations !");
1753   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitDiscretizations());
1754   std::size_t sz(contentsSplit.size());
1755   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1756   for(std::size_t i=0;i<sz;i++)
1757     {
1758       ret[i]=shallowCpy();
1759       ret[i]->_content=contentsSplit[i];
1760     }
1761   return ret;
1762 }
1763
1764 /*!
1765  * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of sub-discretizations over time steps in \a this.
1766  * The returned instances are shallow copied of \a this included globals that are shared with those contained in \a this.
1767  */
1768 std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes() const
1769 {
1770   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
1771   if(!content)
1772     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretizations !");
1773   std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
1774   std::size_t sz(contentsSplit.size());
1775   std::vector< MCAuto< MEDFileAnyTypeFieldMultiTS > > ret(sz);
1776   for(std::size_t i=0;i<sz;i++)
1777     {
1778       ret[i]=shallowCpy();
1779       ret[i]->_content=contentsSplit[i];
1780     }
1781   return ret;
1782 }
1783
1784 MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::deepCopy() const
1785 {
1786   MCAuto<MEDFileAnyTypeFieldMultiTS> ret=shallowCpy();
1787   if((const MEDFileAnyTypeFieldMultiTSWithoutSDA *)_content)
1788     ret->_content=_content->deepCopy();
1789   ret->deepCpyGlobs(*this);
1790   return ret.retn();
1791 }
1792
1793 MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> MEDFileAnyTypeFieldMultiTS::getContent()
1794 {
1795   return _content;
1796 }
1797
1798 /*!
1799  * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
1800  *  \param [in] iteration - the iteration number of a required time step.
1801  *  \param [in] order - the iteration order number of required time step.
1802  *  \return MEDFileField1TS * or MEDFileInt32Field1TS *- a new instance of MEDFileField1TS or MEDFileInt32Field1TS. The caller is to
1803  *          delete this field using decrRef() as it is no more needed.
1804  *  \throw If there is no required time step in \a this field.
1805  */
1806 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStep(int iteration, int order) const
1807 {
1808   int pos=getPosOfTimeStep(iteration,order);
1809   return getTimeStepAtPos(pos);
1810 }
1811
1812 /*!
1813  * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
1814  *  \param [in] time - the time of the time step of interest.
1815  *  \param [in] eps - a precision used to compare time values.
1816  *  \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
1817  *          delete this field using decrRef() as it is no more needed.
1818  *  \throw If there is no required time step in \a this field.
1819  */
1820 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime(double time, double eps) const
1821 {
1822   int pos=getPosGivenTime(time,eps);
1823   return getTimeStepAtPos(pos);
1824 }
1825
1826 /*!
1827  * 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.
1828  * The float64 value of time attached to the pair of integers are not considered here.
1829  * WARNING the returned pointers are not incremented. The caller is \b not responsible to deallocate them ! This method only reorganizes entries in \a vectFMTS.
1830  *
1831  * \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
1832  * \throw If there is a null pointer in \a vectFMTS.
1833  */
1834 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS)
1835 {
1836   static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries : presence of null instance in input vector !";
1837   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1838   std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
1839   while(!lstFMTS.empty())
1840     {
1841       std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
1842       MEDFileAnyTypeFieldMultiTS *curIt(*it);
1843       if(!curIt)
1844         throw INTERP_KERNEL::Exception(msg);
1845       std::vector< std::pair<int,int> > refIts=curIt->getIterations();
1846       std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
1847       elt.push_back(curIt); it=lstFMTS.erase(it);
1848       while(it!=lstFMTS.end())
1849         {
1850           curIt=*it;
1851           if(!curIt)
1852             throw INTERP_KERNEL::Exception(msg);
1853           std::vector< std::pair<int,int> > curIts=curIt->getIterations();
1854           if(refIts==curIts)
1855             { elt.push_back(curIt); it=lstFMTS.erase(it); }
1856           else
1857             it++;
1858         }
1859       ret.push_back(elt);
1860     }
1861   return ret;
1862 }
1863
1864 /*!
1865  * This method splits the input list \a vectFMTS considering the aspect of the geometrical support over time.
1866  * All returned instances in a subvector can be safely loaded, rendered along time
1867  * All items must be defined on the same time step ids ( see MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries method ).
1868  * Each item in \a vectFMTS is expected to have one and exactly one spatial discretization along time.
1869  * 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).
1870  * All items in \a vectFMTS whose spatial discretization is not ON_NODES will appear once.
1871  * 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.
1872  *
1873  * \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().
1874  * \param [in] mesh - the mesh shared by all items in \a vectFMTS across time.
1875  * \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.
1876  * \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.
1877  *
1878  * \throw If an element in \a vectFMTS has not only one spatial discretization set.
1879  * \throw If an element in \a vectFMTS change of spatial discretization along time.
1880  * \throw If an element in \a vectFMTS lies on a mesh with meshname different from those in \a mesh.
1881  * \thorw If some elements in \a vectFMTS do not have the same times steps.
1882  * \throw If mesh is null.
1883  * \throw If an element in \a vectFMTS is null.
1884  * \sa MEDFileAnyTypeFieldMultiTS::AreOnSameSupportAcrossTime
1885  */
1886 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& fsc)
1887 {
1888   static const char msg[]="MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : presence of a null instance in the input vector !";
1889   if(!mesh)
1890     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : input mesh is null !");
1891   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1892   if(vectFMTS.empty())
1893     return ret;
1894   std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
1895   MEDFileAnyTypeFieldMultiTS *frstElt(*it);
1896   if(!frstElt)
1897     throw INTERP_KERNEL::Exception(msg);
1898   std::size_t i=0;
1899   std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNotNodes;
1900   std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNodes;
1901   for(;it!=vectFMTS.end();it++,i++)
1902     {
1903       if(!(*it))
1904         throw INTERP_KERNEL::Exception(msg);
1905       TypeOfField tof0,tof1;
1906       if(CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1)>0)
1907         {
1908           if(tof1!=ON_NODES)
1909             vectFMTSNotNodes.push_back(*it);
1910           else
1911             vectFMTSNodes.push_back(*it);
1912         }
1913       else
1914         vectFMTSNotNodes.push_back(*it);
1915     }
1916   std::vector< MCAuto<MEDFileFastCellSupportComparator> > cmps;
1917   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > retCell=SplitPerCommonSupportNotNodesAlg(vectFMTSNotNodes,mesh,cmps);
1918   ret=retCell;
1919   for(std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it2=vectFMTSNodes.begin();it2!=vectFMTSNodes.end();it2++)
1920     {
1921       i=0;
1922       bool isFetched(false);
1923       for(std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> >::const_iterator it0=retCell.begin();it0!=retCell.end();it0++,i++)
1924         {
1925           if((*it0).empty())
1926             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport : internal error !");
1927           if(cmps[i]->isCompatibleWithNodesDiscr(*it2))
1928             { ret[i].push_back(*it2); isFetched=true; }
1929         }
1930       if(!isFetched)
1931         {
1932           std::vector<MEDFileAnyTypeFieldMultiTS *> tmp(1,*it2);
1933           MCAuto<MEDFileMeshStruct> tmp2(MEDFileMeshStruct::New(mesh));
1934           ret.push_back(tmp); retCell.push_back(tmp); cmps.push_back(MEDFileFastCellSupportComparator::New(tmp2,*it2));
1935         }
1936     }
1937   fsc=cmps;
1938   return ret;
1939 }
1940
1941 /*!
1942  * 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.
1943  * \param [out] cmps - same size than the returned vector.
1944  */
1945 std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupportNotNodesAlg(const std::vector<MEDFileAnyTypeFieldMultiTS *>& vectFMTS, const MEDFileMesh *mesh, std::vector< MCAuto<MEDFileFastCellSupportComparator> >& cmps)
1946 {
1947   std::vector< std::vector<MEDFileAnyTypeFieldMultiTS *> > ret;
1948   std::list<MEDFileAnyTypeFieldMultiTS *> lstFMTS(vectFMTS.begin(),vectFMTS.end());
1949   while(!lstFMTS.empty())
1950     {
1951       std::list<MEDFileAnyTypeFieldMultiTS *>::iterator it(lstFMTS.begin());
1952       MEDFileAnyTypeFieldMultiTS *ref(*it);
1953       std::vector<MEDFileAnyTypeFieldMultiTS *> elt;
1954       elt.push_back(ref); it=lstFMTS.erase(it);
1955       MCAuto<MEDFileMeshStruct> mst(MEDFileMeshStruct::New(mesh));
1956       MCAuto<MEDFileFastCellSupportComparator> cmp(MEDFileFastCellSupportComparator::New(mst,ref));
1957       while(it!=lstFMTS.end())
1958         {
1959           MEDFileAnyTypeFieldMultiTS *curIt(*it);
1960           if(cmp->isEqual(curIt))
1961             { elt.push_back(curIt); it=lstFMTS.erase(it); }
1962           else
1963             it++;
1964         }
1965       ret.push_back(elt); cmps.push_back(cmp);
1966     }
1967   return ret;
1968 }
1969
1970 /*!
1971  * 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.
1972  * \a f0 and \a f1 must be defined each only on a same spatial discretization even if this can be different each other.
1973  *
1974  * \throw If \a f0 or \a f1 has not only one spatial discretization set.
1975  * \throw If \a f0 or \a f1 change of spatial discretization along time.
1976  * \throw If \a f0 or \a f1 on a mesh with meshname different from those in \a mesh.
1977  * \thorw If \a f0 and \a f1 do not have the same times steps.
1978  * \throw If mesh is null.
1979  * \throw If \a f0 or \a f1 is null.
1980  * \sa MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport
1981  */
1982 int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1)
1983 {
1984   if(!mesh)
1985     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : input mesh is null !");
1986   if(!f0 || !f1)
1987     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : presence of null instance in fields over time !");
1988   if(f0->getMeshName()!=mesh->getName())
1989     {
1990       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh \""<< f0->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
1991       throw INTERP_KERNEL::Exception(oss.str());
1992     }
1993   if(f1->getMeshName()!=mesh->getName())
1994     {
1995       std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !";
1996       throw INTERP_KERNEL::Exception(oss.str());
1997     }
1998   int nts=f0->getNumberOfTS();
1999   if(nts!=f1->getNumberOfTS())
2000     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : number of time steps are not the same !");
2001   if(nts==0)
2002     return nts;
2003   for(int i=0;i<nts;i++)
2004     {
2005       MCAuto<MEDFileAnyTypeField1TS> f0cur=f0->getTimeStepAtPos(i);
2006       MCAuto<MEDFileAnyTypeField1TS> f1cur=f1->getTimeStepAtPos(i);
2007       std::vector<TypeOfField> tofs0(f0cur->getTypesOfFieldAvailable()),tofs1(f1cur->getTypesOfFieldAvailable());
2008       if(tofs0.size()!=1 || tofs1.size()!=1)
2009         throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : All time steps must be defined on only one spatial discretization !");
2010       if(i!=0)
2011         {
2012           if(tof0!=tofs0[0] || tof1!=tofs1[0])
2013             throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : Across times steps MEDFileAnyTypeFieldMultiTS instances have to keep the same unique spatial discretization !");
2014         }
2015       else
2016         { tof0=tofs0[0]; tof1=tofs1[0]; }
2017       if(f0cur->getMeshIteration()!=mesh->getIteration() || f0cur->getMeshOrder()!=mesh->getOrder())
2018         {
2019           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() << ") !";
2020           throw INTERP_KERNEL::Exception(oss.str());
2021         }
2022       if(f1cur->getMeshIteration()!=mesh->getIteration() || f1cur->getMeshOrder()!=mesh->getOrder())
2023         {
2024           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() << ") !";
2025           throw INTERP_KERNEL::Exception(oss.str());
2026         }
2027       if(f0cur->getIteration()!=f1cur->getIteration() || f0cur->getOrder()!=f1cur->getOrder())
2028         {
2029           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() << ") !";
2030           throw INTERP_KERNEL::Exception(oss.str());
2031         }
2032     }
2033   return nts;
2034 }
2035
2036 template<class T>
2037 MCAuto<MEDFileAnyTypeField1TS> AggregateHelperF1TS(const std::vector< typename MLFieldTraits<T>::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2038 {
2039   MCAuto< typename MLFieldTraits<T>::F1TSType > ret(MLFieldTraits<T>::F1TSType::New());
2040   if(f1tss.empty())
2041     throw INTERP_KERNEL::Exception("AggregateHelperF1TS : empty vector !");
2042   std::size_t sz(f1tss.size()),i(0);
2043   std::vector< typename MLFieldTraits<T>::F1TSWSDAType const *> f1tsw(sz);
2044   for(typename std::vector< typename MLFieldTraits<T>::F1TSType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++,i++)
2045     {
2046       typename MLFieldTraits<T>::F1TSType const *elt(*it);
2047       if(!elt)
2048         throw INTERP_KERNEL::Exception("AggregateHelperF1TS : presence of a null pointer !");
2049       f1tsw[i]=dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType const *>(elt->contentNotNullBase());
2050     }
2051   typename MLFieldTraits<T>::F1TSWSDAType *retc(dynamic_cast<typename MLFieldTraits<T>::F1TSWSDAType *>(ret->contentNotNullBase()));
2052   if(!retc)
2053     throw INTERP_KERNEL::Exception("AggregateHelperF1TS : internal error 1 !");
2054   retc->aggregate(f1tsw,dts);
2055   ret->setDtUnit(f1tss[0]->getDtUnit());
2056   return DynamicCast<typename MLFieldTraits<T>::F1TSType , MEDFileAnyTypeField1TS>(ret);
2057 }
2058
2059 template<class T>
2060 MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits<T>::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2061 {
2062   MCAuto< typename MLFieldTraits<T>::FMTSType > ret(MLFieldTraits<T>::FMTSType::New());
2063   if(fmtss.empty())
2064     throw INTERP_KERNEL::Exception("AggregateHelperFMTS : empty vector !");
2065   std::size_t sz(fmtss.size());
2066   for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2067     {
2068       typename MLFieldTraits<T>::FMTSType const *elt(*it);
2069       if(!elt)
2070         throw INTERP_KERNEL::Exception("AggregateHelperFMTS : presence of null pointer !");
2071     }
2072   int nbTS(fmtss[0]->getNumberOfTS());
2073   for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2074     if((*it)->getNumberOfTS()!=nbTS)
2075       throw INTERP_KERNEL::Exception("AggregateHelperFMTS : all fields must have the same number of TS !");
2076   for(int iterTS=0;iterTS<nbTS;iterTS++)
2077     {
2078       std::size_t i(0);
2079       std::vector< typename MLFieldTraits<T>::F1TSType const *> f1tss(sz);
2080       std::vector< MCAuto<typename MLFieldTraits<T>::F1TSType> > f1tss2(sz);
2081       for(typename std::vector< typename MLFieldTraits<T>::FMTSType const *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++,i++)
2082         { f1tss2[i]=(*it)->getTimeStepAtPos(iterTS); f1tss[i]=f1tss2[i]; }
2083       MCAuto<MEDFileAnyTypeField1TS> f1ts(AggregateHelperF1TS<T>(f1tss,dts));
2084       ret->pushBackTimeStep(f1ts);
2085       ret->setDtUnit(f1ts->getDtUnit());
2086     }
2087   return DynamicCast<typename MLFieldTraits<T>::FMTSType , MEDFileAnyTypeFieldMultiTS>(ret);
2088 }
2089
2090 /*!
2091  * \a dts and \a ftmss are expected to have same size.
2092  * see MEDFileFieldPerMeshPerTypePerDisc::Aggregate for description of \a dts.
2093  */
2094 MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
2095 {
2096   if(fmtss.empty())
2097     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
2098   std::size_t sz(fmtss.size());
2099   std::vector<const MEDFileFieldMultiTS *> fmtss1;
2100   std::vector<const MEDFileInt32FieldMultiTS *> fmtss2;
2101   std::vector<const MEDFileInt64FieldMultiTS *> fmtss3;
2102   for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
2103     {
2104       if(!(*it))
2105         throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : presence of null instance in input vector !");
2106       const MEDFileFieldMultiTS *elt1(dynamic_cast<const MEDFileFieldMultiTS *>(*it));
2107       if(elt1)
2108         {
2109           fmtss1.push_back(elt1);
2110           continue;
2111         }
2112       const MEDFileInt32FieldMultiTS *elt2(dynamic_cast<const MEDFileInt32FieldMultiTS *>(*it));
2113       if(elt2)
2114         {
2115           fmtss2.push_back(elt2);
2116           continue;
2117         }
2118       const MEDFileInt64FieldMultiTS *elt3(dynamic_cast<const MEDFileInt64FieldMultiTS *>(*it));
2119       if(elt3)
2120         {
2121           fmtss3.push_back(elt3);
2122           continue;
2123         }
2124       throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !");
2125     }
2126   if(fmtss1.size()!=sz && fmtss2.size()!=sz && fmtss3.size()!=sz)
2127     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !");
2128   if(fmtss1.size()==sz)
2129     return AggregateHelperFMTS<double>(fmtss1,dts);
2130   if(fmtss2.size()!=sz)
2131     return AggregateHelperFMTS<Int32>(fmtss2,dts);
2132   if(fmtss3.size()!=sz)
2133     return AggregateHelperFMTS<Int64>(fmtss3,dts);
2134   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !");
2135 }
2136
2137 MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator()
2138 {
2139   return new MEDFileAnyTypeFieldMultiTSIterator(this);
2140 }
2141
2142 //= MEDFileFieldMultiTS
2143
2144 MEDFileAnyTypeFieldMultiTS *MEDFileFieldMultiTS::shallowCpy() const
2145 {
2146   return new MEDFileFieldMultiTS(*this);
2147 }
2148
2149 /*!
2150  * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
2151  * following the given input policy.
2152  *
2153  * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
2154  *                            By default (true) the globals are deeply copied.
2155  * \return MEDFileInt32FieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
2156  */
2157 MEDFileInt32FieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
2158 {
2159   MCAuto<MEDFileInt32FieldMultiTS> ret;
2160   const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
2161   if(content)
2162     {
2163       const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
2164       if(!contc)
2165         throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
2166       MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> newc(contc->convertToInt());
2167       ret=static_cast<MEDFileInt32FieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileInt32FieldMultiTSWithoutSDA *)newc));
2168     }
2169   else
2170     ret=MEDFileInt32FieldMultiTS::New();
2171   if(isDeepCpyGlobs)
2172     ret->deepCpyGlobs(*this);
2173   else
2174     ret->shallowCpyGlobs(*this);
2175   return ret.retn();
2176 }
2177
2178 MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
2179 try:MEDFileTemplateFieldMultiTS<double>(fid,loadAll,ms)
2180 {
2181 }
2182 catch(INTERP_KERNEL::Exception& e)
2183 { throw e; }
2184
2185 MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities)
2186 try:MEDFileTemplateFieldMultiTS<double>(fid,fieldName,loadAll,ms,entities)
2187 {
2188 }
2189 catch(INTERP_KERNEL::Exception& e)
2190 { throw e; }
2191
2192 MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<double>(other,shallowCopyOfContent)
2193 {
2194 }
2195
2196 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
2197 {
2198   return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
2199 }
2200
2201 //= MEDFileAnyTypeFieldMultiTSIterator
2202
2203 MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
2204 {
2205   if(fmts)
2206     {
2207       fmts->incrRef();
2208       _nb_iter=fmts->getNumberOfTS();
2209     }
2210 }
2211
2212 MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator() 
2213 {
2214 }
2215
2216 MEDFileAnyTypeField1TS *MEDFileAnyTypeFieldMultiTSIterator::nextt()
2217 {
2218   if(_iter_id<_nb_iter)
2219     {
2220       MEDFileAnyTypeFieldMultiTS *fmts(_fmts);
2221       if(fmts)
2222         return fmts->getTimeStepAtPos(_iter_id++);
2223       else
2224         return 0;
2225     }
2226   else
2227     return 0;
2228 }
2229
2230 //= MEDFileInt32FieldMultiTS