Version: 9.12.0
SMESH_ObjectDef.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SMESH OBJECT : interactive object for SMESH visualization
24 // File : SMESH_Object.h
25 // Author : Nicolas REJNERI
26 // Module : SMESH
27 //
28 #ifndef SMESH_OBJECTDEF_H
29 #define SMESH_OBJECTDEF_H
30 
31 #include "SMESH_Controls.hxx"
32 #include "SMESH_Object.h"
33 #include "SMESH_Client.hxx"
34 #include "SMESH_Actor.h"
35 
36 // IDL Headers
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
39 #include CORBA_SERVER_HEADER(SMESH_Group)
40 
41 #include <map>
42 #include <list>
43 
44 class vtkPoints;
45 class SALOME_ExtractUnstructuredGrid;
46 
47 class SMDS_MeshNode;
48 class SMDS_MeshElement;
49 
50 /*
51  Class : SMESH_VisualObj
52  Description : Base class for all mesh objects to be visuilised
53 */
55 {
56 public:
57  typedef std::list<const SMDS_MeshElement*> TEntityList;
58  typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
59 
61  virtual ~SMESH_VisualObjDef();
62 
63  virtual bool Update( int theIsClear = true ) = 0;
64  virtual bool NulData() {return 0; };
65  virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
66  virtual int GetElemDimension( const smIdType theObjId ) = 0;
67 
68  virtual smIdType GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
69  virtual smIdType GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
70  virtual bool IsNodePrs() const = 0;
71  virtual SMDS_Mesh* GetMesh() const = 0;
72  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() = 0;
73 
74  virtual bool IsValid() const;
75 
76  virtual bool GetEdgeNodes( const smIdType theElemId,
77  const int theEdgeNum,
78  smIdType& theNodeId1,
79  smIdType& theNodeId2 ) const;
80 
82 
83  virtual vtkIdType GetNodeObjId( vtkIdType theVTKID );
84  virtual vtkIdType GetNodeVTKId( vtkIdType theObjID );
85  virtual vtkIdType GetElemObjId( vtkIdType theVTKID );
86  virtual vtkIdType GetElemVTKId( vtkIdType theObjID );
87 
88  virtual void ClearEntitiesFlags();
89  virtual bool GetEntitiesFlag();
90  virtual unsigned int GetEntitiesState();
91 
92 protected:
93 
94  void createPoints( vtkPoints* );
95  void buildPrs(bool buildGrid = false);
96  void buildNodePrs();
97  void buildElemPrs();
98  void updateEntitiesFlags();
99 //private:
100 
106 
108  unsigned int myEntitiesState;
109 
111  std::map<SMDSAbs_ElementType,smIdType> myEntitiesCache;
112 };
113 
114 
115 /*
116  Class : SMESH_MeshObj
117  Description : Class for visualisation of mesh
118 */
119 
121 {
122 public:
123 
124  SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
125  virtual ~SMESH_MeshObj();
126 
127  virtual bool Update( int theIsClear = true );
128  virtual bool NulData();
129 
130  virtual smIdType GetNbEntities( const SMDSAbs_ElementType) const;
131  virtual smIdType GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
132  virtual bool IsNodePrs() const;
133 
134  virtual int GetElemDimension( const smIdType theObjId );
135 
136  virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
137 
138  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myClient.GetMeshServer(); }
139  virtual SMDS_Mesh* GetMesh() const { return myClient.GetMesh(); }
140 
141 protected:
142 
145 };
146 
147 
148 /*
149  Class : SMESH_SubMeshObj
150  Description : Base class for visualisation of submeshes and groups
151 */
152 
154 {
155 public:
156 
157  SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
158  virtual ~SMESH_SubMeshObj();
159 
160  virtual bool Update( int theIsClear = true );
161 
162  virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
163  virtual int GetElemDimension( const smIdType theObjId );
164  virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
165  virtual SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshObj->GetMeshServer(); }
166 
167 protected:
168 
170 };
171 
172 
173 /*
174  Class : SMESH_GroupObj
175  Description : Class for visualisation of groups
176 */
177 
179 {
180 public:
181  SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
182  virtual ~SMESH_GroupObj();
183 
184  virtual smIdType GetNbEntities( const SMDSAbs_ElementType) const;
185  virtual smIdType GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
186  virtual bool IsNodePrs() const;
187 
188  virtual SMDSAbs_ElementType GetElementType() const;
189 
190 private:
191 
192  SMESH::SMESH_GroupBase_var myGroupServer;
193 };
194 
195 
196 /*
197  Class : SMESH_subMeshObj
198  Description : Class for visualisation of submeshes
199 */
200 
202 {
203 public:
204 
205  SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
206  SMESH_MeshObj* );
207  virtual ~SMESH_subMeshObj();
208 
209  virtual smIdType GetNbEntities( const SMDSAbs_ElementType) const;
210  virtual smIdType GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
211  virtual bool IsNodePrs() const;
212 
213 protected:
214 
215  SMESH::SMESH_subMesh_var mySubMeshServer;
216 };
217 
218 
219 #endif
SMDSAbs_ElementType
Type (node, edge, face or volume) of elements.
Definition: SMDSAbs_ElementType.hxx:34
#define SMESHOBJECT_EXPORT
Definition: SMESH_Object.h:38
Base class for elements.
Definition: SMDS_MeshElement.hxx:56
Definition: SMDS_MeshNode.hxx:36
Definition: SMDS_Mesh.hxx:53
Definition: SMESH_Client.hxx:53
Definition: SMESH_ObjectDef.h:179
SMESH::SMESH_GroupBase_var myGroupServer
Definition: SMESH_ObjectDef.h:192
Definition: SMESH_ObjectDef.h:121
virtual SMESH::SMESH_Mesh_ptr GetMeshServer()
Definition: SMESH_ObjectDef.h:138
vtkUnstructuredGrid * myEmptyGrid
Definition: SMESH_ObjectDef.h:144
virtual SMDS_Mesh * GetMesh() const
Definition: SMESH_ObjectDef.h:139
SMESH_Client myClient
Definition: SMESH_ObjectDef.h:143
Definition: SMESH_ObjectDef.h:154
virtual SMDS_Mesh * GetMesh() const
Definition: SMESH_ObjectDef.h:164
virtual SMESH::SMESH_Mesh_ptr GetMeshServer()
Definition: SMESH_ObjectDef.h:165
SMESH_MeshObj * myMeshObj
Definition: SMESH_ObjectDef.h:169
Definition: SMESH_ObjectDef.h:55
virtual SMESH::SMESH_Mesh_ptr GetMeshServer()=0
TMapOfIds myVTK2SMDSNodes
Definition: SMESH_ObjectDef.h:102
unsigned int myEntitiesState
Definition: SMESH_ObjectDef.h:108
TMapOfIds mySMDS2VTKNodes
Definition: SMESH_ObjectDef.h:101
std::map< SMDSAbs_ElementType, smIdType > myEntitiesCache
Definition: SMESH_ObjectDef.h:111
virtual void UpdateFunctor(const SMESH::Controls::FunctorPtr &theFunctor)=0
virtual smIdType GetEntities(const SMDSAbs_ElementType, TEntityList &) const =0
std::list< const SMDS_MeshElement * > TEntityList
Definition: SMESH_ObjectDef.h:57
TMapOfIds mySMDS2VTKElems
Definition: SMESH_ObjectDef.h:103
virtual SMDS_Mesh * GetMesh() const =0
virtual bool NulData()
Definition: SMESH_ObjectDef.h:64
std::map< vtkIdType, vtkIdType > TMapOfIds
Definition: SMESH_ObjectDef.h:58
bool myLocalGrid
Definition: SMESH_ObjectDef.h:105
vtkUnstructuredGrid * myGrid
Definition: SMESH_ObjectDef.h:110
virtual bool IsNodePrs() const =0
bool myEntitiesFlag
Definition: SMESH_ObjectDef.h:107
virtual smIdType GetNbEntities(const SMDSAbs_ElementType theType) const =0
TMapOfIds myVTK2SMDSElems
Definition: SMESH_ObjectDef.h:104
virtual int GetElemDimension(const smIdType theObjId)=0
virtual bool Update(int theIsClear=true)=0
Definition: SMESH_Object.h:59
virtual unsigned int GetEntitiesState()=0
virtual void ClearEntitiesFlags()=0
virtual void UpdateFunctor(const SMESH::Controls::FunctorPtr &theFunctor)=0
virtual bool Update(int theIsClear=true)=0
virtual vtkIdType GetElemObjId(vtkIdType theVTKID)=0
virtual vtkIdType GetNodeVTKId(vtkIdType theObjID)=0
virtual smIdType GetNbEntities(const SMDSAbs_ElementType theType) const =0
virtual bool IsValid() const =0
virtual int GetElemDimension(const smIdType theObjId)=0
virtual vtkUnstructuredGrid * GetUnstructuredGrid()=0
virtual vtkIdType GetNodeObjId(vtkIdType theVTKID)=0
virtual vtkIdType GetElemVTKId(vtkIdType theObjID)=0
virtual bool GetEntitiesFlag()=0
virtual bool NulData()=0
virtual bool GetEdgeNodes(const smIdType theElemId, const int theEdgeNum, smIdType &theNodeId1, smIdType &theNodeId2) const =0
Definition: SMESH_ObjectDef.h:202
SMESH::SMESH_subMesh_var mySubMeshServer
Definition: SMESH_ObjectDef.h:215
boost::shared_ptr< Functor > FunctorPtr
Definition: SMESH_Controls.hxx:60