[contrib][haskell] Hkl.Edf
[hkl.git] / hkl / hkl-engine-soleil-sirius-turret.c
blob65f5edcfe83026c46606438e6fb293c888fa2d6b
1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2017 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
22 #include "hkl-factory-private.h" // for autodata_factories_, etc
23 #include "hkl-pseudoaxis-common-hkl-private.h" // for hkl_engine_hkl_new, etc
24 #include "hkl-pseudoaxis-common-q-private.h" // for hkl_engine_q2_new, etc
25 #include "hkl-pseudoaxis-common-tth-private.h" // for hkl_engine_tth2_new, etc
26 #include "hkl-pseudoaxis-common-readonly-private.h"
28 #define BASEPITCH "basepitch"
29 #define THETAH "thetah"
30 #define ALPHAY "alphay"
31 #define ALPHAX "alphax"
32 #define DELTA "delta"
33 #define GAMMA "gamma"
35 /************/
36 /* mode hkl */
37 /************/
39 static HklMode* lifting_detector_thetah()
41 static const char *axes_r[] = {BASEPITCH, THETAH, ALPHAY, ALPHAX, DELTA, GAMMA};
42 static const char* axes_w[] = {THETAH, DELTA, GAMMA};
43 static const HklFunction *functions[] = {&RUBh_minus_Q_func};
44 static const HklModeAutoInfo info = {
45 HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions),
48 return hkl_mode_auto_new(&info,
49 &hkl_full_mode_operations,
50 TRUE);
53 static HklEngine *hkl_engine_soleil_sirius_turret_hkl_new(HklEngineList *engines)
55 HklEngine *self;
56 HklMode *default_mode;
58 self = hkl_engine_hkl_new(engines);
60 default_mode = lifting_detector_thetah();
61 hkl_engine_add_mode(self, default_mode);
62 hkl_engine_mode_set(self, default_mode);
64 return self;
67 /*****************/
68 /* mode readonly */
69 /*****************/
71 REGISTER_READONLY_INCIDENCE(hkl_engine_soleil_sirius_turret_incidence_new,
72 P99_PROTECT({BASEPITCH, THETAH, ALPHAY, ALPHAX}),
73 surface_parameters_z);
75 REGISTER_READONLY_EMERGENCE(hkl_engine_soleil_sirius_turret_emergence_new,
76 P99_PROTECT({BASEPITCH, THETAH, ALPHAY, ALPHAX, DELTA, GAMMA}),
77 surface_parameters_z);
79 /************************/
80 /* SOLEIL SIRIUS TURRET */
81 /************************/
83 #define HKL_GEOMETRY_TYPE_SOLEIL_SIRIUS_TURRET_DESCRIPTION \
84 "+ xrays source fix allong the :math:`\\vec{x}` direction (1, 0, 0)\n" \
85 "+ 4 axes for the sample\n" \
86 "\n" \
87 " + **" BASEPITCH "** : rotation around the :math:`\\vec{y}` direction (0, 1, 0)\n" \
88 " + **" THETAH "** : rotation around the :math:`-\\vec{z}` direction (0, 0, -1)\n" \
89 " + **" ALPHAY "** : rotation around the :math:`\\vec{y}` direction (0, 1, 0)\n" \
90 " + **" ALPHAX "** : rotating around the :math:`\\vec{x}` direction (1, 0, 0)\n" \
91 "\n" \
92 "+ 3 axis for the detector\n" \
93 "\n" \
94 " + **" BASEPITCH "** : rotation around the :math:`\\vec{y}` direction (0, 1, 0)\n" \
95 " + **" DELTA "** : rotation around the :math:`-\\vec{y}` direction (0, 0, -1)\n" \
96 " + **" GAMMA "** : rotation around the :math:`\\vec{z}` direction (0, -1, 0)\n"
98 static const char* hkl_geometry_soleil_sirius_turret_axes[] = {BASEPITCH, THETAH, ALPHAY, ALPHAX, DELTA, GAMMA};
100 static HklGeometry *hkl_geometry_new_soleil_sirius_turret(const HklFactory *factory)
102 HklGeometry *self = hkl_geometry_new(factory, &hkl_geometry_operations_defaults);
103 HklHolder *h;
105 h = hkl_geometry_add_holder(self);
106 hkl_holder_add_rotation(h, BASEPITCH, 0, 1, 0, &hkl_unit_angle_mrad);
107 hkl_holder_add_rotation(h, THETAH, 0, 0, -1, &hkl_unit_angle_deg);
108 hkl_holder_add_rotation(h, ALPHAY, 0, 1, 0, &hkl_unit_angle_deg);
109 hkl_holder_add_rotation(h, ALPHAX, 1, 0, 0, &hkl_unit_angle_deg);
111 h = hkl_geometry_add_holder(self);
112 hkl_holder_add_rotation(h, BASEPITCH, 0, 1, 0, &hkl_unit_angle_mrad);
113 hkl_holder_add_rotation(h, DELTA, 0, 0, -1, &hkl_unit_angle_deg);
114 hkl_holder_add_rotation(h, GAMMA, 0, -1, 0, &hkl_unit_angle_deg);
116 return self;
119 static HklEngineList *hkl_engine_list_new_soleil_sirius_turret(const HklFactory *factory)
121 HklEngineList *self = hkl_engine_list_new();
123 hkl_engine_soleil_sirius_turret_hkl_new(self);
124 hkl_engine_q2_new(self);
125 hkl_engine_qper_qpar_new(self);
126 hkl_engine_tth2_new(self);
127 hkl_engine_soleil_sirius_turret_incidence_new(self);
128 hkl_engine_soleil_sirius_turret_emergence_new(self);
130 return self;
133 REGISTER_DIFFRACTOMETER(soleil_sirius_turret, "SOLEIL SIRIUS TURRET", HKL_GEOMETRY_TYPE_SOLEIL_SIRIUS_TURRET_DESCRIPTION);