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>
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
;
38 typedef void (* HklGeometryListMultiplyFunction
) (HklGeometryList
*self
,
39 HklGeometryListItem
*item
);
41 typedef darray(HklHolder
*) darray_holder
;
43 struct HklHolderConfig
{
50 struct HklHolderConfig
*config
;
51 HklGeometry
*geometry
;
57 const HklFactory
*factory
;
59 darray_parameter axes
;
60 darray_holder holders
;
63 #define HKL_GEOMETRY_ERROR hkl_geometry_error_quark ()
65 static GQuark
hkl_geometry_error_quark (void)
67 return g_quark_from_static_string ("hkl-geometry-error-quark");
71 HKL_GEOMETRY_ERROR_AXIS_GET
, /* can not get the axis */
72 HKL_GEOMETRY_ERROR_AXIS_SET
, /* can not set the axis */
75 struct _HklGeometryList
77 HklGeometryListMultiplyFunction multiply
;
78 struct list_head items
;
82 struct _HklGeometryListItem
84 struct list_node list
;
85 HklGeometry
*geometry
;
92 extern HklParameter
*hkl_holder_add_rotation_axis(HklHolder
*self
,
93 char const *name
, double x
, double y
, double z
);
99 extern HklGeometry
*hkl_geometry_new(const HklFactory
*factory
);
101 extern int hkl_geometry_init_geometry(HklGeometry
*self
,
102 const HklGeometry
*src
);
104 extern HklHolder
*hkl_geometry_add_holder(HklGeometry
*self
);
106 extern void hkl_geometry_update(HklGeometry
*self
);
108 extern int hkl_geometry_get_axis_idx_by_name(const HklGeometry
*self
,
111 /* internally require do not use the hkl_geometry_axis_get */
112 extern HklParameter
*hkl_geometry_get_axis_by_name(HklGeometry
*self
,
115 extern double hkl_geometry_distance(const HklGeometry
*self
,
116 const HklGeometry
*ref
);
118 extern double hkl_geometry_distance_orthodromic(const HklGeometry
*self
,
119 const HklGeometry
*ref
);
121 extern int hkl_geometry_closest_from_geometry_with_range(HklGeometry
*self
,
122 const HklGeometry
*ref
);
124 extern int hkl_geometry_is_valid(const HklGeometry
*self
);
126 /*******************/
127 /* HklGeometryList */
128 /*******************/
130 extern HklGeometryList
*hkl_geometry_list_new(void);
132 extern HklGeometryList
*hkl_geometry_list_new_copy(const HklGeometryList
*self
);
134 extern void hkl_geometry_list_add(HklGeometryList
*self
, HklGeometry
*geometry
);
136 extern void hkl_geometry_list_reset(HklGeometryList
*self
);
138 extern void hkl_geometry_list_sort(HklGeometryList
*self
, HklGeometry
*ref
);
140 extern void hkl_geometry_list_fprintf(FILE *f
, const HklGeometryList
*self
);
142 extern void hkl_geometry_list_multiply(HklGeometryList
*self
);
144 extern void hkl_geometry_list_multiply_from_range(HklGeometryList
*self
);
146 extern void hkl_geometry_list_remove_invalid(HklGeometryList
*self
);
148 /***********************/
149 /* HklGeometryListItem */
150 /***********************/
152 extern HklGeometryListItem
*hkl_geometry_list_item_new(const HklGeometry
*geometry
);
154 extern HklGeometryListItem
*hkl_geometry_list_item_new_copy(const HklGeometryListItem
*self
);
156 extern void hkl_geometry_list_item_free(HklGeometryListItem
*self
);
160 #endif /* __HKL_GEOMETRY_PRIVATE_H__ */