-// VISU OBJECT : interactive object for VISU entities implementation
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
//
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// File : VISU_Convertor_impl.hxx
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// VISU OBJECT : interactive object for VISU entities implementation
+// File : VISU_ConvertorUtils.hxx
// Author : Alexey PETROV
// Module : VISU
-
+//
#ifndef VISU_ConvertorUtils_HeaderFile
#define VISU_ConvertorUtils_HeaderFile
-extern "C"{
-#include <med.h>
-}
+#include "VISUConvertor.hxx"
+
+#include "VISU_ConvertorDef.hxx"
+#include "VISU_IDMapper.hxx"
+#include "MED_Utilities.hxx"
+
+#include "VTKViewer.h"
+#include <vtkSystemIncludes.h>
-#include <fstream>
-#include <strstream>
#include <string>
-#include <vtkCellType.h>
+class vtkInformationVector;
+class vtkUnstructuredGrid;
+class vtkPolyData;
+class vtkTimerLog;
+class vtkDataSet;
+class vtkCell;
-#include <qstring.h>
-#include <qfileinfo.h>
+#ifndef VISU_ENABLE_QUADRATIC
+ #define VISU_ENABLE_QUADRATIC
+ #define VISU_USE_VTK_QUADRATIC
+#endif
-#ifndef MESSAGE
-#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
+namespace MED
+{
+ class PrefixPrinter;
+}
-#undef EXCEPT
-#define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
+namespace VISU
+{
+ //---------------------------------------------------------------
+ //! Get number of nodes for defined geometrical type
+ vtkIdType VISU_CONVERTOR_EXPORT
+ VISUGeom2NbNodes(EGeometry theGeom);
-#undef EXCEPTION
-#define EXCEPTION(msg) EXCEPT(msg).latin1()
-#endif
+ //---------------------------------------------------------------
+ //! Maps VISU geometrical type to VTK one
+ vtkIdType
+ VISUGeom2VTK(EGeometry theGeom);
-template<class T> std::string dtos(const std::string& fmt, T val){
- static QString aString;
- aString.sprintf(fmt.c_str(),val);
- return aString.latin1();
-}
-extern "C"{
- int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
- int getNbMedNodes(int theMedType);
- int med2vtkCellType(int theMedType);
- int vtk2medCellType(int theVtkType);
- int getIdMedType(int medType);
-}
+ //---------------------------------------------------------------
+ //! The utility function allows to write vtkUnstructuredGrid to a file with defined name
+ VISU_CONVERTOR_EXPORT
+ void
+ WriteToFile(vtkUnstructuredGrid* theDataSet,
+ const std::string& theFileName);
+
+
+ //---------------------------------------------------------------
+ //! The utility function allows to write vtkPolyData to a file with defined name
+ VISU_CONVERTOR_EXPORT
+ void
+ WriteToFile(vtkPolyData* theDataSet,
+ const std::string& theFileName);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ bool
+ IsDataOnCells(vtkDataSet* theDataSet);
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ bool
+ IsElnoData(vtkDataSet* theDataSet);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ bool
+ IsDataOnPoints(vtkDataSet* theDataSet);
+
-struct Med2vtk {
- med_geometrie_element medType;
- const char *medName;
- int medNbNodes;
- int vtkType;
- const char *vtkName;
- int vtkNbNodes;
-};
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkIdType
+ GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
-extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkIdType
+ GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkCell*
+ GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkIdType
+ GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkIdType
+ GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
+
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ vtkFloatingPointType*
+ GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
+
+ //---------------------------------------------------------------
+ VISU_CONVERTOR_EXPORT
+ TGaussPointID
+ GetObjID(vtkDataSet *theDataSet, vtkIdType theID);
+
+
+ //---------------------------------------------------------------
+ typedef vtkIdType TInputID;
+ typedef vtkIdType TCellID;
+ typedef std::pair<TInputID,TCellID> TInputCellID;
+
+ VISU_CONVERTOR_EXPORT
+ TInputCellID
+ GetInputCellID(vtkDataSet *theDataSet, vtkIdType theObjID);
+
+
+ VISU_CONVERTOR_EXPORT
+ vtkDataSet*
+ GetInput(vtkInformationVector **theInputVector,
+ vtkIdType theInputId = 0);
+
+ VISU_CONVERTOR_EXPORT
+ vtkDataSet*
+ GetOutput(vtkInformationVector *theOutputVector);
+
+ //! Utility for ELNO Data Selection
+ //---------------------------------------------------------------
+ typedef vtkIdType TVTKPointID;
+ typedef vtkIdType TVTKCellID;
+ typedef std::pair<TVTKPointID,TVTKCellID> TElnoPointID;
+ typedef std::vector<TElnoPointID> TElnoPoints;
+
+ VISU_CONVERTOR_EXPORT
+ TElnoPoints
+ GetElnoPoints(vtkDataSet *theDataSet, vtkIdType theNodeObjID);
+
+ //---------------------------------------------------------------
+ //! The utility class that allows to perform perfomance mesurement
+ class VISU_CONVERTOR_EXPORT TTimerLog
+ {
+ int myIsDebug;
+ double myCPUTime;
+ std::string myName;
+ vtkTimerLog* myTimerLog;
+ MED::PrefixPrinter myPrefixPrinter;
+ public:
+
+ TTimerLog(int theIsDebug,
+ const std::string& theName);
+ ~TTimerLog();
+ };
+
+
+ //---------------------------------------------------------------
+}
#endif