+ if(!field)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !");
+ std::string name(field->getName());
+ setName(name.c_str());
+ setDtUnit(field->getTimeUnit());
+ if(name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : no array set !");
+ if(!arr->isAllocated())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : array is not allocated !");
+ _dt=field->getTime(_iteration,_order);
+ getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
+ if(!getOrCreateAndGetArray()->isAllocated())
+ {
+ allocNotFromFile(arr->getNumberOfTuples());
+ return 0;
+ }
+ else
+ {
+ int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
+ int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
+ getOrCreateAndGetArray()->reAlloc(newNbOfTuples);
+ _nb_of_tuples_to_be_allocated=-3;
+ return oldNbOfTuples;
+ }
+}
+
+/*!
+ * Returns number of components in \a this field
+ * \return int - the number of components.
+ */
+int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const
+{
+ return getOrCreateAndGetArray()->getNumberOfComponents();
+}
+
+/*!
+ * Change info on components in \a this.
+ * \throw If size of \a infos is not equal to the number of components already in \a this.
+ */
+void MEDFileAnyTypeField1TSWithoutSDA::setInfo(const std::vector<std::string>& infos)
+{
+ DataArray *arr=getOrCreateAndGetArray();
+ arr->setInfoOnComponents(infos);//will throw an exception if number of components mimatches
+}
+
+/*!
+ * Returns info on components of \a this field.
+ * \return const std::vector<std::string>& - a sequence of strings each being an
+ * information on _i_-th component.
+ */
+const std::vector<std::string>& MEDFileAnyTypeField1TSWithoutSDA::getInfo() const
+{
+ const DataArray *arr=getOrCreateAndGetArray();
+ return arr->getInfoOnComponents();
+}
+
+/*!
+ * Returns a mutable info on components of \a this field.
+ * \return std::vector<std::string>& - a sequence of strings each being an
+ * information on _i_-th component.
+ */
+std::vector<std::string>& MEDFileAnyTypeField1TSWithoutSDA::getInfo()
+{
+ DataArray *arr=getOrCreateAndGetArray();
+ return arr->getInfoOnComponents();
+}
+
+bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfMultiDiscPerGeoType() const
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ {
+ const MEDFileFieldPerMesh *fpm(*it);
+ if(!fpm)
+ continue;
+ if(fpm->presenceOfMultiDiscPerGeoType())
+ return true;
+ }
+ return false;
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of given type lying on a given support.
+ * \param [in] type - a spatial discretization of the new field.
+ * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities.
+ * \param [in] mName - a name of 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.
+ *
+ * \param [in] glob - the global data storing profiles and localization.
+ * \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 no field of \a this is lying on the mesh \a mName.
+ * \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
+ */
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+{
+ MCAuto<MEDFileMesh> mm;
+ if(mName.empty())
+ mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
+ else
+ mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
+ return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc);
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of given type lying on a given support.
+ * \param [in] type - a spatial discretization of the new field.
+ * \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.
+ *
+ * \param [in] glob - the global data storing profiles and localization.
+ * \param [in] mesh - the supporting mesh.
+ * \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 no field of \a this is lying on \a mesh.
+ * \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.
+ */
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+{
+ MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax,false));
+ const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax);
+ const DataArrayInt *e=mesh->getNumberFieldAtLevel(1);
+ if(meshDimRelToMax==1)
+ (static_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)m))->setMeshDimension(0);
+ return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc);
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of a given type lying on the top level cells of a
+ * given mesh.
+ * \param [in] type - a spatial discretization of the new field.
+ * \param [in] mName - a name of 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.
+ *
+ * \param [in] glob - the global data storing profiles and localization.
+ * \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 in the mesh.
+ * \throw If no field values of the given \a type are available.
+ */
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+{
+ MCAuto<MEDFileMesh> mm;
+ if(mName.empty())
+ mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
+ else
+ mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
+ int absDim=getDimension();
+ int meshDimRelToMax=absDim-mm->getMeshDimension();
+ return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm,arrOut,nasc);
+}
+
+/*!
+ * Returns a new MEDCouplingFieldDouble of given type lying on a given support.
+ * \param [in] type - a spatial discretization of the new 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.
+ *
+ * \param [in] glob - the global data storing profiles and localization.
+ * \param [in] mesh - the supporting mesh.
+ * \param [in] cellRenum - the cell numbers array used for permutation of the result
+ * field according to \a renumPol.
+ * \param [in] nodeRenum - the node numbers array used for permutation of the result
+ * field according to \a renumPol.
+ * \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.
+ */
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+{
+ static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
+ int meshId=getMeshIdFromMeshName(mesh->getName());
+ bool isPfl=false;
+ MCAuto<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
+ switch(renumPol)
+ {
+ case 0:
+ {
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ return ret.retn();
+ }
+ case 3:
+ case 1:
+ {
+ if(isPfl)
+ throw INTERP_KERNEL::Exception(msg1);
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ if(cellRenum)
+ {
+ if((int)cellRenum->getNbOfElems()!=mesh->getNumberOfCells())
+ {
+ std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field ";
+ oss << "\"" << getName() << "\" has partial renumbering (some geotype has no renumber) !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDCouplingFieldDiscretization *disc=ret->getDiscretization();
+ if(!disc) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel : internal error, no discretization on field !");
+ std::vector<DataArray *> arrOut2(1,arrOut);
+ // 2 following lines replace ret->renumberCells(cellRenum->getConstPointer()) if not DataArrayDouble
+ disc->renumberArraysForCell(ret->getMesh(),arrOut2,cellRenum->getConstPointer(),true);
+ (const_cast<MEDCouplingMesh*>(ret->getMesh()))->renumberCells(cellRenum->getConstPointer(),true);
+ }
+ if(renumPol==1)
+ return ret.retn();
+ }
+ case 2:
+ {
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ if(isPfl)
+ throw INTERP_KERNEL::Exception(msg1);
+ if(nodeRenum)
+ {
+ if((int)nodeRenum->getNbOfElems()!=mesh->getNumberOfNodes())
+ {
+ std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field ";
+ oss << "\"" << nasc.getName() << "\" not defined on all nodes !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MCAuto<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+ if(!dynamic_cast<DataArrayDouble *>((DataArray *)arrOut))
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !");
+ ret->renumberNodes(nodeRenumSafe->getConstPointer());
+ }
+ return ret.retn();
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : unsupported renum policy ! Dealing with policy 0 1 2 and 3 !");
+ }
+}
+
+/*!
+ * Returns values and a profile of the field of a given type lying on a given support.
+ * \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.
+ * \param [in] glob - the global data storing profiles and localization.
+ * \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 are available.
+ */
+DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const
+{
+ MCAuto<MEDCouplingMesh> m(mesh->getMeshAtLevel(meshDimRelToMax));
+ int meshId=getMeshIdFromMeshName(mesh->getName().c_str());
+ MCAuto<DataArray> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc);
+ ret->setName(nasc.getName().c_str());
+ return ret.retn();
+}
+
+//= MEDFileField1TSWithoutSDA
+
+/*!
+ * Throws if a given value is not a valid (non-extended) relative dimension.
+ * \param [in] meshDimRelToMax - the relative dimension value.
+ * \throw If \a meshDimRelToMax > 0.
+ */
+void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax)
+{
+ if(meshDimRelToMax>0)
+ throw INTERP_KERNEL::Exception("CheckMeshDimRel : This is a meshDimRel not a meshDimRelExt ! So value should be <=0 !");
+}
+
+/*!
+ * Checks if elements of a given mesh are in the order suitable for writing
+ * to the MED file. If this is not so, an exception is thrown. In a case of success, returns a
+ * vector describing types of elements and their number.
+ * \param [in] mesh - the mesh to check.
+ * \return std::vector<int> - a vector holding for each element type (1) item of
+ * INTERP_KERNEL::NormalizedCellType, (2) number of elements, (3) -1.
+ * These values are in full-interlace mode.
+ * \throw If elements in \a mesh are not in the order suitable for writing to the MED file.
+ */
+std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh)
+{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !");
+ std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
+ int nbOfTypes=geoTypes.size();
+ std::vector<int> code(3*nbOfTypes);
+ MCAuto<DataArrayInt> arr1=DataArrayInt::New();
+ arr1->alloc(nbOfTypes,1);
+ int *arrPtr=arr1->getPointer();
+ std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
+ for(int i=0;i<nbOfTypes;i++,it++)
+ arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
+ MCAuto<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
+ const int *arrPtr2=arr2->getConstPointer();
+ int i=0;
+ for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
+ {
+ int pos=arrPtr2[i];
+ int nbCells=mesh->getNumberOfCellsWithType(*it);
+ code[3*pos]=(int)(*it);
+ code[3*pos+1]=nbCells;
+ code[3*pos+2]=-1;//no profiles
+ }
+ std::vector<const DataArrayInt *> idsPerType;//no profiles
+ DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
+ if(da)
+ {
+ da->decrRef();
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : underlying mesh is not sorted by type as MED file expects !");
+ }
+ return code;
+}
+
+MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
+{
+ return new MEDFileField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
+}
+
+/*!
+ * Returns all attributes and values of parts of \a this field lying on a given mesh.
+ * Each part differs from other ones by a type of supporting mesh entity. The _i_-th
+ * item of every of returned sequences refers to the _i_-th part of \a this field.
+ * Thus all sequences returned by this method are of the same length equal to number
+ * of different types of supporting entities.<br>
+ * A field part can include sub-parts with several different spatial discretizations,
+ * \ref MEDCoupling::ON_CELLS "ON_CELLS" and \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT"
+ * for example. Hence, some of the returned sequences contains nested sequences, and an item
+ * of a nested sequence corresponds to a type of spatial discretization.<br>
+ * This method allows for iteration over MEDFile DataStructure with a reduced overhead.
+ * The overhead is due to selecting values into new instances of DataArrayDouble.
+ * \param [in] mname - a name of a mesh of interest. It can be \c NULL, which is valid
+ * for the case with only one underlying mesh. (Actually, the number of meshes is
+ * not checked if \a mname == \c NULL).
+ * \param [in,out] types - a sequence of types of underlying mesh entities. A type per
+ * a field part is returned.
+ * \param [in,out] typesF - a sequence of sequences of types of spatial discretizations.
+ * A field part can include sub-parts with several different spatial discretizations,
+ * \ref MEDCoupling::ON_CELLS "ON_CELLS" and
+ * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" for example.
+ * This sequence is of the same length as \a types.
+ * \param [in,out] pfls - a sequence returning a profile name per each type of spatial
+ * discretization. A profile name can be empty.
+ * Length of this and of nested sequences is the same as that of \a typesF.
+ * \param [in,out] locs - a sequence returning a localization name per each type of spatial
+ * discretization. A localization name can be empty.
+ * Length of this and of nested sequences is the same as that of \a typesF.
+ * \return std::vector< std::vector<DataArrayDouble *> > - a sequence holding arrays of values
+ * per each type of spatial discretization within one mesh entity type.
+ * The caller is to delete each DataArrayDouble using decrRef() as it is no more needed.
+ * Length of this and of nested sequences is the same as that of \a typesF.
+ * \throw If no field is lying on \a mname.
+ */
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TSWithoutSDA::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
+{
+ int meshId=0;
+ if(!mname.empty())
+ meshId=getMeshIdFromMeshName(mname);
+ else
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !");
+ std::vector< std::vector< std::pair<int,int> > > ret0=_field_per_mesh[meshId]->getFieldSplitedByType(types,typesF,pfls,locs);
+ int nbOfRet=ret0.size();
+ std::vector< std::vector<DataArrayDouble *> > ret(nbOfRet);
+ for(int i=0;i<nbOfRet;i++)
+ {
+ const std::vector< std::pair<int,int> >& p=ret0[i];
+ int nbOfRet1=p.size();
+ ret[i].resize(nbOfRet1);
+ for(int j=0;j<nbOfRet1;j++)
+ {
+ DataArrayDouble *tmp=_arr->selectByTupleIdSafeSlice(p[j].first,p[j].second,1);
+ ret[i][j]=tmp;
+ }
+ }
+ return ret;
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayDouble instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type.
+ * \return DataArrayDouble * - the pointer to the field values array.
+ */
+DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayDouble() const
+{
+ const DataArrayDouble *ret=_arr;
+ if(ret)
+ return const_cast<DataArrayDouble *>(ret);
+ else
+ return 0;
+}
+
+const char *MEDFileField1TSWithoutSDA::getTypeStr() const
+{
+ return TYPE_STR;
+}
+
+MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const
+{
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA);
+ ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
+ ret->deepCpyLeavesFrom(*this);
+ const DataArrayDouble *arr(_arr);
+ if(arr)
+ {
+ MCAuto<DataArrayInt> arr2(arr->convertToIntArr());
+ ret->setArray(arr2);
+ }
+ return ret.retn();
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayDouble instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type.
+ * \return DataArrayDouble * - the pointer to the field values array.
+ */
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArray() const
+{
+ return getUndergroundDataArrayDouble();
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayDouble instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayDouble. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ * \param [in,out] entries - the sequence describing parameters of a support of each
+ * part of \a this field. Each item of this sequence consists of two parts. The
+ * first part describes a type of mesh entity and an id of discretization of a
+ * current field part. The second part describes a range of values [begin,end)
+ * within the returned array relating to the current field part.
+ * \return DataArrayDouble * - the pointer to the field values array.
+ * \throw If the number of underlying meshes is not equal to 1.
+ * \throw If no field values are available.
+ * \sa getUndergroundDataArray()
+ */
+DataArrayDouble *MEDFileField1TSWithoutSDA::getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ if(_field_per_mesh.size()!=1)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
+ if(_field_per_mesh[0]==0)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
+ _field_per_mesh[0]->getUndergroundDataArrayExt(entries);
+ return getUndergroundDataArrayDouble();
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayDouble instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayDouble. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ * \param [in,out] entries - the sequence describing parameters of a support of each
+ * part of \a this field. Each item of this sequence consists of two parts. The
+ * first part describes a type of mesh entity and an id of discretization of a
+ * current field part. The second part describes a range of values [begin,end)
+ * within the returned array relating to the current field part.
+ * \return DataArrayDouble * - the pointer to the field values array.
+ * \throw If the number of underlying meshes is not equal to 1.
+ * \throw If no field values are available.
+ * \sa getUndergroundDataArray()
+ */
+DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ return getUndergroundDataArrayDoubleExt(entries);
+}
+
+MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
+{
+ DataArrayDouble *arr(getOrCreateAndGetArrayDouble());
+ arr->setInfoAndChangeNbOfCompo(infos);
+}
+
+MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA()
+{
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const
+{
+ MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA(*this));
+ ret->deepCpyLeavesFrom(*this);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const
+{
+ MCAuto<MEDFileField1TSWithoutSDA> ret=static_cast<MEDFileField1TSWithoutSDA *>(shallowCpy());
+ if((const DataArrayDouble *)_arr)
+ ret->_arr=_arr->deepCopy();
+ return ret.retn();
+}
+
+void MEDFileField1TSWithoutSDA::setArray(DataArray *arr)
+{
+ if(!arr)
+ {
+ _nb_of_tuples_to_be_allocated=-1;
+ _arr=0;
+ return ;
+ }
+ DataArrayDouble *arrC=dynamic_cast<DataArrayDouble *>(arr);
+ if(!arrC)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayDouble !");
+ else
+ _nb_of_tuples_to_be_allocated=-3;
+ arrC->incrRef();
+ _arr=arrC;
+}
+
+DataArray *MEDFileField1TSWithoutSDA::createNewEmptyDataArrayInstance() const
+{
+ return DataArrayDouble::New();
+}
+
+DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArrayDouble()
+{
+ DataArrayDouble *ret=_arr;
+ if(ret)
+ return ret;
+ _arr=DataArrayDouble::New();
+ return _arr;
+}
+
+DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray()
+{
+ return getOrCreateAndGetArrayDouble();
+}
+
+const DataArrayDouble *MEDFileField1TSWithoutSDA::getOrCreateAndGetArrayDouble() const
+{
+ const DataArrayDouble *ret=_arr;
+ if(ret)
+ return ret;
+ DataArrayDouble *ret2=DataArrayDouble::New();
+ const_cast<MEDFileField1TSWithoutSDA *>(this)->_arr=DataArrayDouble::New();
+ return ret2;
+}
+
+const DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const
+{
+ return getOrCreateAndGetArrayDouble();
+}
+
+//= MEDFileIntField1TSWithoutSDA
+
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
+{
+ return new MEDFileIntField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
+}
+
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileAnyTypeField1TSWithoutSDA()
+{
+}
+
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order,
+ const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
+{
+ DataArrayInt *arr(getOrCreateAndGetArrayInt());
+ arr->setInfoAndChangeNbOfCompo(infos);
+}
+
+const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const
+{
+ return TYPE_STR;
+}
+
+MEDFileField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::convertToDouble() const
+{
+ MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA);
+ ret->MEDFileAnyTypeField1TSWithoutSDA::operator =(*this);
+ ret->deepCpyLeavesFrom(*this);
+ const DataArrayInt *arr(_arr);
+ if(arr)
+ {
+ MCAuto<DataArrayDouble> arr2(arr->convertToDblArr());
+ ret->setArray(arr2);
+ }
+ return ret.retn();
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayInt instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type.
+ * \return DataArrayInt * - the pointer to the field values array.
+ */
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArray() const
+{
+ return getUndergroundDataArrayInt();
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayInt instance. So the
+ * caller should not decrRef() it. This method allows for a direct access to the field
+ * values. This method is quite unusable if there is more than a nodal field or a cell
+ * field on single geometric cell type.
+ * \return DataArrayInt * - the pointer to the field values array.
+ */
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayInt() const
+{
+ const DataArrayInt *ret=_arr;
+ if(ret)
+ return const_cast<DataArrayInt *>(ret);
+ else
+ return 0;
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayInt instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ * \param [in,out] entries - the sequence describing parameters of a support of each
+ * part of \a this field. Each item of this sequence consists of two parts. The
+ * first part describes a type of mesh entity and an id of discretization of a
+ * current field part. The second part describes a range of values [begin,end)
+ * within the returned array relating to the current field part.
+ * \return DataArrayInt * - the pointer to the field values array.
+ * \throw If the number of underlying meshes is not equal to 1.
+ * \throw If no field values are available.
+ * \sa getUndergroundDataArray()
+ */
+DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ return getUndergroundDataArrayIntExt(entries);
+}
+
+/*!
+ * Returns a pointer to the underground DataArrayInt instance and a
+ * sequence describing parameters of a support of each part of \a this field. The
+ * caller should not decrRef() the returned DataArrayInt. This method allows for a
+ * direct access to the field values. This method is intended for the field lying on one
+ * mesh only.
+ * \param [in,out] entries - the sequence describing parameters of a support of each
+ * part of \a this field. Each item of this sequence consists of two parts. The
+ * first part describes a type of mesh entity and an id of discretization of a
+ * current field part. The second part describes a range of values [begin,end)
+ * within the returned array relating to the current field part.
+ * \return DataArrayInt * - the pointer to the field values array.
+ * \throw If the number of underlying meshes is not equal to 1.
+ * \throw If no field values are available.
+ * \sa getUndergroundDataArray()
+ */
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+{
+ if(_field_per_mesh.size()!=1)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !");
+ if(_field_per_mesh[0]==0)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : no field specified !");
+ _field_per_mesh[0]->getUndergroundDataArrayExt(entries);
+ return getUndergroundDataArrayInt();
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const
+{
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA(*this));
+ ret->deepCpyLeavesFrom(*this);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const
+{
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret=static_cast<MEDFileIntField1TSWithoutSDA *>(shallowCpy());
+ if((const DataArrayInt *)_arr)
+ ret->_arr=_arr->deepCopy();
+ return ret.retn();
+}
+
+void MEDFileIntField1TSWithoutSDA::setArray(DataArray *arr)
+{
+ if(!arr)
+ {
+ _nb_of_tuples_to_be_allocated=-1;
+ _arr=0;
+ return ;
+ }
+ DataArrayInt *arrC=dynamic_cast<DataArrayInt *>(arr);
+ if(!arrC)
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayInt !");
+ else
+ _nb_of_tuples_to_be_allocated=-3;
+ arrC->incrRef();
+ _arr=arrC;
+}
+
+DataArray *MEDFileIntField1TSWithoutSDA::createNewEmptyDataArrayInstance() const
+{
+ return DataArrayInt::New();
+}
+
+DataArrayInt *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArrayInt()
+{
+ DataArrayInt *ret=_arr;
+ if(ret)
+ return ret;
+ _arr=DataArrayInt::New();
+ return _arr;
+}
+
+DataArray *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArray()
+{
+ return getOrCreateAndGetArrayInt();
+}
+
+const DataArrayInt *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArrayInt() const
+{
+ const DataArrayInt *ret=_arr;
+ if(ret)
+ return ret;
+ DataArrayInt *ret2=DataArrayInt::New();
+ const_cast<MEDFileIntField1TSWithoutSDA *>(this)->_arr=DataArrayInt::New();
+ return ret2;
+}
+
+const DataArray *MEDFileIntField1TSWithoutSDA::getOrCreateAndGetArray() const
+{
+ return getOrCreateAndGetArrayInt();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
+{
+}
+
+//= MEDFileAnyTypeField1TS
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
+{
+ med_field_type typcha;
+ //
+ std::vector<std::string> infos;
+ std::string dtunit,fieldName;
+ LocateField2(fid,fileName,0,true,fieldName,typcha,infos,dtunit);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ switch(typcha)
+ {
+ case MED_FLOAT64:
+ {
+ ret=MEDFileField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+ break;
+ }
+ case MED_INT32:
+ {
+ ret=MEDFileIntField1TSWithoutSDA::New(fieldName.c_str(),-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+ break;
+ }
+ default:
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret->setDtUnit(dtunit.c_str());
+ ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+ //
+ med_int numdt,numit;
+ med_float dt;
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
+ ret->setTime(numdt,numit,dt);
+ ret->_csit=1;
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ _content=BuildContentFrom(fid,fileName,loadAll,ms);
+ loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+ throw e;
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
+{
+ med_field_type typcha;
+ std::vector<std::string> infos;
+ std::string dtunit;
+ int iii=-1;
+ int nbSteps=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ switch(typcha)
+ {
+ case MED_FLOAT64:
+ {
+ ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+ break;
+ }
+ case MED_INT32:
+ {
+ ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,-1/*iteration*/,-1/*order*/,std::vector<std::string>());
+ break;
+ }
+ default:
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret->setDtUnit(dtunit.c_str());
+ ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+ //
+ if(nbSteps<1)
+ {
+ std::ostringstream oss; oss << "MEDFileField1TS(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but there is no time steps on it !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ //
+ med_int numdt,numit;
+ med_float dt;
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
+ ret->setTime(numdt,numit,dt);
+ ret->_csit=1;
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ _content=BuildContentFrom(fid,fileName,fieldName,loadAll,ms);
+ loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+ throw e;
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName)
+{
+ if(!c)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
+ if(dynamic_cast<const MEDFileField1TSWithoutSDA *>(c))
+ {
+ MCAuto<MEDFileField1TS> ret=MEDFileField1TS::New();
+ ret->setFileName(fileName);
+ ret->_content=c; c->incrRef();
+ return ret.retn();
+ }
+ if(dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(c))
+ {
+ MCAuto<MEDFileIntField1TS> ret=MEDFileIntField1TS::New();
+ ret->setFileName(fileName);
+ ret->_content=c; c->incrRef();
+ return ret.retn();
+ }
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, bool loadAll)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ ret->loadGlobals(fid);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ ret->loadGlobals(fid);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll,0);
+ MCAuto<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
+ ret->loadGlobals(fid);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
+{
+ med_field_type typcha;
+ std::vector<std::string> infos;
+ std::string dtunit;
+ int iii=-1;
+ int nbOfStep2=LocateField(fid,fileName,fieldName,iii,typcha,infos,dtunit);
+ MCAuto<MEDFileAnyTypeField1TSWithoutSDA> ret;
+ switch(typcha)
+ {
+ case MED_FLOAT64:
+ {
+ ret=MEDFileField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector<std::string>());
+ break;
+ }
+ case MED_INT32:
+ {
+ ret=MEDFileIntField1TSWithoutSDA::New(fieldName,-1,iteration,order,std::vector<std::string>());
+ break;
+ }
+ default:
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName,iteration,order) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret->setDtUnit(dtunit.c_str());
+ ret->getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(infos);
+ //
+ bool found=false;
+ std::vector< std::pair<int,int> > dtits(nbOfStep2);
+ for(int i=0;i<nbOfStep2 && !found;i++)
+ {
+ med_int numdt,numit;
+ med_float dt;
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),i+1,&numdt,&numit,&dt));
+ if(numdt==iteration && numit==order)
+ {
+ found=true;
+ ret->_csit=i+1;
+ }
+ else
+ dtits[i]=std::pair<int,int>(numdt,numit);
+ }
+ if(!found)
+ {
+ std::ostringstream oss; oss << "No such iteration (" << iteration << "," << order << ") in existing field '" << fieldName << "' in file '" << fileName << "' ! Available iterations are : ";
+ for(std::vector< std::pair<int,int> >::const_iterator iter=dtits.begin();iter!=dtits.end();iter++)
+ oss << "(" << (*iter).first << "," << (*iter).second << "), ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0);
+ return ret.retn();
+}
+
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileMeshes *ms)
+try:MEDFileFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ _content=BuildContentFrom(fid,fileName.c_str(),fieldName.c_str(),iteration,order,loadAll,ms);
+ loadGlobals(fid);
+}
+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
+ */
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent)
+{
+ if(!shallowCopyOfContent)
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *otherPtr(&other);
+ otherPtr->incrRef();
+ _content=const_cast<MEDFileAnyTypeField1TSWithoutSDA *>(otherPtr);
+ }
+ else
+ {
+ _content=other.shallowCpy();
+ }
+}
+
+int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
+{
+ if(checkFieldId)
+ {
+ int nbFields=MEDnField(fid);
+ if(fieldIdCFormat>=nbFields)
+ {
+ std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << fileName << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localMesh;
+ int nbOfStep;
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep));
+ fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
+ dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE);
+ infos.clear(); infos.resize(ncomp);
+ for(int j=0;j<ncomp;j++)
+ infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+ return nbOfStep;
+}
+
+/*!
+ * This method throws an INTERP_KERNEL::Exception if \a fieldName field is not in file pointed by \a fid and with name \a fileName.
+ *
+ * \param [out]
+ * \return in case of success the number of time steps available for the field with name \a fieldName.
+ */
+int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
+{
+ int nbFields=MEDnField(fid);
+ bool found=false;
+ std::vector<std::string> fns(nbFields);
+ int nbOfStep2=-1;
+ for(int i=0;i<nbFields && !found;i++)
+ {
+ std::string tmp;
+ nbOfStep2=LocateField2(fid,fileName,i,false,tmp,typcha,infos,dtunitOut);
+ fns[i]=tmp;
+ found=(tmp==fieldName);
+ if(found)
+ posCFormat=i;
+ }
+ if(!found)
+ {
+ std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << fileName << "' ! Available fields are : ";
+ for(std::vector<std::string>::const_iterator it=fns.begin();it!=fns.end();it++)
+ oss << "\"" << *it << "\" ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return nbOfStep2;
+}
+
+/*!
+ * This method as MEDFileField1TSW::setLocNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
+ * This method changes the attribute (here it's profile name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * If \b newPflName profile name does not already exist the profile with old name will be renamed with name \b newPflName.
+ * If \b newPflName already exists and that \b forceRenameOnGlob is false (the default) an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newPflName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
+ * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName
+ */
+void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob)
+{
+ MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+ std::string oldPflName=disc->getProfile();
+ std::vector<std::string> vv=getPflsReallyUsedMulti();
+ int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+ if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
+ {
+ disc->setProfile(newPflName);
+ DataArrayInt *pfl=getProfile(oldPflName.c_str());
+ pfl->setName(newPflName);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileField1TS::setProfileNameOnLeaf : Profile \"" << newPflName << "\" already exists or referenced more than one !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+/*!
+ * This method as MEDFileField1TSW::setProfileNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutSDA::getFieldSplitedByType or MEDFileField1TSWithoutSDA::getFieldSplitedByType2.
+ * This method changes the attribute (here it's localization name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFileFieldGlobs::appendProfile or MEDFileFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * This method is an extension of MEDFileField1TSWithoutSDA::setProfileNameOnLeafExt method because it performs a modification of global info.
+ * If \b newLocName profile name does not already exist the localization with old name will be renamed with name \b newLocName.
+ * If \b newLocName already exists an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newLocName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
+ * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName
+ */
+void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob)
+{
+ MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+ std::string oldLocName=disc->getLocalization();
+ std::vector<std::string> vv=getLocsReallyUsedMulti();
+ int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+ if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
+ {
+ disc->setLocalization(newLocName);
+ MEDFileFieldLoc& loc=getLocalization(oldLocName.c_str());
+ loc.setName(newLocName);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileField1TS::setLocNameOnLeaf : Localization \"" << newLocName << "\" already exists or referenced more than one !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBase()
+{
+ MEDFileAnyTypeField1TSWithoutSDA *ret=_content;
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS : content is expected to be not null !");
+ return ret;
+}
+
+const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBase() const
+{
+ const MEDFileAnyTypeField1TSWithoutSDA *ret=_content;
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS : const content is expected to be not null !");
+ return ret;
+}
+
+/*!
+ * Writes \a this field into a MED file specified by its name.
+ * \param [in] fileName - the MED file name.
+ * \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics.
+ * - 2 - erase; an existing file is removed.
+ * - 1 - append; same data should not be present in an existing file.
+ * - 0 - overwrite; same data present in an existing file is overwritten.
+ * \throw If the field name is not set.
+ * \throw If no field data is set.
+ * \throw If \a mode == 1 and the same data is present in an existing file.
+ */
+void MEDFileAnyTypeField1TS::write(const std::string& fileName, int mode) const
+{
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
+ writeLL(fid);
+}
+
+/*!
+ * This method alloc the arrays and load potentially huge arrays contained in this field.
+ * This method should be called when a MEDFileAnyTypeField1TS::New constructor has been with false as the last parameter.
+ * This method can be also called to refresh or reinit values from a file.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileAnyTypeField1TS::loadArraysIfNecessary
+ */
+void MEDFileAnyTypeField1TS::loadArrays()
+{
+ if(getFileName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::loadArrays : the structure does not come from a file !");
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
+}
+
+/*!
+ * This method behaves as MEDFileAnyTypeField1TS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
+ * But once data loaded once, this method does nothing. Contrary to MEDFileAnyTypeField1TS::loadArrays and MEDFileAnyTypeField1TS::unloadArrays
+ * this method does not throw if \a this does not come from file read.
+ *
+ * \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::unloadArrays
+ */
+void MEDFileAnyTypeField1TS::loadArraysIfNecessary()
+{
+ if(!getFileName().empty())
+ {
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+ }
+}
+
+/*!
+ * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
+ * \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
+ * So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss instead.
+ *
+ * \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::loadArraysIfNecessary, MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss
+ */
+void MEDFileAnyTypeField1TS::unloadArrays()
+{
+ contentNotNullBase()->unloadArrays();
+}
+
+/*!
+ * 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.
+ * This method is the symetrical method of MEDFileAnyTypeField1TS::loadArraysIfNecessary.
+ * This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
+ *
+ * \sa MEDFileAnyTypeField1TS::loadArraysIfNecessary
+ */
+void MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss()
+{
+ if(!getFileName().empty())
+ contentNotNullBase()->unloadArrays();
+}
+
+void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const
+{
+ int nbComp=getNumberOfComponents();
+ 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=getInfo()[i];
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE,comp+i*MED_SNAME_SIZE,_too_long_str);
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,_too_long_str);
+ }
+ if(getName().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
+ writeGlobals(fid,*this);
+ contentNotNullBase()->writeLL(fid,*this,*contentNotNullBase());
+}
+
+std::size_t MEDFileAnyTypeField1TS::getHeapMemorySizeWithoutChildren() const
+{
+ return MEDFileFieldGlobsReal::getHeapMemorySizeWithoutChildren();
+}
+
+std::vector<const BigMemoryObject *> MEDFileAnyTypeField1TS::getDirectChildrenWithNull() const
+{
+ std::vector<const BigMemoryObject *> ret(MEDFileFieldGlobsReal::getDirectChildrenWithNull());
+ ret.push_back((const MEDFileAnyTypeField1TSWithoutSDA *)_content);
+ return ret;
+}
+
+/*!
+ * Returns a string describing \a this field. This string is outputted
+ * by \c print Python command.
+ */
+std::string MEDFileAnyTypeField1TS::simpleRepr() const
+{
+ std::ostringstream oss;
+ contentNotNullBase()->simpleRepr(0,oss,-1);
+ simpleReprGlobs(oss);
+ return oss.str();
+}
+
+/*!
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING If profile is used several times it will be reported \b only \b once.
+ * To get non empty name profiles as time as they appear in \b this call MEDFileField1TS::getPflsReallyUsedMulti instead.
+ */
+std::vector<std::string> MEDFileAnyTypeField1TS::getPflsReallyUsed() const
+{
+ return contentNotNullBase()->getPflsReallyUsed2();
+}
+
+/*!
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING If localization is used several times it will be reported \b only \b once.
+ */
+std::vector<std::string> MEDFileAnyTypeField1TS::getLocsReallyUsed() const
+{
+ return contentNotNullBase()->getLocsReallyUsed2();
+}
+
+/*!
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getPflsReallyUsed, if profile is used several times it will be reported as time as it appears.
+ */
+std::vector<std::string> MEDFileAnyTypeField1TS::getPflsReallyUsedMulti() const
+{
+ return contentNotNullBase()->getPflsReallyUsedMulti2();
+}
+
+/*!
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getLocsReallyUsed if localization is used several times it will be reported as time as it appears.
+ */
+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< MCAuto< 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< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit=content->splitComponents();
+ std::size_t sz(contentsSplit.size());
+ std::vector< MCAuto< 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< MCAuto< 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< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitDiscretizations());
+ std::size_t sz(contentsSplit.size());
+ std::vector< MCAuto< 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< MCAuto< 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< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > contentsSplit(content->splitMultiDiscrPerGeoTypes());
+ std::size_t sz(contentsSplit.size());
+ std::vector< MCAuto< MEDFileAnyTypeField1TS > > ret(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ ret[i]=shallowCpy();
+ ret[i]->_content=contentsSplit[i];
+ }
+ return ret;
+}
+
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const
+{
+ MCAuto<MEDFileAnyTypeField1TS> ret=shallowCpy();
+ if((const MEDFileAnyTypeField1TSWithoutSDA *)_content)
+ ret->_content=_content->deepCopy();
+ 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)
+{
+ MCAuto<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)
+{
+ MCAuto<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)
+{
+ MCAuto<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)
+{
+ MCAuto<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()
+{
+ MCAuto<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
+{
+ MCAuto<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 !");
+ MCAuto<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, MCAuto<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(MCAuto<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;
+}
+
+/*!
+ * Return an extraction of \a this using \a extractDef map to specify the extraction.
+ * The keys of \a extractDef is level relative to max ext of \a mm mesh.
+ *
+ * \return A new object that the caller is responsible to deallocate.
+ */
+MEDFileField1TS *MEDFileField1TS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+{
+ if(!mm)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !");
+ MCAuto<MEDFileField1TS> ret(MEDFileField1TS::New());
+ std::vector<TypeOfField> tof(getTypesOfFieldAvailable());
+ for(std::vector<TypeOfField>::const_iterator it0=tof.begin();it0!=tof.end();it0++)
+ {
+ if((*it0)!=ON_NODES)
+ {
+ std::vector<int> levs;
+ getNonEmptyLevels(mm->getName(),levs);
+ for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
+ {
+ std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(*lev));
+ if(it2!=extractDef.end())
+ {
+ MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<MEDCouplingFieldDouble> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm));
+ MCAuto<MEDCouplingFieldDouble> fOut(f->buildSubPart(t));
+ ret->setFieldNoProfileSBT(fOut);
+ }
+ }
+ }
+ else
+ {
+ std::map<int, MCAuto<DataArrayInt> >::const_iterator it2(extractDef.find(1));
+ if(it2==extractDef.end())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !");
+ MCAuto<DataArrayInt> t((*it2).second);
+ MCAuto<MEDCouplingFieldDouble> f(getFieldOnMeshAtLevel(ON_NODES,0,mm));
+ MCAuto<MEDCouplingFieldDouble> fOut(f->deepCopy());
+ DataArrayDouble *arr(f->getArray());
+ MCAuto<DataArrayDouble> newArr(arr->selectByTupleIdSafe(t->begin(),t->end()));
+ fOut->setArray(newArr);
+ ret->setFieldNoProfileSBT(fOut);
+ }
+ }
+ return ret.retn();
+}
+
+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 !");
+ MCAuto<DataArray> arrOut;
+ MCAuto<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 !");
+ MCAuto<DataArray> arrOut;
+ MCAuto<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
+{
+ MCAuto<DataArray> arrOut;
+ MCAuto<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
+{
+ MCAuto<DataArray> arrOut;
+ MCAuto<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 !");
+ MCAuto<DataArray> arrOut;
+ MCAuto<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
+{
+ MCAuto<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()
+{
+ MCAuto<MEDFileIntField1TS> ret=new MEDFileIntField1TS;
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll)
+{
+ MCAuto<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)
+{
+ MCAuto<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)
+{
+ MCAuto<MEDFileIntField1TS> ret(new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll,0));
+ ret->contentNotNull();
+ return ret.retn();
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent)
+{
+ MCAuto<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
+{
+ MCAuto<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 !");
+ MCAuto<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 !");
+ MCAuto<DataArray> arrOut2;
+ MCAuto<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(MCAuto<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;
+}
+
+MEDFileIntField1TS *MEDFileIntField1TS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+{
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::extractPart : not implemented yet !");
+}
+
+/*!
+ * 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 !");
+ MCAuto<DataArray> arr;
+ MCAuto<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
+{
+ MCAuto<DataArray> arr;
+ MCAuto<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
+{
+ MCAuto<DataArray> arr;
+ MCAuto<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 !");
+ MCAuto<DataArray> arr;
+ MCAuto<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
+{
+ MCAuto<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(MCAuto<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< MCAuto<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
+{
+ MCAuto<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];
+ MCAuto<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);
+ MCAuto<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];
+ MCAuto<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;
+ MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MCAuto<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;
+ MCAuto<DataArrayInt> ids=DataArrayInt::New(); ids->alloc(0,1);
+ for(std::vector< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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(MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > newTS;
+ for(std::vector< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto<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< MCAuto< 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< MCAuto< 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< MCAuto< 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< MCAuto< 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< MCAuto< 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< MCAuto< 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::deepCopy() const
+{
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> ret=shallowCpy();
+ std::size_t i=0;
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
+ {
+ if((const MEDFileAnyTypeField1TSWithoutSDA *)*it)
+ ret->_time_steps[i]=(*it)->deepCopy();
+ }
+ return ret.retn();
+}
+
+std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents() const
+{
+ std::size_t sz(_infos.size()),sz2(_time_steps.size());
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(sz);
+ std::vector< std::vector< MCAuto<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< MCAuto<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< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations() const
+{
+ std::size_t sz(_time_steps.size());
+ std::vector< std::vector< MCAuto<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< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
+ std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > > ret2;
+ std::vector< TypeOfField > types;
+ for(std::vector< std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<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< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > >::const_iterator it0=items.begin();it0!=items.end();it0++)
+ for(std::vector< MCAuto<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++)
+ {
+ MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> elt(createNew());
+ for(std::vector< MCAuto<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< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes() const
+{
+ std::size_t sz(_time_steps.size());
+ std::vector< std::vector< MCAuto<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< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret(szOut);
+ for(std::size_t i=0;i<szOut;i++)
+ {
+ MCAuto<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());