[hkl] factorize also the psi_constant_vertical parameters for e6c
[hkl.git] / hkl / hkl-pseudoaxis-common-hkl-private.h
blobd7854eb4d7471be56cfbfa24e65a3f5ef96dcae2
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-2014 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 #include <gsl/gsl_vector_double.h> // for gsl_vector
24 #include "hkl-pseudoaxis-auto-private.h"
25 #include "hkl-pseudoaxis-private.h" // for HklModeOperations, etc
26 #include "hkl.h" // for HklEngine, HklDetector, etc
28 typedef struct _HklEngineHkl HklEngineHkl;
29 struct _HklEngineHkl {
30 HklEngine engine;
31 HklParameter *h;
32 HklParameter *k;
33 HklParameter *l;
36 extern int _RUBh_minus_Q_func(const gsl_vector *x, void *params, gsl_vector *f);
37 extern int _double_diffraction_func(const gsl_vector *x, void *params, gsl_vector *f);
38 extern int _psi_constant_vertical_func(const gsl_vector *x, void *params, gsl_vector *f);
40 extern int RUBh_minus_Q(double const x[], void *params, double f[]);
41 extern int _double_diffraction(double const x[], void *params, double f[]);
43 extern int hkl_mode_get_hkl_real(HklMode *self,
44 HklEngine *engine,
45 HklGeometry *geometry,
46 HklDetector *detector,
47 HklSample *sample,
48 GError **error);
50 extern int hkl_mode_set_hkl_real(HklMode *self,
51 HklEngine *engine,
52 HklGeometry *geometry,
53 HklDetector *detector,
54 HklSample *sample,
55 GError **error);
57 extern int hkl_mode_initialized_set_psi_constant_vertical_real(HklMode *base,
58 HklEngine *engine,
59 HklGeometry *geometry,
60 HklDetector *detector,
61 HklSample *sample,
62 int initialized,
63 GError **error);
65 extern HklEngine *hkl_engine_hkl_new(void);
67 #define HKL_MODE_OPERATIONS_HKL_DEFAULTS \
68 HKL_MODE_OPERATIONS_AUTO_DEFAULTS, \
69 .get = hkl_mode_get_hkl_real
71 static const HklModeOperations hkl_mode_operations = {
72 HKL_MODE_OPERATIONS_HKL_DEFAULTS,
75 static const HklModeOperations hkl_full_mode_operations = {
76 HKL_MODE_OPERATIONS_HKL_DEFAULTS,
77 .set = hkl_mode_set_hkl_real,
80 static const HklModeOperations psi_constant_vertical_mode_operations = {
81 HKL_MODE_OPERATIONS_HKL_DEFAULTS,
82 .capabilities = HKL_ENGINE_CAPABILITIES_READABLE | HKL_ENGINE_CAPABILITIES_WRITABLE | HKL_ENGINE_CAPABILITIES_INITIALIZABLE,
83 .initialized_set = hkl_mode_initialized_set_psi_constant_vertical_real,
84 .set = hkl_mode_set_hkl_real,
87 static const HklModeOperations constant_incidence_mode_operations = {
88 HKL_MODE_OPERATIONS_AUTO_WITH_INIT_DEFAULTS,
89 .get = hkl_mode_get_hkl_real,
90 .set = hkl_mode_set_hkl_real
93 static const HklFunction RUBh_minus_Q_func = {
94 .function = _RUBh_minus_Q_func,
95 .size = 3,
98 static const HklFunction double_diffraction_func = {
99 .function = _double_diffraction_func,
100 .size = 4,
103 static const HklFunction psi_constant_vertical_func = {
104 .function = _psi_constant_vertical_func,
105 .size = 4,
108 /* outside the mode because used in more than one mode */
109 static const HklParameter double_diffraction_parameters[] = {
111 HKL_PARAMETER_DEFAULTS, .name = "h2", ._value = 1,
112 .description = "h coordinate of the second diffracting plan",
113 .range = {.min=-1, .max=1},
116 HKL_PARAMETER_DEFAULTS, .name = "k2", ._value = 1,
117 .description = "k coordinate of the second diffracting plan",
118 .range = {.min=-1, .max=1},
121 HKL_PARAMETER_DEFAULTS, .name = "l2", ._value = 1,
122 .description = "l coordinate of the second diffracting plan",
123 .range = {.min=-1, .max=1},
127 #define PSI_CONSTANT_PARAMETERS(_h2, _k2, _l2, _psi) \
129 HKL_PARAMETER_DEFAULTS, .name = "h2", ._value = _h2, \
130 .description = "h coordinate of the reference plan", \
131 .range = { .min=-1, .max=1 }, \
132 }, \
134 HKL_PARAMETER_DEFAULTS, .name = "k2", ._value = _k2, \
135 .description = "k coordinate of the reference plan", \
136 .range = { .min=-1, .max=1 }, \
137 }, \
139 HKL_PARAMETER_DEFAULTS, .name = "l2", ._value = _l2, \
140 .description = "l coordinate of the reference plan", \
141 .range = { .min=-1, .max=1 }, \
142 }, \
144 HKL_PARAMETER_DEFAULTS_ANGLE, .name = "psi", ._value = _psi, \
145 .description = "expected angle between the reference and the diffraction plans", \
148 static const HklParameter psi_constant_parameters[] = { PSI_CONSTANT_PARAMETERS(1, 1, 1, 0) };