2 #include "eulerian6C_geometry.h"
3 #include "twoC_vertical_geometry.h"
4 #include "eulerian4C_vertical_geometry.h"
5 #include "kappa4C_vertical_geometry.h"
6 #include "kappa6C_geometry.h"
10 namespace eulerian6C
{
13 * @brief Default constructor
15 Geometry::Geometry() :
16 hkl::Geometry("Eulerian 6 circles", "A default Eulerian 6 circles diffractometer.")
18 // Bouml preserved body begin 0002B802
19 _source
.setDirection(svector(1,0,0));
21 // add the sample holder
22 hkl::Holder
* holder
= _holders
.add();
23 _mu
= holder
->add_rotation("mu", svector(0., 0., 1.));
24 _omega
= holder
->add_rotation("omega", svector(0., -1., 0.));
25 _chi
= holder
->add_rotation("chi", svector(1, 0., 0.));
26 _phi
= holder
->add_rotation("phi", svector(0., -1., 0.));
28 // add the detector holder;
29 holder
= _holders
.add();
30 _gamma
= holder
->add_rotation("gamma", svector(0., 0., 1.));
31 _delta
= holder
->add_rotation("delta", svector(0., -1., 0.));
32 // Bouml preserved body end 0002B802
36 * @brief Another constructor.
37 * @param mu the first angle value.
38 * @param omega the second angle value.
39 * @param chi the third angle value.
40 * @param phi the fourth angle value.
41 * @param gamma the fifth angle value.
42 * @param delta the sixth angle value.
44 Geometry::Geometry(double mu
, double omega
, double chi
, double phi
, double gamma
, double delta
) :
45 hkl::Geometry("Eulerian 6 circles", "A default Eulerian 6 circles diffractometer.")
47 // Bouml preserved body begin 0002B882
48 _source
.setDirection(svector(1,0,0));
50 // add the sample holder
51 hkl::Holder
* holder
= _holders
.add();
52 _mu
= holder
->add_rotation("mu", svector(0., 0., 1.));
53 _omega
= holder
->add_rotation("omega", svector(0., -1., 0.));
54 _chi
= holder
->add_rotation("chi", svector(1, 0., 0.));
55 _phi
= holder
->add_rotation("phi", svector(0., -1., 0.));
57 // add the detector holder;
58 holder
= _holders
.add();
59 _gamma
= holder
->add_rotation("gamma", svector(0., 0., 1.));
60 _delta
= holder
->add_rotation("delta", svector(0., -1., 0.));
62 this->set_angles(mu
, omega
, chi
, phi
, gamma
, delta
);
63 this->set_angles_consign(mu
, omega
, chi
, phi
, gamma
, delta
);
64 // Bouml preserved body end 0002B882
69 // Bouml preserved body begin 00034382
70 // Bouml preserved body end 00034382
74 * @brief Copy Constructor.
76 Geometry::Geometry(const hkl::eulerian6C::Geometry
& geometry
) :
77 hkl::Geometry(geometry
)
79 // Bouml preserved body begin 0002B902
80 _mu
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["mu"]);
81 _omega
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["omega"]);
82 _chi
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["chi"]);
83 _phi
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["phi"]);
84 _gamma
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["gamma"]);
85 _delta
= static_cast<hkl::axe::Rotation
*>(_holders
.axes()["delta"]);
86 // Bouml preserved body end 0002B902
90 * @brief Get the _mu Axe.
91 * @return A pointer on the _mu Axe.
93 hkl::axe::Rotation
* Geometry::mu()
95 // Bouml preserved body begin 0002C082
97 // Bouml preserved body end 0002C082
101 * @brief Get the _omega Axe.
102 * @return A pointer on the _omega Axe.
104 hkl::axe::Rotation
* Geometry::omega()
106 // Bouml preserved body begin 0002BA02
108 // Bouml preserved body end 0002BA02
112 * @brief Get the _chi Axe.
113 * @return A pointer on the _chi Axe.
115 hkl::axe::Rotation
* Geometry::chi()
117 // Bouml preserved body begin 0002BA82
119 // Bouml preserved body end 0002BA82
123 * @brief Get the _phi Axe.
124 * @return A pointer on the _phi Axe.
126 hkl::axe::Rotation
* Geometry::phi()
128 // Bouml preserved body begin 0002BB02
130 // Bouml preserved body end 0002BB02
134 * @brief Get the _gamma Axe.
135 * @return A pointer on the _gamma Axe.
137 hkl::axe::Rotation
* Geometry::gamma()
139 // Bouml preserved body begin 0002BB82
141 // Bouml preserved body end 0002BB82
145 * @brief Get the _delta Axe.
146 * @return A pointer on the _delta Axe.
148 hkl::axe::Rotation
* Geometry::delta()
150 // Bouml preserved body begin 0002C102
152 // Bouml preserved body end 0002C102
156 * @brief Get the _mu Axe.
157 * @return A pointer on the _mu Axe.
159 const hkl::axe::Rotation
* Geometry::mu() const
161 // Bouml preserved body begin 0002C182
163 // Bouml preserved body end 0002C182
167 * @brief Get the _omega Axe.
168 * @return A pointer on the _omega Axe.
170 const hkl::axe::Rotation
* Geometry::omega() const
172 // Bouml preserved body begin 0002BC02
174 // Bouml preserved body end 0002BC02
178 * @brief Get the _chi Axe.
179 * @return A pointer on the _chi Axe.
181 const hkl::axe::Rotation
* Geometry::chi() const
183 // Bouml preserved body begin 0002BC82
185 // Bouml preserved body end 0002BC82
189 * @brief Get the _phi Axe.
190 * @return A pointer on the _phi Axe.
192 const hkl::axe::Rotation
* Geometry::phi() const
194 // Bouml preserved body begin 0002BD02
196 // Bouml preserved body end 0002BD02
200 * @brief Get the _gamma Axe.
201 * @return A pointer on the _gamma Axe.
203 const hkl::axe::Rotation
* Geometry::gamma() const
205 // Bouml preserved body begin 0002BD82
207 // Bouml preserved body end 0002BD82
211 * @brief Get the _delta Axe.
212 * @return A pointer on the _delta Axe.
214 const hkl::axe::Rotation
* Geometry::delta() const
216 // Bouml preserved body begin 0002C202
218 // Bouml preserved body end 0002C202
222 * @brief Set the angles of the eulerian4CD::Vertical geometry.
223 * @param mu The value of the "omega" Axe.
224 * @param omega The value of the "chi" Axe.
225 * @param chi The value of the "phi" Axe.
226 * @param phi The value of the "2theta" Axe.
227 * @param gamma The value of the "gamma" Axe.
228 * @param delta The value of the "delta" Axe.
230 void Geometry::set_angles(double mu
, double omega
, double chi
, double phi
, double gamma
, double delta
)
232 // Bouml preserved body begin 0002BE02
233 _mu
->set_current(mu
);
234 _omega
->set_current(omega
);
235 _chi
->set_current(chi
);
236 _phi
->set_current(phi
);
237 _gamma
->set_current(gamma
);
238 _delta
->set_current(delta
);
239 // Bouml preserved body end 0002BE02
243 * @brief Set the consign angles of the Geometry.
244 * @param mu The value of the "mu" Axe.
245 * @param omega The value of the "omega" Axe.
246 * @param chi The value of the "chi" Axe.
247 * @param phi The value of the "phi" Axe.
248 * @param gamma The value of the "gamma" Axe.
249 * @param delta The value of the "delta" Axe.
251 void Geometry::set_angles_consign(double mu
, double omega
, double chi
, double phi
, double gamma
, double delta
)
253 // Bouml preserved body begin 00040A02
254 _mu
->set_consign(mu
);
255 _omega
->set_consign(omega
);
256 _chi
->set_consign(chi
);
257 _phi
->set_consign(phi
);
258 _gamma
->set_consign(gamma
);
259 _delta
->set_consign(delta
);
260 // Bouml preserved body end 00040A02
264 * @brief Set an eulerian4C::Vertical Geometry from another Geometry.
265 * @param geometry The hkl::twoC::vertical::Geometry.
266 * @param strict false or true if we must not care of the strictness of the conversion.
267 * @throw HKLException
269 void Geometry::setFromGeometry(const hkl::twoC::vertical::Geometry
& geometry
, bool strict
) throw(hkl::HKLException
)
271 // Bouml preserved body begin 0002BE82
273 _source
= geometry
.get_source();
278 _chi
->set_current(0);
279 _phi
->set_current(0);
280 _gamma
->set_current(0);
283 _chi
->set_consign(0);
284 _phi
->set_consign(0);
285 _gamma
->set_consign(0);
287 _omega
->set_current(geometry
.omega()->get_current());
288 _delta
->set_current(geometry
.tth()->get_current());
290 _omega
->set_consign(geometry
.omega()->get_consign());
291 _delta
->set_consign(geometry
.tth()->get_consign());
292 // Bouml preserved body end 0002BE82
296 * @brief Set an eulerian4C::Vertical Geometry from another Geometry.
297 * @param geometry The hkl::eulerian4C::vertical::Geometry.
298 * @param strict false or true if we must not care of the strictness of the conversion.
299 * @throw HKLException
301 void Geometry::setFromGeometry(const hkl::eulerian4C::vertical::Geometry
& geometry
, bool strict
) throw(hkl::HKLException
)
303 // Bouml preserved body begin 0002BF02
305 _source
= geometry
.get_source();
310 _gamma
->set_current(0);
313 _gamma
->set_consign(0);
315 _omega
->set_current(geometry
.omega()->get_current());
316 _chi
->set_current(geometry
.chi()->get_current());
317 _phi
->set_current(geometry
.phi()->get_current());
318 _delta
->set_current(geometry
.tth()->get_current());
320 _omega
->set_consign(geometry
.omega()->get_consign());
321 _chi
->set_consign(geometry
.chi()->get_consign());
322 _phi
->set_consign(geometry
.phi()->get_consign());
323 _delta
->set_consign(geometry
.tth()->get_consign());
324 // Bouml preserved body end 0002BF02
328 * @brief Set an eulerian4C::Vertical Geometry from another Geometry.
329 * @param geometry The hkl::kappa4C::vertical::Geometry.
330 * @param strict false or true if we must not care of the strictness of the conversion.
331 * @throw HKLException
333 void Geometry::setFromGeometry(const hkl::kappa4C::vertical::Geometry
& geometry
, bool strict
) throw(hkl::HKLException
)
335 // Bouml preserved body begin 0002BF82
336 double const & alpha
= geometry
.get_alpha();
338 // compute the current values
339 double const & komega
= geometry
.komega()->get_current().get_value();
340 double const & kappa
= geometry
.kappa()->get_current().get_value();
341 double const & kphi
= geometry
.kphi()->get_current().get_value();
342 double omega
, chi
, phi
;
343 // this line can send an Exception so the source is updated after checking that all conversions are ok.
344 hkl::kappa_to_eulerian(komega
, kappa
, kphi
, alpha
, omega
, chi
, phi
);
346 // compute the consign values
347 double const & komega_c
= geometry
.komega()->get_consign().get_value();
348 double const & kappa_c
= geometry
.kappa()->get_consign().get_value();
349 double const & kphi_c
= geometry
.kphi()->get_consign().get_value();
350 double omega_c
, chi_c
, phi_c
;
351 // this line can send an Exception so the source is updated after checking that all conversions are ok.
352 hkl::kappa_to_eulerian(komega_c
, kappa_c
, kphi_c
, alpha
, omega_c
, chi_c
, phi_c
);
355 _source
= geometry
.get_source();
360 _gamma
->set_current(0);
363 _gamma
->set_consign(0);
365 _omega
->set_current(omega
);
366 _chi
->set_current(chi
);
367 _phi
->set_current(phi
);
368 _delta
->set_current(geometry
.tth()->get_current());
370 _omega
->set_consign(omega_c
);
371 _chi
->set_consign(chi_c
);
372 _phi
->set_consign(phi_c
);
373 _delta
->set_consign(geometry
.tth()->get_consign());
374 // Bouml preserved body end 0002BF82
378 * @brief Set an eulerian4C::Vertical Geometry from another Geometry.
379 * @param geometry The hkl::kappa6C::Geometry.
380 * @param strict false or true if we must not care of the strictness of the conversion.
381 * @throw HKLException
383 void Geometry::setFromGeometry(const hkl::kappa6C::Geometry
& geometry
, bool strict
) throw(hkl::HKLException
)
385 // Bouml preserved body begin 0002C002
386 double const & alpha
= geometry
.get_alpha();
387 double const & komega
= geometry
.komega()->get_current().get_value();
388 double const & kappa
= geometry
.kappa()->get_current().get_value();
389 double const & kphi
= geometry
.kphi()->get_current().get_value();
390 double omega
, chi
, phi
;
391 // this line can send an Exception so the source is updated after checking that all conversions are ok.
392 hkl::kappa_to_eulerian(komega
, kappa
, kphi
, alpha
, omega
, chi
, phi
);
394 // compute the consign values
395 double const & komega_c
= geometry
.komega()->get_consign().get_value();
396 double const & kappa_c
= geometry
.kappa()->get_consign().get_value();
397 double const & kphi_c
= geometry
.kphi()->get_consign().get_value();
398 double omega_c
, chi_c
, phi_c
;
399 // this line can send an Exception so the source is updated after checking that all conversions are ok.
400 hkl::kappa_to_eulerian(komega_c
, kappa_c
, kphi_c
, alpha
, omega_c
, chi_c
, phi_c
);
403 _source
= geometry
.get_source();
405 _mu
->set_current(geometry
.mu()->get_current());
406 _omega
->set_current(omega
);
407 _chi
->set_current(chi
);
408 _phi
->set_current(phi
);
409 _gamma
->set_current(geometry
.gamma()->get_current());
410 _delta
->set_current(geometry
.delta()->get_current());
412 _mu
->set_consign(geometry
.mu()->get_consign());
413 _omega
->set_consign(omega_c
);
414 _chi
->set_consign(chi_c
);
415 _phi
->set_consign(phi_c
);
416 _gamma
->set_consign(geometry
.gamma()->get_consign());
417 _delta
->set_consign(geometry
.delta()->get_consign());
418 // Bouml preserved body end 0002C002
422 } // namespace hkl::eulerian6C