From: Anthony Geay Date: Mon, 13 Feb 2017 15:35:02 +0000 (+0100) Subject: Before generation of data X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=30a3ad47414b41098e233af061d04328643b744d;p=tools%2Fmedcoupling.git Before generation of data --- diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 28b7b0f6b..99c1c0238 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -309,10 +309,26 @@ void MEDFileBlowStrEltUp::DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const // +class FieldWalker2 +{ +public: + FieldWalker2(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); + std::string getLoc() const { return _loc; } + std::string getPfl() const { return _pfl; } + bool isClassic() const { return _is_classic; } + bool operator!=(const FieldWalker2& other) const; + bool operator==(const FieldWalker2& other) const; +private: + std::string _loc; + std::string _pfl; + bool _is_classic; +}; + class LocInfo { public: LocInfo() { } + LocInfo(const std::vector& fw); bool operator==(const LocInfo& other) const { return _locs==other._locs && _pfl==other._pfl; } void push(const std::string& loc, const std::string& pfl) { checkUniqueLoc(loc); _locs.push_back(loc); _pfl.push_back(pfl); } private: @@ -322,6 +338,17 @@ private: std::vector _pfl; }; +LocInfo::LocInfo(const std::vector& fw) +{ + std::size_t sz(fw.size()); + _locs.resize(sz); _pfl.resize(sz); + for(std::size_t i=0;igetLocalization(); _pfl=pmptpd->getProfile(); - _is_classic=pmptpd->getType()==ON_GAUSS_PT; + _is_classic=pmptpd->getType()!=ON_GAUSS_PT; } bool FieldWalker2::operator!=(const FieldWalker2& other) const @@ -356,6 +371,12 @@ bool FieldWalker2::operator!=(const FieldWalker2& other) const return !ret; } +bool FieldWalker2::operator==(const FieldWalker2& other) const +{ + bool ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic); + return ret; +} + class FieldWalker1 { public: @@ -367,6 +388,7 @@ public: void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); void checkOK(const FieldWalker1& other) const; bool isClassical() const; + std::vector getNonClassicalData() const { return _fw; } private: const MEDFileAnyTypeField1TSWithoutSDA *_ts; const MEDFileFieldPerMeshPerTypeDyn *_pm_pt; @@ -441,6 +463,8 @@ public: public: bool isEmpty() const; bool isClassical() const; + const MEDFileAnyTypeFieldMultiTSWithoutSDA *field() const { return _f; } + std::vector getNonClassicalData() const { return _fw_prev->getNonClassicalData(); } private: const MEDFileAnyTypeFieldMultiTSWithoutSDA *_f; mutable INTERP_KERNEL::AutoCppPtr _fw; @@ -501,6 +525,7 @@ class LocSpliter : public MEDFileFieldVisitor { public: LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(0) { } + MCAuto getClassical() const { return _classical; } private: void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); @@ -540,6 +565,22 @@ void LocSpliter::endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field _classical=MEDFileFields::New(); _classical->shallowCpyGlobs(*_globs); } + MCAuto f(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(const_cast(field))); + _classical->pushField(f); + } + else + { + std::vector fw2(_fw->getNonClassicalData()); + LocInfo elt(fw2); + std::vector< LocInfo >::iterator it(std::find(_locs.begin(),_locs.end(),elt)); + if(it==_locs.end()) + { + _locs.push_back(elt); + } + else + { + } + std::cerr << "lkk " << _locs.size() << std::endl; } } @@ -582,4 +623,5 @@ MCAuto MEDFileBlowStrEltUp::splitFieldsPerLoc(const MEDFileFields { LocSpliter ls(fields); fields->accept(ls); + return ls.getClassical(); } diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 03557216a..bdb8d5dea 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -1070,7 +1070,6 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c); static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid); static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms); static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); @@ -1079,6 +1078,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c); MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays();