X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_ProxyMesh.hxx;h=35a4c3a97b8ff6d2804084a0a6d7d1cd89ed7a47;hb=5e2c97c386dc03e51e072c7f9909803a86307872;hp=03d3f2b1bd5b3909a38cb6d6ed26519e1b4ba1f4;hpb=7a65c9fad427b1ccba6b9ccae612296e5092a324;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_ProxyMesh.hxx b/src/SMESH/SMESH_ProxyMesh.hxx index 03d3f2b1b..35a4c3a97 100644 --- a/src/SMESH/SMESH_ProxyMesh.hxx +++ b/src/SMESH/SMESH_ProxyMesh.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, 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,7 +26,7 @@ #include "SMESH_SMESH.hxx" -#include "SMDS_MeshElement.hxx" +#include "SMDS_ElementHolder.hxx" #include "SMESHDS_SubMesh.hxx" #include "SMESH_TypeDefs.hxx" @@ -37,6 +37,7 @@ #include class SMDS_MeshNode; +class SMDS_MeshElement; class SMESHDS_Mesh; class SMESH_Mesh; @@ -56,7 +57,7 @@ public: /*! * \brief Proxy sub-mesh */ - class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh + class SMESH_EXPORT SubMesh : public SMESHDS_SubMesh, SMDS_ElementHolder { public: @@ -72,13 +73,14 @@ public: 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) + :SMESHDS_SubMesh(0,index), SMDS_ElementHolder(mesh), _n2n(0) {} virtual ~SubMesh() { Clear(); } protected: @@ -86,13 +88,20 @@ 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 @@ -129,11 +138,11 @@ 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 SubMesh* findProxySubMesh(int shapeIndex=0) const; @@ -177,7 +186,7 @@ public: std::set< const SMDS_MeshElement* > _elemsInMesh; // Complex submesh used to iterate over elements in other sub-meshes - mutable SubMesh _subContainer; + mutable SubMesh* _subContainer; }; #endif