1 // Copyright (C) 2007-2012 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
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_ConvertorUtils.hxx
25 // Author : Alexey PETROV
28 #ifndef VISU_ConvertorUtils_HeaderFile
29 #define VISU_ConvertorUtils_HeaderFile
31 #include "VISUConvertor.hxx"
33 #include "VISU_ConvertorDef.hxx"
34 #include "VISU_IDMapper.hxx"
35 #include "MED_Utilities.hxx"
37 #include "VTKViewer.h"
38 #include <vtkSystemIncludes.h>
42 class vtkInformationVector;
43 class vtkUnstructuredGrid;
50 #ifndef VISU_ENABLE_QUADRATIC
51 #define VISU_ENABLE_QUADRATIC
52 #define VISU_USE_VTK_QUADRATIC
62 //---------------------------------------------------------------
63 //! Get number of nodes for defined geometrical type
64 vtkIdType VISU_CONVERTOR_EXPORT
65 VISUGeom2NbNodes(EGeometry theGeom);
68 //---------------------------------------------------------------
69 //! Maps VISU geometrical type to VTK one
71 VISUGeom2VTK(EGeometry theGeom);
74 //---------------------------------------------------------------
75 //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
78 WriteToFile(vtkUnstructuredGrid* theDataSet,
79 const std::string& theFileName);
82 //---------------------------------------------------------------
83 //! The utility function allows to write vtkPolyData to a file with defined name
86 WriteToFile(vtkPolyData* theDataSet,
87 const std::string& theFileName);
90 //---------------------------------------------------------------
93 IsDataOnCells(vtkDataSet* theDataSet);
95 //---------------------------------------------------------------
98 IsElnoData(vtkDataSet* theDataSet);
101 //---------------------------------------------------------------
102 VISU_CONVERTOR_EXPORT
104 IsDataOnPoints(vtkDataSet* theDataSet);
107 //---------------------------------------------------------------
108 VISU_CONVERTOR_EXPORT
110 GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
113 //---------------------------------------------------------------
114 VISU_CONVERTOR_EXPORT
116 GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
119 //---------------------------------------------------------------
120 VISU_CONVERTOR_EXPORT
122 GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
125 //---------------------------------------------------------------
126 VISU_CONVERTOR_EXPORT
128 GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
131 //---------------------------------------------------------------
132 VISU_CONVERTOR_EXPORT
134 GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
137 //---------------------------------------------------------------
138 VISU_CONVERTOR_EXPORT
140 GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
142 //---------------------------------------------------------------
143 VISU_CONVERTOR_EXPORT
145 GetObjID(vtkDataSet *theDataSet, vtkIdType theID);
148 //---------------------------------------------------------------
149 typedef vtkIdType TInputID;
150 typedef vtkIdType TCellID;
151 typedef std::pair<TInputID,TCellID> TInputCellID;
153 VISU_CONVERTOR_EXPORT
155 GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID);
158 VISU_CONVERTOR_EXPORT
160 GetInput(vtkInformationVector **theInputVector,
161 vtkIdType theInputId = 0);
163 VISU_CONVERTOR_EXPORT
165 GetOutput(vtkInformationVector *theOutputVector);
167 VISU_CONVERTOR_EXPORT
169 GetObjectID(vtkDataArray *theIDDataArray, vtkIdType theID);
171 VISU_CONVERTOR_EXPORT
173 GetVTKID(vtkDataArray *theIDDataArray, vtkIdType theID, int theEntity);
176 //! Utility for ELNO Data Selection
177 //---------------------------------------------------------------
178 typedef vtkIdType TVTKPointID;
179 typedef vtkIdType TVTKCellID;
180 typedef std::pair<TVTKPointID,TVTKCellID> TElnoPointID;
181 typedef std::vector<TElnoPointID> TElnoPoints;
183 VISU_CONVERTOR_EXPORT
185 GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
187 //---------------------------------------------------------------
188 //! The utility class that allows to perform perfomance mesurement
189 class VISU_CONVERTOR_EXPORT TTimerLog
194 vtkTimerLog* myTimerLog;
195 MED::PrefixPrinter myPrefixPrinter;
198 TTimerLog(int theIsDebug,
199 const std::string& theName);
204 //---------------------------------------------------------------