upgrading copyright year from 2015 to 2016
[hkl.git] / hkl / hkl-pseudoaxis-common-hkl-private.h
blobe4574427a5268c8a47e5d11283593fb62e99cb60
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-2016 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>
21 * Maria-Teresa Nunez-Pardo-de-Verra <tnunez@mail.desy.de>
23 #ifndef __HKL_PSEUDOAXIS_COMMON_HKL_PRIVATE__
24 #define __HKL_PSEUDOAXIS_COMMON_HKL_PRIVATE__
26 #include <gsl/gsl_vector_double.h> // for gsl_vector
27 #include "hkl-pseudoaxis-auto-private.h"
28 #include "hkl-pseudoaxis-private.h" // for HklModeOperations, etc
29 #include "hkl.h" // for HklEngine, HklDetector, etc
30 #include "hkl-pseudoaxis-common-readonly-private.h"
32 typedef struct _HklEngineHkl HklEngineHkl;
33 struct _HklEngineHkl {
34 HklEngine engine;
35 HklParameter *h;
36 HklParameter *k;
37 HklParameter *l;
40 extern int _RUBh_minus_Q_func(const gsl_vector *x, void *params, gsl_vector *f);
41 extern int _double_diffraction_func(const gsl_vector *x, void *params, gsl_vector *f);
42 extern int _psi_constant_vertical_func(const gsl_vector *x, void *params, gsl_vector *f);
43 extern int _emergence_fixed_func(const gsl_vector *x, void *params, gsl_vector *f);
45 extern int RUBh_minus_Q(double const x[], void *params, double f[]);
46 extern int _double_diffraction(double const x[], void *params, double f[]);
48 extern int hkl_mode_get_hkl_real(HklMode *self,
49 HklEngine *engine,
50 HklGeometry *geometry,
51 HklDetector *detector,
52 HklSample *sample,
53 GError **error);
55 extern int hkl_mode_set_hkl_real(HklMode *self,
56 HklEngine *engine,
57 HklGeometry *geometry,
58 HklDetector *detector,
59 HklSample *sample,
60 GError **error);
62 extern int hkl_mode_initialized_set_psi_constant_vertical_real(HklMode *base,
63 HklEngine *engine,
64 HklGeometry *geometry,
65 HklDetector *detector,
66 HklSample *sample,
67 int initialized,
68 GError **error);
70 extern HklEngine *hkl_engine_hkl_new(HklEngineList *engines);
72 #define HKL_MODE_OPERATIONS_HKL_DEFAULTS \
73 HKL_MODE_OPERATIONS_AUTO_DEFAULTS, \
74 .get = hkl_mode_get_hkl_real
76 #define HKL_MODE_OPERATIONS_HKL_FULL_DEFAULTS \
77 HKL_MODE_OPERATIONS_HKL_DEFAULTS, \
78 .set = hkl_mode_set_hkl_real
80 static const HklModeOperations hkl_mode_operations = {
81 HKL_MODE_OPERATIONS_HKL_DEFAULTS,
84 static const HklModeOperations hkl_full_mode_operations = {
85 HKL_MODE_OPERATIONS_HKL_FULL_DEFAULTS,
88 static const HklModeOperations psi_constant_vertical_mode_operations = {
89 HKL_MODE_OPERATIONS_HKL_FULL_DEFAULTS,
90 .capabilities = HKL_ENGINE_CAPABILITIES_READABLE | HKL_ENGINE_CAPABILITIES_WRITABLE | HKL_ENGINE_CAPABILITIES_INITIALIZABLE,
91 .initialized_set = hkl_mode_initialized_set_psi_constant_vertical_real,
94 static const HklModeOperations constant_incidence_mode_operations = {
95 HKL_MODE_OPERATIONS_AUTO_WITH_INIT_DEFAULTS,
96 .get = hkl_mode_get_hkl_real,
97 .set = hkl_mode_set_hkl_real
100 static const HklFunction RUBh_minus_Q_func = {
101 .function = _RUBh_minus_Q_func,
102 .size = 3,
105 static const HklFunction double_diffraction_func = {
106 .function = _double_diffraction_func,
107 .size = 4,
110 static const HklFunction psi_constant_vertical_func = {
111 .function = _psi_constant_vertical_func,
112 .size = 4,
115 /* mode parameters */
117 #define CONSTANT_PARAMETER(_name) \
119 HKL_PARAMETER_DEFAULTS_ANGLE, .name = #_name, \
120 .description = "the freezed value", \
123 #define PSI_CONSTANT_PARAMETERS(_h2, _k2, _l2, _psi) \
125 HKL_PARAMETER_DEFAULTS, .name = "h2", ._value = _h2, \
126 .description = "h coordinate of the reference plan", \
127 .range = { .min=-1, .max=1 }, \
128 }, \
130 HKL_PARAMETER_DEFAULTS, .name = "k2", ._value = _k2, \
131 .description = "k coordinate of the reference plan", \
132 .range = { .min=-1, .max=1 }, \
133 }, \
135 HKL_PARAMETER_DEFAULTS, .name = "l2", ._value = _l2, \
136 .description = "l coordinate of the reference plan", \
137 .range = { .min=-1, .max=1 }, \
138 }, \
140 HKL_PARAMETER_DEFAULTS_ANGLE, .name = "psi", ._value = _psi, \
141 .description = "expected angle between the reference and the diffraction plans", \
144 static const HklParameter constant_omega_parameters[] = { CONSTANT_PARAMETER(omega) };
145 static const HklParameter constant_chi_parameters[] = { CONSTANT_PARAMETER(chi) };
146 static const HklParameter constant_phi_parameters[] = { CONSTANT_PARAMETER(phi) };
148 /* outside the mode because used in more than one mode */
149 static const HklParameter double_diffraction_parameters[] = {
151 HKL_PARAMETER_DEFAULTS, .name = "h2", ._value = 1,
152 .description = "h coordinate of the second diffracting plan",
153 .range = {.min=-1, .max=1},
156 HKL_PARAMETER_DEFAULTS, .name = "k2", ._value = 1,
157 .description = "k coordinate of the second diffracting plan",
158 .range = {.min=-1, .max=1},
161 HKL_PARAMETER_DEFAULTS, .name = "l2", ._value = 1,
162 .description = "l coordinate of the second diffracting plan",
163 .range = {.min=-1, .max=1},
167 static const HklParameter psi_constant_parameters[] = { PSI_CONSTANT_PARAMETERS(1, 1, 1, 0) };
169 static const HklParameter constant_incidence_parameters[] = {
170 SURFACE_PARAMETERS(1, 1, 1),
172 HKL_PARAMETER_DEFAULTS_ANGLE, .name = "incidence",
173 .description = "expected incidence of the incoming beam $\\vec{k_i}$ on the surface."
176 HKL_PARAMETER_DEFAULTS_ANGLE, .name = "azimuth", ._value = M_PI_2,
177 .description = "expected azimuth",
181 #define HKL_PARAMETER_EMERGENCE_DEFAULTS \
182 HKL_PARAMETER_DEFAULTS_ANGLE, \
183 .name="emergence", \
184 .description = "expected emergence of the outgoing beam $\\vec{k_f}$ from the surface $\\vec{n}$."
186 #define HKL_PARAMETER_EMERGENCE_AZIMUTH_DEFAULTS \
187 HKL_PARAMETER_DEFAULTS_ANGLE, \
188 .name="emergence_azimuth", \
189 ._value = M_PI_2, \
190 .description = "expected azimuth of the outgoing beam $\\vec{k_f}$ from the surface $\\vec{n}$ projected into the yOz plan."
192 /*******************/
193 /* Emergence fixed */
194 /*******************/
196 static const HklFunction emergence_fixed_func = {
197 .function = _emergence_fixed_func,
198 .size = 4,
201 #define HKL_MODE_HKL_EMERGENCE_FIXED_PARAMETERS_DEFAULTS(_x, _y, _z, _emergence) \
202 SURFACE_PARAMETERS(_x, _y, _z), \
204 HKL_PARAMETER_EMERGENCE_DEFAULTS, \
205 ._value = _emergence, \
208 extern HklMode *hkl_mode_hkl_emergence_fixed_new(const HklModeAutoInfo *info);
210 #endif