IMP
2.2.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-2014 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> inline void set_##name##_d_geometry( \
59
Name##D<D> &g, const Name##D<D> &v) { g = v; } \
60
/** See Name */
\
61
template <int D> \
62
inline const Name##D<D> &get_##name##_d_geometry( \
63
const Name##D<D> &g) { return g; }) \
64
/** Typedef for python. */
\
65
typedef Name##D<1> Name##1D; \
66
IMP_VALUES(Name##1D, Name##1Ds); \
67
/** Typedef for python. */
\
68
typedef Name##D<2> Name##2D; \
69
IMP_VALUES(Name##2D, Name##2Ds); \
70
/** Typedef for python. */
\
71
typedef Name##D<3> Name##3D; \
72
IMP_VALUES(Name##3D, Name##3Ds); \
73
/** Typedef for python. */
\
74
typedef Name##D<4> Name##4D; \
75
IMP_VALUES(Name##4D, Name##4Ds); \
76
/** Typedef for python. */
\
77
typedef Name##D<5> Name##5D; \
78
IMP_VALUES(Name##5D, Name##5Ds); \
79
/** Typedef for python. */
\
80
typedef Name##D<6> Name##6D; \
81
IMP_VALUES(Name##6D, Name##6Ds); \
82
/** Typedef for python. */
\
83
typedef Name##D<-1> Name##KD; \
84
IMP_VALUES(Name##KD, Name##KDs)
85
86
//! implement the needed namespace methods for a geometry type
87
/** These are
88
- IMP::algebra::get_bounding_box()
89
- output to a stream
90
91
The name should not include the D.
92
93
The name of the argument is g and the code snipets should return
94
the expected value.
95
*/
96
#define IMP_LINEAR_GEOMETRY_METHODS(Name, name, bounding_box) \
97
IMP_VALUES(Name, Name##s); \
98
/** See Name */
\
99
inline BoundingBoxD<3> get_bounding_box(const Name &g) { bounding_box; } \
100
/** See Name */
\
101
inline const Name &get_##name##_geometry(const Name &g) { return g; } \
102
IMP_NO_SWIG( \
103
inline void set_##name##_geometry(Name &g, const Name &gi) { g = gi; })
104
105
//! implement the needed namespace methods for a geometry type
106
/** These are
107
- IMP::algebra::get_surface_area()
108
- IMP::algebra::get_bounding_box()
109
- output to a stream
110
111
The name of the argument is g and the code snipets should return
112
the expected value.
113
*/
114
#define IMP_AREA_GEOMETRY_METHODS(Name, name, area, bounding_box) \
115
IMP_VALUES(Name, Name##s); \
116
/** See Name */
\
117
inline double get_area(const Name &g) { area; } \
118
/** See Name */
\
119
inline BoundingBoxD<3> get_bounding_box(const Name &g) { bounding_box; } \
120
/** See Name */
\
121
inline const Name &get_##name##_geometry(const Name &g) { return g; } \
122
/** See Name */
\
123
IMP_NO_SWIG( \
124
inline void set_##name##_geometry(Name &g, const Name &v) { g = v; })
125
126
//! implement the needed namespace methods for a geometry type
127
/** These are
128
- IMP::algebra::get_surface_area()
129
- IMP::algebra::get_bounding_box()
130
- output to a stream
131
132
The name of the argument is g and the code snipets should return
133
the expected value.
134
*/
135
#define IMP_AREA_GEOMETRY_METHODS_D(Name, name, area, bounding_box) \
136
/** See Name */
\
137
template <int D> \
138
inline double get_area(const Name##D<D> &g) { \
139
area; \
140
} \
141
/** See Name */
\
142
template <int D> \
143
inline BoundingBoxD<D> get_bounding_box(const Name##D<D> &g) { \
144
bounding_box; \
145
} \
146
/** See Name */
\
147
template <int D> \
148
inline const Name &get_##name##_d_geometry(const Name##D<D> &g) { \
149
return g; \
150
} \
151
/** See Name */
\
152
IMP_NO_SWIG(template <int D> inline void set_##name##_d_geometry( \
153
Name &g, const Name##D<D> &v) { g = v; }) \
154
/** Typedef for python. */
\
155
typedef Name##D<1> Name##1D; \
156
IMP_VALUES(Name##1D, Name##1Ds); \
157
/** Typedef for python. */
\
158
typedef Name##D<2> Name##2D; \
159
IMP_VALUES(Name##2D, Name##2Ds); \
160
/** Typedef for python. */
\
161
typedef Name##D<3> Name##3D; \
162
IMP_VALUES(Name##3D, Name##3Ds); \
163
/** Typedef for python. */
\
164
typedef Name##D<4> Name##4D; \
165
IMP_VALUES(Name##4D, Name##4Ds); \
166
/** Typedef for python. */
\
167
typedef Name##D<5> Name##5D; \
168
IMP_VALUES(Name##5D, Name##5Ds); \
169
/** Typedef for python.*/
\
170
typedef Name##D<6> Name##6D; \
171
IMP_VALUES(Name##6D, Name##6Ds); \
172
/** Typedef for python. */
\
173
typedef Name##D<-1> Name##KD; \
174
IMP_VALUES(Name##KD, Name##KDs)
175
176
#endif
/* IMPALGEBRA_GEOMETRIC_PRIMITIVE_MACROS_H */