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