id_types.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_ID_TYPES_H
21 #define LIBMESH_ID_TYPES_H
22 
23 #include <limits>
24 #include <stdint.h>
25 
26 #include "libmesh/libmesh_config.h"
27 
28 namespace libMesh
29 {
30 
31 // A useful way to debug:
32 #if 0
33 class TestClass {
34 //int _c;
35 unsigned int _c;
36 public:
37 TestClass() : _c(0) {}
38 TestClass(unsigned int c) : _c(c) {}
39 TestClass& operator=(unsigned int c) { _c = c; return *this; }
40 bool operator<(const TestClass &l) const { return _c < l._c; }
41 operator int() const { return _c; }
42 };
44 #endif
45 
46 #if LIBMESH_BOUNDARY_ID_BYTES == 1
47 typedef int8_t boundary_id_type;
48 #elif LIBMESH_BOUNDARY_ID_BYTES == 4
49 typedef int32_t boundary_id_type;
50 #elif LIBMESH_BOUNDARY_ID_BYTES == 8
51 typedef int64_t boundary_id_type;
52 #else // LIBMESH_BOUNDARY_ID_BYTES = 2 (default)
53 typedef int16_t boundary_id_type;
54 #endif
55 
56 
57 #if LIBMESH_DOF_ID_BYTES == 1
58 typedef uint8_t dof_id_type;
59 #elif LIBMESH_DOF_ID_BYTES == 2
60 typedef uint16_t dof_id_type;
61 #elif LIBMESH_DOF_ID_BYTES == 8
62 typedef uint64_t dof_id_type;
63 #else // LIBMESH_DOF_ID_BYTES = 4 (default)
64 typedef uint32_t dof_id_type;
65 #endif
66 
67 
68 #if LIBMESH_UNIQUE_ID_BYTES == 1
69 typedef uint8_t unique_id_type;
70 #elif LIBMESH_UNIQUE_ID_BYTES == 2
71 typedef uint16_t unique_id_type;
72 #elif LIBMESH_UNIQUE_ID_BYTES == 4
73 typedef uint32_t unique_id_type;
74 #else // LIBMESH_UNIQUE_ID_BYTES == 8 (default)
75 typedef uint64_t unique_id_type;
76 
77 #endif
78 
79 
80 // We may want to specialize this later, but for now we'll assume
81 // numeric vector indices are the same as dof indices
83 
84 
85 // Define processor id storage type. We default to short to save
86 // space, but expanding to support more than 2^16-2 procs should work
87 // too.
88 #if LIBMESH_PROCESSOR_ID_BYTES == 1
89 typedef uint8_t processor_id_type;
90 #elif LIBMESH_PROCESSOR_ID_BYTES == 4
91 typedef uint32_t processor_id_type;
92 #elif LIBMESH_PROCESSOR_ID_BYTES == 8
93 typedef uint64_t processor_id_type;
94 #else // LIBMESH_PROCESSOR_ID_BYTES = 2 (default)
95 typedef uint16_t processor_id_type;
96 #endif
97 
98 
99 #if LIBMESH_SUBDOMAIN_ID_BYTES == 1
100 typedef uint8_t subdomain_id_type;
101 #elif LIBMESH_SUBDOMAIN_ID_BYTES == 4
102 
107 typedef int32_t subdomain_id_type;
108 #elif LIBMESH_SUBDOMAIN_ID_BYTES == 8
109 
113 typedef int64_t subdomain_id_type;
114 #else // LIBMESH_SUBDOMAIN_ID_BYTES = 2 (default)
115 typedef uint16_t subdomain_id_type;
116 #endif
117 
118 #if (LIBMESH_BOUNDARY_ID_BYTES > 4) || (LIBMESH_DOF_ID_BYTES > 4) || \
119  (LIBMESH_UNIQUE_ID_BYTES > 4) || (LIBMESH_PROCESSOR_ID_BYTES > 4) || \
120  (LIBMESH_SUBDOMAIN_ID_BYTES > 4)
121 typedef uint64_t largest_id_type;
122 #elif (LIBMESH_BOUNDARY_ID_BYTES > 2) || (LIBMESH_DOF_ID_BYTES > 2) || \
123  (LIBMESH_UNIQUE_ID_BYTES > 2) || (LIBMESH_PROCESSOR_ID_BYTES > 2) || \
124  (LIBMESH_SUBDOMAIN_ID_BYTES > 2)
125 typedef uint32_t largest_id_type;
126 #elif (LIBMESH_BOUNDARY_ID_BYTES > 1) || (LIBMESH_DOF_ID_BYTES > 1) || \
127  (LIBMESH_UNIQUE_ID_BYTES > 1) || (LIBMESH_PROCESSOR_ID_BYTES > 1) || \
128  (LIBMESH_SUBDOMAIN_ID_BYTES > 1)
129 typedef uint16_t largest_id_type;
130 #else
131 typedef uint8_t largest_id_type;
132 #endif
133 
134 } // namespace libMesh
135 
136 #endif // LIBMESH_ID_TYPES_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo