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