]> SALOME platform Git repositories - modules/visu.git/blob - src/CONVERTOR/VISU_ConvertorUtils.hxx
Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / CONVERTOR / VISU_ConvertorUtils.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, 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.
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 //  VISU OBJECT : interactive object for VISU entities implementation
24 //  File   : VISU_ConvertorUtils.hxx
25 //  Author : Alexey PETROV
26 //  Module : VISU
27 //
28 #ifndef VISU_ConvertorUtils_HeaderFile
29 #define VISU_ConvertorUtils_HeaderFile
30
31 #include "VISUConvertor.hxx"
32
33 #include "VISU_ConvertorDef.hxx"
34 #include "VISU_IDMapper.hxx"
35 #include "MED_Utilities.hxx"
36
37 #include "VTKViewer.h"
38 #include <vtkSystemIncludes.h>
39
40 #include <string>
41
42 class vtkInformationVector;
43 class vtkUnstructuredGrid;
44 class vtkPolyData;
45 class vtkTimerLog;
46 class vtkDataSet;
47 class vtkCell;
48
49 #ifndef VISU_ENABLE_QUADRATIC
50   #define VISU_ENABLE_QUADRATIC
51   #define VISU_USE_VTK_QUADRATIC
52 #endif
53
54 namespace MED
55 {
56   class PrefixPrinter;
57 }
58
59 namespace VISU
60 {
61   //---------------------------------------------------------------
62   //! Get number of nodes for defined geometrical type
63   vtkIdType VISU_CONVERTOR_EXPORT
64   VISUGeom2NbNodes(EGeometry theGeom);
65
66
67   //---------------------------------------------------------------
68   //! Maps VISU geometrical type to VTK one
69   vtkIdType
70   VISUGeom2VTK(EGeometry theGeom);
71
72
73   //---------------------------------------------------------------
74   //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
75   VISU_CONVERTOR_EXPORT
76   void 
77   WriteToFile(vtkUnstructuredGrid* theDataSet, 
78               const std::string& theFileName);
79
80
81   //---------------------------------------------------------------
82   //! The utility function allows to write vtkPolyData to a file with defined name
83   VISU_CONVERTOR_EXPORT
84   void 
85   WriteToFile(vtkPolyData* theDataSet, 
86               const std::string& theFileName);
87
88
89   //---------------------------------------------------------------
90   VISU_CONVERTOR_EXPORT
91   bool 
92   IsDataOnCells(vtkDataSet* theDataSet);
93
94   //---------------------------------------------------------------
95   VISU_CONVERTOR_EXPORT
96   bool 
97   IsElnoData(vtkDataSet* theDataSet);
98
99
100   //---------------------------------------------------------------
101   VISU_CONVERTOR_EXPORT
102   bool 
103   IsDataOnPoints(vtkDataSet* theDataSet);
104
105
106   //---------------------------------------------------------------
107   VISU_CONVERTOR_EXPORT
108   vtkIdType
109   GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
110
111
112   //---------------------------------------------------------------
113   VISU_CONVERTOR_EXPORT
114   vtkIdType
115   GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
116
117
118   //---------------------------------------------------------------
119   VISU_CONVERTOR_EXPORT
120   vtkCell* 
121   GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
122
123
124   //---------------------------------------------------------------
125   VISU_CONVERTOR_EXPORT
126   vtkIdType
127   GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
128
129
130   //---------------------------------------------------------------
131   VISU_CONVERTOR_EXPORT
132   vtkIdType
133   GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
134
135
136   //---------------------------------------------------------------
137   VISU_CONVERTOR_EXPORT
138   vtkFloatingPointType* 
139   GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
140
141   //---------------------------------------------------------------
142   VISU_CONVERTOR_EXPORT
143   TGaussPointID
144   GetObjID(vtkDataSet *theDataSet, vtkIdType theID);
145
146
147   //---------------------------------------------------------------
148   typedef vtkIdType TInputID;
149   typedef vtkIdType TCellID; 
150   typedef std::pair<TInputID,TCellID> TInputCellID;
151
152   VISU_CONVERTOR_EXPORT
153   TInputCellID
154   GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID);
155
156
157   VISU_CONVERTOR_EXPORT
158   vtkDataSet*
159   GetInput(vtkInformationVector **theInputVector, 
160            vtkIdType theInputId = 0);
161
162   VISU_CONVERTOR_EXPORT
163   vtkDataSet*
164   GetOutput(vtkInformationVector *theOutputVector);
165
166   //! Utility for ELNO Data Selection
167   //---------------------------------------------------------------
168   typedef vtkIdType TVTKPointID;
169   typedef vtkIdType TVTKCellID;
170   typedef std::pair<TVTKPointID,TVTKCellID> TElnoPointID;
171   typedef std::vector<TElnoPointID> TElnoPoints;
172
173   VISU_CONVERTOR_EXPORT 
174   TElnoPoints
175   GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
176
177   //---------------------------------------------------------------
178   //! The utility class that allows to perform perfomance mesurement
179   class VISU_CONVERTOR_EXPORT TTimerLog
180   {
181     int myIsDebug;
182     double myCPUTime;
183     std::string myName;
184     vtkTimerLog* myTimerLog;
185     MED::PrefixPrinter myPrefixPrinter;
186   public:
187
188     TTimerLog(int theIsDebug,
189               const std::string& theName);
190     ~TTimerLog();
191   };
192   
193
194   //---------------------------------------------------------------
195 }
196
197 #endif