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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VISU_Convertor.hxx
24 // Author : Alexey PETROV
27 #ifndef VISU_IDMapper_HeaderFile
28 #define VISU_IDMapper_HeaderFile
31 \file VISU_IDMapper.hxx
32 \brief The file contains declarations for basic interfaces that defines mapping of mesh elements
35 #include "VISUConvertor.hxx"
37 #include "MED_SharedPtr.hxx"
38 #include "MED_Vector.hxx"
39 #include "VTKViewer.h"
44 class vtkUnstructuredGrid;
55 typedef TVector<vtkIdType> TIdTypeVector;
56 typedef std::map<vtkIdType,TIdTypeVector> TObj2IdTypeVector;
58 struct VISU_CONVERTOR_EXPORT TStructured
61 myIsStructured(false),
70 * Get structure of grille
71 * see also MED::TGrilleInfo::GetGrilleStructure
72 * see also MED::TGrilleInfo::GetNbIndexes
78 * Gets i,j,k by object id
79 * return -1, if not found
82 GetIndexesOfNode(vtkIdType theNodeId);
85 * Gets object id by i,j,k
86 * return -1, if not found
89 GetObjectIDByIndexes(TIdTypeVector theVec);
92 bool myIsStructured; //!< To define mesh type (structured - true, non structured - false)
93 bool myType; //!< To define structured mesh is polair
95 /*!provides grille structure for structured grid.
96 * Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ...
98 TIdTypeVector myGrilleStructure;
100 TObj2IdTypeVector myObjID2StructureID;//!< map of object id to i,j,k ids of structured grid nodes
104 //---------------------------------------------------------------
105 //! Defines a basic class for intemediate data structures
106 struct VISU_CONVERTOR_EXPORT TBaseStructure: virtual TStructured
108 //! Just to provide possibility of dynamic navigation through the class hierarchy
109 virtual ~TBaseStructure()
112 std::string myEntry; //!< To simplify publication of the object tree
114 typedef MED::SharedPtr<TBaseStructure> PBaseStructure;
116 //---------------------------------------------------------------
117 //! Defines a basic abstract interface for VTK to object ID's and backward mapping
119 Where object ID means ID which attached to corresponding MED entity.
120 For example, each MED node can have its own ID as well as any other mesh cell
122 struct VISU_CONVERTOR_EXPORT TIDMapper: virtual TBaseStructure
124 //! Get node object ID for corresponding VTK ID
127 GetNodeObjID(vtkIdType theID) const;
129 //! Get node VTK ID for corresponding object ID
132 GetNodeVTKID(vtkIdType theID) const;
134 //! Get coordinates of node for corresponding object ID
136 vtkFloatingPointType*
137 GetNodeCoord(vtkIdType theObjID);
139 //! Get cell object ID for corresponding VTK ID
142 GetElemObjID(vtkIdType theID) const;
144 //! Get cell VTK ID for corresponding object ID
147 GetElemVTKID(vtkIdType theID) const;
149 //! Get VTK representation of mesh cell for corresponding object ID
152 GetElemCell(vtkIdType theObjID);
154 //! Get VTK representation of mesh for corresponding MED entity
159 //! Gets memory size used by the instance (bytes).
164 typedef MED::SharedPtr<TIDMapper> PIDMapper;
167 //---------------------------------------------------------------
168 struct VISU_CONVERTOR_EXPORT TUnstructuredGridIDMapper: virtual TIDMapper
170 //! Get VTK representation of mesh for corresponding MED entity
173 GetUnstructuredGridOutput() = 0;
175 //! Reimplement the TIDMapper::GetOutput
180 typedef MED::SharedPtr<TUnstructuredGridIDMapper> PUnstructuredGridIDMapper;
183 //---------------------------------------------------------------
184 //! Defines an abstract interface for VTK to object ID's and backward mapping
186 This class defines some additional methods that allow get names for corresponding mesh elements
188 struct TNamedIDMapper: virtual TUnstructuredGridIDMapper
190 //! Get name of mesh node for corresponding object ID
193 GetNodeName(vtkIdType theObjID) const = 0;
195 //! Get name of mesh cell for corresponding object ID
198 GetElemName(vtkIdType theObjID) const = 0;
200 typedef MED::SharedPtr<TNamedIDMapper> PNamedIDMapper;
203 //---------------------------------------------------------------
204 struct TPolyDataIDMapper: virtual TIDMapper
206 //! Get VTK representation of mesh for corresponding MED entity
209 GetPolyDataOutput() = 0;
211 //! Reimplement the TIDMapper::GetOutput
216 typedef MED::SharedPtr<TPolyDataIDMapper> PPolyDataIDMapper;
219 //---------------------------------------------------------------
220 typedef vtkIdType TCellID;
221 typedef vtkIdType TLocalPntID;
222 //! Defines a type that represent complex ID for defined Gauss Point
223 typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
225 struct TGaussPtsIDMapper: virtual TPolyDataIDMapper
227 //! Gets complex Gauss Point ID by its VTK ID
230 GetObjID(vtkIdType theID) const = 0;
232 //! Gets VTK ID by its complex Gauss Point ID
235 GetVTKID(const TGaussPointID& theID) const = 0;
237 //! Gets parent TNamedIDMapper, which contains reference mesh cells
240 GetParent() const = 0;
242 typedef MED::SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
244 //---------------------------------------------------------------