File: Particles.h

package info (click to toggle)
bornagain 23.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,948 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (248 lines) | stat: -rw-r--r-- 5,498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Img3D/Model/Particles.h
//! @brief     Defines class Particle.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_IMG3D_MODEL_PARTICLES_H
#define BORNAGAIN_IMG3D_MODEL_PARTICLES_H

#include "Img3D/Model/PlottableBody.h"

namespace Img3D {

enum class EShape {
    BarGauss,
    BarLorentz,
    Bipyramid4,
    Box,
    CantellatedCube,
    Cone,
    CosineRippleBox,
    CosineRippleGauss,
    CosineRippleLorentz,
    Cylinder,
    Dodecahedron,
    EllipsoidalCylinder,
    Sphere,
    Spheroid,
    HemiEllipsoid,
    HorizontalCylinder,
    Icosahedron,
    None,
    PlatonicOctahedron,
    PlatonicTetrahedron,
    Prism3,
    Prism6,
    Pyramid2,
    Pyramid3,
    Pyramid4,
    Pyramid6,
    SawtoothRippleBox,
    SawtoothRippleGauss,
    SawtoothRippleLorentz,
    TruncatedCube,
    SphericalSegment,
    SpheroidalSegment
};

//------------------------------------------------------------------------------

class PlotParticle : public PlottableBody {
protected:
    PlotParticle(GeometricID::Key);
    F3 turn;      // turn before scale
    F3 scale;     // geometries are of 1-size (box 1x1x1, sphere D=1), need scaling
    F3 offset;    // geometries centered around origin; particles stand on z=0 plane
    F3 rotate;    // remembered
    F3 translate; // remembered

    void set();

public:
    static EShape const firstKind = EShape::BarGauss;
    static EShape const lastKind = EShape::SpheroidalSegment;

    void transform(F3 rotate, F3 translate);

    void addTransform(F3 rotate, F3 translate);
    void addTranslation(F3 translate_);
    void addExtrinsicRotation(F3 rotateExtrinsic);
};

//------------------------------------------------------------------------------

namespace Particles {

class Sphere : public PlotParticle {
public:
    Sphere(float R);
};

class Spheroid : public PlotParticle {
public:
    Spheroid(float Rxy, float Rz);
};

class Cylinder : public PlotParticle {
public:
    Cylinder(float R, float H);
};

class SphericalSegment : public PlotParticle {
public:
    SphericalSegment(float R, float H, float deltaH = 0.0f);
};

class SpheroidalSegment : public PlotParticle {
public:
    SpheroidalSegment(float R, float H, float fp, float deltaH = 0.0f);
};

class Cone : public PlotParticle {
public:
    Cone(float R, float H, float alpha);
};

class Icosahedron : public PlotParticle {
public:
    Icosahedron(float L);
};

class Dodecahedron : public PlotParticle {
public:
    Dodecahedron(float L);
};

class TruncatedCube : public PlotParticle {
public:
    TruncatedCube(float L, float t);
};

class Prism6 : public PlotParticle {
public:
    Prism6(float R, float H);
};

class Pyramid6 : public PlotParticle {
public:
    Pyramid6(float R, float H, float alpha);
};

class Pyramid4 : public PlotParticle {
public:
    Pyramid4(float L, float H, float alpha);
};

class Bipyramid4 : public PlotParticle {
public:
    Bipyramid4(float L, float H, float rH, float alpha);
};

class Prism3 : public PlotParticle {
public:
    Prism3(float L, float H);
};

class Pyramid3 : public PlotParticle {
public:
    Pyramid3(float L, float H, float alpha);
};

class EllipsoidalCylinder : public PlotParticle {
public:
    EllipsoidalCylinder(float Ra, float Rb, float H);
};

class BarGauss : public PlotParticle {
public:
    BarGauss(float L, float W, float H);
};

class BarLorentz : public PlotParticle {
public:
    BarLorentz(float L, float W, float H);
};

class Box : public PlotParticle {
public:
    Box(float L, float W, float H);
};

class HemiEllipsoid : public PlotParticle {
public:
    HemiEllipsoid(float Ra, float Rb, float H);
};

class CosineRippleBox : public PlotParticle {
public:
    CosineRippleBox(float L, float W, float H);
};

class CosineRippleGauss : public PlotParticle {
public:
    CosineRippleGauss(float L, float W, float H);
};

class CosineRippleLorentz : public PlotParticle {
public:
    CosineRippleLorentz(float L, float W, float H);
};

class SawtoothRippleBox : public PlotParticle {
public:
    SawtoothRippleBox(float L, float W, float H);
};

class SawtoothRippleGauss : public PlotParticle {
public:
    SawtoothRippleGauss(float L, float W, float H);
};

class SawtoothRippleLorentz : public PlotParticle {
public:
    SawtoothRippleLorentz(float L, float W, float H);
};

class SawtoothRipple : public PlotParticle {
public:
    SawtoothRipple(float L, float W, float H, float asymmetry);
};

class CantellatedCube : public PlotParticle {
public:
    CantellatedCube(float L, float t);
};

class HorizontalCylinder : public PlotParticle {
public:
    HorizontalCylinder(float R, float L, float s_b, float s_t);
};

class PlatonicOctahedron : public PlotParticle {
public:
    PlatonicOctahedron(float L);
};

class PlatonicTetrahedron : public PlotParticle {
public:
    PlatonicTetrahedron(float L);
};

class Pyramid2 : public PlotParticle {
public:
    Pyramid2(float L, float W, float H, float alpha);
};

} // namespace Particles
} // namespace Img3D

#endif // BORNAGAIN_IMG3D_MODEL_PARTICLES_H