+std::vector<std::string> MEDFileAnyTypeField1TS::getLocsReallyUsedMulti() const
+{
+ return contentNotNullBase()->getLocsReallyUsedMulti2();
+}
+
+void MEDFileAnyTypeField1TS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+{
+ contentNotNullBase()->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileAnyTypeField1TS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+{
+ contentNotNullBase()->changeLocsRefsNamesGen2(mapOfModif);
+}
+
+int MEDFileAnyTypeField1TS::getDimension() const
+{
+ return contentNotNullBase()->getDimension();
+}
+
+int MEDFileAnyTypeField1TS::getIteration() const
+{
+ return contentNotNullBase()->getIteration();
+}
+
+int MEDFileAnyTypeField1TS::getOrder() const
+{
+ return contentNotNullBase()->getOrder();
+}
+
+double MEDFileAnyTypeField1TS::getTime(int& iteration, int& order) const
+{
+ return contentNotNullBase()->getTime(iteration,order);
+}
+
+void MEDFileAnyTypeField1TS::setTime(int iteration, int order, double val)
+{
+ contentNotNullBase()->setTime(iteration,order,val);
+}
+
+std::string MEDFileAnyTypeField1TS::getName() const
+{
+ return contentNotNullBase()->getName();
+}
+
+void MEDFileAnyTypeField1TS::setName(const std::string& name)
+{
+ contentNotNullBase()->setName(name);
+}
+
+void MEDFileAnyTypeField1TS::simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const
+{
+ contentNotNullBase()->simpleRepr(bkOffset,oss,f1tsId);
+}
+
+std::string MEDFileAnyTypeField1TS::getDtUnit() const
+{
+ return contentNotNullBase()->getDtUnit();
+}
+
+void MEDFileAnyTypeField1TS::setDtUnit(const std::string& dtUnit)
+{
+ contentNotNullBase()->setDtUnit(dtUnit);
+}
+
+std::string MEDFileAnyTypeField1TS::getMeshName() const
+{
+ return contentNotNullBase()->getMeshName();
+}
+
+void MEDFileAnyTypeField1TS::setMeshName(const std::string& newMeshName)
+{
+ contentNotNullBase()->setMeshName(newMeshName);
+}
+
+bool MEDFileAnyTypeField1TS::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
+{
+ return contentNotNullBase()->changeMeshNames(modifTab);
+}
+
+int MEDFileAnyTypeField1TS::getMeshIteration() const
+{
+ return contentNotNullBase()->getMeshIteration();
+}
+
+int MEDFileAnyTypeField1TS::getMeshOrder() const
+{
+ return contentNotNullBase()->getMeshOrder();
+}
+
+int MEDFileAnyTypeField1TS::getNumberOfComponents() const
+{
+ return contentNotNullBase()->getNumberOfComponents();
+}
+
+bool MEDFileAnyTypeField1TS::isDealingTS(int iteration, int order) const
+{
+ return contentNotNullBase()->isDealingTS(iteration,order);
+}
+
+std::pair<int,int> MEDFileAnyTypeField1TS::getDtIt() const
+{
+ return contentNotNullBase()->getDtIt();
+}
+
+void MEDFileAnyTypeField1TS::fillIteration(std::pair<int,int>& p) const
+{
+ contentNotNullBase()->fillIteration(p);
+}
+
+void MEDFileAnyTypeField1TS::fillTypesOfFieldAvailable(std::vector<TypeOfField>& types) const
+{
+ contentNotNullBase()->fillTypesOfFieldAvailable(types);
+}
+
+void MEDFileAnyTypeField1TS::setInfo(const std::vector<std::string>& infos)
+{
+ contentNotNullBase()->setInfo(infos);
+}
+
+const std::vector<std::string>& MEDFileAnyTypeField1TS::getInfo() const
+{
+ return contentNotNullBase()->getInfo();
+}
+std::vector<std::string>& MEDFileAnyTypeField1TS::getInfo()
+{
+ return contentNotNullBase()->getInfo();
+}
+
+bool MEDFileAnyTypeField1TS::presenceOfMultiDiscPerGeoType() const
+{
+ return contentNotNullBase()->presenceOfMultiDiscPerGeoType();
+}
+
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
+{
+ return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+}
+
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
+{
+ return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+}
+
+int MEDFileAnyTypeField1TS::getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const
+{
+ return contentNotNullBase()->getNonEmptyLevels(mname,levs);
+}
+
+std::vector<TypeOfField> MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() const
+{
+ return contentNotNullBase()->getTypesOfFieldAvailable();
+}
+
+std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(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
+{
+ return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+}
+
+/*!
+ * This method returns as MEDFileAnyTypeField1TS new instances as number of components in \a this.
+ * The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this.
+ * ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field !
+ */
+std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitComponents() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(!content)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitComponents : no content in this ! Unable to split components !");
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit=content->splitComponents();
+ std::size_t sz(contentsSplit.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ ret[i]=shallowCpy();
+ ret[i]->_content=contentsSplit[i];
+ }
+ return ret;
+}
+
+/*!
+ * This method returns as MEDFileAnyTypeField1TS new instances as number of spatial discretizations in \a this.
+ * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this.
+ */
+std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitDiscretizations() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(!content)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitDiscretizations : no content in this ! Unable to split discretization !");
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitDiscretizations());
+ std::size_t sz(contentsSplit.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ ret[i]=shallowCpy();
+ ret[i]->_content=contentsSplit[i];
+ }
+ return ret;
+}
+
+/*!
+ * This method returns as MEDFileAnyTypeField1TS new instances as number of maximal number of discretization in \a this.
+ * The returned instances are shallowed copied of \a this except that for globals that are share with those contained in \a this.
+ */
+std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(!content)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::splitMultiDiscrPerGeoTypes : no content in this ! Unable to split discretization !");
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
+ std::size_t sz(contentsSplit.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ ret[i]=shallowCpy();
+ ret[i]->_content=contentsSplit[i];
+ }
+ return ret;
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCpy() const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=shallowCpy();
+ if((const MEDFileAnyTypeField1TSWithoutSDA *)_content)
+ ret->_content=_content->deepCpy();
+ ret->deepCpyGlobs(*this);
+ return ret.retn();
+}
+
+int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+{
+ return contentNotNullBase()->copyTinyInfoFrom(field,arr);
+}
+
+//= MEDFileField1TS
+
+/*!
+ * Returns a new instance of MEDFileField1TS holding data of the first time step of
+ * the first field that has been read from a specified MED file.
+ * \param [in] fileName - the name of the MED file to read.
+ * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+ * is to delete this field using decrRef() as it is no more needed.
+ * \throw If reading the file fails.
+ */
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+/*!
+ * Returns a new instance of MEDFileField1TS holding data of the first time step of
+ * a given field that has been read from a specified MED file.
+ * \param [in] fileName - the name of the MED file to read.
+ * \param [in] fieldName - the name of the field to read.
+ * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+ * is to delete this field using decrRef() as it is no more needed.
+ * \throw If reading the file fails.
+ * \throw If there is no field named \a fieldName in the file.
+ */
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+/*!
+ * Returns a new instance of MEDFileField1TS holding data of a given time step of
+ * a given field that has been read from a specified MED file.
+ * \param [in] fileName - the name of the MED file to read.
+ * \param [in] fieldName - the name of the field to read.
+ * \param [in] iteration - the iteration number of a required time step.
+ * \param [in] order - the iteration order number of required time step.
+ * \return MEDFileField1TS * - a new instance of MEDFileFieldMultiTS. The caller
+ * is to delete this field using decrRef() as it is no more needed.
+ * \throw If reading the file fails.
+ * \throw If there is no field named \a fieldName in the file.
+ * \throw If the required time step is missing from the file.
+ */
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret(new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+/*!
+ * Returns a new instance of MEDFileField1TS. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+ * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+ *
+ * Returns a new instance of MEDFileField1TS holding either a shallow copy
+ * of a given MEDFileField1TSWithoutSDA ( \a other ) or \a other itself.
+ * \warning this is a shallow copy constructor
+ * \param [in] other - a MEDFileField1TSWithoutSDA to copy.
+ * \param [in] shallowCopyOfContent - if \c true, a shallow copy of \a other is created.
+ * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
+ * is to delete this field using decrRef() as it is no more needed.
+ */
+MEDFileField1TS *MEDFileField1TS::New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(other,shallowCopyOfContent);
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+/*!
+ * Returns a new empty instance of MEDFileField1TS.
+ * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller
+ * is to delete this field using decrRef() as it is no more needed.
+ */
+MEDFileField1TS *MEDFileField1TS::New()
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS;
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+/*!
+ * This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
+ * following the given input policy.
+ *
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * By default (true) the globals are deeply copied.
+ * \return MEDFileIntField1TS * - a new object that is the result of the conversion of \a this to int32 field.
+ */
+MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret;
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(content)
+ {
+ const MEDFileField1TSWithoutSDA *contc=dynamic_cast<const MEDFileField1TSWithoutSDA *>(content);
+ if(!contc)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TSWithoutSDA> newc(contc->convertToInt());
+ ret=static_cast<MEDFileIntField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileIntField1TSWithoutSDA *)newc,getFileName()));
+ }
+ else
+ ret=MEDFileIntField1TS::New();
+ if(isDeepCpyGlobs)
+ ret->deepCpyGlobs(*this);
+ else
+ ret->shallowCpyGlobs(*this);
+ return ret.retn();
+}
+
+const MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the content pointer is null !");
+ const MEDFileField1TSWithoutSDA *ret=dynamic_cast<const MEDFileField1TSWithoutSDA *>(pt);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
+ return ret;
+}
+
+MEDFileField1TSWithoutSDA *MEDFileField1TS::contentNotNull()
+{
+ MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the non const content pointer is null !");
+ MEDFileField1TSWithoutSDA *ret=dynamic_cast<MEDFileField1TSWithoutSDA *>(pt);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::contentNotNull : the non const content pointer is not null but it is not of type double ! Reason is maybe that the read field has not the type FLOAT64 !");
+ return ret;
+}
+
+void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+{
+ if(!f)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !");
+ if(!((DataArray*)arr))
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : no array !");
+ DataArrayDouble *arrOutC=dynamic_cast<DataArrayDouble *>((DataArray*)arr);
+ if(!arrOutC)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
+ f->setArray(arrOutC);
+}
+
+DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+{
+ if(!((DataArray*)arr))
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : no array !");
+ DataArrayDouble *arrOutC=dynamic_cast<DataArrayDouble *>((DataArray*)arr);
+ if(!arrOutC)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::ReturnSafelyDataArrayDouble : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
+ arrOutC->incrRef();
+ return arrOutC;
+}
+
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+/*!
+ * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+ * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+ *
+ * \warning this is a shallow copy constructor
+ */
+MEDFileField1TS::MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent)
+try:MEDFileAnyTypeField1TS(other,shallowCopyOfContent)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileField1TS::MEDFileField1TS()
+{
+ _content=new MEDFileField1TSWithoutSDA;
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on
+ * mesh entities of a given dimension of the first mesh in MED file. If \a this field
+ * has not been constructed via file reading, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If \a this field has not been constructed via file reading.
+ * \throw If the MED file is not readable.
+ * \throw If there is no mesh in the MED file.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ * \sa getFieldOnMeshAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull());
+ MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on
+ * the top level cells of the first mesh in MED file. If \a this field
+ * has not been constructed via file reading, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If \a this field has not been constructed via file reading.
+ * \throw If the MED file is not readable.
+ * \throw If there is no mesh in the MED file.
+ * \throw If no field values of the given \a type.
+ * \throw If no field values lying on the top level support.
+ * \sa getFieldAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull());
+ MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of given type lying on a given mesh.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of the new field.
+ * \param [in] mesh - the supporting mesh.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If the mesh is empty.
+ * \throw If no field values of the given \a type are available.
+ * \sa getFieldAtLevel()
+ * \sa getFieldOnMeshAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull());
+ MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] mesh - the supporting mesh.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ * \sa getFieldAtLevel()
+ * \sa getFieldOnMeshAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull());
+ MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
+ * This method is called "Old" because in MED3 norm a field has only one meshName
+ * attached, so this method is for readers of MED2 files. If \a this field
+ * has not been constructed via file reading, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] mName - a name of the supporting mesh.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If the MED file is not readable.
+ * \throw If there is no mesh named \a mName in the MED file.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+ * \throw If \a this field has not been constructed via file reading.
+ * \throw If no field of \a this is lying on the mesh named \a mName.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ * \sa getFieldAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
+ MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
+ return ret.retn();
+}
+
+/*!
+ * Returns values and a profile of the field of a given type lying on a given support.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of the field.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] mesh - the supporting mesh.
+ * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * field of interest lies on. If the field lies on all entities of the given
+ * dimension, all ids in \a pfl are zero. The caller is to delete this array
+ * using decrRef() as it is no more needed.
+ * \return DataArrayDouble * - a new instance of DataArrayDouble holding values of the
+ * field. The caller is to delete this array using decrRef() as it is no more needed.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ */
+DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> ret=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
+ return MEDFileField1TS::ReturnSafelyDataArrayDouble(ret);
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is
+ * checked if its elements are sorted suitable for writing to MED file ("STB" stands for
+ * "Sort By Type"), if not, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] field - the field to add to \a this.
+ * \throw If the name of \a field is empty.
+ * \throw If the data array of \a field is not set.
+ * \throw If the data array is already allocated but has different number of components
+ * than \a field.
+ * \throw If the underlying mesh of \a field has no name.
+ * \throw If elements in the mesh are not in the order suitable for writing to the MED file.
+ */
+void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field)
+{
+ setFileName("");
+ contentNotNull()->setFieldNoProfileSBT(field,field->getArray(),*this,*contentNotNull());
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. As described in \ref MEDLoaderMainC a field in MED file sense
+ * can be an aggregation of several MEDCouplingFieldDouble instances.
+ * The mesh support of input parameter \a field is ignored here, it can be NULL.
+ * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
+ * and \a profile.
+ *
+ * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
+ * A new profile is added only if no equal profile is missing.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] field - the field to add to \a this. The mesh support of field is ignored.
+ * \param [in] mesh - the supporting mesh of \a field.
+ * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
+ * \param [in] profile - ids of mesh entities on which corresponding field values lie.
+ * \throw If either \a field or \a mesh or \a profile has an empty name.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+ * \throw If the data array of \a field is not set.
+ * \throw If the data array of \a this is already allocated but has different number of
+ * components than \a field.
+ * \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
+ * \sa setFieldNoProfileSBT()
+ */
+void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+{
+ setFileName("");
+ contentNotNull()->setFieldProfile(field,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+}
+
+MEDFileAnyTypeField1TS *MEDFileField1TS::shallowCpy() const
+{
+ return new MEDFileField1TS(*this);
+}
+
+DataArrayDouble *MEDFileField1TS::getUndergroundDataArray() const
+{
+ return contentNotNull()->getUndergroundDataArrayDouble();
+}
+
+DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ return contentNotNull()->getUndergroundDataArrayDoubleExt(entries);
+}
+
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(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
+{
+ return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
+}
+
+//= MEDFileIntField1TS
+
+MEDFileIntField1TS *MEDFileIntField1TS::New()
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS;
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(other,shallowCopyOfContent);
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS::MEDFileIntField1TS()
+{
+ _content=new MEDFileIntField1TSWithoutSDA;
+}
+
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll,ms)
+{
+}
+catch(INTERP_KERNEL::Exception& e)
+{ throw e; }
+
+/*!
+ * This constructor is a shallow copy constructor. If \a shallowCopyOfContent is true the content of \a other is shallow copied.
+ * If \a shallowCopyOfContent is false, \a other is taken to be the content of \a this.
+ *
+ * \warning this is a shallow copy constructor
+ */
+MEDFileIntField1TS::MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent)
+{
+}
+
+MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const
+{
+ return new MEDFileIntField1TS(*this);
+}
+
+/*!
+ * This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
+ * following the given input policy.
+ *
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * By default (true) the globals are deeply copied.
+ * \return MEDFileField1TS * - a new object that is the result of the conversion of \a this to float64 field.
+ */
+MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret;
+ const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
+ if(content)
+ {
+ const MEDFileIntField1TSWithoutSDA *contc=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(content);
+ if(!contc)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::convertToInt : the content inside this is not INT32 ! This is incoherent !");
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA> newc(contc->convertToDouble());
+ ret=static_cast<MEDFileField1TS *>(MEDFileAnyTypeField1TS::BuildNewInstanceFromContent((MEDFileField1TSWithoutSDA *)newc,getFileName()));
+ }
+ else
+ ret=MEDFileField1TS::New();
+ if(isDeepCpyGlobs)
+ ret->deepCpyGlobs(*this);
+ else
+ ret->shallowCpyGlobs(*this);
+ return ret.retn();
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is
+ * checked if its elements are sorted suitable for writing to MED file ("STB" stands for
+ * "Sort By Type"), if not, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] field - the field to add to \a this. The field double values are ignored.
+ * \param [in] arrOfVals - the values of the field \a field used.
+ * \throw If the name of \a field is empty.
+ * \throw If the data array of \a field is not set.
+ * \throw If the data array is already allocated but has different number of components
+ * than \a field.
+ * \throw If the underlying mesh of \a field has no name.
+ * \throw If elements in the mesh are not in the order suitable for writing to the MED file.
+ */
+void MEDFileIntField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals)
+{
+ setFileName("");
+ contentNotNull()->setFieldNoProfileSBT(field,arrOfVals,*this,*contentNotNull());
+}
+
+/*!
+ * Adds a MEDCouplingFieldDouble to \a this. As described in \ref MEDLoaderMainC a field in MED file sense
+ * can be an aggregation of several MEDCouplingFieldDouble instances.
+ * The mesh support of input parameter \a field is ignored here, it can be NULL.
+ * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax,
+ * and \a profile.
+ *
+ * This method will check that the field based on the computed support is coherent. If not an exception will be thrown.
+ * A new profile is added only if no equal profile is missing.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] field - the field to add to \a this. The field double values and mesh support are ignored.
+ * \param [in] arrOfVals - the values of the field \a field used.
+ * \param [in] mesh - the supporting mesh of \a field.
+ * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES).
+ * \param [in] profile - ids of mesh entities on which corresponding field values lie.
+ * \throw If either \a field or \a mesh or \a profile has an empty name.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+ * \throw If the data array of \a field is not set.
+ * \throw If the data array of \a this is already allocated but has different number of
+ * components than \a field.
+ * \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
+ * \sa setFieldNoProfileSBT()
+ */
+void MEDFileIntField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+{
+ setFileName("");
+ contentNotNull()->setFieldProfile(field,arrOfVals,mesh,meshDimRelToMax,profile,*this,*contentNotNull());
+}
+
+const MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the content pointer is null !");
+ const MEDFileIntField1TSWithoutSDA *ret=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(pt);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the content pointer is not null but it is not of type int32 ! Reason is maybe that the read field has not the type INT32 !");
+ return ret;
+}
+
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut2;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull());
+ DataArrayInt *arrOutC=dynamic_cast<DataArrayInt *>((DataArray *)arrOut2);
+ if(!arrOutC)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !");
+ arrOut=arrOutC;
+ arrOut->incrRef(); // arrOut2 dies at the end of the func
+ return ret.retn();
+}
+
+DataArrayInt *MEDFileIntField1TS::ReturnSafelyDataArrayInt(MEDCouplingAutoRefCountObjectPtr<DataArray>& arr)
+{
+ if(!((DataArray *)arr))
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is NULL !");
+ DataArrayInt *arrC=dynamic_cast<DataArrayInt *>((DataArray *)arr);
+ if(!arrC)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::ReturnSafelyDataArrayInt : input DataArray is not of type INT32 !");
+ arrC->incrRef();
+ return arrC;
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on
+ * the top level cells of the first mesh in MED file. If \a this field
+ * has not been constructed via file reading, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [out] arrOut - the DataArrayInt containing values of field.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If \a this field has not been constructed via file reading.
+ * \throw If the MED file is not readable.
+ * \throw If there is no mesh in the MED file.
+ * \throw If no field values of the given \a type.
+ * \throw If no field values lying on the top level support.
+ * \sa getFieldAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull());
+ arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of given type lying on a given mesh.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of the new field.
+ * \param [in] mesh - the supporting mesh.
+ * \param [out] arrOut - the DataArrayInt containing values of field.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If the mesh is empty.
+ * \throw If no field values of the given \a type are available.
+ * \sa getFieldAtLevel()
+ * \sa getFieldOnMeshAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNull());
+ arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [out] arrOut - the DataArrayInt containing values of field.
+ * \param [in] mesh - the supporting mesh.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ * \sa getFieldAtLevel()
+ * \sa getFieldOnMeshAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNull());
+ arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+ return ret.retn();
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on a given support.
+ * This method is called "Old" because in MED3 norm a field has only one meshName
+ * attached, so this method is for readers of MED2 files. If \a this field
+ * has not been constructed via file reading, an exception is thrown.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of interest.
+ * \param [in] mName - a name of the supporting mesh.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [out] arrOut - the DataArrayInt containing values of field.
+ * \param [in] renumPol - specifies how to permute values of the result field according to
+ * the optional numbers of cells and nodes, if any. The valid values are
+ * - 0 - do not permute.
+ * - 1 - permute cells.
+ * - 2 - permute nodes.
+ * - 3 - permute cells and nodes.
+ *
+ * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The
+ * caller is to delete this field using decrRef() as it is no more needed.
+ * \throw If the MED file is not readable.
+ * \throw If there is no mesh named \a mName in the MED file.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh.
+ * \throw If \a this field has not been constructed via file reading.
+ * \throw If no field of \a this is lying on the mesh named \a mName.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ * \sa getFieldAtLevel()
+ */
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNull());
+ arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+ return ret.retn();
+}
+
+/*!
+ * Returns values and a profile of the field of a given type lying on a given support.
+ * For more info, see \ref AdvMEDLoaderAPIFieldRW
+ * \param [in] type - a spatial discretization of the field.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] mesh - the supporting mesh.
+ * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the
+ * field of interest lies on. If the field lies on all entities of the given
+ * dimension, all ids in \a pfl are zero. The caller is to delete this array
+ * using decrRef() as it is no more needed.
+ * \return DataArrayInt * - a new instance of DataArrayInt holding values of the
+ * field. The caller is to delete this array using decrRef() as it is no more needed.
+ * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh.
+ * \throw If no field of \a this is lying on \a mesh.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ */
+DataArrayInt *MEDFileIntField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArray> arr=contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull());
+ return MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
+}
+
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TS::contentNotNull()
+{
+ MEDFileAnyTypeField1TSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the non const content pointer is null !");
+ MEDFileIntField1TSWithoutSDA *ret=dynamic_cast<MEDFileIntField1TSWithoutSDA *>(pt);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::contentNotNull : the non const content pointer is not null but it is not of type int32 ! Reason is maybe that the read field has not the type INT32 !");
+ return ret;
+}
+
+DataArrayInt *MEDFileIntField1TS::getUndergroundDataArray() const
+{
+ return contentNotNull()->getUndergroundDataArrayInt();
+}
+
+//= MEDFileAnyTypeFieldMultiTSWithoutSDA
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
+{
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileFieldNameScope(fieldName)
+{
+}
+
+/*!
+ * \param [in] fieldId field id in C mode
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities)
+{
+ med_field_type typcha;
+ std::string dtunitOut;
+ int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,"",fieldId,false,_name,typcha,_infos,dtunitOut);
+ setDtUnit(dtunitOut.c_str());
+ loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll,ms,entities);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities)
+try:MEDFileFieldNameScope(fieldName),_infos(infos)
+{
+ setDtUnit(dtunit.c_str());
+ loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll,ms,entities);
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+ throw e;
+}
+
+std::size_t MEDFileAnyTypeFieldMultiTSWithoutSDA::getHeapMemorySizeWithoutChildren() const
+{
+ std::size_t ret(_name.capacity()+_infos.capacity()*sizeof(std::string)+_time_steps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutSDA>));
+ for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+ ret+=(*it).capacity();
+ return ret;
+}
+
+std::vector<const BigMemoryObject *> MEDFileAnyTypeFieldMultiTSWithoutSDA::getDirectChildrenWithNull() const
+{
+ std::vector<const BigMemoryObject *> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)*it);
+ return ret;
+}
+
+/*!
+ * 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
+ * NULL.
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds(const int *startIds, const int *endIds) const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+ ret->setInfo(_infos);
+ int sz=(int)_time_steps.size();
+ for(const int *id=startIds;id!=endIds;id++)
+ {
+ if(*id>=0 && *id<sz)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[*id];
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+ if(tse)
+ {
+ tse->incrRef();
+ tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
+ }
+ ret->pushBackTimeStep(tse2);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << std::distance(startIds,id) << " value is " << *id;
+ oss << " ! Should be in [0," << sz << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(ret->getNumberOfTS()>0)
+ ret->synchronizeNameScope();
+ ret->copyNameScope(*this);
+ return ret.retn();
+}
+
+/*!
+ * 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
+ * NULL.
+ */
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const
+{
+ static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2";
+ int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=createNew();
+ ret->setInfo(_infos);
+ int sz=(int)_time_steps.size();
+ int j=bg;
+ for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
+ {
+ if(j>=0 && j<sz)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> tse2;
+ if(tse)
+ {
+ tse->incrRef();
+ tse2=(const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(tse));
+ }
+ ret->pushBackTimeStep(tse2);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << i << " value is " << j;
+ oss << " ! Should be in [0," << sz << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(ret->getNumberOfTS()>0)
+ ret->synchronizeNameScope();
+ ret->copyNameScope(*this);
+ return ret.retn();
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
+{
+ int id=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+ if(!cur)
+ continue;
+ std::pair<int,int> p(cur->getIteration(),cur->getOrder());
+ if(std::find(timeSteps.begin(),timeSteps.end(),p)!=timeSteps.end())
+ ids->pushBackSilent(id);
+ }
+ return buildFromTimeStepIds(ids->begin(),ids->end());
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const
+{
+ int id=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+ if(!cur)
+ continue;
+ std::pair<int,int> p(cur->getIteration(),cur->getOrder());
+ if(std::find(timeSteps.begin(),timeSteps.end(),p)==timeSteps.end())
+ ids->pushBackSilent(id);
+ }
+ return buildFromTimeStepIds(ids->begin(),ids->end());
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+ if(!cur)
+ continue;
+ if(cur->presenceOfMultiDiscPerGeoType())
+ return true;
+ }
+ return false;
+}
+
+const std::vector<std::string>& MEDFileAnyTypeFieldMultiTSWithoutSDA::getInfo() const
+{
+ return _infos;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setInfo(const std::vector<std::string>& info)
+{
+ _infos=info;
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int order) const
+{
+ int ret=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *pt(*it);
+ if(pt->isDealingTS(iteration,order))
+ return ret;
+ }
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepPos : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
+ std::vector< std::pair<int,int> > vp=getIterations();
+ for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
+ oss << "(" << (*it2).first << "," << (*it2).second << ") ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const
+{
+ return *_time_steps[getTimeStepPos(iteration,order)];
+}
+
+MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order)
+{
+ return *_time_steps[getTimeStepPos(iteration,order)];
+}
+
+std::string MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshName() const
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::getMeshName : not time steps !");
+ return _time_steps[0]->getMeshName();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMeshName)
+{
+ std::string oldName(getMeshName());
+ std::vector< std::pair<std::string,std::string> > v(1);
+ v[0].first=oldName; v[0].second=newMeshName;
+ changeMeshNames(v);
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab)
+{
+ bool ret=false;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *cur(*it);
+ if(cur)
+ ret=cur->changeMeshNames(modifTab) || ret;
+ }
+ return ret;
+}
+
+/*!
+ * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArray
+ */
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int iteration, int order) const
+{
+ return getTimeStepEntry(iteration,order).getUndergroundDataArray();
+}
+
+/*!
+ * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt
+ */
+DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+ MEDFileFieldGlobsReal& glob)
+{
+ bool ret=false;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *f1ts(*it);
+ if(f1ts)
+ ret=f1ts->renumberEntitiesLyingOnMesh(meshName,oldCode,newCode,renumO2N,glob) || ret;
+ }
+ return ret;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const
+{
+ std::string startLine(bkOffset,' ');
+ oss << startLine << "Field multi time steps [Type=" << getTypeStr() << "]";
+ if(fmtsId>=0)
+ oss << " (" << fmtsId << ")";
+ oss << " has the following name: \"" << _name << "\"." << std::endl;
+ oss << startLine << "Field multi time steps has " << _infos.size() << " components with the following infos :" << std::endl;
+ for(std::vector<std::string>::const_iterator it=_infos.begin();it!=_infos.end();it++)
+ {
+ oss << startLine << " - \"" << *it << "\"" << std::endl;
+ }
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ {
+ std::string chapter(17,'0'+i);
+ oss << startLine << chapter << std::endl;
+ const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
+ if(cur)
+ cur->simpleRepr(bkOffset+2,oss,i);
+ else
+ oss << startLine << " Field on one time step #" << i << " is not defined !" << std::endl;
+ oss << startLine << chapter << std::endl;
+ }
+}
+
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeSteps(std::vector<double>& ret1) const
+{
+ std::size_t sz=_time_steps.size();
+ std::vector< std::pair<int,int> > ret(sz);
+ ret1.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *f1ts=_time_steps[i];
+ if(f1ts)
+ {
+ ret1[i]=f1ts->getTime(ret[i].first,ret[i].second);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeSteps : At rank #" << i << " time step is not defined. Invoke eraseEmptyTS method !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse)
+{
+ MEDFileAnyTypeField1TSWithoutSDA *tse2(tse);
+ if(!tse2)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::pushBackTimeStep : input content object is null !");
+ checkCoherencyOfType(tse2);
+ if(_time_steps.empty())
+ {
+ setName(tse2->getName().c_str());
+ setInfo(tse2->getInfo());
+ }
+ checkThatComponentsMatch(tse2->getInfo());
+ _time_steps.push_back(tse);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope()
+{
+ std::size_t nbOfCompo=_infos.size();
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
+ if(cur)
+ {
+ if((cur->getInfo()).size()!=nbOfCompo)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope : Mismatch in the number of components of parts ! Should be " << nbOfCompo;
+ oss << " ! but the field at iteration=" << cur->getIteration() << " order=" << cur->getOrder() << " has " << (cur->getInfo()).size() << " components !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ cur->copyNameScope(*this);
+ }
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities)
+{
+ _time_steps.resize(nbPdt);
+ for(int i=0;i<nbPdt;i++)
+ {
+ std::vector< std::pair<int,int> > ts;
+ med_int numdt=0,numo=0;
+ med_int meshIt=0,meshOrder=0;
+ med_float dt=0.0;
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepMeshInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder));
+ switch(fieldTyp)
+ {
+ case MED_FLOAT64:
+ {
+ _time_steps[i]=MEDFileField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos);
+ break;
+ }
+ case MED_INT32:
+ {
+ _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(_name.c_str(),i+1,numdt,numo,_infos);
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32 !");
+ }
+ if(loadAll)
+ _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entities);
+ else
+ _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this,ms,entities);
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWritable& opts) const
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !");
+ checkThatNbOfCompoOfTSMatchThis();
+ std::vector<std::string> infos(getInfo());
+ int nbComp=infos.size();
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ for(int i=0;i<nbComp;i++)
+ {
+ std::string info=infos[i];
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,opts.getTooLongStrPolicy());
+ }
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ int nbOfTS=_time_steps.size();
+ for(int i=0;i<nbOfTS;i++)
+ _time_steps[i]->writeLL(fid,opts,*this);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursively(fid,nasc);
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays()
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->unloadArrays();
+ }
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
+{
+ return _time_steps.size();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS()
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *tmp=(*it);
+ if(tmp)
+ newTS.push_back(*it);
+ }
+ _time_steps=newTS;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, const int *endIds)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ int maxId=(int)_time_steps.size();
+ int ii=0;
+ std::set<int> idsToDel;
+ for(const int *id=startIds;id!=endIds;id++,ii++)
+ {
+ if(*id>=0 && *id<maxId)
+ {
+ idsToDel.insert(*id);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds : At pos #" << ii << " request for id=" << *id << " not in [0," << maxId << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ for(int iii=0;iii<maxId;iii++)
+ if(idsToDel.find(iii)==idsToDel.end())
+ newTS.push_back(_time_steps[iii]);
+ _time_steps=newTS;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step)
+{
+ static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2";
+ int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg);
+ if(nbOfEntriesToKill==0)
+ return ;
+ std::size_t sz=_time_steps.size();
+ std::vector<bool> b(sz,true);
+ int j=bg;
+ for(int i=0;i<nbOfEntriesToKill;i++,j+=step)
+ b[j]=false;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ for(std::size_t i=0;i<sz;i++)
+ if(b[i])
+ newTS.push_back(_time_steps[i]);
+ _time_steps=newTS;
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const
+{
+ int ret=0;
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : ";
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
+ if(tmp)
+ {
+ int it2,ord;
+ tmp->getTime(it2,ord);
+ if(it2==iteration && order==ord)
+ return ret;
+ else
+ oss << "(" << it2 << "," << ord << "), ";
+ }
+ }
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosGivenTime(double time, double eps) const
+{
+ int ret=0;
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosGivenTime : No such time step " << time << "! \nPossibilities are : ";
+ oss.precision(15);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
+ if(tmp)
+ {
+ int it2,ord;
+ double ti=tmp->getTime(it2,ord);
+ if(fabs(time-ti)<eps)
+ return ret;
+ else
+ oss << ti << ", ";
+ }
+ }
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const
+{
+ int lgth=_time_steps.size();
+ std::vector< std::pair<int,int> > ret(lgth);
+ for(int i=0;i<lgth;i++)
+ _time_steps[i]->fillIteration(ret[i]);
+ return ret;
+}
+
+/*!
+ * 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'
+ * This method returns two things.
+ * - The absolute dimension of 'this' in first parameter.
+ * - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative
+ * to the first output parameter. The values in 'levs' will be returned in decreasing order.
+ *
+ * This method is designed for MEDFileFieldMultiTS instances that have a discritization ON_CELLS, ON_GAUSS_NE and ON_GAUSS.
+ * Only these 3 discretizations will be taken into account here.
+ *
+ * If 'this' is empty this method will throw an INTERP_KERNEL::Exception.
+ * If there is \b only node fields defined in 'this' -1 is returned and 'levs' output parameter will be empty. In this
+ * case the caller has to know the underlying mesh it refers to. By defaut it is the level 0 of the corresponding mesh.
+ *
+ * This method is usefull to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'.
+ * 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'.
+ *
+ * Let's consider the typical following case :
+ * - a mesh 'm1' has a meshDimension 3 and has the following non empty levels
+ * [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2
+ * - 'f1' lies on 'm1' and is defined on 3D and 1D cells for example
+ * TETRA4 and SEG2
+ * - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2
+ *
+ * In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1])
+ *
+ * To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev
+ * To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev
+ * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
+ * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev
+ */
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
+{
+ return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
+}
+
+const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos) const
+{
+ if(pos<0 || pos>=(int)_time_steps.size())
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
+ if(item==0)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
+ oss << "\nTry to use following method eraseEmptyTS !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return item;
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2(int pos)
+{
+ if(pos<0 || pos>=(int)_time_steps.size())
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos];
+ if(item==0)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !";
+ oss << "\nTry to use following method eraseEmptyTS !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return item;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getPflsReallyUsedMulti2() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileAnyTypeFieldMultiTSWithoutSDA::getLocsReallyUsedMulti2() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TSWithoutSDA > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changeLocsRefsNamesGen2(mapOfModif);
+}
+
+std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const
+{
+ int lgth=_time_steps.size();
+ std::vector< std::vector<TypeOfField> > ret(lgth);
+ for(int i=0;i<lgth;i++)
+ _time_steps[i]->fillTypesOfFieldAvailable(ret[i]);
+ return ret;
+}
+
+/*!
+ * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
+ */
+std::vector< std::vector< std::pair<int,int> > > 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
+{
+ return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
+}
+
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::deepCpy() const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
+ std::size_t i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ {
+ if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
+ ret->_time_steps[i]=(*it)->deepCpy();
+ }
+ return ret.retn();
+}
+
+std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
+{
+ std::size_t sz(_infos.size()),sz2(_time_steps.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
+ std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > ts(sz2);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ ret[i]=shallowCpy();
+ ret[i]->_infos.resize(1); ret[i]->_infos[0]=_infos[i];
+ }
+ for(std::size_t i=0;i<sz2;i++)
+ {
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > ret1=_time_steps[i]->splitComponents();
+ if(ret1.size()!=sz)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ ts[i]=ret1;
+ }
+ for(std::size_t i=0;i<sz;i++)
+ for(std::size_t j=0;j<sz2;j++)
+ ret[i]->_time_steps[j]=ts[j][i];
+ return ret;
+}
+
+/*!
+ * This method splits into discretization each time steps in \a this.
+ * ** WARNING ** the returned instances are not compulsary defined on the same time steps series !
+ */
+std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
+{
+ std::size_t sz(_time_steps.size());
+ std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
+ if(!timeStep)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ items[i]=timeStep->splitDiscretizations();
+ }
+ //
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
+ std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
+ std::vector< TypeOfField > types;
+ for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ {
+ std::vector<TypeOfField> ts=(*it1)->getTypesOfFieldAvailable();
+ if(ts.size()!=1)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : it appears that the splitting of MEDFileAnyTypeField1TSWithoutSDA::splitDiscretizations has returned invalid result !");
+ std::vector< TypeOfField >::iterator it2=std::find(types.begin(),types.end(),ts[0]);
+ if(it2==types.end())
+ types.push_back(ts[0]);
+ }
+ ret.resize(types.size()); ret2.resize(types.size());
+ for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++)
+ {
+ TypeOfField typ=(*it1)->getTypesOfFieldAvailable()[0];
+ std::size_t pos=std::distance(types.begin(),std::find(types.begin(),types.end(),typ));
+ ret2[pos].push_back(*it1);
+ }
+ for(std::size_t i=0;i<types.size();i++)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it1=ret2[i].begin();it1!=ret2[i].end();it1++)
+ elt->pushBackTimeStep(*it1);//also updates infos in elt
+ ret[i]=elt;
+ elt->MEDFileFieldNameScope::operator=(*this);
+ }
+ return ret;
+}
+
+/*!
+ * Contrary to splitDiscretizations method this method makes the hypothesis that the times series are **NOT** impacted by the splitting of multi discretization.
+ */
+std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
+{
+ std::size_t sz(_time_steps.size());
+ std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > > items(sz);
+ std::size_t szOut(std::numeric_limits<std::size_t>::max());
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
+ if(!timeStep)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : time step #" << i << " is null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ items[i]=timeStep->splitMultiDiscrPerGeoTypes();
+ if(szOut==std::numeric_limits<std::size_t>::max())
+ szOut=items[i].size();
+ else
+ if(items[i].size()!=szOut)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : The splitting per discretization is expected to be same among time steps !");
+ }
+ if(szOut==std::numeric_limits<std::size_t>::max())
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : empty field !");
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
+ for(std::size_t i=0;i<szOut;i++)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+ for(std::size_t j=0;j<sz;j++)
+ elt->pushBackTimeStep(items[j][i]);
+ ret[i]=elt;
+ elt->MEDFileFieldNameScope::operator=(*this);
+ }
+ return ret;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr)
+{
+ _name=field->getName();
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::copyTinyInfoFrom : no array set !");
+ _infos=arr->getInfoOnComponents();
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field, const DataArray *arr) const
+{
+ static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : invalid ";
+ if(_name!=field->getName())
+ {
+ std::ostringstream oss; oss << MSG << "name ! should be \"" << _name;
+ oss << "\" and it is set in input field to \"" << field->getName() << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !");
+ checkThatComponentsMatch(arr->getInfoOnComponents());
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::vector<std::string>& compos) const
+{
+ static const char MSG[]="MEDFileFieldMultiTSWithoutSDA::checkThatComponentsMatch : ";
+ if(getInfo().size()!=compos.size())
+ {
+ std::ostringstream oss; oss << MSG << "mismatch of number of components between this (" << getInfo().size() << ") and ";
+ oss << " number of components of element to append (" << compos.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(_infos!=compos)
+ {
+ std::ostringstream oss; oss << MSG << "components have same size but are different ! should be \"";
+ std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
+ oss << " But compo in input fields are : ";
+ std::copy(compos.begin(),compos.end(),std::ostream_iterator<std::string>(oss,", "));
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() const
+{
+ std::size_t sz=_infos.size();
+ int j=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,j++)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ if(elt->getInfo().size()!=sz)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis : At pos #" << j << " the number of components is equal to ";
+ oss << elt->getInfo().size() << " whereas it is expected to be equal to " << sz << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob)
+{
+ if(!field)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+ if(!_time_steps.empty())
+ checkCoherencyOfTinyInfo(field,arr);
+ MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+ objC->setFieldNoProfileSBT(field,arr,glob,*this);
+ copyTinyInfoFrom(field,arr);
+ _time_steps.push_back(obj);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob)
+{
+ if(!field)
+ throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+ if(!_time_steps.empty())
+ checkCoherencyOfTinyInfo(field,arr);
+ MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA;
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
+ objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this);
+ copyTinyInfoFrom(field,arr);
+ _time_steps.push_back(obj);
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> ts)
+{
+ int sz=(int)_time_steps.size();
+ if(i<0 || i>=sz)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts);
+ if(tsPtr)
+ {
+ if(tsPtr->getNumberOfComponents()!=(int)_infos.size())
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ _time_steps[i]=ts;
+}
+
+//= MEDFileFieldMultiTSWithoutSDA
+
+MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > *entities)