Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
GmshUtil.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 GMSH_UTIL_HPP
17 #define GMSH_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 gmsh_type; //!< GMsh integer type
32  EntityType mb_type; //!< MOAB type
33  unsigned num_nodes; //!< Number of nodes (0 for polygon)
34  const int* node_order; //!< Gmsh element node ordering, indexed by
35  //!< the Gmsh node position and containing
36  //!< the corresponding MOAB node position.
37  //!< NOTE: This field is NULL if MOAB and Gmsh
38  //!< ordering is the same!
39 };
40 
41 //! General data about GMsh files for use by read and write code.
42 //! \author Jason Kraftcheck
43 class GmshUtil
44 {
45 
46  public:
47  //! Gmsh types, indexed by Gmsh type number.
48  //! For unused Gmsh type numbers, mb_type will be MBMAXTYPE.
49  static const GmshElemType gmshElemTypes[];
50 
51  //! Length of \ref gmshElemTypes
52  static const unsigned numGmshElemType;
53 
54  //! Get the Gmsh type corresponding to a tuple of the MOAB type and number of nodes.
55  //! num_nodes is ignored for MBPOLYGON type. Returns -1 for unsupported types.
56  static int get_gmsh_type( EntityType type, unsigned num_nodes );
57 };
58 
59 } // namespace moab
60 
61 #endif