Salome HOME
Implementation of MEDFileUMesh::computeFetchedNodeIds
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 20 Apr 2020 22:00:17 +0000 (00:00 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 20 Apr 2020 22:00:17 +0000 (00:00 +0200)
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/MEDFileMeshLL.cxx
src/MEDLoader/MEDFileMeshLL.hxx
src/MEDLoader/Swig/MEDLoaderCommon.i

index ec244f8dab34abad544f5824faaba476a6218cbb..f3d05fa5e02d073d938f7c4044c88e2dd1cfda67 100644 (file)
@@ -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<int> neLevs(this->getNonEmptyLevels());
+  std::vector<bool> 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.
index fbc7d8b5caa927b9aa2116e33b1d0493ac459dd5..b966a04a0de35aff0c00d620d79bc0d04860107c 100644 (file)
@@ -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<mcIdType>& oldCode, std::vector<mcIdType>& newCode, DataArrayIdType *& o2nRenumCell);
     MEDLOADER_EXPORT DataArrayIdType *zipCoords();
+    MEDLOADER_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
     MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
     MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map<int, MCAuto<DataArrayIdType> >& extractDef) const;
     MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const;
index 0d5aa1ca95dd96b8babedc744aed97e1b62caec3..5b4704df13f98a00ebbebb05541d4ca81cc39a3d 100644 (file)
@@ -1632,6 +1632,16 @@ std::vector<MEDCoupling1GTUMesh *> MEDFileUMeshAggregateCompute::getParts() cons
   return retrievePartsWithoutComputation();
 }
 
+void MEDFileUMeshAggregateCompute::highlightUsedNodes(std::vector<bool>& 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<MEDCoupling1GTUMesh *> v(retrievePartsWithoutComputation());
index 8cdd735a293176ab188305a17228e0a6c8bdb407..2abe8819aaec3f856c405a70fcc364b59af6ac7e 100644 (file)
@@ -209,6 +209,7 @@ namespace MEDCoupling
     void assignUMesh(MEDCouplingUMesh *m);
     MEDCouplingUMesh *getUmesh() const;
     mcIdType getNumberOfCells() const;
+    void highlightUsedNodes(std::vector<bool>& nodesToBeHighlighted) const;
     std::vector<MEDCoupling1GTUMesh *> getParts() const;
     std::vector<INTERP_KERNEL::NormalizedCellType> 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<bool>& nodesToBeHighlighted) const { _m_by_types.highlightUsedNodes(nodesToBeHighlighted); }
     const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const;
     void eraseFamilyField();
     void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,mcIdType>& familyIds,
index fd07f356956f5a15f991485befc06b9a608f2451..4ff7d28cc4527e543d0d945cf011a2d4fdfe6f74 100644 (file)
@@ -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;