Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
VtkUtil.hpp
Go to the documentation of this file.
1 /**
2  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
3  * storing and accessing finite element mesh data.
4  *
5  * Copyright 2004 Sandia Corporation. Under the terms of Contract
6  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
7  * retains certain rights in this software.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef VTK_UTIL_HPP
17 #define VTK_UTIL_HPP
18 
19 #include "moab/EntityType.hpp"
20 
21 namespace moab
22 {
23 
24 //! Structure defining relation between MOAB and VTK element
25 //! types. VTK had different types for quadratic than linear
26 //! elements, so a tuple of the MOAB type and number of
27 //! elements maps to a VTK type.
29 {
30  const char* name; //!< String name for use in error messages
31  unsigned vtk_type; //!< VTK integer type
32  EntityType mb_type; //!< MOAB type
33  unsigned num_nodes; //!< Number of nodes (0 for polygon)
34  const unsigned* node_order; //!< VTK element node ordering, indexed by
35  //!< the VTK node position and containing
36  //!< the corresponding MOAB node position.
37  //!< NOTE: This field is NULL if MOAB and VTK
38  //!< ordering is the same!
39 };
40 
41 //! General data about VTK files for use by read and write code.
42 //! \author Jason Kraftcheck
43 class VtkUtil
44 {
45 
46  public:
47  //! vtk data type names, indexed by DataType
48  static const char* vtkTypeNames[];
49 
50  //! Vtk types, indexed by VTK type number.
51  //! For unused VTK type numbers, mb_type will be MBMAXTYPE.
52  static const VtkElemType vtkElemTypes[];
53 
54  //! Lenght of \ref vtkElemTypes
55  static const unsigned numVtkElemType;
56 
57  //! Get the VTK type corresponding to a tuple of the MOAB type and number of nodes.
58  //! num_nodes is ignored for MBPOLYGON type.
59  static const VtkElemType* get_vtk_type( EntityType type, unsigned num_nodes );
60 };
61 
62 } // namespace moab
63 
64 #endif