throw INTERP_KERNEL::Exception(oss.str());
}
-const MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull() const
-{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
- if(!pt)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the content pointer is null !");
- const MEDFileFieldMultiTSWithoutSDA *ret=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(pt);
- if(!ret)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::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;
-}
-
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTS::contentNotNull()
-{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
- if(!pt)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::contentNotNull : the non const content pointer is null !");
- MEDFileFieldMultiTSWithoutSDA *ret=dynamic_cast<MEDFileFieldMultiTSWithoutSDA *>(pt);
- if(!ret)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::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;
-}
-
-/*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step. 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 existing time steps have different name or 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 MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field)
-{
- const DataArrayDouble *arr=0;
- if(field)
- arr=field->getArray();
- contentNotNull()->appendFieldNoProfileSBT(field,arr,*this);
-}
-
-/*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step.
- * 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 MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
-{
- const DataArrayDouble *arr=0;
- if(field)
- arr=field->getArray();
- contentNotNull()->appendFieldProfile(field,arr,mesh,meshDimRelToMax,profile,*this);
-}
-
MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
try:MEDFileTemplateFieldMultiTS<double>(fid,loadAll,ms)
{
throw INTERP_KERNEL::Exception(oss.str());
}
-/*!
- * Adds a MEDCouplingFieldInt to \a this as another time step. 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 existing time steps have different name or 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 MEDFileIntFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldInt *field)
-{
- MCAuto<MEDCouplingFieldDouble> field2(MEDFileIntField1TS::ConvertFieldIntToFieldDouble(field));
- contentNotNull()->appendFieldNoProfileSBT(field2,field->getArray(),*this);
-}
-
-/*!
- * Adds a MEDCouplingFieldDouble to \a this as another time step.
- * 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 MEDFileIntFieldMultiTS::appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
-{
- MCAuto<MEDCouplingFieldDouble> field2(MEDFileIntField1TS::ConvertFieldIntToFieldDouble(field));
- contentNotNull()->appendFieldProfile(field2,field->getArray(),mesh,meshDimRelToMax,profile,*this);
-}
-
-const MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull() const
-{
- const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
- if(!pt)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the content pointer is null !");
- const MEDFileIntFieldMultiTSWithoutSDA *ret=dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(pt);
- if(!ret)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the content pointer is not null but it is not of type int ! Reason is maybe that the read field has not the type INT32 !");
- return ret;
-}
-
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull()
-{
- MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
- if(!pt)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the non const content pointer is null !");
- MEDFileIntFieldMultiTSWithoutSDA *ret=dynamic_cast<MEDFileIntFieldMultiTSWithoutSDA *>(pt);
- if(!ret)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::contentNotNull : the non const content pointer is not null but it is not of type int ! Reason is maybe that the read field has not the type INT32 !");
- return ret;
-}
-
MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<int>(other,shallowCopyOfContent)
{
}
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray() const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
- MEDLOADER_EXPORT static MCAuto<typename Traits<T>::FieldType> SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
+ MEDLOADER_EXPORT static MCAuto<typename Traits<T>::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr);
+ MEDLOADER_EXPORT static MCAuto<MEDCouplingFieldDouble> ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f);
public:
MEDLOADER_EXPORT typename Traits<T>::FieldType *field(const MEDFileMesh *mesh) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT typename Traits<T>::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
+ //
+ MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field);
+ MEDLOADER_EXPORT void appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
+ protected:
+ const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
+ typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
protected:
~MEDFileTemplateFieldMultiTS() { }
MEDFileTemplateFieldMultiTS();
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
//
- MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
- MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray(int iteration, int order) const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
public:
MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const;
- private:
- const MEDFileFieldMultiTSWithoutSDA *contentNotNull() const;
- MEDFileFieldMultiTSWithoutSDA *contentNotNull();
private:
~MEDFileFieldMultiTS() { }
MEDFileFieldMultiTS() { }
MEDLOADER_EXPORT MEDFileIntField1TS *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
- MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field);
- MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
- //
MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const;
public:
MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const;
- private:
- const MEDFileIntFieldMultiTSWithoutSDA *contentNotNull() const;
- MEDFileIntFieldMultiTSWithoutSDA *contentNotNull();
private:
~MEDFileIntFieldMultiTS() { }
MEDFileIntFieldMultiTS() { }
}
template<class T>
- MCAuto<typename Traits<T>::FieldType> MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
+ MCAuto<typename Traits<T>::FieldType> MEDFileTemplateField1TS<T>::SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
{
if(!f)
- throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField : input field is NULL !");
+ throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayInField : input field is NULL !");
if(arr.isNull())
- throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField : no array !");
+ throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::SetDataArrayInField : no array !");
int t1,t2;
double t0(f->getTime(t1,t2));
std::string tu(f->getTimeUnit());
return ret.retn();
}
+ template<class T>
+ MCAuto<MEDCouplingFieldDouble> MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(const typename Traits<T>::FieldType *f)
+ {
+ int t1,t2;
+ double t0(f->getTime(t1,t2));
+ std::string tu(f->getTimeUnit());
+ MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::NewWithoutCheck(*f));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
+ ret->setTime(t0,t1,t2); ret->setTimeUnit(tu);
+ return ret.retn();
+ }
+
/*!
* This is the simplest version to fetch a field for MED structure. One drawback : if \a this is a complex field (multi spatial discretization inside a same field) this method will throw exception and more advance
* method should be called (getFieldOnMeshAtLevel for example).
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->fieldOnMesh(this,mesh,arrOut,*contentNotNull()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::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()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::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()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateField1TS<T>::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()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtTopLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldOnMeshAtLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::getFieldAtLevelOld : mismatch of type of field !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()));
- MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayDoubleInField(ret,arrOut));
+ MCAuto<typename Traits<T>::FieldType> ret2(MEDFileTemplateField1TS<T>::SetDataArrayInField(ret,arrOut));
return ret2.retn();
}
MCAuto<DataArray> ret(myF1TSC->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNullBase()));
return MEDFileTemplateField1TS<T>::ReturnSafelyTypedDataArray(ret);
}
+
+ /*!
+ * Adds a MEDCouplingFieldDouble to \a this as another time step. 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 existing time steps have different name or 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.
+ */
+ template<class T>
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldNoProfileSBT(const typename Traits<T>::FieldType *field)
+ {
+ const typename Traits<T>::ArrayType *arr(NULL);
+ if(field)
+ arr=field->getArray();
+ MCAuto<MEDCouplingFieldDouble> field2(MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(field));
+ contentNotNull()->appendFieldNoProfileSBT(field2,arr,*this);
+ }
+
+ /*!
+ * Adds a MEDCouplingFieldDouble to \a this as another time step.
+ * 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()
+ */
+ template<class T>
+ void MEDFileTemplateFieldMultiTS<T>::appendFieldProfile(const typename Traits<T>::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile)
+ {
+ const typename Traits<T>::ArrayType *arr(NULL);
+ if(field)
+ arr=field->getArray();
+ MCAuto<MEDCouplingFieldDouble> field2(MEDFileTemplateField1TS<T>::ToFieldTemplateWithTime(field));
+ contentNotNull()->appendFieldProfile(field2,arr,mesh,meshDimRelToMax,profile,*this);
+ }
+
+ template<class T>
+ const typename MLFieldTraits<T>::FMTSWSDAType *MEDFileTemplateFieldMultiTS<T>::contentNotNull() const
+ {
+ const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the content pointer is null !");
+ const typename MLFieldTraits<T>::FMTSWSDAType *ret=dynamic_cast<const typename MLFieldTraits<T>::FMTSWSDAType *>(pt);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::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;
+ }
+
+ template<class T>
+ typename MLFieldTraits<T>::FMTSWSDAType *MEDFileTemplateFieldMultiTS<T>::contentNotNull()
+ {
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content);
+ if(!pt)
+ throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::contentNotNull : the non const content pointer is null !");
+ typename MLFieldTraits<T>::FMTSWSDAType *ret(dynamic_cast<typename MLFieldTraits<T>::FMTSWSDAType *>(pt));
+ if(!ret)
+ throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::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;
+ }
}
#endif