moab
CellTypeToType.h
Go to the documentation of this file.
00001 #ifndef __smoab_CellTypeToType_h
00002 #define __smoab_CellTypeToType_h
00003 
00004 #include "SimpleMoab.h"
00005 #include "vtkCellType.h"
00006 
00007 namespace smoab
00008 {
00009 template<int> struct CellTypeToType;
00010 
00011 int vtkCellType(moab::EntityType t, int &num_connect)
00012   {
00013   int ctype = -1;
00014   switch (t)
00015     {
00016     case moab::MBEDGE:
00017       if (num_connect == 2) ctype = VTK_LINE;
00018       else if (num_connect == 3) ctype = VTK_QUADRATIC_EDGE;
00019       break;
00020     case moab::MBTRI:
00021       if (num_connect == 3) ctype = VTK_TRIANGLE;
00022       else if (num_connect == 6) ctype = VTK_QUADRATIC_TRIANGLE;
00023       else if (num_connect == 7) ctype = VTK_BIQUADRATIC_TRIANGLE;
00024       break;
00025     case moab::MBQUAD:
00026       if (num_connect == 4) ctype = VTK_QUAD;
00027       else if (num_connect == 8) ctype = VTK_QUADRATIC_QUAD;
00028       else if (num_connect == 9) ctype = VTK_BIQUADRATIC_QUAD;
00029       break;
00030     case moab::MBPOLYGON:
00031       if (num_connect == 4) ctype = VTK_POLYGON;
00032       break;
00033     case moab::MBTET:
00034       if (num_connect == 4) ctype = VTK_TETRA;
00035       else if (num_connect == 10) ctype = VTK_QUADRATIC_TETRA;
00036       break;
00037     case moab::MBPYRAMID:
00038       if (num_connect == 5) ctype = VTK_PYRAMID;
00039       else if (num_connect == 13) ctype = VTK_QUADRATIC_PYRAMID;
00040       break;
00041     case moab::MBPRISM:
00042       if (num_connect == 6) ctype = VTK_WEDGE;
00043       else if (num_connect == 15) ctype = VTK_QUADRATIC_WEDGE;
00044       break;
00045     case moab::MBHEX:
00046       if (num_connect == 8) ctype = VTK_HEXAHEDRON;
00047       else if (num_connect == 20) ctype = VTK_QUADRATIC_HEXAHEDRON;
00048       else if (num_connect == 21) ctype = VTK_QUADRATIC_HEXAHEDRON, num_connect = 20;
00049       else if (num_connect == 27) ctype = VTK_TRIQUADRATIC_HEXAHEDRON;
00050       break;
00051     default:
00052       ctype = -1;
00053       break;
00054     }
00055   return ctype;
00056   }
00057 }
00058 
00059 #endif // CELLTYPETOTYPE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines