1 // SMESH OBJECT : interactive object for SMESH visualization
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_Object.h
25 // Author : Nicolas REJNERI
29 #ifndef SMESH_OBJECT_H
30 #define SMESH_OBJECT_H
33 #include <SALOMEconfig.h>
34 #include CORBA_SERVER_HEADER(SMESH_Mesh)
35 #include CORBA_SERVER_HEADER(SMESH_Group)
36 #include CORBA_SERVER_HEADER(SMESH_Filter)
40 #include <boost/shared_ptr.hpp>
41 #include <vtkSystemIncludes.h>
43 class vtkUnstructuredGrid;
45 class SALOME_ExtractUnstructuredGrid;
50 class SMDS_MeshElement;
52 class SMESH_VisualObj;
53 typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
57 Class : SMESH_VisualObj
58 Description : Base class for all mesh objects to be visuilised
65 typedef std::list<const SMDS_MeshElement*> TEntityList;
66 typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
70 virtual ~SMESH_VisualObj();
72 virtual void Update( int theIsClear = true ) = 0;
73 virtual void UpdateFunctor( SMESH::Functor_ptr theFunctor ) = 0;
74 virtual int GetElemDimension( const int theObjId ) = 0;
76 virtual int GetNbEntities( const SMESH::ElementType) const = 0;
77 virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
78 virtual bool IsNodePrs() const = 0;
80 vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
82 vtkIdType GetNodeObjId( int theVTKID );
83 vtkIdType GetNodeVTKId( int theObjID );
84 vtkIdType GetElemObjId( int theVTKID );
85 vtkIdType GetElemVTKId( int theObjID );
89 void createPoints( vtkPoints* );
96 TMapOfIds mySMDS2VTKNodes;
97 TMapOfIds myVTK2SMDSNodes;
98 TMapOfIds mySMDS2VTKElems;
99 TMapOfIds myVTK2SMDSElems;
101 vtkUnstructuredGrid* myGrid;
106 Class : SMESH_MeshObj
107 Description : Class for visualisation of mesh
110 class SMESH_MeshObj: public SMESH_VisualObj
114 SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
115 virtual ~SMESH_MeshObj();
117 virtual void Update( int theIsClear = true );
119 virtual int GetNbEntities( const SMESH::ElementType) const;
120 virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
121 virtual bool IsNodePrs() const;
123 virtual int GetElemDimension( const int theObjId );
125 virtual void UpdateFunctor( SMESH::Functor_ptr f );
127 SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshServer.in(); }
128 SMDS_Mesh* GetMesh() { return myMesh; }
132 SMESH::SMESH_Mesh_var myMeshServer;
138 Class : SMESH_SubMeshObj
139 Description : Base class for visualisation of submeshes and groups
142 class SMESH_SubMeshObj: public SMESH_VisualObj
146 SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
147 virtual ~SMESH_SubMeshObj();
149 virtual void Update( int theIsClear = true );
151 virtual void UpdateFunctor( SMESH::Functor_ptr );
152 virtual int GetElemDimension( const int theObjId );
156 SMESH_MeshObj* myMeshObj;
161 Class : SMESH_GroupObj
162 Description : Class for visualisation of groups
165 class SMESH_GroupObj: public SMESH_SubMeshObj
168 SMESH_GroupObj( SMESH::SMESH_Group_ptr, SMESH_MeshObj* );
169 virtual ~SMESH_GroupObj();
171 virtual int GetNbEntities( const SMESH::ElementType) const;
172 virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
173 virtual bool IsNodePrs() const;
177 SMESH::SMESH_Group_var myGroupServer;
182 Class : SMESH_subMeshObj
183 Description : Class for visualisation of submeshes
186 class SMESH_subMeshObj : public SMESH_SubMeshObj
190 SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
192 virtual ~SMESH_subMeshObj();
194 virtual int GetNbEntities( const SMESH::ElementType) const;
195 virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
196 virtual bool IsNodePrs() const;
200 SMESH::SMESH_subMesh_var mySubMeshServer;
204 extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);