From: Anthony Geay Date: Tue, 22 Jun 2021 09:22:33 +0000 (+0200) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1982ae6908ad46643b969cb983e61a2aecf4d3d;p=tools%2Fmedcoupling.git WIP --- diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index a94a7d760..d5ac6d1f6 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -313,6 +313,7 @@ public: FieldWalker2(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); std::string getLoc() const { return _loc; } std::string getPfl() const { return _pfl; } + INTERP_KERNEL::NormalizedCellType getGeoType() const { return _ct; } bool isClassic() const { return _is_classic; } bool operator!=(const FieldWalker2& other) const; bool operator==(const FieldWalker2& other) const; @@ -320,6 +321,7 @@ public: private: std::string _loc; std::string _pfl; + INTERP_KERNEL::NormalizedCellType _ct; bool _is_classic; MCAuto _pd; }; @@ -348,6 +350,7 @@ public: private: std::vector _locs; std::vector _pfl; + std::vector _cts; MCAuto _pd; }; @@ -362,13 +365,14 @@ const char LocInfo::EPAISSEUR[]="EPAISSEUR"; LocInfo::LocInfo(const std::vector& fw) { std::size_t sz(fw.size()); - _locs.resize(sz); _pfl.resize(sz); + _locs.resize(sz); _pfl.resize(sz); _cts.resize(sz); if(sz>0) _pd=fw[0].getPartDef()->deepCopy(); for(std::size_t i=0;i0) _pd=(*_pd)+(*(fw[i].getPartDef())); } @@ -636,19 +640,22 @@ MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileU throw INTERP_KERNEL::Exception("LocInfo::generateNonClassicalData : internal error !"); const MEDFileUMesh *meshLoc(gtk2->getMesh()),*section(gtk2->getSection()); const MEDFileStructureElement *se(gtk2->getSE()); - INTERP_KERNEL::NormalizedCellType gt; + MCAuto um(meshLoc->getMeshAtLevel(0)); + INTERP_KERNEL::NormalizedCellType gt(_cts[i]); { std::vector nel(meshLoc->getNonEmptyLevels()); if(nel.size()!=1) throw INTERP_KERNEL::Exception(MSG1); if(nel[0]!=0) throw INTERP_KERNEL::Exception(MSG1); - MCAuto um(meshLoc->getMeshAtLevel(0)); - if(um->getNumberOfCells()!=1) + mcIdType zePos(-1); + for(mcIdType icell = 0 ; icell < um->getNumberOfCells() ; ++icell) + if( gt == um->getTypeOfCell(icell) ) + zePos = icell; + if(zePos == -1) throw INTERP_KERNEL::Exception(MSG1); - gt=um->getTypeOfCell(0); std::vector v; - um->getNodeIdsOfCell(0,v); + um->getNodeIdsOfCell(zePos,v); std::size_t sz2(v.size()); for(std::size_t j=0;jgetLocalization(); _pfl=pmptpd->getProfile(); + _ct=pmptpd->getGeoTypeStatic(); _is_classic=pmptpd->getType()!=ON_GAUSS_PT; _pd=SlicePartDefinition::New(pmptpd->getStart(),pmptpd->getEnd(),1); } diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index fc228e675..fffb38ef8 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -801,6 +801,11 @@ INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypePerDisc::getGeoType( return _father->getGeoType(); } +INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypePerDisc::getGeoTypeStatic() const +{ + return _father->getGeoTypeStatic(); +} + void MEDFileFieldPerMeshPerTypePerDisc::fillTypesOfFieldAvailable(std::set& types) const { types.insert(_type); @@ -1778,6 +1783,11 @@ INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const return _geo_type; } +INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoTypeStatic() const +{ + return _geo_type; +} + void MEDFileFieldPerMeshPerType::entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const { ent=MEDFileFieldPerMeshPerTypeCommon::ConvertIntoMEDFileType(mct,_geo_type,gt); @@ -1930,6 +1940,11 @@ INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypeDyn::getGeoType() co throw INTERP_KERNEL::Exception("not implemented yet !"); } +INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypeDyn::getGeoTypeStatic() const +{ + return _se->getGeoType(); +} + void MEDFileFieldPerMeshPerTypeDyn::simpleRepr(int bkOffset, std::ostream& oss, int id) const { const char startLine[]=" ## "; diff --git a/src/MEDLoader/MEDFileFieldInternal.hxx b/src/MEDLoader/MEDFileFieldInternal.hxx index 67db06bde..91dd39117 100644 --- a/src/MEDLoader/MEDFileFieldInternal.hxx +++ b/src/MEDLoader/MEDFileFieldInternal.hxx @@ -158,6 +158,7 @@ namespace MEDCoupling void fillTypesOfFieldAvailable(std::set& types) const; void setType(TypeOfField newType); INTERP_KERNEL::NormalizedCellType getGeoType() const; + INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const; std::size_t getNumberOfComponents() const; mcIdType getNumberOfTuples() const; mcIdType getStart() const { return _start; } @@ -269,6 +270,7 @@ namespace MEDCoupling virtual ~MEDFileFieldPerMeshPerTypeCommon(); virtual void getDimension(int& dim) const = 0; virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0; + virtual INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const = 0; virtual void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const = 0; virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0; virtual std::string getGeoTypeRepr() const = 0; @@ -295,7 +297,8 @@ namespace MEDCoupling static MCAuto Aggregate(mcIdType &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); public:// overload of abstract methods void getDimension(int& dim) const; - INTERP_KERNEL::NormalizedCellType getGeoType() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const override; + INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override; void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; void simpleRepr(int bkOffset, std::ostream& oss, int id) const; std::string getGeoTypeRepr() const; @@ -317,7 +320,8 @@ namespace MEDCoupling std::string getModelName() const; public: void getDimension(int& dim) const; - INTERP_KERNEL::NormalizedCellType getGeoType() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const override; + INTERP_KERNEL::NormalizedCellType getGeoTypeStatic() const override; void entriesForMEDfile(TypeOfField mct, med_geometry_type& gt, med_entity_type& ent) const; void simpleRepr(int bkOffset, std::ostream& oss, int id) const; std::string getGeoTypeRepr() const;