From 42f55b46f070c9affc3fafcc58d17feee135eb59 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 18 May 2017 10:12:05 +0200 Subject: [PATCH] Fatorization of MultiTS done. Last polish remaining. --- src/MEDLoader/MEDFileField.cxx | 141 ------------------------------ src/MEDLoader/MEDFileField.hxx | 102 +++++++++++++++------ src/MEDLoader/MEDFileField.txx | 37 ++++++++ src/MEDLoader/MEDLoaderTraits.hxx | 6 +- 4 files changed, 118 insertions(+), 168 deletions(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index b1e2e2603..25a87324b 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -8021,65 +8021,6 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -{ - return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); -} - -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA() -{ -} - -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) -{ -} - -/*! - * \param [in] fieldId field id in C mode - */ -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - -MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - -MEDFileAnyTypeField1TSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const -{ - return new MEDFileField1TSWithoutSDA; -} - -void MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const -{ - if(!f1ts) - throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !"); - const MEDFileField1TSWithoutSDA *f1tsC=dynamic_cast(f1ts); - if(!f1tsC) - throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a FLOAT64 type !"); -} - -const char *MEDFileFieldMultiTSWithoutSDA::getTypeStr() const -{ - return MEDFileField1TSWithoutSDA::TYPE_STR; -} - -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::shallowCpy() const -{ - return new MEDFileFieldMultiTSWithoutSDA(*this); -} - -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew() const -{ - return new MEDFileFieldMultiTSWithoutSDA; -} - /*! * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller. @@ -8233,65 +8174,6 @@ catch(INTERP_KERNEL::Exception& e) //= MEDFileIntFieldMultiTSWithoutSDA -MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -{ - return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); -} - -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA() -{ -} - -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) -{ -} - -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - -/*! - * \param [in] fieldId field id in C mode - */ -MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - -MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const -{ - return new MEDFileIntField1TSWithoutSDA; -} - -void MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const -{ - if(!f1ts) - throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !"); - const MEDFileIntField1TSWithoutSDA *f1tsC=dynamic_cast(f1ts); - if(!f1tsC) - throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a INT32 type !"); -} - -const char *MEDFileIntFieldMultiTSWithoutSDA::getTypeStr() const -{ - return MEDFileIntField1TSWithoutSDA::TYPE_STR; -} - -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::shallowCpy() const -{ - return new MEDFileIntFieldMultiTSWithoutSDA(*this); -} - -MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::createNew() const -{ - return new MEDFileIntFieldMultiTSWithoutSDA; -} - MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble() const { MCAuto ret(new MEDFileFieldMultiTSWithoutSDA); @@ -9207,29 +9089,6 @@ MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs return ret.retn(); } -MEDFileAnyTypeFieldMultiTS *MEDFileIntFieldMultiTS::shallowCpy() const -{ - return new MEDFileIntFieldMultiTS(*this); -} - -MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS(other,shallowCopyOfContent) -{ -} - -MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms) -try:MEDFileTemplateFieldMultiTS(fid,loadAll,ms) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - -MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) -try:MEDFileTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) -{ -} -catch(INTERP_KERNEL::Exception& e) -{ throw e; } - //= MEDFileFields MEDFileFields *MEDFileFields::New() diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index e5ca288d9..d670fee4f 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -1049,43 +1049,67 @@ namespace MEDCoupling class MEDFileIntFieldMultiTSWithoutSDA; - class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA + template + class MEDFileTemplateFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA { public: - MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); - MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDLOADER_EXPORT static typename MLFieldTraits::FMTSWSDAType *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; + protected: + MEDFileTemplateFieldMultiTSWithoutSDA() { } + MEDFileTemplateFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName,meshName) { } + /** \param [in] fieldId field id in C mode */ + MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } + MEDFileTemplateFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } + void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; + }; + + class MEDFileFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA + { + friend class MEDFileTemplateFieldMultiTSWithoutSDA; + public: + MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFieldMultiTSWithoutSDA(*this); } protected: - MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName); - MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } + MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } med_field_type getMEDFileFieldType() const { return MED_FLOAT64; } - MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; - void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; public: - MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(); + MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA() { } }; - class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA + class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA { + friend class MEDFileTemplateFieldMultiTSWithoutSDA; public: - MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); - MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const; + MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileIntFieldMultiTSWithoutSDA(*this); } protected: - MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName); - MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); + MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } + MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } med_field_type getMEDFileFieldType() const { return MED_INT32; } - MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const; - void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const; public: - MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(); + MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA() { } + }; + + class MEDFileFloatFieldMultiTSWithoutSDA : public MEDFileTemplateFieldMultiTSWithoutSDA + { + friend class MEDFileTemplateFieldMultiTSWithoutSDA; + public: + MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldId,loadAll,ms,entities) { } + MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const { return new MEDFileFloatFieldMultiTSWithoutSDA(*this); } + protected: + MEDFileFloatFieldMultiTSWithoutSDA(const std::string& fieldName, const std::string& meshName):MEDFileTemplateFieldMultiTSWithoutSDA(fieldName,meshName) { } + MEDFileFloatFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTSWithoutSDA(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities) { } + med_field_type getMEDFileFieldType() const { return MED_INT32; }//6432 + public: + MEDLOADER_EXPORT MEDFileFloatFieldMultiTSWithoutSDA() { } }; class MEDFileAnyTypeFieldMultiTSIterator; @@ -1247,22 +1271,50 @@ namespace MEDCoupling MEDFileFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); }; + template + class MEDFileNDTemplateFieldMultiTS : public MEDFileTemplateFieldMultiTS + { + protected: + ~MEDFileNDTemplateFieldMultiTS() { } + MEDFileNDTemplateFieldMultiTS() { } + MEDFileNDTemplateFieldMultiTS(const typename MLFieldTraits::FMTSWSDAType& other, bool shallowCopyOfContent):MEDFileTemplateFieldMultiTS(other,shallowCopyOfContent) { } + MEDFileNDTemplateFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileTemplateFieldMultiTS(fid,loadAll,ms) { } + MEDFileNDTemplateFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities):MEDFileTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + }; + /*! * User class. */ - class MEDFileIntFieldMultiTS : public MEDFileTemplateFieldMultiTS + class MEDFileIntFieldMultiTS : public MEDFileNDTemplateFieldMultiTS { friend class MEDFileTemplateFieldMultiTS; public: - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileIntFieldMultiTS(*this); } MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDLOADER_EXPORT MEDFileIntFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } private: ~MEDFileIntFieldMultiTS() { } MEDFileIntFieldMultiTS() { } - MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); - MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); + MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } + MEDFileIntFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } + MEDFileIntFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } + }; + + /*! + * User class. + */ + class MEDFileFloatFieldMultiTS : public MEDFileNDTemplateFieldMultiTS + { + friend class MEDFileTemplateFieldMultiTS; + public: + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const { return new MEDFileFloatFieldMultiTS(*this); } + MEDLOADER_EXPORT MEDFileFloatFieldMultiTS *buildNewEmpty() const { return buildNewEmptyImpl(); } + private: + ~MEDFileFloatFieldMultiTS() { } + MEDFileFloatFieldMultiTS() { } + MEDFileFloatFieldMultiTS(const MEDFileFloatFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent):MEDFileNDTemplateFieldMultiTS(other,shallowCopyOfContent) { } + MEDFileFloatFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms):MEDFileNDTemplateFieldMultiTS(fid,loadAll,ms) { } + MEDFileFloatFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0):MEDFileNDTemplateFieldMultiTS(fid,fieldName,loadAll,ms,entities) { } }; class MEDFileAnyTypeFieldMultiTSIterator diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index 50a9d6756..6bcb4271d 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -1196,6 +1196,43 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception(oss.str()); } } + + template + typename MLFieldTraits::FMTSWSDAType *MEDFileTemplateFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, const std::string& meshName, med_field_type fieldTyp, const std::vector& infos, int nbOfStep, const std::string& dtunit, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) + { + return new typename MLFieldTraits::FMTSWSDAType(fid,fieldName,meshName,fieldTyp,infos,nbOfStep,dtunit,loadAll,ms,entities); + } + + template + void MEDFileTemplateFieldMultiTSWithoutSDA::checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const + { + if(!f1ts) + throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : input field1TS is NULL ! Impossible to check !"); + const typename MLFieldTraits::F1TSWSDAType *f1tsC(dynamic_cast::F1TSWSDAType *>(f1ts)); + if(!f1tsC) + { + std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfType : the input field1TS is not a " << MLFieldTraits::F1TSWSDAType::TYPE_STR << " type !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + + template + const char *MEDFileTemplateFieldMultiTSWithoutSDA::getTypeStr() const + { + return MLFieldTraits::F1TSWSDAType::TYPE_STR; + } + + template + MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileTemplateFieldMultiTSWithoutSDA::createNew() const + { + return new typename MLFieldTraits::FMTSWSDAType; + } + + template + MEDFileAnyTypeField1TSWithoutSDA *MEDFileTemplateFieldMultiTSWithoutSDA::createNew1TSWithoutSDAEmptyInstance() const + { + return new typename MLFieldTraits::F1TSWSDAType; + } } #endif diff --git a/src/MEDLoader/MEDLoaderTraits.hxx b/src/MEDLoader/MEDLoaderTraits.hxx index f62d881fe..c9af424fb 100644 --- a/src/MEDLoader/MEDLoaderTraits.hxx +++ b/src/MEDLoader/MEDLoaderTraits.hxx @@ -35,12 +35,14 @@ namespace MEDCoupling class MEDFileField1TS; class MEDFileIntFieldMultiTS; class MEDFileIntField1TS; + class MEDFileFloatFieldMultiTS; class MEDFileFloatField1TS; class MEDFileField1TSWithoutSDA; class MEDFileIntField1TSWithoutSDA; class MEDFileFloatField1TSWithoutSDA; class MEDFileFieldMultiTSWithoutSDA; class MEDFileIntFieldMultiTSWithoutSDA; + class MEDFileFloatFieldMultiTSWithoutSDA; template<> struct MEDLOADER_EXPORT MLFieldTraits @@ -54,8 +56,8 @@ namespace MEDCoupling template<> struct MEDLOADER_EXPORT MLFieldTraits { - //typedef MEDFileFloatFieldMultiTSWithoutSDA FMTSWSDAType; - //typedef MEDFileFloatFieldMultiTS FMTSType; + typedef MEDFileFloatFieldMultiTSWithoutSDA FMTSWSDAType; + typedef MEDFileFloatFieldMultiTS FMTSType; typedef MEDFileFloatField1TS F1TSType; typedef MEDFileFloatField1TSWithoutSDA F1TSWSDAType; }; -- 2.39.2