Version: 6.3.1

src/OBJECT/SMESH_ObjectDef.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH OBJECT : interactive object for SMESH visualization
00024 //  File   : SMESH_Object.h
00025 //  Author : Nicolas REJNERI
00026 //  Module : SMESH
00027 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_ObjectDef.h,v 1.7.2.2.6.2.6.1 2011-06-02 05:57:22 vsr Exp $
00028 //
00029 #ifndef SMESH_OBJECTDEF_H
00030 #define SMESH_OBJECTDEF_H
00031 
00032 #include "SMESH_Controls.hxx"
00033 #include "SMESH_Object.h"
00034 #include "SMESH_Client.hxx"
00035 
00036 // IDL Headers
00037 #include <SALOMEconfig.h>
00038 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00039 #include CORBA_SERVER_HEADER(SMESH_Group)
00040 
00041 #include <map>
00042 #include <list>
00043 
00044 class vtkPoints;
00045 class SALOME_ExtractUnstructuredGrid;
00046 
00047 class SMESH_Actor;
00048 class SMDS_MeshNode;
00049 class SMDS_MeshElement;
00050 
00051 /*
00052   Class       : SMESH_VisualObj
00053   Description : Base class for all mesh objects to be visuilised
00054 */
00055 class SMESHOBJECT_EXPORT SMESH_VisualObjDef: public SMESH_VisualObj
00056 {
00057 public:
00058   typedef std::list<const SMDS_MeshElement*>   TEntityList;
00059   typedef std::map<vtkIdType,vtkIdType>  TMapOfIds;
00060   
00061                             SMESH_VisualObjDef();
00062   virtual                   ~SMESH_VisualObjDef();
00063   
00064   virtual bool              Update( int theIsClear = true ) = 0;
00065   virtual bool              NulData() {return 0; };
00066   virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
00067   virtual int               GetElemDimension( const int theObjId ) = 0;
00068 
00069   virtual int               GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
00070   virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
00071   virtual bool              IsNodePrs() const = 0;
00072   virtual SMDS_Mesh*        GetMesh() const = 0;
00073 
00074   virtual bool              IsValid() const;
00075 
00076   virtual bool              GetEdgeNodes( const int theElemId,
00077                                           const int theEdgeNum,
00078                                           int&      theNodeId1,
00079                                           int&      theNodeId2 ) const;
00080 
00081   virtual vtkUnstructuredGrid* GetUnstructuredGrid();
00082   
00083   virtual vtkIdType         GetNodeObjId( int theVTKID );
00084   virtual vtkIdType         GetNodeVTKId( int theObjID );
00085   virtual vtkIdType         GetElemObjId( int theVTKID );
00086   virtual vtkIdType         GetElemVTKId( int theObjID );
00087   
00088 protected:
00089 
00090   void                      createPoints( vtkPoints* );
00091   void                      buildPrs(bool buildGrid = false);
00092   void                      buildNodePrs();
00093   void                      buildElemPrs();
00094   
00095 //private:
00096 
00097   TMapOfIds                 mySMDS2VTKNodes;
00098   TMapOfIds                 myVTK2SMDSNodes;
00099   TMapOfIds                 mySMDS2VTKElems;
00100   TMapOfIds                 myVTK2SMDSElems;
00101   bool                      myLocalGrid;
00102 
00103   vtkUnstructuredGrid*      myGrid;
00104 };
00105 
00106 
00107 /*
00108   Class       : SMESH_MeshObj
00109   Description : Class for visualisation of mesh
00110 */
00111 
00112 class SMESHOBJECT_EXPORT SMESH_MeshObj: public SMESH_VisualObjDef
00113 {
00114 public:
00115 
00116                             SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
00117   virtual                   ~SMESH_MeshObj();
00118   
00119   virtual bool              Update( int theIsClear = true );
00120   virtual bool              NulData();
00121   
00122   virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
00123   virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
00124   virtual bool              IsNodePrs() const;
00125 
00126   virtual int               GetElemDimension( const int theObjId );
00127 
00128   virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
00129   
00130   SMESH::SMESH_Mesh_ptr     GetMeshServer() { return myClient.GetMeshServer(); }
00131   SMDS_Mesh*                GetMesh() const { return myClient.GetMesh(); }
00132 
00133 protected:
00134   SMESH_Client              myClient;
00135   vtkUnstructuredGrid*      myEmptyGrid;
00136 };
00137 
00138 
00139 /*
00140   Class       : SMESH_SubMeshObj
00141   Description : Base class for visualisation of submeshes and groups
00142 */
00143 
00144 class SMESHOBJECT_EXPORT SMESH_SubMeshObj: public SMESH_VisualObjDef
00145 {
00146 public:
00147 
00148                             SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
00149   virtual                   ~SMESH_SubMeshObj();
00150 
00151   virtual bool              Update( int theIsClear = true );
00152   
00153   virtual void              UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
00154   virtual int               GetElemDimension( const int theObjId );
00155   virtual SMDS_Mesh*        GetMesh() const { return myMeshObj->GetMesh(); }
00156   
00157 protected:
00158 
00159   SMESH_MeshObj*            myMeshObj;
00160 };
00161 
00162 
00163 /*
00164   Class       : SMESH_GroupObj
00165   Description : Class for visualisation of groups
00166 */
00167 
00168 class SMESHOBJECT_EXPORT SMESH_GroupObj: public SMESH_SubMeshObj
00169 {
00170 public:
00171                             SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
00172   virtual                   ~SMESH_GroupObj();
00173 
00174   virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
00175   virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
00176   virtual bool              IsNodePrs() const;
00177 
00178   virtual SMDSAbs_ElementType GetElementType() const;
00179 
00180 private:
00181 
00182   SMESH::SMESH_GroupBase_var    myGroupServer;
00183 };
00184 
00185 
00186 /*
00187   Class       : SMESH_subMeshObj
00188   Description : Class for visualisation of submeshes
00189 */
00190 
00191 class SMESHOBJECT_EXPORT SMESH_subMeshObj : public SMESH_SubMeshObj
00192 {
00193 public:
00194 
00195                             SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr, 
00196                                               SMESH_MeshObj* );
00197   virtual                   ~SMESH_subMeshObj();
00198 
00199   virtual int               GetNbEntities( const SMDSAbs_ElementType) const;
00200   virtual int               GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
00201   virtual bool              IsNodePrs() const;    
00202   
00203 protected:
00204 
00205   SMESH::SMESH_subMesh_var  mySubMeshServer;
00206 };
00207 
00208 
00209 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS