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>
22 #ifndef __HKL_GEOMETRY_PRIVATE_H__
23 #define __HKL_GEOMETRY_PRIVATE_H__
25 #include <stddef.h> // for size_t
26 #include <stdio.h> // for FILE
27 #include "hkl-parameter-private.h" // for darray_parameter
28 #include "hkl-quaternion-private.h" // for _HklQuaternion
29 #include "hkl-source-private.h" // for HklSource
30 #include "hkl-vector-private.h" // for HklQuaternion
31 #include "hkl.h" // for HklGeometry, etc
32 #include "hkl/ccan/darray/darray.h" // for darray
33 #include "hkl/ccan/list/list.h"
37 typedef struct _HklHolder HklHolder
;
39 typedef void (* HklGeometryListMultiplyFunction
) (HklGeometryList
*self
,
40 HklGeometryListItem
*item
);
42 typedef darray(HklHolder
*) darray_holder
;
44 struct HklHolderConfig
{
51 struct HklHolderConfig
*config
;
52 HklGeometry
*geometry
;
58 const HklFactory
*factory
;
60 darray_parameter axes
;
61 darray_holder holders
;
64 #define HKL_GEOMETRY_ERROR hkl_geometry_error_quark ()
66 static inline GQuark
hkl_geometry_error_quark (void)
68 return g_quark_from_static_string ("hkl-geometry-error-quark");
72 HKL_GEOMETRY_ERROR_AXIS_GET
, /* can not get the axis */
73 HKL_GEOMETRY_ERROR_AXIS_SET
, /* can not set the axis */
76 struct _HklGeometryList
78 HklGeometryListMultiplyFunction multiply
;
79 struct list_head items
;
83 struct _HklGeometryListItem
85 struct list_node list
;
86 HklGeometry
*geometry
;
93 extern HklParameter
*hkl_holder_add_rotation_axis(HklHolder
*self
,
94 char const *name
, double x
, double y
, double z
);
100 extern HklGeometry
*hkl_geometry_new(const HklFactory
*factory
);
102 extern int hkl_geometry_init_geometry(HklGeometry
*self
,
103 const HklGeometry
*src
);
105 extern HklHolder
*hkl_geometry_add_holder(HklGeometry
*self
);
107 extern void hkl_geometry_update(HklGeometry
*self
);
109 extern int hkl_geometry_get_axis_idx_by_name(const HklGeometry
*self
,
112 /* internally require do not use the hkl_geometry_axis_get */
113 extern HklParameter
*hkl_geometry_get_axis_by_name(HklGeometry
*self
,
116 extern double hkl_geometry_distance(const HklGeometry
*self
,
117 const HklGeometry
*ref
);
119 extern double hkl_geometry_distance_orthodromic(const HklGeometry
*self
,
120 const HklGeometry
*ref
);
122 extern int hkl_geometry_closest_from_geometry_with_range(HklGeometry
*self
,
123 const HklGeometry
*ref
);
125 extern int hkl_geometry_is_valid(const HklGeometry
*self
);
127 /*******************/
128 /* HklGeometryList */
129 /*******************/
131 extern HklGeometryList
*hkl_geometry_list_new(void);
133 extern HklGeometryList
*hkl_geometry_list_new_copy(const HklGeometryList
*self
);
135 extern void hkl_geometry_list_add(HklGeometryList
*self
, HklGeometry
*geometry
);
137 extern void hkl_geometry_list_reset(HklGeometryList
*self
);
139 extern void hkl_geometry_list_sort(HklGeometryList
*self
, HklGeometry
*ref
);
141 extern void hkl_geometry_list_fprintf(FILE *f
, const HklGeometryList
*self
);
143 extern void hkl_geometry_list_multiply(HklGeometryList
*self
);
145 extern void hkl_geometry_list_multiply_from_range(HklGeometryList
*self
);
147 extern void hkl_geometry_list_remove_invalid(HklGeometryList
*self
);
149 /***********************/
150 /* HklGeometryListItem */
151 /***********************/
153 extern HklGeometryListItem
*hkl_geometry_list_item_new(const HklGeometry
*geometry
);
155 extern HklGeometryListItem
*hkl_geometry_list_item_new_copy(const HklGeometryListItem
*self
);
157 extern void hkl_geometry_list_item_free(HklGeometryListItem
*self
);
161 #endif /* __HKL_GEOMETRY_PRIVATE_H__ */