Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/visu.git] / src / CONVERTOR / VISU_Vtk2MedConvertor.cxx
index f50d10e31a3965c1c1a6a93cff7bbe3f67eddd1a..f6ead6464bc1de019f48092ac9062e7b37721515 100644 (file)
@@ -1,28 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  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.
 //
-//  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.
 //
-//  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
 //
-//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : VISU_Vtk2MedConvertor.cxx
 //  Author : Eugeny NIKOLAEV, Open CASCADE SAS
 //
-
 #include "VISU_Vtk2MedConvertor.hxx"
 
 // QT includes
@@ -78,33 +75,33 @@ using namespace std;
 
 /*
 # = dynamic_cast</*
-*>(  );define  VTK_EMPTY_CELL   0
-#define        VTK_VERTEX   1
-#define        VTK_POLY_VERTEX   2
-#define        VTK_LINE   3
-#define        VTK_POLY_LINE   4
-#define        VTK_TRIANGLE   5
-#define        VTK_TRIANGLE_STRIP   6
-#define        VTK_POLYGON   7
-#define        VTK_PIXEL   8
-#define        VTK_QUAD   9
-#define        VTK_TETRA   10
-#define        VTK_VOXEL   11
-#define        VTK_HEXAHEDRON   12
-#define        VTK_WEDGE   13
-#define        VTK_PYRAMID   14
-#define        VTK_QUADRATIC_EDGE   21
-#define        VTK_QUADRATIC_TRiTSIANGLE   22
-#define        VTK_QUADRATIC_QUAD   23
-#define        VTK_QUADRATIC_TETRA   24
-#define        VTK_QUADRATIC_HEXAHEDRON   25
-#define        VTK_CONVEX_POINT_SET   41
-#define        VTK_PARAMETRIC_CURVE   51
-#define        VTK_PARAMETRIC_SURFACE   52
-#define        VTK_PARAMETRIC_TRI_SURFACE   53
-#define        VTK_PARAMETRIC_QUAD_SURFACE   54
-#define        VTK_PARAMETRIC_TETRA_REGION   55
-#define        VTK_PARAMETRIC_HEX_REGION   56
+*>(  );define   VTK_EMPTY_CELL   0
+#define         VTK_VERTEX   1
+#define         VTK_POLY_VERTEX   2
+#define         VTK_LINE   3
+#define         VTK_POLY_LINE   4
+#define         VTK_TRIANGLE   5
+#define         VTK_TRIANGLE_STRIP   6
+#define         VTK_POLYGON   7
+#define         VTK_PIXEL   8
+#define         VTK_QUAD   9
+#define         VTK_TETRA   10
+#define         VTK_VOXEL   11
+#define         VTK_HEXAHEDRON   12
+#define         VTK_WEDGE   13
+#define         VTK_PYRAMID   14
+#define         VTK_QUADRATIC_EDGE   21
+#define         VTK_QUADRATIC_TRiTSIANGLE   22
+#define         VTK_QUADRATIC_QUAD   23
+#define         VTK_QUADRATIC_TETRA   24
+#define         VTK_QUADRATIC_HEXAHEDRON   25
+#define         VTK_CONVEX_POINT_SET   41
+#define         VTK_PARAMETRIC_CURVE   51
+#define         VTK_PARAMETRIC_SURFACE   52
+#define         VTK_PARAMETRIC_TRI_SURFACE   53
+#define         VTK_PARAMETRIC_QUAD_SURFACE   54
+#define         VTK_PARAMETRIC_TETRA_REGION   55
+#define         VTK_PARAMETRIC_HEX_REGION   56
 */
 
 static MED::EGeometrieElement VTK2MED( const int theGeom )
@@ -133,12 +130,15 @@ static MED::EGeometrieElement VTK2MED( const int theGeom )
   case VTK_HEXAHEDRON:       return MED::eHEXA8;
   case VTK_WEDGE:            return MED::ePENTA6;
   case VTK_PYRAMID:          return MED::ePYRA5;
+  case VTK_HEXAGONAL_PRISM:  return MED::eOCTA12;
   // QUADRATIC elements
   case VTK_QUADRATIC_EDGE:      return MED::eSEG3;
   case VTK_QUADRATIC_TRIANGLE:  return MED::eTRIA6;
   case VTK_QUADRATIC_QUAD:      return MED::eQUAD8;
+  case VTK_BIQUADRATIC_QUAD:      return MED::eQUAD9;
   case VTK_QUADRATIC_TETRA:     return MED::eTETRA10;
   case VTK_QUADRATIC_HEXAHEDRON:return MED::eHEXA20;
+  case VTK_TRIQUADRATIC_HEXAHEDRON :return MED::eHEXA27;
   case VTK_CONVEX_POINT_SET:    return MED::ePOLYEDRE;
   }
   
@@ -234,7 +234,7 @@ VISU_Vtk2MedConvertor
 
 /*!
   \brief Adds field names, which used as specific fields with ids or elements 
-  (or something else). (Default: \93VISU_CELLS_MAPPER\94,\94VISU_POINTS_MAPPER\94,\94VISU_FILED\94)
+  (or something else). (Default: "VISU_CELLS_MAPPER","VISU_POINTS_MAPPER","VISU_FILED")
   \param theFieldName field name
   \sa eraseFromIgnoringFieldList()
 */
@@ -340,7 +340,7 @@ VISU_Vtk2MedConvertor
 }
 
 /*!
-  \brief Sets output mesh name. (\93vtk2med\94 - default)
+  \brief Sets output mesh name. ("vtk2med" - default)
   \param theMeshName mesh name
   \sa getMeshName()
 */
@@ -352,7 +352,7 @@ VISU_Vtk2MedConvertor
 }
 
 /*!
-  \brief Gets output mesh name. (\93vtk2med\94 - default)
+  \brief Gets output mesh name. ("vtk2med" - default)
   \return mesh name
   \sa setMeshName()
 */
@@ -1247,8 +1247,9 @@ VISU_Vtk2MedConvertor
   MED::PWrapper myMed;
   MED::PMeshInfo aMeshInfo;
   int aMeshDimension = 3;
+  int aSpaceDimension = 3;
   myMed = CrWrapper(myMEDFileName.c_str(),myVersion);
-  aMeshInfo = myMed->CrMeshInfo(aMeshDimension,myMeshName.c_str());
+  aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,myMeshName.c_str());
   myMed->SetMeshInfo(aMeshInfo);
     
   {