return new MEDFileFieldMultiTS(*this);
}
-void MEDFileFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
-{
- if(!f1ts)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
- const MEDFileField1TS *f1tsC=dynamic_cast<const MEDFileField1TS *>(f1ts);
- if(!f1tsC)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::checkCoherencyOfType : the input field1TS is not a FLOAT64 type !");
-}
-
/*!
* This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
* following the given input policy.
return ret.retn();
}
-/*!
- * Returns a new MEDFileField1TS holding data of a given time step of \a this field.
- * \param [in] pos - a time step id.
- * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
- * delete this field using decrRef() as it is no more needed.
- * \throw If \a pos is not a valid time step id.
- */
-MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const
-{
- const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos);
- if(!item)
- {
- std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- const MEDFileField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(item);
- if(itemC)
- {
- MCAuto<MEDFileField1TS> ret=MEDFileField1TS::New(*itemC,false);
- ret->shallowCpyGlobs(*this);
- return ret.retn();
- }
- std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not FLOAT64 !";
- throw INTERP_KERNEL::Exception(oss.str());
-}
-
MEDFileFieldMultiTS::MEDFileFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms)
try:MEDFileTemplateFieldMultiTS<double>(fid,loadAll,ms)
{
return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
}
-DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArray(int iteration, int order) const
-{
- return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArray(iteration,order));
-}
-
-DataArrayDouble *MEDFileFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
-{
- return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
-}
-
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::buildNewEmpty() const
-{
- return MEDFileFieldMultiTS::New();
-}
-
//= MEDFileAnyTypeFieldMultiTSIterator
MEDFileAnyTypeFieldMultiTSIterator::MEDFileAnyTypeFieldMultiTSIterator(MEDFileAnyTypeFieldMultiTS *fmts):_fmts(fmts),_iter_id(0),_nb_iter(0)
return new MEDFileIntFieldMultiTS(*this);
}
-void MEDFileIntFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
-{
- if(!f1ts)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
- const MEDFileIntField1TS *f1tsC=dynamic_cast<const MEDFileIntField1TS *>(f1ts);
- if(!f1tsC)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::checkCoherencyOfType : the input field1TS is not a INT32 type !");
-}
-
-/*!
- * Returns a new MEDFileIntField1TS holding data of a given time step of \a this field.
- * \param [in] pos - a time step id.
- * \return MEDFileIntField1TS * - a new instance of MEDFileIntField1TS. The caller is to
- * delete this field using decrRef() as it is no more needed.
- * \throw If \a pos is not a valid time step id.
- */
-MEDFileIntField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const
-{
- const MEDFileAnyTypeField1TSWithoutSDA *item=contentNotNullBase()->getTimeStepAtPos2(pos);
- if(!item)
- {
- std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
- throw INTERP_KERNEL::Exception(oss.str());
- }
- const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(item);
- if(itemC)
- {
- MCAuto<MEDFileIntField1TS> ret=MEDFileIntField1TS::New(*itemC,false);
- ret->shallowCpyGlobs(*this);
- return ret.retn();
- }
- std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not INT32 !";
- throw INTERP_KERNEL::Exception(oss.str());
-}
-
MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS<int>(other,shallowCopyOfContent)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-DataArrayInt *MEDFileIntFieldMultiTS::getUndergroundDataArray(int iteration, int order) const
-{
- return static_cast<DataArrayInt *>(contentNotNull()->getUndergroundDataArray(iteration,order));
-}
-
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::buildNewEmpty() const
-{
- return MEDFileIntFieldMultiTS::New();
-}
-
//= MEDFileFields
MEDFileFields *MEDFileFields::New()
//
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);
+ //
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::F1TSType *getTimeStepAtPos(int pos) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArray(int iteration, int order) const;
+ MEDLOADER_EXPORT typename Traits<T>::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
+ MEDLOADER_EXPORT typename MLFieldTraits<T>::FMTSType *buildNewEmptyImpl() const;
+ MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
protected:
const typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull() const;
typename MLFieldTraits<T>::FMTSWSDAType *contentNotNull();
friend class MEDFileTemplateFieldMultiTS<double>;
public:
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
- MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
//
- MEDLOADER_EXPORT MEDFileField1TS *getTimeStepAtPos(int pos) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const;
- //
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;
+ MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
public:
- MEDLOADER_EXPORT MEDFileFieldMultiTS *buildNewEmpty() const;
private:
~MEDFileFieldMultiTS() { }
MEDFileFieldMultiTS() { }
friend class MEDFileTemplateFieldMultiTS<int>;
public:
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
- MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
- MEDLOADER_EXPORT MEDFileIntField1TS *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
- //
- MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const;
- public:
- MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const;
+ MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); }
private:
~MEDFileIntFieldMultiTS() { }
MEDFileIntFieldMultiTS() { }
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;
}
+
+ /*!
+ * Returns a new MEDFileField1TS holding data of a given time step of \a this field.
+ * \param [in] pos - a time step id.
+ * \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
+ * delete this field using decrRef() as it is no more needed.
+ * \throw If \a pos is not a valid time step id.
+ */
+ template<class T>
+ typename MLFieldTraits<T>::F1TSType *MEDFileTemplateFieldMultiTS<T>::getTimeStepAtPos(int pos) const
+ {
+ const MEDFileAnyTypeField1TSWithoutSDA *item(contentNotNullBase()->getTimeStepAtPos2(pos));
+ if(!item)
+ {
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ const typename MLFieldTraits<T>::F1TSWSDAType *itemC=dynamic_cast<const typename MLFieldTraits<T>::F1TSWSDAType *>(item);
+ if(itemC)
+ {
+ MCAuto<typename MLFieldTraits<T>::F1TSType> ret(MLFieldTraits<T>::F1TSType::New(*itemC,false));
+ ret->shallowCpyGlobs(*this);
+ return ret.retn();
+ }
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+
+ template<class T>
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArray(int iteration, int order) const
+ {
+ DataArray *ret(contentNotNull()->getUndergroundDataArray(iteration,order));
+ if(!ret)
+ return NULL;
+ typename Traits<T>::ArrayType *ret2(dynamic_cast<typename Traits<T>::ArrayType *>(ret));
+ if(!ret2)
+ {
+ std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArray : invalid type of data dectected ! Expecting " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ return ret2;
+ }
+
+ template<class T>
+ typename Traits<T>::ArrayType *MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const
+ {
+ DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
+ if(!ret)
+ return NULL;
+ typename Traits<T>::ArrayType *ret2(dynamic_cast<typename Traits<T>::ArrayType *>(ret));
+ if(!ret2)
+ {
+ std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::getUndergroundDataArrayExt : invalid type of data dectected ! Expecting " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR;
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ return ret2;
+ }
+
+ template<class T>
+ typename MLFieldTraits<T>::FMTSType *MEDFileTemplateFieldMultiTS<T>::buildNewEmptyImpl() const
+ {
+ return MLFieldTraits<T>::FMTSType::New();
+ }
+
+ template<class T>
+ void MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const
+ {
+ if(!f1ts)
+ throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !");
+ const typename MLFieldTraits<T>::F1TSType *f1tsC=dynamic_cast<const typename MLFieldTraits<T>::F1TSType *>(f1ts);
+ if(!f1tsC)
+ {
+ std::ostringstream oss; oss << "MEDFileTemplateFieldMultiTS<T>::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits<T>::F1TSWSDAType::TYPE_STR << " type !";
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ }
}
#endif