BRL-CAD
defines.h
Go to the documentation of this file.
1 /* D E F I N E S . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2011-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @addtogroup rt_defines
21  *
22  * Common definitions for LIBRT
23  *
24  */
25 
26 /** @{ */
27 /** @file rt/defines.h */
28 
29 #ifndef RT_DEFINES_H
30 #define RT_DEFINES_H
31 
32 #ifndef RT_EXPORT
33 # if defined(RT_DLL_EXPORTS) && defined(RT_DLL_IMPORTS)
34 # error "Only RT_DLL_EXPORTS or RT_DLL_IMPORTS can be defined, not both."
35 # elif defined(RT_DLL_EXPORTS)
36 # define RT_EXPORT COMPILER_DLLEXPORT
37 # elif defined(RT_DLL_IMPORTS)
38 # define RT_EXPORT COMPILER_DLLIMPORT
39 # else
40 # define RT_EXPORT
41 # endif
42 #endif
43 
44 #include "common.h"
45 
46 #ifdef USE_OPENCL
47 #include <limits.h>
48 #define CL_USE_DEPRECATED_OPENCL_1_2_APIS
49 #define CL_USE_DEPRECATED_OPENCL_2_0_APIS
50 
51 #define CL_TARGET_OPENCL_VERSION 120
52 
53 #ifdef __APPLE__
54 #include <OpenCL/cl.h>
55 #else
56 #include <CL/cl.h>
57 #endif
58 
59 #ifndef CL_VERSION_1_2
60 # error "OpenCL 1.2 required."
61 #endif
62 
63 #ifdef CLT_SINGLE_PRECISION
64 #define cl_double cl_float
65 #define cl_double3 cl_float3
66 #define cl_double4 cl_float4
67 #define cl_double16 cl_float16
68 #endif
69 #endif
70 
71 #include "bg/defines.h"
72 
73 /* The most modern version of the .g database format.
74  * Code wanting to create the newest database format
75  * should use this define rather than hard coding the
76  * current latest format */
77 #define BRLCAD_DB_FORMAT_LATEST 5
78 
79 /*
80  * Values for Solid ID.
81  */
82 #define ID_NULL 0 /**< @brief Unused */
83 #define ID_TOR 1 /**< @brief Toroid */
84 #define ID_TGC 2 /**< @brief Generalized Truncated General Cone */
85 #define ID_ELL 3 /**< @brief Ellipsoid */
86 #define ID_ARB8 4 /**< @brief Generalized ARB. V + 7 vectors */
87 #define ID_ARS 5 /**< @brief ARS */
88 #define ID_HALF 6 /**< @brief Half-space */
89 #define ID_REC 7 /**< @brief Right Elliptical Cylinder [TGC special] */
90 #define ID_POLY 8 /**< @brief Polygonal faceted object */
91 #define ID_BSPLINE 9 /**< @brief B-spline object */
92 #define ID_SPH 10 /**< @brief Sphere */
93 #define ID_NMG 11 /**< @brief n-Manifold Geometry solid */
94 #define ID_EBM 12 /**< @brief Extruded bitmap solid */
95 #define ID_VOL 13 /**< @brief 3-D Volume */
96 #define ID_ARBN 14 /**< @brief ARB with N faces */
97 #define ID_PIPE 15 /**< @brief Pipe (wire) solid */
98 #define ID_PARTICLE 16 /**< @brief Particle system solid */
99 #define ID_RPC 17 /**< @brief Right Parabolic Cylinder */
100 #define ID_RHC 18 /**< @brief Right Hyperbolic Cylinder */
101 #define ID_EPA 19 /**< @brief Elliptical Paraboloid */
102 #define ID_EHY 20 /**< @brief Elliptical Hyperboloid */
103 #define ID_ETO 21 /**< @brief Elliptical Torus */
104 #define ID_GRIP 22 /**< @brief Pseudo Solid Grip */
105 #define ID_JOINT 23 /**< @brief Pseudo Solid/Region Joint */
106 #define ID_HF 24 /**< @brief Height Field */
107 #define ID_DSP 25 /**< @brief Displacement map */
108 #define ID_SKETCH 26 /**< @brief 2D sketch */
109 #define ID_EXTRUDE 27 /**< @brief Solid of extrusion */
110 #define ID_SUBMODEL 28 /**< @brief Instanced submodel */
111 #define ID_CLINE 29 /**< @brief FASTGEN4 CLINE solid */
112 #define ID_BOT 30 /**< @brief Bag o' triangles */
113 
114 /* Add a new primitive id above here (this is will break v5 format)
115  * NOTE: must update the non-geometric object id's below the
116  * ADD_BELOW_HERE marker
117  */
118 #define ID_MAX_SOLID 47 /**< @brief Maximum defined ID_xxx for solids */
119 
120 /*
121  * Non-geometric objects
122  */
123 #define ID_COMBINATION 31 /**< @brief Combination Record */
124 #define ID_UNUSED1 32 /**< @brief UNUSED (placeholder) */
125 #define ID_BINUNIF 33 /**< @brief Uniform-array binary */
126 #define ID_UNUSED2 34 /**< @brief UNUSED (placeholder) */
127 #define ID_CONSTRAINT 39 /**< @brief Constraint object */
128 #define ID_MATERIAL 46 /**< @brief Material object */
129 
130 /* - ADD_BELOW_HERE - */
131 /* superellipsoid should be 31, but is not v5 compatible */
132 #define ID_SUPERELL 35 /**< @brief Superquadratic ellipsoid */
133 #define ID_METABALL 36 /**< @brief Metaball */
134 #define ID_BREP 37 /**< @brief B-rep object */
135 #define ID_HYP 38 /**< @brief Hyperboloid of one sheet */
136 #define ID_REVOLVE 40 /**< @brief Solid of Revolution */
137 #define ID_PNTS 41 /**< @brief Collection of Points */
138 #define ID_ANNOT 42 /**< @brief Annotation */
139 #define ID_HRT 43 /**< @brief Heart */
140 #define ID_DATUM 44 /**< @brief Datum references */
141 #define ID_SCRIPT 45 /**< @brief Script */
142 #define ID_MAXIMUM 47 /**< @brief Maximum defined ID_xxx value */
143 
144 /**
145  * DEPRECATED: external applications should use other LIBRT API to
146  * access database objects.
147  *
148  * The directory is organized as forward linked lists hanging off of
149  * one of RT_DBNHASH headers in the db_i structure.
150  *
151  * FIXME: this should not be public API, push container and iteration
152  * down into LIBRT. External applications should not use this.
153  */
154 #define RT_DBNHASH 8192 /**< @brief hash table is an
155  * array of linked lists with
156  * this many array pointer
157  * elements (Memory use for
158  * 32-bit: 32KB, 64-bit: 64KB)
159  */
160 
161 #if ((RT_DBNHASH)&((RT_DBNHASH)-1)) != 0
162 /**
163  * DEPRECATED: external applications should use other LIBRT API to
164  * access database objects.
165  */
166 #define RT_DBHASH(sum) ((size_t)(sum) % (RT_DBNHASH))
167 #else
168 /**
169  * DEPRECATED: external applications should use other LIBRT API to
170  * access database objects.
171  */
172 #define RT_DBHASH(sum) ((size_t)(sum) & ((RT_DBNHASH)-1))
173 #endif
174 
175 /* Used to set globals declared in bot.c */
176 #define RT_DEFAULT_MINPIECES 32
177 #define RT_DEFAULT_TRIS_PER_PIECE 4
178 #define RT_DEFAULT_MINTIE 8
179 
180 
181 #define BACKING_DIST (-2.0) /**< @brief mm to look behind start point */
182 #define OFFSET_DIST 0.01 /**< @brief mm to advance point into box */
183 
184 /**
185  * FIXME: These should probably be vmath macros
186  */
187 #define RT_BADNUM(n) (!((n) >= -INFINITY && (n) <= INFINITY))
188 #define RT_BADVEC(v) (RT_BADNUM((v)[X]) || RT_BADNUM((v)[Y]) || RT_BADNUM((v)[Z]))
189 
190 /* FIXME: this is a dubious define that should be removed */
191 #define RT_MAXLINE 10240
192 
193 #define RT_PART_NUBSPT 0
194 
195 #endif /* RT_DEFINES_H */
196 
197 /** @} */
198 
199 /*
200  * Local Variables:
201  * tab-width: 8
202  * mode: C
203  * indent-tabs-mode: t
204  * c-file-style: "stroustrup"
205  * End:
206  * ex: shiftwidth=4 tabstop=8
207  */
Header file for the BRL-CAD common definitions.