From: ageay Date: Fri, 29 Nov 2013 15:58:11 +0000 (+0000) Subject: MEDCouplingUMesh::getAllGeoTypesSorted X-Git-Tag: V7_3_0b1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=195e39221e97bb0fa6698101fcd8546b95899515;p=modules%2Fmed.git MEDCouplingUMesh::getAllGeoTypesSorted --- diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 6aeaa1ff5..f5517b430 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -596,15 +596,37 @@ MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m->getNumberOfNodes(),gts,pfls,nbEntities) { std::size_t sz(gts.size()); + if(sz<1) + throw INTERP_KERNEL::Exception("constructor of MEDUMeshMultiLev : number of different geo type must be >= 1 !"); + unsigned dim(INTERP_KERNEL::CellModel::GetCellModel(gts[0]).getDimension()); _parts.resize(sz); + bool isSameDim(true),isNoPfl(true); for(std::size_t i=0;igetDirectUndergroundSingleGeoTypeMesh(gts[i])); + if(INTERP_KERNEL::CellModel::GetCellModel(gts[i]).getDimension()!=dim) + isSameDim=false; + if(pfls[i]) + isNoPfl=false; if(elt) elt->incrRef(); _parts[i]=elt; } // ids fields management + int lev(m->getMeshDimension()-(int)dim); + if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part + { + _cell_fam_ids_nocpy=true; + const DataArrayInt *famIds(m->getFamilyFieldAtLevel(lev)); + if(famIds) + { _cell_fam_ids=const_cast(famIds); famIds->incrRef(); } + _cell_num_ids_nocpy=true; + const DataArrayInt *numIds(m->getNumberFieldAtLevel(lev)); + if(numIds) + { _cell_num_ids=const_cast(numIds); numIds->incrRef(); } + return ; + } + // _cell_fam_ids_nocpy=false; std::vector< MEDCouplingAutoRefCountObjectPtr > famIdsSafe(sz); std::vector famIds(sz); diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 2e7760173..8a39139cd 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -2966,6 +2966,16 @@ MEDCoupling1GTUMesh *MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh(INTERP_ return sp->getDirectUndergroundSingleGeoTypeMesh(gt); } +/*! + * Given a relative level \a meshDimRelToMax it returns the sorted vector of geometric types present in \a this. + * \throw if the reqsuested \a meshDimRelToMax does not exist. + */ +std::vector MEDFileUMesh::getGeoTypesAtLevel(int meshDimRelToMax) const +{ + const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe(meshDimRelToMax)); + return sp->getGeoTypes(); +} + /*! * This method extracts from whole family field ids the part relative to the input parameter \a gt. * \param [in] gt - the geometric type for which the family field is asked. diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 564d8a0af..e6f2d3b6f 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -214,6 +214,7 @@ 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 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; MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 595a22e2d..52e787533 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -777,6 +777,11 @@ DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int return da.retn(); } +std::vector MEDFileUMeshSplitL1::getGeoTypes() const +{ + return _m_by_types.getGeoTypes(); +} + MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const { MEDCouplingAutoRefCountObjectPtr tmp; @@ -1041,6 +1046,20 @@ MEDCouplingUMesh *MEDFileUMeshAggregateCompute::getUmesh() const return _m; } +std::vector MEDFileUMeshAggregateCompute::getGeoTypes() const +{ + if(_mp_time>=_m_time) + { + std::size_t sz(_m_parts.size()); + std::vector ret(sz); + for(std::size_t i=0;igetCellModelEnum(); + return ret; + } + else + return _m->getAllGeoTypesSorted(); +} + std::vector MEDFileUMeshAggregateCompute::getPartsWithoutComputation() const { if(_mp_time<_m_time) diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 4857330d7..937a088fc 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -145,6 +145,7 @@ namespace ParaMEDMEM void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; std::vector getParts() const; + std::vector getGeoTypes() const; std::vector getPartsWithoutComputation() const; MEDCoupling1GTUMesh *getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const; @@ -197,6 +198,7 @@ namespace ParaMEDMEM MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const; DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const; MEDCouplingUMesh *getWholeMesh(bool renum) const; + std::vector getGeoTypes() const; std::vector getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.getPartsWithoutComputation(); } MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.getPartWithoutComputation(gt); } DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;