From: Anthony Geay Date: Mon, 20 Apr 2020 22:00:17 +0000 (+0200) Subject: Implementation of MEDFileUMesh::computeFetchedNodeIds X-Git-Tag: V9_5_0b1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7dc86e759f0504e2d22234acb307dde8c12e57b6;p=tools%2Fmedcoupling.git Implementation of MEDFileUMesh::computeFetchedNodeIds --- diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index ec244f8da..f3d05fa5e 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -4338,6 +4338,23 @@ DataArrayIdType *MEDFileUMesh::zipCoords() return ret.retn(); } +/*! + * This method is the extension of MEDCouplingUMesh::computeFetchedNodeIds. Except that here all levels are considered here. + * + * \return newly allocated array containing all nodes in \a this that are part of nodal connectivity of at least one cell in \a this whatever its level. + */ +DataArrayIdType *MEDFileUMesh::computeFetchedNodeIds() const +{ + std::vector neLevs(this->getNonEmptyLevels()); + std::vector nodesHighlighted(this->getNumberOfNodes(),false); + for(auto lev : neLevs) + { + const MEDFileUMeshSplitL1 *zeLev(this->getMeshAtLevSafe(lev)); + zeLev->highlightUsedNodes(nodesHighlighted); + } + return DataArrayIdType::BuildListOfSwitchedOn(nodesHighlighted); +} + /*! * This method is a const method. It computes the minimal set of node ids covered by the cell extraction of \a this. * The extraction of \a this is specified by the extractDef \a input map. diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index fbc7d8b5c..b966a04a0 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -356,6 +356,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified); MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); MEDLOADER_EXPORT DataArrayIdType *zipCoords(); + MEDLOADER_EXPORT DataArrayIdType *computeFetchedNodeIds() const; MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map >& extractDef) const; MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 0d5aa1ca9..5b4704df1 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1632,6 +1632,16 @@ std::vector MEDFileUMeshAggregateCompute::getParts() cons return retrievePartsWithoutComputation(); } +void MEDFileUMeshAggregateCompute::highlightUsedNodes(std::vector& nodesToBeHighlighted) const +{ + if(_mp_time<_m_time) + forceComputationOfPartsFromUMesh(); + for(auto part : this->_m_parts) + { + part->computeNodeIdsAlg(nodesToBeHighlighted); + } +} + MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const { std::vector v(retrievePartsWithoutComputation()); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 8cdd735a2..2abe8819a 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -209,6 +209,7 @@ namespace MEDCoupling void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; mcIdType getNumberOfCells() const; + void highlightUsedNodes(std::vector& nodesToBeHighlighted) const; std::vector getParts() const; std::vector getGeoTypes() const; mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; @@ -292,6 +293,7 @@ namespace MEDCoupling const DataArrayIdType *getNumberField() const; const DataArrayAsciiChar *getNameField() const; const DataArrayIdType *getRevNumberField() const; + void highlightUsedNodes(std::vector& nodesToBeHighlighted) const { _m_by_types.highlightUsedNodes(nodesToBeHighlighted); } const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const; void eraseFamilyField(); void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index fd07f3569..4ff7d28cc 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -120,6 +120,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh; %newobject MEDCoupling::MEDFileUMesh::extractFamilyFieldOnGeoType; %newobject MEDCoupling::MEDFileUMesh::extractNumberFieldOnGeoType; +%newobject MEDCoupling::MEDFileUMesh::computeFetchedNodeIds; %newobject MEDCoupling::MEDFileUMesh::zipCoords; %newobject MEDCoupling::MEDFileUMesh::deduceNodeSubPartFromCellSubPart; %newobject MEDCoupling::MEDFileUMesh::extractPart; @@ -1410,6 +1411,7 @@ namespace MEDCoupling void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false); void optimizeFamilies(); + DataArrayIdType *computeFetchedNodeIds() const; DataArrayIdType *zipCoords(); DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const;