From: ageay Date: Wed, 24 Jul 2013 09:00:48 +0000 (+0000) Subject: Target MEDReader X-Git-Tag: V7_3_1b1~291 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=854b8c30cd78bd9c7679492863fab2128552bb92;p=tools%2Fmedcoupling.git Target MEDReader --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 98fbbf48c..ab12329ca 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -179,6 +179,18 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED } } +bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const +{ + if(startExp!=_start_end.first) + return false; + if(gt!=_geo_type) + return false; + if(getPflName()!=pflName) + return false; + startExp=_start_end.second; + return true; +} + bool MEDFileField1TSStructItem2::operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception) { //_nb_of_entity is not taken into account here. It is not a bug, because no mesh consideration needed here to perform fast compare. @@ -867,6 +879,58 @@ void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr) _node_reduction=const_cast(nr); } +bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception) +{ + if(fst.getType()==ON_NODES) + { + if(fst.getNumberOfItems()!=1) + throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !"); + const MEDFileField1TSStructItem2& p(fst[0]); + std::string pflName(p.getPflName()); + const DataArrayInt *nr(_node_reduction); + if(pflName.empty() && !nr) + return true; + if(pflName==nr->getName()) + return true; + return false; + } + else + { + std::size_t sz(fst.getNumberOfItems()); + if(sz!=_geo_types.size()) + return false; + int strt(0); + for(std::size_t i=0;i ret(const_cast(vals)); ret->incrRef(); + if(isFastlyTheSameStruct(fst,globs)) + return ret.retn(); + //else + // return constructDataArray(fst,globs,vals); + return 0; +} + +std::string MEDMeshMultiLev::getPflNameOfId(int id) const +{ + std::size_t sz(_pfls.size()); + if(id<0 || id>=sz) + throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !"); + const DataArrayInt *pfl(_pfls[id]); + if(!pfl) + return std::string(""); + return pfl->getName(); +} + MEDMeshMultiLev::MEDMeshMultiLev() { } diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index e8866b543..15b1d266d 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -62,7 +62,9 @@ namespace ParaMEDMEM int _nb_nodes; std::vector< std::vector > _geo_types_distrib; }; - + + class MEDFileField1TSStructItem; + class MEDMeshMultiLev : public RefCountObject { public: @@ -72,8 +74,12 @@ namespace ParaMEDMEM static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs) throw(INTERP_KERNEL::Exception); static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode) throw(INTERP_KERNEL::Exception); void setNodeReduction(const DataArrayInt *nr); + bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception); virtual void selectPartOfNodes(const DataArrayInt *pflNodes) throw(INTERP_KERNEL::Exception) = 0; virtual MEDMeshMultiLev *prepare() const throw(INTERP_KERNEL::Exception) = 0; + protected: + std::string getPflNameOfId(int id) const; protected: MEDMeshMultiLev(); MEDMeshMultiLev(const MEDMeshMultiLev& other); @@ -161,6 +167,7 @@ namespace ParaMEDMEM std::string getPflName() const; //! warning this method also set _nb_of_entity attribute ! void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) throw(INTERP_KERNEL::Exception); + bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const; bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception); bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); @@ -211,9 +218,9 @@ namespace ParaMEDMEM bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception); MEDMeshMultiLev *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); bool isDataSetSupportFastlyEqualTo(const MEDFileField1TSStruct& other, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception); + static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt); private: MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst); - static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt); bool presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception); bool presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception); private: