From: geay Date: Fri, 21 Mar 2014 18:25:57 +0000 (+0100) Subject: Management of lev -1 even for cell fields on structured meshes X-Git-Tag: V7_4_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=84ddd4290c34f47a07b36552679129a7a347444f;p=tools%2Fmedcoupling.git Management of lev -1 even for cell fields on structured meshes --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index a77d36324..5493d88cd 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -81,6 +81,9 @@ int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) co throw INTERP_KERNEL::Exception("MEDFileMeshStruct::getLevelOfGeoType : The specified geometric type is not present in the mesh structure !"); } +/*! + * \sa MEDFileMeshStruct::doesManageGeoType + */ int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) @@ -96,6 +99,42 @@ int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellTy throw INTERP_KERNEL::Exception("The specified geometric type is not present in the mesh structure !"); } +/*! + * \sa MEDFileMeshStruct::getNumberOfElemsOfGeoType + */ +bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const +{ + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) + { + std::size_t sz=(*it1).size(); + if(sz%3!=0) + throw INTERP_KERNEL::Exception("MEDFileMeshStruct::doesManageGeoType : internal error in code !"); + std::size_t nbGeo=sz/3; + for(std::size_t i=0;ihasImplicitPart()) + throw INTERP_KERNEL::Exception("MEDFileMeshStruct::appendIfImplicitType : by default no implicit geo type can be appended !"); + static const char MSG[]="MEDFileMeshStruct::appendIfImplicitType : the distribution does not looks like structured standard !"; + if(_geo_types_distrib.size()!=1) + throw INTERP_KERNEL::Exception(MSG); + std::size_t sz(_geo_types_distrib[0].size()); + if(sz%3!=0) + throw INTERP_KERNEL::Exception("MEDFileMeshStruct::appendIfImplicitType : internal error in code !"); + std::size_t nbGeo(sz/3); + if(nbGeo!=1) + throw INTERP_KERNEL::Exception(MSG); + std::vector arr(3); arr[0]=(int)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; + _geo_types_distrib.push_back(arr); +} + + int MEDFileMeshStruct::getNumberOfLevs() const { return (int)_geo_types_distrib.size(); @@ -600,11 +639,11 @@ void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArra } } -MEDMeshMultiLev::MEDMeshMultiLev():_nb_nodes(0),_cell_fam_ids_nocpy(false) +MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh):_mesh(mesh),_nb_nodes(0),_cell_fam_ids_nocpy(false) { } -MEDMeshMultiLev::MEDMeshMultiLev(int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes),_cell_fam_ids_nocpy(false),_cell_num_ids_nocpy(false),_node_fam_ids_nocpy(false),_node_num_ids_nocpy(false) +MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes),_cell_fam_ids_nocpy(false),_cell_num_ids_nocpy(false),_node_fam_ids_nocpy(false),_node_num_ids_nocpy(false) { std::size_t sz(_geo_types.size()); if(sz!=pfls.size() || sz!=nbEntities.size()) @@ -618,7 +657,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(int nbNodes, const std::vector& levs) +MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs):MEDMeshMultiLev(m) { if(!m) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev constructor : null input pointer !"); @@ -732,7 +771,7 @@ MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector return new MEDUMeshMultiLev(m,gts,pfls,nbEntities); } -MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { std::size_t sz(gts.size()); if(sz<1) @@ -1133,11 +1172,11 @@ void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArr //= -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev():_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m):MEDMeshMultiLev(m),_is_internal(true) { } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev):MEDMeshMultiLev(m),_is_internal(true) { // ids fields management _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true; @@ -1171,7 +1210,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh } } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true) { // ids fields management _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true; @@ -1209,6 +1248,43 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMult { } +bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const +{ + ret=0; + MEDCoupling1GTUMesh *facesIfPresent((static_cast(_mesh))->getImplicitFaceMesh()); + if(!facesIfPresent) + return false; + const DataArrayInt *pfl(0),*nr(_node_reduction); + if(!_pfls.empty()) + pfl=_pfls[0]; + MEDCouplingAutoRefCountObjectPtr facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); + MEDCouplingAutoRefCountObjectPtr ret2(new MEDUMeshMultiLev(*this,facesIfPresent2)); + if(pfl) + throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for profile on implicit unstructured mesh."); + if(nr) + throw INTERP_KERNEL::Exception("MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase : case is not treated yet for node reduction on implicit unstructured mesh."); + ret=ret2.retn(); + return true; +} + +void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m) +{ + _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true; + const DataArrayInt *tmp(0); + tmp=m->getFamilyFieldAtLevel(-1); + if(tmp) + { + tmp->incrRef(); + _cell_fam_ids=const_cast(tmp); + } + tmp=m->getNumberFieldAtLevel(-1); + if(tmp) + { + tmp->incrRef(); + _cell_num_ids=const_cast(tmp); + } +} + void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) @@ -1272,16 +1348,19 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vectorgetMeshDimension()); INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(mdim)); - if(gt!=gts[0]) - throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : the unique geo type is invalid regarding meshdim !"); - _coords.resize(mdim); - for(int i=0;i(m->getMesh()->getCoordsAt(i))); - if(!elt) - throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !"); - _coords[i]=elt; _coords[i]->incrRef(); + _coords.resize(mdim); + for(int i=0;i(m->getMesh()->getCoordsAt(i))); + if(!elt) + throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !"); + _coords[i]=elt; _coords[i]->incrRef(); + } } + else + dealWithImplicitUnstructuredMesh(m); } MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords) @@ -1298,6 +1377,9 @@ std::vector MEDCMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const { + MEDMeshMultiLev *retSpecific(0); + if(prepareForImplicitUnstructuredMeshCase(retSpecific)) + return retSpecific; const DataArrayInt *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; @@ -1406,15 +1488,18 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !"); if(gts.size()!=1 || pfls.size()!=1) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : lengthes of gts and pfls must be equal to one !"); - int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension())); - if(mdim!=gts[0]) - throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : the unique geo type is invalid regarding meshdim !"); - DataArrayDouble *coords(const_cast(m->getMesh()->getCoords())); - if(!coords) - throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !"); - coords->incrRef(); - _coords=coords; - _structure=m->getMesh()->getNodeGridStructure(); + INTERP_KERNEL::NormalizedCellType gt(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension())); + if(gt==gts[0]) + { + DataArrayDouble *coords(const_cast(m->getMesh()->getCoords())); + if(!coords) + throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : no coords set !"); + coords->incrRef(); + _coords=coords; + _structure=m->getMesh()->getNodeGridStructure(); + } + else + dealWithImplicitUnstructuredMesh(m); } MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other):MEDStructuredMeshMultiLev(other),_coords(other._coords),_structure(other._structure) @@ -1428,6 +1513,9 @@ std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const { + MEDMeshMultiLev *retSpecific(0); + if(prepareForImplicitUnstructuredMeshCase(retSpecific)) + return retSpecific; const DataArrayInt *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; @@ -1515,6 +1603,11 @@ MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::Normalized void MEDFileField1TSStructItem2::checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) { + if(!mst->doesManageGeoType(_geo_type)) + { + MEDFileMeshStruct *mstUnConstCasted(const_cast(mst)); + mstUnConstCasted->appendIfImplicitType(_geo_type); + } int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,1,globs); } diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 6b7924565..acb6c3c31 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -54,10 +54,13 @@ namespace ParaMEDMEM std::vector getDirectChildren() const; const MEDFileMesh *getTheMesh() const { return _mesh; } int getNumberOfNodes() const { return _nb_nodes; } + bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfLevs() const; int getNumberOfGeoTypesInLev(int relativeLev) const; + // non const methods + void appendIfImplicitType(INTERP_KERNEL::NormalizedCellType t); private: MEDFileMeshStruct(const MEDFileMesh *mesh); private: @@ -99,10 +102,11 @@ namespace ParaMEDMEM DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); protected: - MEDMeshMultiLev(); + MEDMeshMultiLev(const MEDFileMesh *mesh); MEDMeshMultiLev(const MEDMeshMultiLev& other); - MEDMeshMultiLev(int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); protected: + const MEDFileMesh *_mesh; std::vector< MEDCouplingAutoRefCountObjectPtr > _pfls; std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; std::vector _nb_entities; @@ -154,10 +158,13 @@ namespace ParaMEDMEM void selectPartOfNodes(const DataArrayInt *pflNodes); virtual std::vector getNodeGridStructure() const = 0; protected: - MEDStructuredMeshMultiLev(); + MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m); MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m); + protected: + bool prepareForImplicitUnstructuredMeshCase(MEDMeshMultiLev *&ret) const; protected: bool _is_internal; }; diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 08af32e71..aaf990758 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2702,6 +2702,20 @@ int MEDFileUMesh::getNumberOfNodes() const return coo->getNumberOfTuples(); } +bool MEDFileUMesh::hasImplicitPart() const +{ + return false; +} + +int MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +{ + throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !"); +} + +void MEDFileUMesh::releaseImplicitPartIfAny() const +{ +} + void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const { std::size_t sz(st.getNumberOfItems()); @@ -4683,7 +4697,7 @@ MEDCouplingMesh *MEDFileStructuredMesh::getGenMeshAtLevel(int meshDimRelToMax, b { if(!m) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGenMeshAtLevel : level -1 requested must be non empty to be able to compute unstructured sub mesh !"); - return m->build1SGTSubLevelMesh(); + return _faces_if_necessary; } default: throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh does not support multi level for mesh 0 expected as input !"); @@ -4722,6 +4736,51 @@ int MEDFileStructuredMesh::getNumberOfNodes() const return cmesh->getNumberOfNodes(); } +bool MEDFileStructuredMesh::hasImplicitPart() const +{ + return true; +} + +/*! + * \sa MEDFileStructuredMesh::getImplicitFaceMesh + */ +int MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +{ + static const char MSG[]="MEDFileStructuredMesh::buildImplicitPartIfAny : the given geo type is not manageable by a structured mesh !"; + const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary); + if(!zeFaceMesh) + { + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))); + if(cm.getReverseExtrudedType()!=gt) + throw INTERP_KERNEL::Exception(MSG); + const MEDCouplingStructuredMesh *mcmesh(getStructuredMesh()); + _faces_if_necessary=mcmesh->build1SGTSubLevelMesh(); + return mcmesh->getNumberOfCellsOfSubLevelMesh(); + } + else + { + if(gt!=zeFaceMesh->getCellModelEnum()) + throw INTERP_KERNEL::Exception(MSG); + return zeFaceMesh->getNumberOfCells(); + } +} + +void MEDFileStructuredMesh::releaseImplicitPartIfAny() const +{ + _faces_if_necessary=0; +} + +/*! + * Retrieves the internal pointer (no decrRef requested) of the implicit face mesh if any. + * To force to build it you can invoke MEDFileStructuredMesh::buildImplicitPartIfAny method. + * + * \sa MEDFileStructuredMesh::buildImplicitPartIfAny + */ +MEDCoupling1SGTUMesh *MEDFileStructuredMesh::getImplicitFaceMesh() const +{ + return _faces_if_necessary; +} + std::vector MEDFileStructuredMesh::getGeoTypesAtLevel(int meshDimRelToMax) const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 682f28f01..d62d585a3 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -66,6 +66,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; } MEDLOADER_EXPORT std::vector getAllGeoTypes() const; MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0; + MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0; + MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0; + MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0; MEDLOADER_EXPORT virtual std::vector getGeoTypesAtLevel(int meshDimRelToMax) const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevels() const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevelsExt() const = 0; @@ -220,6 +223,9 @@ namespace ParaMEDMEM MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT int getNumberOfNodes() const; + MEDLOADER_EXPORT bool hasImplicitPart() const; + MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; MEDLOADER_EXPORT std::vector getNonEmptyLevels() const; @@ -325,8 +331,13 @@ namespace ParaMEDMEM MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const; MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT int getNumberOfNodes() const; + MEDLOADER_EXPORT bool hasImplicitPart() const; + MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; + MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const; MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; + MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; // tools MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); protected: @@ -334,7 +345,6 @@ namespace ParaMEDMEM void deepCpyAttributes(); void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void writeStructuredLL(med_idt fid, const std::string& maa) const; - virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; static med_geometry_type GetGeoTypeFromMeshDim(int meshDim); private: static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs, @@ -351,6 +361,7 @@ namespace ParaMEDMEM MEDCouplingAutoRefCountObjectPtr _names_faces; mutable MEDCouplingAutoRefCountObjectPtr _rev_num_nodes; mutable MEDCouplingAutoRefCountObjectPtr _rev_num_cells; + mutable MEDCouplingAutoRefCountObjectPtr _faces_if_necessary; }; class MEDFileCMesh : public MEDFileStructuredMesh diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 851cb7374..52621541b 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -93,6 +93,7 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr; %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced; %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse; +%newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh; %newobject ParaMEDMEM::MEDFileUMesh::New; %newobject ParaMEDMEM::MEDFileUMesh::getCoords; %newobject ParaMEDMEM::MEDFileUMesh::getGroup; @@ -492,6 +493,9 @@ namespace ParaMEDMEM void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); + virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception); + virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception); + virtual void releaseImplicitPartIfAny() const throw(INTERP_KERNEL::Exception); virtual std::vector getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); @@ -861,6 +865,17 @@ namespace ParaMEDMEM class MEDFileStructuredMesh : public MEDFileMesh { + public: + %extend + { + MEDCoupling1SGTUMesh *getImplicitFaceMesh() const throw(INTERP_KERNEL::Exception) + { + MEDCoupling1SGTUMesh *ret(self->getImplicitFaceMesh()); + if(ret) + ret->incrRef(); + return ret; + } + } }; class MEDFileCMesh : public MEDFileStructuredMesh