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>
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
;
107 typedef struct _HklQuaternion HklQuaternion
;
109 struct _HklQuaternion
114 typedef darray(const char *) darray_string
;
120 typedef struct _HklMatrix HklMatrix
;
122 HKLAPI HklMatrix
*hkl_matrix_new(void);
124 HKLAPI HklMatrix
*hkl_matrix_new_full(double m11
, double m12
, double m13
,
125 double m21
, double m22
, double m23
,
126 double m31
, double m32
, double m33
);
128 HKLAPI HklMatrix
*hkl_matrix_new_euler(double euler_x
, double euler_y
, double euler_z
);
130 HKLAPI
double hkl_matrix_get(const HklMatrix
*self
, unsigned int i
, unsigned int j
) HKL_ARG_NONNULL(1);
132 HKLAPI
void hkl_matrix_free(HklMatrix
*self
) HKL_ARG_NONNULL(1);
134 HKLAPI
void hkl_matrix_init(HklMatrix
*self
,
135 double m11
, double m12
, double m13
,
136 double m21
, double m22
, double m23
,
137 double m31
, double m32
, double m33
) HKL_ARG_NONNULL(1);
139 HKLAPI
int hkl_matrix_cmp(const HklMatrix
*self
, const HklMatrix
*m
) HKL_ARG_NONNULL(1, 2);
141 HKLAPI
void hkl_matrix_times_matrix(HklMatrix
*self
, const HklMatrix
*m
) HKL_ARG_NONNULL(1, 2);
147 typedef enum _HklUnitEnum
157 typedef struct _HklParameter HklParameter
;
161 HKLAPI HklParameter
*hkl_parameter_new_copy(const HklParameter
*self
) HKL_ARG_NONNULL(1);
163 HKLAPI
void hkl_parameter_free(HklParameter
*self
) HKL_ARG_NONNULL(1);
165 HKLAPI
const char *hkl_parameter_name_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
167 HKLAPI
const char *hkl_parameter_default_unit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
169 HKLAPI
const char *hkl_parameter_user_unit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
171 HKLAPI
double hkl_parameter_value_get(const HklParameter
*self
,
172 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1);
174 HKLAPI
int hkl_parameter_value_set(HklParameter
*self
, double value
,
175 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
177 HKLAPI
void hkl_parameter_min_max_get(const HklParameter
*self
, double *min
, double *max
,
178 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2, 3);
180 HKLAPI
int hkl_parameter_min_max_set(HklParameter
*self
, double min
, double max
,
181 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
183 HKLAPI
int hkl_parameter_fit_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
185 HKLAPI
void hkl_parameter_fit_set(HklParameter
*self
, int fit
) HKL_ARG_NONNULL(1);
187 HKLAPI
void hkl_parameter_randomize(HklParameter
*self
) HKL_ARG_NONNULL(1);
189 /* getter and setter specific to certain type of HklParameter */
191 HKLAPI
const HklVector
*hkl_parameter_axis_v_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
193 HKLAPI
const HklQuaternion
*hkl_parameter_quaternion_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
195 HKLAPI
const char *hkl_parameter_description_get(const HklParameter
*self
) HKL_ARG_NONNULL(1);
201 typedef struct _HklDetector HklDetector
;
202 typedef enum _HklDetectorType
207 HKLAPI HklDetector
*hkl_detector_factory_new(HklDetectorType type
);
209 HKLAPI HklDetector
*hkl_detector_new_copy(const HklDetector
*src
) HKL_ARG_NONNULL(1);
211 HKLAPI
void hkl_detector_free(HklDetector
*self
) HKL_ARG_NONNULL(1);
213 HKLAPI
void hkl_detector_fprintf(FILE *f
, const HklDetector
*self
) HKL_ARG_NONNULL(1, 2);
219 typedef struct _HklGeometry HklGeometry
;
220 typedef struct _HklGeometryList HklGeometryList
;
221 typedef struct _HklGeometryListItem HklGeometryListItem
;
225 HKLAPI HklGeometry
*hkl_geometry_new_copy(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
227 HKLAPI
void hkl_geometry_free(HklGeometry
*self
) HKL_ARG_NONNULL(1);
229 HKLAPI
int hkl_geometry_set(HklGeometry
*self
, const HklGeometry
*src
) HKL_ARG_NONNULL(1, 2);
231 HKLAPI
const darray_string
*hkl_geometry_axis_names_get(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
233 HKLAPI
const HklParameter
*hkl_geometry_axis_get(const HklGeometry
*self
, const char *name
,
234 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
236 HKLAPI
int hkl_geometry_axis_set(HklGeometry
*self
, const char *name
,
237 const HklParameter
*axis
,
238 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
240 HKLAPI
void hkl_geometry_axis_values_get(const HklGeometry
*self
,
241 double values
[], size_t n_values
,
242 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2);
244 HKLAPI
int hkl_geometry_axis_values_set(HklGeometry
*self
,
245 double values
[], size_t n_values
,
246 HklUnitEnum unit_type
,
247 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
249 HKLAPI
const char *hkl_geometry_name_get(const HklGeometry
*self
) HKL_ARG_NONNULL(1);
251 HKLAPI
double hkl_geometry_wavelength_get(const HklGeometry
*self
,
252 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1);
254 HKLAPI
int hkl_geometry_wavelength_set(HklGeometry
*self
, double wavelength
,
255 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
257 HKLAPI
void hkl_geometry_randomize(HklGeometry
*self
) HKL_ARG_NONNULL(1);
259 /* TODO after bissecting it seems that this method is slow (to replace) */
260 HKLAPI
int hkl_geometry_set_values_v(HklGeometry
*self
, HklUnitEnum unit_type
,
261 GError
**error
, ...) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
263 HKLAPI
void hkl_geometry_fprintf(FILE *file
, const HklGeometry
*self
) HKL_ARG_NONNULL(1, 2);
265 /* HklGeometryList */
267 #define HKL_GEOMETRY_LIST_FOREACH(item, list) for((item)=hkl_geometry_list_items_first_get((list)); \
269 (item)=hkl_geometry_list_items_next_get((list), (item)))
271 HKLAPI
void hkl_geometry_list_free(HklGeometryList
*self
) HKL_ARG_NONNULL(1);
273 HKLAPI
size_t hkl_geometry_list_n_items_get(const HklGeometryList
*self
) HKL_ARG_NONNULL(1);
275 HKLAPI
const HklGeometryListItem
*hkl_geometry_list_items_first_get(const HklGeometryList
*self
) HKL_ARG_NONNULL(1);
277 HKLAPI
const HklGeometryListItem
*hkl_geometry_list_items_next_get(const HklGeometryList
*self
,
278 const HklGeometryListItem
*item
) HKL_ARG_NONNULL(1, 2);
280 /* HklGeometryListItem */
282 HKLAPI
const HklGeometry
*hkl_geometry_list_item_geometry_get(const HklGeometryListItem
*self
) HKL_ARG_NONNULL(1);
288 typedef struct _HklLattice HklLattice
;
289 typedef struct _HklSample HklSample
;
290 typedef struct _HklSampleReflection HklSampleReflection
;
294 HKLAPI HklLattice
*hkl_lattice_new(double a
, double b
, double c
,
295 double alpha
, double beta
, double gamma
,
296 GError
**error
) HKL_WARN_UNUSED_RESULT
;
298 HKLAPI HklLattice
*hkl_lattice_new_copy(const HklLattice
*self
) HKL_ARG_NONNULL(1);
300 HKLAPI HklLattice
*hkl_lattice_new_default(void);
302 HKLAPI
void hkl_lattice_free(HklLattice
*self
) HKL_ARG_NONNULL(1);
304 HKLAPI
const HklParameter
*hkl_lattice_a_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
306 HKLAPI
int hkl_lattice_a_set(HklLattice
*self
, const HklParameter
*parameter
,
307 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
309 HKLAPI
const HklParameter
*hkl_lattice_b_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
311 HKLAPI
int hkl_lattice_b_set(HklLattice
*self
, const HklParameter
*parameter
,
312 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
314 HKLAPI
const HklParameter
*hkl_lattice_c_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
316 HKLAPI
int hkl_lattice_c_set(HklLattice
*self
, const HklParameter
*parameter
,
317 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
319 HKLAPI
const HklParameter
*hkl_lattice_alpha_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
321 HKLAPI
int hkl_lattice_alpha_set(HklLattice
*self
, const HklParameter
*parameter
,
322 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
324 HKLAPI
const HklParameter
*hkl_lattice_beta_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
326 HKLAPI
int hkl_lattice_beta_set(HklLattice
*self
, const HklParameter
*parameter
,
327 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
329 HKLAPI
const HklParameter
*hkl_lattice_gamma_get(const HklLattice
*self
) HKL_ARG_NONNULL(1);
331 HKLAPI
int hkl_lattice_gamma_set(HklLattice
*self
, const HklParameter
*parameter
,
332 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
334 HKLAPI
int hkl_lattice_set(HklLattice
*self
,
335 double a
, double b
, double c
,
336 double alpha
, double beta
, double gamma
,
337 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
339 HKLAPI
void hkl_lattice_get(const HklLattice
*self
,
340 double *a
, double *b
, double *c
,
341 double *alpha
, double *beta
, double *gamma
,
342 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2, 3, 4, 5, 6, 7);
344 HKLAPI
int hkl_lattice_get_B(const HklLattice
*self
, HklMatrix
*B
) HKL_ARG_NONNULL(1, 2);
346 HKLAPI
int hkl_lattice_get_1_B(const HklLattice
*self
, HklMatrix
*B
) HKL_ARG_NONNULL(1, 2);
348 HKLAPI
int hkl_lattice_reciprocal(const HklLattice
*self
, HklLattice
*reciprocal
) HKL_ARG_NONNULL(1, 2);
352 HKLAPI HklSample
*hkl_sample_new(const char *name
) HKL_ARG_NONNULL(1);
354 HKLAPI HklSample
*hkl_sample_new_copy(const HklSample
*self
) HKL_ARG_NONNULL(1);
356 HKLAPI
void hkl_sample_free(HklSample
*self
) HKL_ARG_NONNULL(1);
358 HKLAPI
const char *hkl_sample_name_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
360 HKLAPI
void hkl_sample_name_set(HklSample
*self
, const char *name
) HKL_ARG_NONNULL(1, 2);
362 HKLAPI
const HklLattice
*hkl_sample_lattice_get(HklSample
*self
) HKL_ARG_NONNULL(1);
364 HKLAPI
void hkl_sample_lattice_set(HklSample
*self
, const HklLattice
*lattice
) HKL_ARG_NONNULL(1, 2);
366 HKLAPI
const HklParameter
*hkl_sample_ux_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
368 HKLAPI
int hkl_sample_ux_set(HklSample
*self
, const HklParameter
*ux
,
369 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
371 HKLAPI
const HklParameter
*hkl_sample_uy_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
373 HKLAPI
int hkl_sample_uy_set(HklSample
*self
, const HklParameter
*uy
,
374 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
376 HKLAPI
const HklParameter
*hkl_sample_uz_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
378 HKLAPI
int hkl_sample_uz_set(HklSample
*self
, const HklParameter
*uz
,
379 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
381 HKLAPI
const HklMatrix
*hkl_sample_U_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
383 HKLAPI
void hkl_sample_U_set(HklSample
*self
, const HklMatrix
*U
, GError
**error
) HKL_ARG_NONNULL(1);
385 HKLAPI
const HklMatrix
*hkl_sample_UB_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
387 HKLAPI
int hkl_sample_UB_set(HklSample
*self
, const HklMatrix
*UB
,
388 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
390 HKLAPI
size_t hkl_sample_n_reflections_get(const HklSample
*self
) HKL_ARG_NONNULL(1);
392 #define HKL_SAMPLE_REFLECTIONS_FOREACH(_item, _list) for((_item)=hkl_sample_reflections_first_get((_list)); \
394 (_item)=hkl_sample_reflections_next_get((_list), (_item)))
396 HKLAPI HklSampleReflection
*hkl_sample_reflections_first_get(HklSample
*self
) HKL_ARG_NONNULL(1);
398 HKLAPI HklSampleReflection
*hkl_sample_reflections_next_get(HklSample
*self
,
399 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
401 HKLAPI
void hkl_sample_del_reflection(HklSample
*self
,
402 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
404 HKLAPI
void hkl_sample_add_reflection(HklSample
*self
,
405 HklSampleReflection
*reflection
) HKL_ARG_NONNULL(1, 2);
407 HKLAPI
int hkl_sample_compute_UB_busing_levy(HklSample
*self
,
408 const HklSampleReflection
*r1
,
409 const HklSampleReflection
*r2
,
410 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
412 HKLAPI
double hkl_sample_get_reflection_measured_angle(const HklSample
*self
,
413 const HklSampleReflection
*r1
,
414 const HklSampleReflection
*r2
) HKL_ARG_NONNULL(1, 2, 3);
416 HKLAPI
double hkl_sample_get_reflection_theoretical_angle(const HklSample
*self
,
417 const HklSampleReflection
*r1
,
418 const HklSampleReflection
*r2
) HKL_ARG_NONNULL(1, 2, 3);
420 HKLAPI
int hkl_sample_affine(HklSample
*self
, GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
422 /* HklSampleReflection */
424 HKLAPI HklSampleReflection
*hkl_sample_reflection_new(const HklGeometry
*geometry
,
425 const HklDetector
*detector
,
426 double h
, double k
, double l
,
427 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
429 HKLAPI
void hkl_sample_reflection_hkl_get(const HklSampleReflection
*self
,
430 double *h
, double *k
, double *l
) HKL_ARG_NONNULL(1, 2, 3, 4);
432 HKLAPI
int hkl_sample_reflection_hkl_set(HklSampleReflection
*self
,
433 double h
, double k
, double l
,
434 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
436 HKLAPI
int hkl_sample_reflection_flag_get(const HklSampleReflection
*self
) HKL_ARG_NONNULL(1);
438 HKLAPI
void hkl_sample_reflection_flag_set(HklSampleReflection
*self
, int flag
) HKL_ARG_NONNULL(1);
440 HKLAPI
const HklGeometry
*hkl_sample_reflection_geometry_get(HklSampleReflection
*self
) HKL_ARG_NONNULL(1);
442 HKLAPI
void hkl_sample_reflection_geometry_set(HklSampleReflection
*self
,
443 const HklGeometry
*geometry
) HKL_ARG_NONNULL(1, 2);
449 typedef struct _HklEngine HklEngine
;
450 typedef struct _HklEngineList HklEngineList
;
452 typedef darray(HklEngine
*) darray_engine
;
456 HKLAPI
const char *hkl_engine_name_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
458 HKLAPI
unsigned int hkl_engine_len(const HklEngine
*self
) HKL_ARG_NONNULL(1);
460 HKLAPI
const darray_string
*hkl_engine_pseudo_axis_names_get(HklEngine
*self
) HKL_ARG_NONNULL(1);
462 HKLAPI
int hkl_engine_pseudo_axis_values_get(HklEngine
*self
,
463 double values
[], size_t n_values
,
464 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
466 HKLAPI HklGeometryList
*hkl_engine_pseudo_axis_values_set(HklEngine
*self
,
467 double values
[], size_t n_values
,
468 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
470 HKLAPI
const HklParameter
*hkl_engine_pseudo_axis_get(const HklEngine
*self
,
472 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
474 typedef enum _HklEngineCapabilities
476 HKL_ENGINE_CAPABILITIES_READABLE
= 1u << 0,
477 HKL_ENGINE_CAPABILITIES_WRITABLE
= 1u << 1,
478 HKL_ENGINE_CAPABILITIES_INITIALIZABLE
= 1u << 2,
479 } HklEngineCapabilities
;
481 HKLAPI
unsigned int hkl_engine_capabilities_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
483 HKLAPI
int hkl_engine_initialized_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
485 HKLAPI
int hkl_engine_initialized_set(HklEngine
*self
, int initialized
,
486 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
488 HKLAPI
void hkl_engine_fprintf(FILE *f
, const HklEngine
*self
) HKL_ARG_NONNULL(1, 2);
492 HKLAPI
const darray_string
*hkl_engine_modes_names_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
494 HKLAPI
const char *hkl_engine_current_mode_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
496 HKLAPI
int hkl_engine_current_mode_set(HklEngine
*self
, const char *name
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
498 typedef enum _HklEngineAxisNamesGet
500 HKL_ENGINE_AXIS_NAMES_GET_READ
,
501 HKL_ENGINE_AXIS_NAMES_GET_WRITE
,
502 } HklEngineAxisNamesGet
;
504 HKLAPI
const darray_string
*hkl_engine_axis_names_get(const HklEngine
*self
,
505 HklEngineAxisNamesGet mode
) HKL_ARG_NONNULL(1);
507 HKLAPI
const darray_string
*hkl_engine_parameters_names_get(const HklEngine
*self
) HKL_ARG_NONNULL(1);
509 HKLAPI
const HklParameter
*hkl_engine_parameter_get(const HklEngine
*self
, const char *name
,
510 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
512 HKLAPI
int hkl_engine_parameter_set(HklEngine
*self
,
513 const char *name
, const HklParameter
*parameter
,
514 GError
**error
) HKL_ARG_NONNULL(1, 2, 3) HKL_WARN_UNUSED_RESULT
;
516 HKLAPI
void hkl_engine_parameters_values_get(const HklEngine
*self
,
517 double values
[], size_t n_values
,
518 HklUnitEnum unit_type
) HKL_ARG_NONNULL(1, 2);
520 HKLAPI
int hkl_engine_parameters_values_set(HklEngine
*self
,
521 double values
[], size_t n_values
,
522 HklUnitEnum unit_type
, GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
526 HKLAPI
void hkl_engine_list_free(HklEngineList
*self
) HKL_ARG_NONNULL(1);
528 HKLAPI darray_engine
*hkl_engine_list_engines_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
530 HKLAPI HklGeometry
*hkl_engine_list_geometry_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
532 HKLAPI
int hkl_engine_list_geometry_set(HklEngineList
*self
, const HklGeometry
*geometry
) HKL_ARG_NONNULL(1, 2);
534 HKLAPI
int hkl_engine_list_select_solution(HklEngineList
*self
,
535 const HklGeometryListItem
*item
) HKL_ARG_NONNULL(1);
537 HKLAPI HklEngine
*hkl_engine_list_engine_get_by_name(HklEngineList
*self
,
539 GError
**error
) HKL_ARG_NONNULL(1, 2) HKL_WARN_UNUSED_RESULT
;
541 HKLAPI
void hkl_engine_list_init(HklEngineList
*self
,
542 HklGeometry
*geometry
,
543 HklDetector
*detector
,
544 HklSample
*sample
) HKL_ARG_NONNULL(1, 2, 3, 4);
546 HKLAPI
int hkl_engine_list_get(HklEngineList
*self
) HKL_ARG_NONNULL(1);
548 HKLAPI
void hkl_engine_list_fprintf(FILE *f
,
549 const HklEngineList
*self
) HKL_ARG_NONNULL(1, 2);
555 typedef struct _HklFactory HklFactory
;
557 HKLAPI HklFactory
**hkl_factory_get_all(size_t *n
) HKL_ARG_NONNULL(1);
559 HKLAPI HklFactory
*hkl_factory_get_by_name(const char *name
,
560 GError
**error
) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT
;
562 HKLAPI
const char *hkl_factory_name_get(const HklFactory
*self
) HKL_ARG_NONNULL(1);
564 HKLAPI HklGeometry
*hkl_factory_create_new_geometry(const HklFactory
*self
) HKL_ARG_NONNULL(1);
566 HKLAPI HklEngineList
*hkl_factory_create_new_engine_list(const HklFactory
*self
) HKL_ARG_NONNULL(1);