IMP
2.1.1
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
geometric_primitive_macros.h
Go to the documentation of this file.
1
/**
2
* \file IMP/algebra/geometric_primitive_macros.h
3
* \brief Various important macros
4
* for implementing geometry.
5
*
6
* Copyright 2007-2013 IMP Inventors. All rights reserved.
7
*
8
*/
9
10
#ifndef IMPALGEBRA_GEOMETRIC_PRIMITIVE_MACROS_H
11
#define IMPALGEBRA_GEOMETRIC_PRIMITIVE_MACROS_H
12
13
//! implement the needed namespace methods for a geometry type
14
/** These are
15
- IMP::algebra::get_surface_area()
16
- IMP::algebra::get_volume()
17
- IMP::algebra::get_bounding_box()
18
- output to a stream
19
20
The name of the argument is g and the code snipets should return
21
the expected value.
22
*/
23
#define IMP_VOLUME_GEOMETRY_METHODS(Name, name, area, volume, bounding_box) \
24
IMP_VALUES(Name, Name##s); \
25
/** See Name */
\
26
inline double get_surface_area(const Name &g) { area; } \
27
/** See Name */
\
28
inline double get_volume(const Name &g) { volume; } \
29
/** See Name */
\
30
inline BoundingBoxD<3> get_bounding_box(const Name &g) { bounding_box; } \
31
/** See Name */
\
32
inline const Name &get_##name##_geometry(const Name &g) { return g; } \
33
/** See Name */
\
34
IMP_NO_SWIG( \
35
inline void set_##name##_geometry(Name &g, const Name &v) { g = v; })
36
37
//! implement the needed namespace methods for a geometry type
38
/** These are
39
- IMP::algebra::get_surface_area()
40
- IMP::algebra::get_volume()
41
- IMP::algebra::get_bounding_box()
42
- output to a stream
43
44
The name of the argument is g and the code snipets should return
45
the expected value.
46
*/
47
#define IMP_VOLUME_GEOMETRY_METHODS_D(Name, name, area, volume, bounding_box) \
48
/** See Name */
\
49
inline double get_surface_area(const Name##D<3> &g) { area; } \
50
/** See Name */
\
51
inline double get_volume(const Name##D<3> &g) { volume; } \
52
/** See Name */
\
53
template <int D> \
54
inline BoundingBoxD<D> get_bounding_box(const Name##D<D> &g) { \
55
bounding_box; \
56
} \
57
/** See Name */
\
58
IMP_NO_SWIG(template <int D> \
59
inline void set_##name##_d_geometry( \
60
Name##D<D> &g, const Name##D<D> &v) { g = v; } \
61
/** See Name */
\
62
template <int D> \
63
inline const Name##D<D> &get_##name##_d_geometry( \
64
const Name##D<D> &g) { return g; }) \
65
/** Typedef for python. */
\
66
typedef Name##D<1> Name##1D; \
67
IMP_VALUES(Name##1D, Name##1Ds); \
68
/** Typedef for python. */
\
69
typedef Name##D<2> Name##2D; \
70
IMP_VALUES(Name##2D, Name##2Ds); \
71
/** Typedef for python. */
\
72
typedef Name##D<3> Name##3D; \
73
IMP_VALUES(Name##3D, Name##3Ds); \
74
/** Typedef for python. */
\
75
typedef Name##D<4> Name##4D; \
76
IMP_VALUES(Name##4D, Name##4Ds); \
77
/** Typedef for python. */
\
78
typedef Name##D<5> Name##5D; \
79
IMP_VALUES(Name##5D, Name##5Ds); \
80
/** Typedef for python. */
\
81
typedef Name##D<6> Name##6D; \
82
IMP_VALUES(Name##6D, Name##6Ds); \
83
/** Typedef for python. */
\
84
typedef Name##D<-1> Name##KD; \
85
IMP_VALUES(Name##KD, Name##KDs)
86
87
//! implement the needed namespace methods for a geometry type
88
/** These are
89
- IMP::algebra::get_bounding_box()
90
- output to a stream
91
92
The name should not include the D.
93
94
The name of the argument is g and the code snipets should return
95
the expected value.
96
*/
97
#define IMP_LINEAR_GEOMETRY_METHODS(Name, name, bounding_box) \
98
IMP_VALUES(Name, Name##s); \
99
/** See Name */
\
100
inline BoundingBoxD<3> get_bounding_box(const Name &g) { bounding_box; } \
101
/** See Name */
\
102
inline const Name &get_##name##_geometry(const Name &g) { return g; } \
103
IMP_NO_SWIG( \
104
inline void set_##name##_geometry(Name &g, const Name &gi) { g = gi; })
105
106
//! implement the needed namespace methods for a geometry type
107
/** These are
108
- IMP::algebra::get_surface_area()
109
- IMP::algebra::get_bounding_box()
110
- output to a stream
111
112
The name of the argument is g and the code snipets should return
113
the expected value.
114
*/
115
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box) \
116
IMP_VALUES(Name, Name##s); \
117
/** See Name */
\
118
inline double get_area(const Name &g) { area; } \
119
/** See Name */
\
120
inline BoundingBoxD<3> get_bounding_box(const Name &g) { bounding_box; } \
121
/** See Name */
\
122
inline const Name &get_##name##_geometry(const Name &g) { return g; } \
123
/** See Name */
\
124
IMP_NO_SWIG( \
125
inline void set_##name##_geometry(Name &g, const Name &v) { g = v; })
126
127
//! implement the needed namespace methods for a geometry type
128
/** These are
129
- IMP::algebra::get_surface_area()
130
- IMP::algebra::get_bounding_box()
131
- output to a stream
132
133
The name of the argument is g and the code snipets should return
134
the expected value.
135
*/
136
#define IMP_AREA_GEOMETRY_METHODS_D(Name, name, area, bounding_box) \
137
/** See Name */
\
138
template <int D> \
139
inline double get_area(const Name##D<D> &g) { \
140
area; \
141
} \
142
/** See Name */
\
143
template <int D> \
144
inline BoundingBoxD<D> get_bounding_box(const Name##D<D> &g) { \
145
bounding_box; \
146
} \
147
/** See Name */
\
148
template <int D> \
149
inline const Name &get_##name##_d_geometry(const Name##D<D> &g) { \
150
return g; \
151
} \
152
/** See Name */
\
153
IMP_NO_SWIG(template <int D> \
154
inline void set_##name##_d_geometry( \
155
Name &g, const Name##D<D> &v) { g = v; }) \
156
/** Typedef for python. */
\
157
typedef Name##D<1> Name##1D; \
158
IMP_VALUES(Name##1D, Name##1Ds); \
159
/** Typedef for python. */
\
160
typedef Name##D<2> Name##2D; \
161
IMP_VALUES(Name##2D, Name##2Ds); \
162
/** Typedef for python. */
\
163
typedef Name##D<3> Name##3D; \
164
IMP_VALUES(Name##3D, Name##3Ds); \
165
/** Typedef for python. */
\
166
typedef Name##D<4> Name##4D; \
167
IMP_VALUES(Name##4D, Name##4Ds); \
168
/** Typedef for python. */
\
169
typedef Name##D<5> Name##5D; \
170
IMP_VALUES(Name##5D, Name##5Ds); \
171
/** Typedef for python.*/
\
172
typedef Name##D<6> Name##6D; \
173
IMP_VALUES(Name##6D, Name##6Ds); \
174
/** Typedef for python. */
\
175
typedef Name##D<-1> Name##KD; \
176
IMP_VALUES(Name##KD, Name##KDs)
177
178
#endif
/* IMPALGEBRA_GEOMETRIC_PRIMITIVE_MACROS_H */