1 // Copyright (C) 2007-2011 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;
49 #ifndef VISU_ENABLE_QUADRATIC
50 #define VISU_ENABLE_QUADRATIC
51 #define VISU_USE_VTK_QUADRATIC
61 //---------------------------------------------------------------
62 //! Get number of nodes for defined geometrical type
63 vtkIdType VISU_CONVERTOR_EXPORT
64 VISUGeom2NbNodes(EGeometry theGeom);
67 //---------------------------------------------------------------
68 //! Maps VISU geometrical type to VTK one
70 VISUGeom2VTK(EGeometry theGeom);
73 //---------------------------------------------------------------
74 //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
77 WriteToFile(vtkUnstructuredGrid* theDataSet,
78 const std::string& theFileName);
81 //---------------------------------------------------------------
82 //! The utility function allows to write vtkPolyData to a file with defined name
85 WriteToFile(vtkPolyData* theDataSet,
86 const std::string& theFileName);
89 //---------------------------------------------------------------
92 IsDataOnCells(vtkDataSet* theDataSet);
94 //---------------------------------------------------------------
97 IsElnoData(vtkDataSet* theDataSet);
100 //---------------------------------------------------------------
101 VISU_CONVERTOR_EXPORT
103 IsDataOnPoints(vtkDataSet* theDataSet);
106 //---------------------------------------------------------------
107 VISU_CONVERTOR_EXPORT
109 GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
112 //---------------------------------------------------------------
113 VISU_CONVERTOR_EXPORT
115 GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
118 //---------------------------------------------------------------
119 VISU_CONVERTOR_EXPORT
121 GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
124 //---------------------------------------------------------------
125 VISU_CONVERTOR_EXPORT
127 GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
130 //---------------------------------------------------------------
131 VISU_CONVERTOR_EXPORT
133 GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
136 //---------------------------------------------------------------
137 VISU_CONVERTOR_EXPORT
138 vtkFloatingPointType*
139 GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
141 //---------------------------------------------------------------
142 VISU_CONVERTOR_EXPORT
144 GetObjID(vtkDataSet *theDataSet, vtkIdType theID);
147 //---------------------------------------------------------------
148 typedef vtkIdType TInputID;
149 typedef vtkIdType TCellID;
150 typedef std::pair<TInputID,TCellID> TInputCellID;
152 VISU_CONVERTOR_EXPORT
154 GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID);
157 VISU_CONVERTOR_EXPORT
159 GetInput(vtkInformationVector **theInputVector,
160 vtkIdType theInputId = 0);
162 VISU_CONVERTOR_EXPORT
164 GetOutput(vtkInformationVector *theOutputVector);
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;
173 VISU_CONVERTOR_EXPORT
175 GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
177 //---------------------------------------------------------------
178 //! The utility class that allows to perform perfomance mesurement
179 class VISU_CONVERTOR_EXPORT TTimerLog
184 vtkTimerLog* myTimerLog;
185 MED::PrefixPrinter myPrefixPrinter;
188 TTimerLog(int theIsDebug,
189 const std::string& theName);
194 //---------------------------------------------------------------