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>
25 #include <math.h> // for M_PI
26 #include <stddef.h> // for size_t
27 #include <stdio.h> // for FILE
28 #include <glib.h> // for g_set_error, GError etc
29 #include <hkl/ccan/darray/darray.h> // for darray
32 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
33 # define HKL_DEPRECATED __attribute__((__deprecated__))
34 #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
35 # define HKL_DEPRECATED __declspec(deprecated)
37 # define HKL_DEPRECATED
40 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
41 # define HKL_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
42 #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
43 # define HKL_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
45 # define HKL_DEPRECATED_FOR(f) HKL_DEPRECATED
49 #define HKL_EPSILON 1e-6
50 #define HKL_DEGTORAD (M_PI/180.)
51 #define HKL_RADTODEG (180./M_PI)
54 #define HKL_TAU (2. * M_PI)
55 /* #define HKL_TAU 1 */
63 # define HKLAPI __attribute__ ((visibility("default")))
70 * @brief Used to export functions(by changing visibility).
75 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
76 # define HKL_ARG_NONNULL(...) __attribute__ ((__nonnull__(__VA_ARGS__)))
78 # define HKL_ARG_NONNULL(...)
81 # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
82 # define HKL_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
84 # define HKL_WARN_UNUSED_RESULT
88 #define _darray(type) type *item; size_t size; size_t alloc
96 typedef struct _HklVector HklVector
;
103 HKLAPI
void hkl_vector_init(HklVector
*self
, double x
, double y
, double z
);
109 typedef struct _HklQuaternion HklQuaternion
;
110 typedef struct _HklMatrix HklMatrix
; /* forwarded declaration */
112 struct _HklQuaternion
117 typedef darray(const char *) darray_string
;
119 HKLAPI
void hkl_quaternion_to_matrix(const HklQuaternion
*self
, HklMatrix
*m
) HKL_ARG_NONNULL(1, 2);
125 HKLAPI HklMatrix
*hkl_matrix_new(void);
127 HKLAPI HklMatrix
*hkl_matrix_new_full(double m11
, double m12
, double m13
,
128 double m21
, double m22
, double m23
,
129 double m31
, double m32
, double m33
);
131 HKLAPI HklMatrix
*hkl_matrix_new_euler(double euler_x
, double euler_y
, double euler_z
);
133 HKLAPI
double hkl_matrix_get(const HklMatrix
*self
, unsigned int i
, unsigned int j
) HKL_ARG_NONNULL(1);
135 HKLAPI
void hkl_matrix_free(HklMatrix
*self
) HKL_ARG_NONNULL(1);
137 HKLAPI
void hkl_matrix_init(HklMatrix
*self
,
138 double m11
, double m12
, double m13
,
139 double m21
, double m22
, double m23
,
140 double m31
, double m32
, double m33
) HKL_ARG_NONNULL(1);
142 HKLAPI
int hkl_matrix_cmp(const HklMatrix
*self
, const HklMatrix
*m
) HKL_ARG_NONNULL(1, 2);
144 HKLAPI
void hkl_matrix_times_matrix(HklMatrix
*self
, const HklMatrix
*m
) HKL_ARG_NONNULL(1, 2);
150 typedef enum _HklUnitEnum
160 typedef struct _HklParameter HklParameter
;
164 HKLAPI HklParameter
*hkl_parameter_new_copy(const HklParameter
*self
) HKL_ARG_NONNULL(1);
166 HKLAPI
void hkl_parameter_free(HklParameter
*self
) HKL_ARG_NONNULL(1);
168 HKLAPI
const char *hkl_parameter_name_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
170 HKLAPI
const char *hkl_parameter_default_unit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
172 HKLAPI
const char *hkl_parameter_user_unit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
174 HKLAPI
double hkl_parameter_value_get(const HklParameter
*self
,
175 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1);
177 HKLAPI
int hkl_parameter_value_set(HklParameter
*self
, double value
,
178 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
180 HKLAPI
void hkl_parameter_min_max_get(const HklParameter
*self
, double *min
, double *max
,
181 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2, 3);
183 HKLAPI
int hkl_parameter_min_max_set(HklParameter
*self
, double min
, double max
,
184 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
186 HKLAPI
int hkl_parameter_fit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
188 HKLAPI
void hkl_parameter_fit_set(HklParameter
*self
, int fit
) HKL_ARG_NONNULL(1);
190 HKLAPI
void hkl_parameter_randomize(HklParameter
*self
) HKL_ARG_NONNULL(1);
192 /* getter and setter specific to certain type of HklParameter */
194 HKLAPI
const HklVector
*hkl_parameter_axis_v_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
196 HKLAPI
const HklQuaternion
*hkl_parameter_quaternion_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
198 HKLAPI
const char *hkl_parameter_description_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
204 typedef struct _HklDetector HklDetector
;
205 typedef enum _HklDetectorType
210 HKLAPI HklDetector
*hkl_detector_factory_new(HklDetectorType type
);
212 HKLAPI HklDetector
*hkl_detector_new_copy(const HklDetector
*src
) HKL_ARG_NONNULL(1);
214 HKLAPI
void hkl_detector_free(HklDetector
*self
) HKL_ARG_NONNULL(1);
216 HKLAPI
void hkl_detector_fprintf(FILE *f
, const HklDetector
*self
) HKL_ARG_NONNULL(1, 2);
222 typedef struct _HklGeometry HklGeometry
;
223 typedef struct _HklGeometryList HklGeometryList
;
224 typedef struct _HklGeometryListItem HklGeometryListItem
;
225 typedef struct _HklSample HklSample
; /* forwarded declaration */
229 HKLAPI HklGeometry
*hkl_geometry_new_copy(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
231 HKLAPI
void hkl_geometry_free(HklGeometry
*self
) HKL_ARG_NONNULL(1);
233 HKLAPI
int hkl_geometry_set(HklGeometry
*self
, const HklGeometry
*src
) HKL_ARG_NONNULL(1, 2);
235 HKLAPI
const darray_string
*hkl_geometry_axis_names_get(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
237 HKLAPI
const HklParameter
*hkl_geometry_axis_get(const HklGeometry
*self
, const char *name
,
238 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
240 HKLAPI
int hkl_geometry_axis_set(HklGeometry
*self
, const char *name
,
241 const HklParameter
*axis
,
242 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
244 HKLAPI
void hkl_geometry_axis_values_get(const HklGeometry
*self
,
245 double values
[], size_t n_values
,
246 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2);
248 HKLAPI
int hkl_geometry_axis_values_set(HklGeometry
*self
,
249 double values
[], size_t n_values
,
250 HklUnitEnum unit_type
,
251 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
253 HKLAPI
const char *hkl_geometry_name_get(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
255 HKLAPI
double hkl_geometry_wavelength_get(const HklGeometry
*self
,
256 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1);
258 HKLAPI
int hkl_geometry_wavelength_set(HklGeometry
*self
, double wavelength
,
259 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
261 HKLAPI
void hkl_geometry_randomize(HklGeometry
*self
) HKL_ARG_NONNULL(1);
263 /* TODO after bissecting it seems that this method is slow (to replace) */
264 HKLAPI
int hkl_geometry_set_values_v(HklGeometry
*self
, HklUnitEnum unit_type
,
265 GError
**error
, ...) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
267 HKLAPI HklQuaternion
hkl_geometry_sample_rotation_get(const HklGeometry
*self
,
268 const HklSample
*sample
) HKL_ARG_NONNULL(1, 2);
270 HKLAPI HklQuaternion
hkl_geometry_detector_rotation_get(const HklGeometry
*self
,
271 const HklDetector
*detector
) HKL_ARG_NONNULL(1, 2);
273 HKLAPI
void hkl_geometry_fprintf(FILE *file
, const HklGeometry
*self
) HKL_ARG_NONNULL(1, 2);
275 /* HklGeometryList */
277 #define HKL_GEOMETRY_LIST_FOREACH(item, list) for((item)=hkl_geometry_list_items_first_get((list)); \
279 (item)=hkl_geometry_list_items_next_get((list), (item)))
281 HKLAPI
void hkl_geometry_list_free(HklGeometryList
*self
) HKL_ARG_NONNULL(1);
283 HKLAPI
size_t hkl_geometry_list_n_items_get(const HklGeometryList
*self
) HKL_ARG_NONNULL(1);
285 HKLAPI
const HklGeometryListItem
*hkl_geometry_list_items_first_get(const HklGeometryList
*self
) HKL_ARG_NONNULL(1);
287 HKLAPI
const HklGeometryListItem
*hkl_geometry_list_items_next_get(const HklGeometryList
*self
,
288 const HklGeometryListItem
*item
) HKL_ARG_NONNULL(1, 2);
290 /* HklGeometryListItem */
292 HKLAPI
const HklGeometry
*hkl_geometry_list_item_geometry_get(const HklGeometryListItem
*self
) HKL_ARG_NONNULL(1);
298 typedef struct _HklLattice HklLattice
;
299 typedef struct _HklSampleReflection HklSampleReflection
;
303 HKLAPI HklLattice
*hkl_lattice_new(double a
, double b
, double c
,
304 double alpha
, double beta
, double gamma
,
305 GError
**error
) HKL_WARN_UNUSED_RESULT
;
307 HKLAPI HklLattice
*hkl_lattice_new_copy(const HklLattice
*self
) HKL_ARG_NONNULL(1);
309 HKLAPI HklLattice
*hkl_lattice_new_default(void);
311 HKLAPI
void hkl_lattice_free(HklLattice
*self
) HKL_ARG_NONNULL(1);
313 HKLAPI
const HklParameter
*hkl_lattice_a_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
315 HKLAPI
int hkl_lattice_a_set(HklLattice
*self
, const HklParameter
*parameter
,
316 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
318 HKLAPI
const HklParameter
*hkl_lattice_b_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
320 HKLAPI
int hkl_lattice_b_set(HklLattice
*self
, const HklParameter
*parameter
,
321 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
323 HKLAPI
const HklParameter
*hkl_lattice_c_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
325 HKLAPI
int hkl_lattice_c_set(HklLattice
*self
, const HklParameter
*parameter
,
326 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
328 HKLAPI
const HklParameter
*hkl_lattice_alpha_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
330 HKLAPI
int hkl_lattice_alpha_set(HklLattice
*self
, const HklParameter
*parameter
,
331 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
333 HKLAPI
const HklParameter
*hkl_lattice_beta_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
335 HKLAPI
int hkl_lattice_beta_set(HklLattice
*self
, const HklParameter
*parameter
,
336 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
338 HKLAPI
const HklParameter
*hkl_lattice_gamma_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
340 HKLAPI
int hkl_lattice_gamma_set(HklLattice
*self
, const HklParameter
*parameter
,
341 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
343 HKLAPI
const HklParameter
*hkl_lattice_volume_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
345 HKLAPI
int hkl_lattice_set(HklLattice
*self
,
346 double a
, double b
, double c
,
347 double alpha
, double beta
, double gamma
,
348 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
350 HKLAPI
void hkl_lattice_get(const HklLattice
*self
,
351 double *a
, double *b
, double *c
,
352 double *alpha
, double *beta
, double *gamma
,
353 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2, 3, 4, 5, 6, 7);
355 HKLAPI
int hkl_lattice_get_B(const HklLattice
*self
, HklMatrix
*B
) HKL_ARG_NONNULL(1, 2);
357 HKLAPI
int hkl_lattice_get_1_B(const HklLattice
*self
, HklMatrix
*B
) HKL_ARG_NONNULL(1, 2);
359 HKLAPI
int hkl_lattice_reciprocal(const HklLattice
*self
, HklLattice
*reciprocal
) HKL_ARG_NONNULL(1, 2);
363 HKLAPI HklSample
*hkl_sample_new(const char *name
) HKL_ARG_NONNULL(1);
365 HKLAPI HklSample
*hkl_sample_new_copy(const HklSample
*self
) HKL_ARG_NONNULL(1);
367 HKLAPI
void hkl_sample_free(HklSample
*self
) HKL_ARG_NONNULL(1);
369 HKLAPI
const char *hkl_sample_name_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
371 HKLAPI
void hkl_sample_name_set(HklSample
*self
, const char *name
) HKL_ARG_NONNULL(1, 2);
373 HKLAPI
const HklLattice
*hkl_sample_lattice_get(HklSample
*self
) HKL_ARG_NONNULL(1);
375 HKLAPI
void hkl_sample_lattice_set(HklSample
*self
, const HklLattice
*lattice
) HKL_ARG_NONNULL(1, 2);
377 HKLAPI
const HklParameter
*hkl_sample_ux_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
379 HKLAPI
int hkl_sample_ux_set(HklSample
*self
, const HklParameter
*ux
,
380 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
382 HKLAPI
const HklParameter
*hkl_sample_uy_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
384 HKLAPI
int hkl_sample_uy_set(HklSample
*self
, const HklParameter
*uy
,
385 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
387 HKLAPI
const HklParameter
*hkl_sample_uz_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
389 HKLAPI
int hkl_sample_uz_set(HklSample
*self
, const HklParameter
*uz
,
390 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
392 HKLAPI
const HklMatrix
*hkl_sample_U_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
394 HKLAPI
void hkl_sample_U_set(HklSample
*self
, const HklMatrix
*U
, GError
**error
) HKL_ARG_NONNULL(1);
396 HKLAPI
const HklMatrix
*hkl_sample_UB_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
398 HKLAPI
int hkl_sample_UB_set(HklSample
*self
, const HklMatrix
*UB
,
399 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
401 HKLAPI
size_t hkl_sample_n_reflections_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
403 #define HKL_SAMPLE_REFLECTIONS_FOREACH(_item, _list) for((_item)=hkl_sample_reflections_first_get((_list)); \
405 (_item)=hkl_sample_reflections_next_get((_list), (_item)))
407 HKLAPI HklSampleReflection
*hkl_sample_reflections_first_get(HklSample
*self
) HKL_ARG_NONNULL(1);
409 HKLAPI HklSampleReflection
*hkl_sample_reflections_next_get(HklSample
*self
,
410 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
412 HKLAPI
void hkl_sample_del_reflection(HklSample
*self
,
413 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
415 HKLAPI
void hkl_sample_add_reflection(HklSample
*self
,
416 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
418 HKLAPI
int hkl_sample_compute_UB_busing_levy(HklSample
*self
,
419 const HklSampleReflection
*r1
,
420 const HklSampleReflection
*r2
,
421 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
423 HKLAPI
double hkl_sample_get_reflection_measured_angle(const HklSample
*self
,
424 const HklSampleReflection
*r1
,
425 const HklSampleReflection
*r2
) HKL_ARG_NONNULL(1, 2, 3);
427 HKLAPI
double hkl_sample_get_reflection_theoretical_angle(const HklSample
*self
,
428 const HklSampleReflection
*r1
,
429 const HklSampleReflection
*r2
) HKL_ARG_NONNULL(1, 2, 3);
431 HKLAPI
int hkl_sample_affine(HklSample
*self
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
433 /* HklSampleReflection */
435 HKLAPI HklSampleReflection
*hkl_sample_reflection_new(const HklGeometry
*geometry
,
436 const HklDetector
*detector
,
437 double h
, double k
, double l
,
438 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
440 HKLAPI
void hkl_sample_reflection_hkl_get(const HklSampleReflection
*self
,
441 double *h
, double *k
, double *l
) HKL_ARG_NONNULL(1, 2, 3, 4);
443 HKLAPI
int hkl_sample_reflection_hkl_set(HklSampleReflection
*self
,
444 double h
, double k
, double l
,
445 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
447 HKLAPI
int hkl_sample_reflection_flag_get(const HklSampleReflection
*self
) HKL_ARG_NONNULL(1);
449 HKLAPI
void hkl_sample_reflection_flag_set(HklSampleReflection
*self
, int flag
) HKL_ARG_NONNULL(1);
451 HKLAPI
const HklGeometry
*hkl_sample_reflection_geometry_get(HklSampleReflection
*self
) HKL_ARG_NONNULL(1);
453 HKLAPI
void hkl_sample_reflection_geometry_set(HklSampleReflection
*self
,
454 const HklGeometry
*geometry
) HKL_ARG_NONNULL(1, 2);
460 typedef struct _HklEngine HklEngine
;
461 typedef struct _HklEngineList HklEngineList
;
463 typedef darray(HklEngine
*) darray_engine
;
467 HKLAPI
const char *hkl_engine_name_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
469 HKLAPI
unsigned int hkl_engine_len(const HklEngine
*self
) HKL_ARG_NONNULL(1);
471 HKLAPI
const darray_string
*hkl_engine_pseudo_axis_names_get(HklEngine
*self
) HKL_ARG_NONNULL(1);
473 HKLAPI
int hkl_engine_pseudo_axis_values_get(HklEngine
*self
,
474 double values
[], size_t n_values
,
475 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
477 HKLAPI HklGeometryList
*hkl_engine_pseudo_axis_values_set(HklEngine
*self
,
478 double values
[], size_t n_values
,
479 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
481 HKLAPI
const HklParameter
*hkl_engine_pseudo_axis_get(const HklEngine
*self
,
483 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
485 typedef enum _HklEngineCapabilities
487 HKL_ENGINE_CAPABILITIES_READABLE
= 1u << 0,
488 HKL_ENGINE_CAPABILITIES_WRITABLE
= 1u << 1,
489 HKL_ENGINE_CAPABILITIES_INITIALIZABLE
= 1u << 2,
490 } HklEngineCapabilities
;
492 HKLAPI
unsigned int hkl_engine_capabilities_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
494 HKLAPI
int hkl_engine_initialized_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
496 HKLAPI
int hkl_engine_initialized_set(HklEngine
*self
, int initialized
,
497 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
499 HKLAPI
void hkl_engine_fprintf(FILE *f
, const HklEngine
*self
) HKL_ARG_NONNULL(1, 2);
503 HKLAPI
const darray_string
*hkl_engine_modes_names_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
505 HKLAPI
const char *hkl_engine_current_mode_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
507 HKLAPI
int hkl_engine_current_mode_set(HklEngine
*self
, const char *name
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
509 typedef enum _HklEngineAxisNamesGet
511 HKL_ENGINE_AXIS_NAMES_GET_READ
,
512 HKL_ENGINE_AXIS_NAMES_GET_WRITE
,
513 } HklEngineAxisNamesGet
;
515 HKLAPI
const darray_string
*hkl_engine_axis_names_get(const HklEngine
*self
,
516 HklEngineAxisNamesGet mode
) HKL_ARG_NONNULL(1);
518 HKLAPI
const darray_string
*hkl_engine_parameters_names_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
520 HKLAPI
const HklParameter
*hkl_engine_parameter_get(const HklEngine
*self
, const char *name
,
521 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
523 HKLAPI
int hkl_engine_parameter_set(HklEngine
*self
,
524 const char *name
, const HklParameter
*parameter
,
525 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
527 HKLAPI
void hkl_engine_parameters_values_get(const HklEngine
*self
,
528 double values
[], size_t n_values
,
529 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2);
531 HKLAPI
int hkl_engine_parameters_values_set(HklEngine
*self
,
532 double values
[], size_t n_values
,
533 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
535 typedef enum _HklEngineDependencies
537 HKL_ENGINE_DEPENDENCIES_AXES
= 1u << 0,
538 HKL_ENGINE_DEPENDENCIES_ENERGY
= 1u << 1,
539 HKL_ENGINE_DEPENDENCIES_SAMPLE
= 1u << 2,
540 } HklEngineDependencies
;
542 HKLAPI
unsigned int hkl_engine_dependencies_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
547 HKLAPI
void hkl_engine_list_free(HklEngineList
*self
) HKL_ARG_NONNULL(1);
549 HKLAPI darray_engine
*hkl_engine_list_engines_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
551 HKLAPI HklGeometry
*hkl_engine_list_geometry_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
553 HKLAPI
int hkl_engine_list_geometry_set(HklEngineList
*self
, const HklGeometry
*geometry
) HKL_ARG_NONNULL(1, 2);
555 HKLAPI
int hkl_engine_list_select_solution(HklEngineList
*self
,
556 const HklGeometryListItem
*item
) HKL_ARG_NONNULL(1);
558 HKLAPI HklEngine
*hkl_engine_list_engine_get_by_name(HklEngineList
*self
,
560 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
562 HKLAPI
void hkl_engine_list_init(HklEngineList
*self
,
563 HklGeometry
*geometry
,
564 HklDetector
*detector
,
565 HklSample
*sample
) HKL_ARG_NONNULL(1, 2, 3, 4);
567 HKLAPI
int hkl_engine_list_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
569 HKLAPI
void hkl_engine_list_fprintf(FILE *f
,
570 const HklEngineList
*self
) HKL_ARG_NONNULL(1, 2);
576 typedef struct _HklFactory HklFactory
;
578 HKLAPI HklFactory
**hkl_factory_get_all(size_t *n
) HKL_ARG_NONNULL(1);
580 HKLAPI HklFactory
*hkl_factory_get_by_name(const char *name
,
581 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
583 HKLAPI
const char *hkl_factory_name_get(const HklFactory
*self
) HKL_ARG_NONNULL(1);
585 HKLAPI HklGeometry
*hkl_factory_create_new_geometry(const HklFactory
*self
) HKL_ARG_NONNULL(1);
587 HKLAPI HklEngineList
*hkl_factory_create_new_engine_list(const HklFactory
*self
) HKL_ARG_NONNULL(1);