X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_ProxyMesh.hxx;h=fc2e9b201d16413a7809b5603a46627cb7c8deed;hp=7ab2b4484ad1380984039dd629f4407862e59163;hb=HEAD;hpb=c98d9fcd7f02c1f1f5c24dd3e709ed75228d66c4 diff --git a/src/SMESH/SMESH_ProxyMesh.hxx b/src/SMESH/SMESH_ProxyMesh.hxx index 7ab2b4484..a9ce71ef3 100644 --- a/src/SMESH/SMESH_ProxyMesh.hxx +++ b/src/SMESH/SMESH_ProxyMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -26,17 +26,20 @@ #include "SMESH_SMESH.hxx" -#include "SMDS_MeshElement.hxx" +#include "SMDS_ElementHolder.hxx" #include "SMESHDS_SubMesh.hxx" #include "SMESH_TypeDefs.hxx" #include +#include +#include #include #include #include class SMDS_MeshNode; +class SMDS_MeshElement; class SMESHDS_Mesh; class SMESH_Mesh; @@ -64,21 +67,21 @@ public: const SMDS_MeshNode* GetProxyNode( const SMDS_MeshNode* n ) const; const UVPtStructVec& GetUVPtStructVec() const { return _uvPtStructVec; } virtual void AddElement(const SMDS_MeshElement * e); - virtual int NbElements() const; - virtual int NbNodes() const; + virtual smIdType NbElements() const; + virtual smIdType NbNodes() const; virtual SMDS_ElemIteratorPtr GetElements() const; virtual SMDS_NodeIteratorPtr GetNodes() const; virtual void Clear(); virtual bool Contains(const SMDS_MeshElement * ME) const; template< class ITERATOR > - void ChangeElements( ITERATOR it, ITERATOR end ) + void ChangeElements( ITERATOR it, ITERATOR end ) { // change SubMesh contents without deleting tmp elements // for which the caller is responsible _elements.assign( it, end ); } - SubMesh(int index=0):SMESHDS_SubMesh(0,index),_n2n(0) {} + SubMesh(const SMDS_Mesh* mesh, int index=0); virtual ~SubMesh() { Clear(); } protected: @@ -86,40 +89,55 @@ public: TN2NMap* _n2n; UVPtStructVec _uvPtStructVec; // for SubMesh of EDGE friend class SMESH_ProxyMesh; + + protected: // methods of SMDS_ElementHolder; remove elements before mesh compacting or clearing + virtual SMDS_ElemIteratorPtr getElements() { Clear(); return GetElements(); } + virtual void tmpClear() {} + virtual void add( const SMDS_MeshElement* /*element*/ ) {} + virtual void compact() {} + virtual void clear() { Clear(); } }; //-------------------------------------------------------------------------------- // Public interface SMESH_ProxyMesh(); SMESH_ProxyMesh(std::vector& components); - SMESH_ProxyMesh(const SMESH_Mesh& mesh) { _mesh = &mesh; } + SMESH_ProxyMesh(const SMESH_Mesh& mesh); virtual ~SMESH_ProxyMesh(); - // Returns the submesh of a shape; it can be a proxy sub-mesh + // Returns a sub-mesh of a shape; it can be a proxy sub-mesh const SMESHDS_SubMesh* GetSubMesh(const TopoDS_Shape& shape) const; - // Returns the proxy sub-mesh of a shape; it can be NULL + // Return a sub-mesh by a shape ID; it can be a proxy sub-mesh + const SMESHDS_SubMesh* GetSubMesh(const int shapeID) const; + + // Return a proxy sub-mesh of a shape; it can be NULL const SubMesh* GetProxySubMesh(const TopoDS_Shape& shape) const; - // Returns the proxy node of a node; the input node is returned if no proxy exists + // Return a proxy node of a node; the input node is returned if no proxy exists const SMDS_MeshNode* GetProxyNode( const SMDS_MeshNode* node ) const; - // Returns number of proxy sub-meshes + // Return number of proxy sub-meshes int NbProxySubMeshes() const; - // Returns iterator on all faces of the mesh taking into account substitutions. + // Return iterator on all faces of the mesh taking into account substitutions. // To be used in case of mesh without shape SMDS_ElemIteratorPtr GetFaces() const; - // Returns iterator on all faces on the face taking into account substitutions + // Return iterator on all faces on the face taking into account substitutions SMDS_ElemIteratorPtr GetFaces(const TopoDS_Shape& face) const; // Return total nb of faces taking into account substitutions - int NbFaces() const; + smIdType NbFaces() const; bool IsTemporary(const SMDS_MeshElement* elem ) const; + // Return iterator on inverse elements of a node that may be a proxy one + SMDS_ElemIteratorPtr GetInverseElementIterator(const SMDS_MeshNode* node, + SMDSAbs_ElementType type) const; + // Check if a FACE has prisms on its both sides + static bool HasPrismsOnTwoSides( SMESHDS_SubMesh* faceSM ); SMESH_Mesh* GetMesh() const { return const_cast( _mesh ); } @@ -129,19 +147,19 @@ public: // Interface for descendants protected: - void setMesh(const SMESH_Mesh& mesh) { _mesh = &mesh; } + void setMesh(const SMESH_Mesh& mesh); int shapeIndex(const TopoDS_Shape& shape) const; - virtual SubMesh* newSubmesh(int index=0) const { return new SubMesh(index); } + virtual SubMesh* newSubmesh(int index=0) const; - // returns a proxy sub-mesh; zero index is for the case of mesh w/o shape + // Return a proxy sub-mesh; zero index is for the case of mesh w/o shape SubMesh* findProxySubMesh(int shapeIndex=0) const; - // returns a proxy sub-mesh; it is created if not yet exists + // Return a proxy sub-mesh; it is created if not yet exists SubMesh* getProxySubMesh(int shapeIndex); - // returns a proxy sub-mesh; it is created if not yet exists + // Return a proxy sub-mesh; it is created if not yet exists SubMesh* getProxySubMesh(const TopoDS_Shape& shape=TopoDS_Shape()); // move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found @@ -176,8 +194,14 @@ public: // tmp elements residing the _mesh, to be deleted at destruction std::set< const SMDS_MeshElement* > _elemsInMesh; + // inverse elements of proxy nodes + typedef NCollection_DataMap< const SMDS_MeshNode*, + std::vector< const SMDS_MeshElement* >, + SMESH_Hasher > TNodeElemVecMap; + TNodeElemVecMap _inverseElements; + // Complex submesh used to iterate over elements in other sub-meshes - mutable SubMesh _subContainer; + mutable SubMesh* _subContainer; }; #endif