hkl-geometry-private: hkl Reference Manual

## hkl-geometry-private hkl-geometry-private |

## Functions

void | (*HklGeometryListMultiplyFunction) ()
return | darray_item ()
return | g_quark_from_static_string ()
HklParameter * | hkl_holder_add_parameter ()
HklParameter * | hkl_holder_add_rotation ()
HklParameter * | hkl_holder_add_rotation_with_origin ()
HklParameter * | hkl_holder_add_translation ()
HklVector | hkl_holder_transformation_apply ()
HklGeometry * | hkl_geometry_new ()
int | hkl_geometry_init_geometry ()
HklHolder * | hkl_geometry_add_holder ()
void | hkl_geometry_update ()
int | hkl_geometry_get_axis_idx_by_name ()
HklParameter * | hkl_geometry_get_axis_by_name ()
double | hkl_geometry_distance ()
double | hkl_geometry_distance_orthodromic ()
int | hkl_geometry_closest_from_geometry_with_range ()
int | hkl_geometry_is_valid ()
int | hkl_geometry_is_valid_range ()
HklHolder * | hkl_geometry_sample_holder_get ()
HklHolder * | hkl_geometry_detector_holder_get ()
HklVector | hkl_geometry_ki_get ()
HklVector | hkl_geometry_kf_get ()
HklGeometryList * | hkl_geometry_list_new ()
HklGeometryList * | hkl_geometry_list_new_copy ()
void | hkl_geometry_list_add ()
void | hkl_geometry_list_reset ()
void | hkl_geometry_list_sort ()
void | hkl_geometry_list_fprintf ()
void | hkl_geometry_list_multiply ()
void | hkl_geometry_list_multiply_from_range ()
void | hkl_geometry_list_remove_invalid ()
HklGeometryListItem * | hkl_geometry_list_item_new ()
HklGeometryListItem * | hkl_geometry_list_item_new_copy ()
void | hkl_geometry_list_item_free ()

## Types and Values

#define | HKL_HOLDER_SAMPLE_IDX
#define | HKL_HOLDER_DETECTOR_IDX
typedef | darray_holder
struct | HklHolderConfig
struct | HklHolder
struct | HklGeometryOperations
| HklGeometry
HklVector | kf
HklHolder * | detector_holder
#define | HKL_GEOMETRY_OPERATIONS_DEFAULTS
extern const HklGeometryOperations | hkl_geometry_operations_defaults
#define | HKL_GEOMETRY_ERROR
enum | HklGeometryError
| HklGeometryList
| HklGeometryListItem

## Description

## Functions

### HklGeometryListMultiplyFunction ()

    void
    (*HklGeometryListMultiplyFunction) (HklGeometryList *self,
                                        HklGeometryListItem *item);

### darray_item ()

    return
    darray_item ();

### g_quark_from_static_string ()

    return
    g_quark_from_static_string ();

### hkl_holder_add_parameter ()

    HklParameter *
    hkl_holder_add_parameter (HklHolder *self,
                              char const *name,
                              const HklUnit *punit);

### hkl_holder_add_rotation ()

    HklParameter *
    hkl_holder_add_rotation (HklHolder *self,
                             char const *name,
                             double x,
                             double y,
                             double z,
                             const HklUnit *punit);

### hkl_holder_add_rotation_with_origin ()

    HklParameter *
    hkl_holder_add_rotation_with_origin (HklHolder *self,
                                         const char *name,
                                         double x,
                                         double y,
                                         double z,
                                         double ox,
                                         double oy,
                                         double oz,
                                         const HklUnit *punit);

### hkl_holder_add_translation ()

    HklParameter *
    hkl_holder_add_translation (HklHolder *self,
                                char const *name,
                                double x,
                                double y,
                                double z,
                                const HklUnit *punit);

### hkl_holder_transformation_apply ()

    HklVector
    hkl_holder_transformation_apply (const HklHolder *self,
                                     const HklVector *v);

### hkl_geometry_new ()

    HklGeometry *
    hkl_geometry_new (const HklFactory *factory,
                      const HklGeometryOperations *ops);

constructor

[skip]

### hkl_geometry_init_geometry ()

    int
    hkl_geometry_init_geometry (HklGeometry *self,
                                const HklGeometry *src);

initilize an HklGeometry

[skip]

#### Parameters

self | the this ptr |
src | the HklGeometry to set from |

#### Returns

TRUE on success, FALSE if an error occurred

### hkl_geometry_add_holder ()

    HklHolder *
    hkl_geometry_add_holder (HklGeometry *self);

add an Holder to the HklGeometry

[skip]

### hkl_geometry_update ()

    void
    hkl_geometry_update (HklGeometry *self);

update the geometry internal once an Axis values changed

[skip]

### hkl_geometry_get_axis_idx_by_name ()

    int
    hkl_geometry_get_axis_idx_by_name (const HklGeometry *self,
                                       const char *name);

get the index of the axes named `name` in the geometry

[skip]

#### Returns

-1 if the axis was not found

### hkl_geometry_get_axis_by_name ()

    HklParameter *
    hkl_geometry_get_axis_by_name (HklGeometry *self,
                                   const char *name);

get an HklAxis using its name

#### Returns

.

[transfer none]

### hkl_geometry_distance ()

    double
    hkl_geometry_distance (const HklGeometry *self,
                           const HklGeometry *ref);

compute the distance between two HklGeometries

#### Parameters

self | the this ptr |
ref | the HklGeometry to compare with |

#### Returns

the distance between the two geometries

### hkl_geometry_distance_orthodromic ()

    double
    hkl_geometry_distance_orthodromic (const HklGeometry *self,
                                       const HklGeometry *ref);

[skip]

#### Parameters

self | the this ptr |
ref | the reference HklGeometry to compare with. |

#### Returns

the orthodromique distance

### hkl_geometry_closest_from_geometry_with_range ()

    int
    hkl_geometry_closest_from_geometry_with_range
                                   (HklGeometry *self,
                                    const HklGeometry *ref);

get the closest axes values in the HklInterval compatible with the current axes values

[skip]

### hkl_geometry_is_valid ()

    int
    hkl_geometry_is_valid (const HklGeometry *self);

check if all axes of the HklGeometry are valid.

[skip]

### hkl_geometry_is_valid_range ()

    int
    hkl_geometry_is_valid_range (const HklGeometry *self);

check if all axes of the HklGeometry are valid. (there is a difference for axis)

[skip]

### hkl_geometry_sample_holder_get ()

    HklHolder *
    hkl_geometry_sample_holder_get (const HklGeometry *self,
                                    const HklSample *sample);

### hkl_geometry_detector_holder_get ()

    HklHolder *
    hkl_geometry_detector_holder_get (const HklGeometry *self,
                                      const HklDetector *detector);

### hkl_geometry_ki_get ()

    HklVector
    hkl_geometry_ki_get (const HklGeometry *self);

### hkl_geometry_kf_get ()

    HklVector
    hkl_geometry_kf_get (const HklGeometry *self,
                         const HklDetector *detector);

### hkl_geometry_list_new ()

    HklGeometryList *
    hkl_geometry_list_new (void);

constructor

[skip]

### hkl_geometry_list_new_copy ()

    HklGeometryList *
    hkl_geometry_list_new_copy (const HklGeometryList *self);

copy constructor

[skip]

### hkl_geometry_list_add ()

    void
    hkl_geometry_list_add (HklGeometryList *self,
                           const HklGeometry *geometry);

this method Add a geometry to the geometries

This method try to be clever by allocating memory only if the current length of the geometries is not large enought. Then it just set the geometry axes and copy it to the right geometries. We do not gives the x len as it is equal to the self->axes_len.

[skip]

#### Parameters

self | The current HklGeometryList |
geometry | the HklGeometry to add |

### hkl_geometry_list_reset ()

    void
    hkl_geometry_list_reset (HklGeometryList *self);

reset the HklGeometry, in fact it is a sort of clean method remove all the items of the list.

[skip]

#### Parameters

self | the this ptr |

### hkl_geometry_list_sort ()

    void
    hkl_geometry_list_sort (HklGeometryList *self,
                            HklGeometry *ref);

sort the HklGeometryList compare to the distance of the given HklGeometry

[skip]

### hkl_geometry_list_fprintf ()

    void
    hkl_geometry_list_fprintf (FILE *f,
                               const HklGeometryList *self);

print to a file the HklGeometryList

[skip]

### hkl_geometry_list_multiply ()

    void
    hkl_geometry_list_multiply (HklGeometryList *self);

apply the multiply lenthod to the HklGeometry

[skip]

### hkl_geometry_list_multiply_from_range ()

    void
    hkl_geometry_list_multiply_from_range (HklGeometryList *self);

### hkl_geometry_list_remove_invalid ()

    void
    hkl_geometry_list_remove_invalid (HklGeometryList *self);

remove all invalid HklGeometry from the HklGeometryList

[skip]

### hkl_geometry_list_item_new ()

    HklGeometryListItem *
    hkl_geometry_list_item_new (const HklGeometry *geometry);

constructor

[skip]

### hkl_geometry_list_item_new_copy ()

    HklGeometryListItem *
    hkl_geometry_list_item_new_copy (const HklGeometryListItem *self);

copy constructor

[skip]

### hkl_geometry_list_item_free ()

    void
    hkl_geometry_list_item_free (HklGeometryListItem *self);

destructor

[skip]

## Types and Values

### HKL_HOLDER_SAMPLE_IDX

    #define HKL_HOLDER_SAMPLE_IDX 0

### HKL_HOLDER_DETECTOR_IDX

    #define HKL_HOLDER_DETECTOR_IDX 1

### darray_holder

    typedef darray(HklHolder *) darray_holder;

### struct HklHolderConfig

    struct HklHolderConfig {
    	int gc;
    	size_t *idx;
    	size_t len;
    };

### struct HklHolder

    struct HklHolder {
    	struct HklHolderConfig *config;
    	HklGeometry *geometry;
    	HklQuaternion q;
    };

### struct HklGeometryOperations

    struct HklGeometryOperations {
    	HklHolder* (*sample_holder_get) (const HklGeometry *self, const HklSample *sample);

    	HklHolder* (*detector_holder_get) (const HklGeometry *self, const HklDetector *detector);

    	HklVector (*ki_get) (const HklGeometry *geometry);

    	HklVector (*kf_get) (const HklGeometry *self, const HklDetector *detector);
    };

### HklGeometry

    typedef struct {
    	const HklFactory *factory;
    	HklSource source;
    	darray_parameter axes;
    	darray_holder holders;
    	const HklGeometryOperations *ops;
    } HklGeometry;

### kf

    	HklVector kf = {{HKL_TAU / self->source.wave_length, 0, 0}};

### detector_holder

    	HklHolder *detector_holder = darray_item(self->holders, HKL_HOLDER_DETECTOR_IDX);

### HKL_GEOMETRY_OPERATIONS_DEFAULTS

    #define             HKL_GEOMETRY_OPERATIONS_DEFAULTS

### hkl_geometry_operations_defaults

    extern const HklGeometryOperations hkl_geometry_operations_defaults;

### HKL_GEOMETRY_ERROR

    #define HKL_GEOMETRY_ERROR hkl_geometry_error_quark ()

### enum HklGeometryError

#### Members

HKL_GEOMETRY_ERROR_AXIS_GET |  |
HKL_GEOMETRY_ERROR_AXIS_SET |  |

### HklGeometryList

    typedef struct {
    	HklGeometryListMultiplyFunction multiply;
    	struct list_head items;
    	size_t n_items;
    } HklGeometryList;

### HklGeometryListItem

    typedef struct {
    	struct list_node list;
    	HklGeometry *geometry;
    } HklGeometryListItem;