Mesh Oriented datABase
(version 5.5.1)
An array-based unstructured mesh library
MBEntityType.h
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 MB_ENTITY_TYPE_H
17
#define MB_ENTITY_TYPE_H
18
19
/* This file can be used to define several different things.
20
*
21
* A) If included in C code (not C++), it defines:
22
* 1) An enum named MBEntityType, guarded by the MB_ENTITY_TYPE_H
23
* include guards and
24
* 2) a typedef MBEntityType guarded by MOAB_ENTITY_TYPE_C include guards.
25
*
26
* B) If included in C++ code, it defines:
27
* 1) An enum named EntiyType in the MOAB namespace, guarded
28
* by the MB_ENTITY_TYPE include guards
29
* 2) Increment and decrement oeprators for the moab::EntityType enum,
30
* also guarded by the MB_ENTITY_TYPE include guards
31
* 3) A typedef for moab::EntityType in the global namespace
32
* named MBEntityType, guarded by the MOAB_ENTITY_TYPE_NS_ONLY
33
* include guards
34
*
35
* The C and C++ code should be entirely independent. They are defined
36
* in the same file only to avoid code duplication and inconsistent enum
37
* values. OTOH, the C++ definitions must be in the same file because
38
* the compiler must treat both the namespaced and non-namespaced names
39
* as the same type.
40
*
41
* The C++ code must be able to provide:
42
* a) An enum in the moab namespace
43
* b) An enum in the global namespace that is the *same type*
44
* as a) as far as the compiler is concerned.
45
* c) Nothing in the global namespace unless requested
46
* d) No breakage if both namespaced and non-namespaced headers
47
* are both included.
48
*
49
* This is acheived with the somewhat complicated set of multiple
50
* included guards described above, where moab/EntityType.hpp will
51
* include this file with MOAB_ENTITY_TYPE_NS_OLNY temporarily defined
52
* so as to pull in only the namespaced version at that time, without
53
* prohibiting the non-namespaced version from being pulled in previously
54
* or later.
55
*/
56
#ifdef __cplusplus
57
namespace
moab
58
{
59
#define MOAB_ENTITY_TYPE_NAME EntityType
60
#else
/* __cplusplus */
61
#define MOAB_ENTITY_TYPE_NAME MBEntityType
62
#endif
/* __cplusplus */
63
64
/*! Entity types defined in MOAB and MBCN
65
* The ordering here must ensure that all element types are
66
* grouped together and all elements of similar dimension are
67
* grouped together.
68
*/
69
enum
MOAB_ENTITY_TYPE_NAME
70
{
71
MBVERTEX
= 0,
/**< Mesh Vertex AKA node */
72
MBEDGE
,
/**< Mesh Edge */
73
MBTRI
,
/**< Triangular element (including shells) */
74
MBQUAD
,
/**< Quadrilateral element (including shells) */
75
MBPOLYGON
,
/**< Polygon */
76
MBTET
,
/**< Tetrahedral element */
77
MBPYRAMID
,
/**< Pyramid element (where are the face ids for this defined?) */
78
MBPRISM
,
/**< Wedge element (Exodus has one, Cubit doesn't. Does Mesh need it?) */
79
MBKNIFE
,
/**< Knife element */
80
MBHEX
,
/**< Hexahedral element */
81
MBPOLYHEDRON
,
/**< Polyhedron */
82
MBENTITYSET
,
/**< MeshSet */
83
MBMAXTYPE
/**< Just a place keeper - must be the # of entities, for array */
84
/**< dimensioning purposes */
85
};
86
87
#ifdef __cplusplus
88
/** prefix increment operator for MBEntityType */
89
inline
MOAB_ENTITY_TYPE_NAME
&
operator++
(
MOAB_ENTITY_TYPE_NAME
& type )
90
{
91
return
type =
static_cast<
MOAB_ENTITY_TYPE_NAME
>
( type + 1 );
92
}
93
94
/** postfix increment operator for MBEntityType */
95
inline
MOAB_ENTITY_TYPE_NAME
operator++
(
MOAB_ENTITY_TYPE_NAME
& type,
int
)
96
{
97
MOAB_ENTITY_TYPE_NAME
oldval = type;
98
++type;
99
return
oldval;
100
}
101
102
/** prefix increment operator for MBEntityType */
103
inline
MOAB_ENTITY_TYPE_NAME
& operator--(
MOAB_ENTITY_TYPE_NAME
& type )
104
{
105
return
type =
static_cast<
MOAB_ENTITY_TYPE_NAME
>
( type - 1 );
106
}
107
108
/** postfix increment operator for MBEntityType */
109
inline
MOAB_ENTITY_TYPE_NAME
operator--(
MOAB_ENTITY_TYPE_NAME
& type,
int
)
110
{
111
MOAB_ENTITY_TYPE_NAME
oldval = type;
112
--type;
113
return
oldval;
114
}
115
116
}
/* namespace moab*/
117
#endif
/* __cplusplus */
118
119
#undef MOAB_ENTITY_TYPE_NAME
120
#endif
/* MB_ENTITY_TYPE_H */
121
122
#ifdef __cplusplus
123
#ifndef MOAB_ENTITY_TYPE_NS_ONLY
124
#define MOAB_ENTITY_TYPE_NS_ONLY
125
typedef
moab::EntityType
MBEntityType
;
126
using
moab::MBEDGE
;
127
using
moab::MBENTITYSET
;
128
using
moab::MBHEX
;
129
using
moab::MBKNIFE
;
130
using
moab::MBMAXTYPE
;
131
using
moab::MBPOLYGON
;
132
using
moab::MBPOLYHEDRON
;
133
using
moab::MBPRISM
;
134
using
moab::MBPYRAMID
;
135
using
moab::MBQUAD
;
136
using
moab::MBTET
;
137
using
moab::MBTRI
;
138
using
moab::MBVERTEX
;
139
#endif
/* MOAB_ENTITY_TYPE_NS_ONLY */
140
#else
/* __cplusplus */
141
#ifndef MOAB_ENTITY_TYPE_C
142
#define MOAB_ENTITY_TYPE_C
143
typedef
enum
MBEntityType
MBEntityType
;
144
#endif
/* MOAB_ENTITY_TYPE_C */
145
#endif
/* __cplusplus */
src
MBEntityType.h
Generated on Tue Dec 24 2024 02:06:11 for Mesh Oriented datABase by
1.9.1.