1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_ConvertorUtils.hxx
24 // Author : Alexey PETROV
27 #ifndef VISU_ConvertorUtils_HeaderFile
28 #define VISU_ConvertorUtils_HeaderFile
30 #include "VISUConvertor.hxx"
32 #include "VISU_ConvertorDef.hxx"
33 #include "VISU_IDMapper.hxx"
34 #include "MED_Utilities.hxx"
36 #include "VTKViewer.h"
37 #include <vtkSystemIncludes.h>
41 class vtkInformationVector;
42 class vtkUnstructuredGrid;
48 #ifndef VISU_ENABLE_QUADRATIC
49 #define VISU_ENABLE_QUADRATIC
50 #define VISU_USE_VTK_QUADRATIC
60 //---------------------------------------------------------------
61 //! Get number of nodes for defined geometrical type
62 vtkIdType VISU_CONVERTOR_EXPORT
63 VISUGeom2NbNodes(EGeometry theGeom);
66 //---------------------------------------------------------------
67 //! Maps VISU geometrical type to VTK one
69 VISUGeom2VTK(EGeometry theGeom);
72 //---------------------------------------------------------------
73 //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
76 WriteToFile(vtkUnstructuredGrid* theDataSet,
77 const std::string& theFileName);
80 //---------------------------------------------------------------
81 //! The utility function allows to write vtkPolyData to a file with defined name
84 WriteToFile(vtkPolyData* theDataSet,
85 const std::string& theFileName);
88 //---------------------------------------------------------------
91 IsDataOnCells(vtkDataSet* theDataSet);
93 //---------------------------------------------------------------
96 IsElnoData(vtkDataSet* theDataSet);
99 //---------------------------------------------------------------
100 VISU_CONVERTOR_EXPORT
102 IsDataOnPoints(vtkDataSet* theDataSet);
105 //---------------------------------------------------------------
106 VISU_CONVERTOR_EXPORT
108 GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
111 //---------------------------------------------------------------
112 VISU_CONVERTOR_EXPORT
114 GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
117 //---------------------------------------------------------------
118 VISU_CONVERTOR_EXPORT
120 GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
123 //---------------------------------------------------------------
124 VISU_CONVERTOR_EXPORT
126 GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
129 //---------------------------------------------------------------
130 VISU_CONVERTOR_EXPORT
132 GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
135 //---------------------------------------------------------------
136 VISU_CONVERTOR_EXPORT
137 vtkFloatingPointType*
138 GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
140 //---------------------------------------------------------------
141 VISU_CONVERTOR_EXPORT
143 GetObjID(vtkDataSet *theDataSet, vtkIdType theID);
146 //---------------------------------------------------------------
147 typedef vtkIdType TInputID;
148 typedef vtkIdType TCellID;
149 typedef std::pair<TInputID,TCellID> TInputCellID;
151 VISU_CONVERTOR_EXPORT
153 GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID);
156 VISU_CONVERTOR_EXPORT
158 GetInput(vtkInformationVector **theInputVector,
159 vtkIdType theInputId = 0);
161 VISU_CONVERTOR_EXPORT
163 GetOutput(vtkInformationVector *theOutputVector);
165 //! Utility for ELNO Data Selection
166 //---------------------------------------------------------------
167 typedef vtkIdType TVTKPointID;
168 typedef vtkIdType TVTKCellID;
169 typedef std::pair<TVTKPointID,TVTKCellID> TElnoPointID;
170 typedef std::vector<TElnoPointID> TElnoPoints;
172 VISU_CONVERTOR_EXPORT
174 GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
176 //---------------------------------------------------------------
177 //! The utility class that allows to perform perfomance mesurement
178 class VISU_CONVERTOR_EXPORT TTimerLog
183 vtkTimerLog* myTimerLog;
184 MED::PrefixPrinter myPrefixPrinter;
187 TTimerLog(int theIsDebug,
188 const std::string& theName);
193 //---------------------------------------------------------------