1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
23 // File : VISU_Convertor_impl.cxx
24 // Author : Alexey PETROV
27 #include "VISU_Convertor.hxx"
28 #include "VISU_ConvertorUtils.hxx"
30 #include <vtkCellType.h>
34 #define MED2VTK(MEDTYPE,VTKTYPE,VTKNBNODES) \
35 {MEDTYPE,#MEDTYPE,getNbMedNodes(MEDTYPE),VTKTYPE,#VTKTYPE,VTKNBNODES}
36 Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE] = {
37 MED2VTK(MED_POINT1,VTK_VERTEX,1),
38 MED2VTK(MED_SEG2,VTK_LINE,2),
39 MED2VTK(MED_SEG3,VTK_LINE,2),
40 MED2VTK(MED_TRIA3,VTK_TRIANGLE,3),
41 MED2VTK(MED_TRIA6,VTK_TRIANGLE,3),
42 MED2VTK(MED_QUAD4,VTK_QUAD,4),
43 MED2VTK(MED_QUAD8,VTK_QUAD,4),
44 MED2VTK(MED_TETRA4,VTK_TETRA,4),
45 MED2VTK(MED_TETRA10,VTK_TETRA,4),
46 MED2VTK(MED_HEXA8,VTK_HEXAHEDRON,8),
47 MED2VTK(MED_HEXA20,VTK_HEXAHEDRON,8),
48 MED2VTK(MED_PENTA6,VTK_WEDGE,6),
49 MED2VTK(MED_PENTA15,VTK_WEDGE,6),
50 MED2VTK(MED_PYRA5,VTK_PYRAMID,5),
51 MED2VTK(MED_PYRA13,VTK_PYRAMID,5)
56 int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim){
57 int anElemDim = theMedType / 100, nsup = 0;
58 if(theMedEntity == VISU::CELL_ENTITY && anElemDim < theMeshDim) nsup = 1;
59 return nsup + theMedType % 100;
62 int getNbMedNodes(int geom){
66 int getIdMedType(int medType){
67 for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
68 if(med2vtk[i].medType == medType) return i;
72 int med2vtkCellType(int medType){
73 for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
74 if(med2vtk[i].medType == medType) return med2vtk[i].vtkType;
78 int vtk2medCellType(int vtkType){
79 for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
80 if(med2vtk[i].vtkType == vtkType) return med2vtk[i].medType;