From c5f86fd4c795b1dfc99fb120c45f25e25538a7d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Picca=20Fr=C3=A9d=C3=A9ric-Emmanuel?= Date: Sat, 2 Dec 2017 14:24:30 +0100 Subject: [PATCH] pre-release --- gui/hkl-gui.c | 164 ++++++++--------- hkl/hkl-axis.c | 10 +- hkl/hkl-engine-petra3-p08-lisa.c | 386 +++++++++++++++++++-------------------- hkl/hkl-parameter.c | 2 +- tests/hkl-lattice-t.c | 14 +- tests/tap/basic.h | 18 +- 6 files changed, 297 insertions(+), 297 deletions(-) diff --git a/gui/hkl-gui.c b/gui/hkl-gui.c index 2442881e..f2c59b91 100644 --- a/gui/hkl-gui.c +++ b/gui/hkl-gui.c @@ -2166,88 +2166,88 @@ hkl_gui_window_toolbutton_setUB_clicked_cb(GtkToolButton* _sender, gpointer user hkl_matrix_free(UB); } - void - hkl_gui_window_toolbutton_computeUB_clicked_cb (GtkToolButton* _sender, gpointer user_data) - { - HklGuiWindow *self = HKL_GUI_WINDOW(user_data); - HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data); - GtkTreeSelection* selection = NULL; - guint nb_rows = 0U; - - selection = gtk_tree_view_get_selection (priv->treeview_reflections); - nb_rows = gtk_tree_selection_count_selected_rows (selection); - if (nb_rows > 1) { - GtkTreeModel* model = NULL; - GList* list; - GtkTreeIter iter = {0}; - GtkTreePath *path; - HklSampleReflection *ref1, *ref2; - GError *error = NULL; - - model = GTK_TREE_MODEL(priv->liststore_reflections); - list = gtk_tree_selection_get_selected_rows (selection, &model); - - /* get the first reflection */ - path = g_list_nth_data(list, 0); - gtk_tree_model_get_iter (GTK_TREE_MODEL(priv->liststore_reflections), - &iter, - path); - gtk_tree_model_get (GTK_TREE_MODEL(priv->liststore_reflections), &iter, - REFLECTION_COL_REFLECTION, &ref1, - -1); - - /* get the second one */ - path = g_list_nth_data(list, 1); - gtk_tree_model_get_iter (GTK_TREE_MODEL(priv->liststore_reflections), - &iter, - path); - gtk_tree_model_get (GTK_TREE_MODEL(priv->liststore_reflections), &iter, - REFLECTION_COL_REFLECTION, &ref2, - -1); - - if(!hkl_sample_compute_UB_busing_levy(priv->sample, - ref1, ref2, &error)){ - raise_error(self, &error); - }else{ - if(priv->diffractometer) - diffractometer_set_sample(priv->diffractometer, - priv->sample); - - update_UB (self); - update_ux_uy_uz (self); - update_pseudo_axes (self); - update_pseudo_axes_frames (self); - } - g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free); - } else { - gtk_statusbar_push (priv->statusbar, 0, - "Please select at least two reflection."); - } - } - - void - hkl_gui_window_toolbutton_affiner_clicked_cb (GtkToolButton* _sender, gpointer user_data) - { - HklGuiWindow *self = HKL_GUI_WINDOW(user_data); - HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data); - GError *error = NULL; - - if(!hkl_sample_affine (priv->sample, &error)){ - raise_error(self, &error); - }else{ - if(priv->diffractometer) - diffractometer_set_sample(priv->diffractometer, - priv->sample); - - update_lattice (self); - update_crystal_model (self); - update_reciprocal_lattice (self); - update_UB (self); - update_ux_uy_uz (self); - update_pseudo_axes (self); - update_pseudo_axes_frames (self); - } - } +void +hkl_gui_window_toolbutton_computeUB_clicked_cb (GtkToolButton* _sender, gpointer user_data) +{ + HklGuiWindow *self = HKL_GUI_WINDOW(user_data); + HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data); + GtkTreeSelection* selection = NULL; + guint nb_rows = 0U; + + selection = gtk_tree_view_get_selection (priv->treeview_reflections); + nb_rows = gtk_tree_selection_count_selected_rows (selection); + if (nb_rows > 1) { + GtkTreeModel* model = NULL; + GList* list; + GtkTreeIter iter = {0}; + GtkTreePath *path; + HklSampleReflection *ref1, *ref2; + GError *error = NULL; + + model = GTK_TREE_MODEL(priv->liststore_reflections); + list = gtk_tree_selection_get_selected_rows (selection, &model); + + /* get the first reflection */ + path = g_list_nth_data(list, 0); + gtk_tree_model_get_iter (GTK_TREE_MODEL(priv->liststore_reflections), + &iter, + path); + gtk_tree_model_get (GTK_TREE_MODEL(priv->liststore_reflections), &iter, + REFLECTION_COL_REFLECTION, &ref1, + -1); + + /* get the second one */ + path = g_list_nth_data(list, 1); + gtk_tree_model_get_iter (GTK_TREE_MODEL(priv->liststore_reflections), + &iter, + path); + gtk_tree_model_get (GTK_TREE_MODEL(priv->liststore_reflections), &iter, + REFLECTION_COL_REFLECTION, &ref2, + -1); + + if(!hkl_sample_compute_UB_busing_levy(priv->sample, + ref1, ref2, &error)){ + raise_error(self, &error); + }else{ + if(priv->diffractometer) + diffractometer_set_sample(priv->diffractometer, + priv->sample); + + update_UB (self); + update_ux_uy_uz (self); + update_pseudo_axes (self); + update_pseudo_axes_frames (self); + } + g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free); + } else { + gtk_statusbar_push (priv->statusbar, 0, + "Please select at least two reflection."); + } +} + +void +hkl_gui_window_toolbutton_affiner_clicked_cb (GtkToolButton* _sender, gpointer user_data) +{ + HklGuiWindow *self = HKL_GUI_WINDOW(user_data); + HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data); + GError *error = NULL; + + if(!hkl_sample_affine (priv->sample, &error)){ + raise_error(self, &error); + }else{ + if(priv->diffractometer) + diffractometer_set_sample(priv->diffractometer, + priv->sample); + + update_lattice (self); + update_crystal_model (self); + update_reciprocal_lattice (self); + update_UB (self); + update_ux_uy_uz (self); + update_pseudo_axes (self); + update_pseudo_axes_frames (self); + } +} #define TOGGLE_LATTICE_CB(_parameter) \ void hkl_gui_window_checkbutton_ ## _parameter ## _toggled_cb(GtkCheckButton *checkbutton, \ diff --git a/hkl/hkl-axis.c b/hkl/hkl-axis.c index 4ace9819..0b02342c 100644 --- a/hkl/hkl-axis.c +++ b/hkl/hkl-axis.c @@ -226,7 +226,7 @@ static inline int hkl_axis_transformation_cmp_real(const HklParameter *base, con const HklAxis *axis2 = container_of(p2, HklAxis, parameter); return hkl_parameter_transformation_cmp_real(base, p2) - || hkl_vector_cmp(&self->axis_v, &axis2->axis_v); + || hkl_vector_cmp(&self->axis_v, &axis2->axis_v); } static inline HklVector hkl_axis_transformation_apply_real(const HklParameter *base, @@ -325,10 +325,10 @@ static inline int hkl_rotation_with_origin_transformation_cmp_real(const HklPara HklRotationWithOrigin *self = container_of(container_of(base, HklAxis, parameter), HklRotationWithOrigin, axis); HklRotationWithOrigin *p2 = container_of(container_of(base_p2, HklAxis, parameter), - HklRotationWithOrigin, axis); + HklRotationWithOrigin, axis); return hkl_axis_transformation_cmp_real(base, base_p2) - || hkl_vector_cmp(&self->origin, &p2->origin); + || hkl_vector_cmp(&self->origin, &p2->origin); } static inline HklVector hkl_rotation_with_origin_transformation_apply_real(const HklParameter *base, @@ -404,8 +404,8 @@ static inline void hkl_translation_free_real(HklParameter *base) } static inline int hkl_translation_init_copy_real(HklParameter *base, - const HklParameter *base_src, - GError **error) + const HklParameter *base_src, + GError **error) { HklTranslation *self = container_of(base, HklTranslation, parameter); HklTranslation *src = container_of(base_src, HklTranslation, parameter); diff --git a/hkl/hkl-engine-petra3-p08-lisa.c b/hkl/hkl-engine-petra3-p08-lisa.c index cb830dd5..160f7d0d 100644 --- a/hkl/hkl-engine-petra3-p08-lisa.c +++ b/hkl/hkl-engine-petra3-p08-lisa.c @@ -149,21 +149,21 @@ of the beam on the sample. #define PETRA3_P08_LISA_SAMPLE_HOLDER_IDX 1 #define PETRA3_P08_LISA_DETECTOR_HOLDER_IDX 2 -#define HKL_GEOMETRY_PETRA3_P08_LISA_DESCRIPTION \ - "+ xrays source fix along the :math:`\\vec{x}` direction (1, 0, 0)\n" \ - "+ 1 axes for the monochromator\n" \ - "\n" \ - " + **" MCHI "** : rotation around the :math:`\\vec{x}` direction (1, 0, 0)\n" \ - "\n" \ - "+ 1 axis for the sample\n" \ - "\n" \ - " + **" SPHI "** : rotating around the :math:`\\vec{z}` direction (0, 0, 1)\n" \ - "\n" \ - "+ 2 axes for the detector\n" \ - "\n" \ - " + **" DTTH "** : rotation around the :math:`-\\vec{z}` direction (0, 0, -1)\n" \ - " + **" DH "** : translation along the :math:`\\vec{z}` direction (0, 0, 1)\n" \ - " + **" DROT "** : rotation around the :math:`-\\vec{y}` direction (0, -1, 0)\n" +#define HKL_GEOMETRY_PETRA3_P08_LISA_DESCRIPTION \ + "+ xrays source fix along the :math:`\\vec{x}` direction (1, 0, 0)\n" \ + "+ 1 axes for the monochromator\n" \ + "\n" \ + " + **" MCHI "** : rotation around the :math:`\\vec{x}` direction (1, 0, 0)\n" \ + "\n" \ + "+ 1 axis for the sample\n" \ + "\n" \ + " + **" SPHI "** : rotating around the :math:`\\vec{z}` direction (0, 0, 1)\n" \ + "\n" \ + "+ 2 axes for the detector\n" \ + "\n" \ + " + **" DTTH "** : rotation around the :math:`-\\vec{z}` direction (0, 0, -1)\n" \ + " + **" DH "** : translation along the :math:`\\vec{z}` direction (0, 0, 1)\n" \ + " + **" DROT "** : rotation around the :math:`-\\vec{y}` direction (0, -1, 0)\n" static double _alpha_max(double wavelength, double d1, double d2) { @@ -221,125 +221,125 @@ int hkl_mode_hkl_petra3_p08_lisa_set_real(HklMode *self, GError **error) { /* FRED: to implement */ -/* int last_axis; */ - -/* hkl_error (error == NULL || *error == NULL); */ - -/* /\* check the input parameters *\/ */ -/* if(!hkl_is_reachable(engine, geometry->source.wave_length, */ -/* error)){ */ -/* hkl_assert(error == NULL || *error != NULL); */ -/* return FALSE; */ -/* } */ -/* hkl_assert(error == NULL || *error == NULL); */ - -/* /\* compute the mode *\/ */ -/* if(!hkl_mode_auto_set_real(self, engine, */ -/* geometry, detector, sample, */ -/* error)){ */ -/* hkl_assert(error == NULL || *error != NULL); */ -/* //fprintf(stdout, "message :%s\n", (*error)->message); */ -/* return FALSE; */ -/* } */ -/* hkl_assert(error == NULL || *error == NULL); */ - -/* /\* check that the mode allow to move a sample axis *\/ */ -/* /\* FIXME for now the sample holder is the first one *\/ */ -/* last_axis = get_last_axis_idx(geometry, 0, &self->info->axes_w); */ -/* if(last_axis >= 0){ */ -/* uint i; */ -/* const HklGeometryListItem *item; */ -/* uint len = engine->engines->geometries->n_items; */ - -/* /\* For each solution already found we will generate another one *\/ */ -/* /\* using the Ewalds construction by rotating Q around the last sample *\/ */ -/* /\* axis of the mode until it intersect again the Ewald sphere. *\/ */ -/* /\* FIXME do not work if ki is colinear with the axis. *\/ */ - -/* /\* for this we needs : *\/ */ -/* /\* - the coordinates of the end of the Q vector (q) *\/ */ -/* /\* - the last sample axis orientation of the mode (axis_v) *\/ */ -/* /\* - the coordinates of the center of the ewalds sphere (c) *\/ */ -/* /\* - the coordinates of the center of rotation of the sample (o = 0, 0, 0) *\/ */ - -/* /\* then we can : *\/ */ -/* /\* - project the origin in plane of normal axis_v containing q (o') *\/ */ -/* /\* - project the center of the ewalds sphere into the same plan (c') *\/ */ -/* /\* - rotate q around this (o', c') line of 180° to find the (q2) solution *\/ */ -/* /\* - compute the (kf2) corresponding to this q2 solution *\/ */ -/* /\* at the end we just need to solve numerically the position of the detector *\/ */ - -/* /\* we will add solution to the geometries so save its length before *\/ */ -/* for(i=0, item=list_top(&engine->engines->geometries->items, HklGeometryListItem, list); */ -/* iengines->geometries->items, item, list)){ */ -/* int j; */ -/* HklVector ki; */ -/* HklVector kf2; */ -/* HklVector q; */ -/* HklVector axis_v; */ -/* HklQuaternion qr; */ -/* HklAxis *axis; */ -/* HklVector cp = {{0}}; */ -/* HklVector op = {{0}}; */ -/* double angle; */ -/* HklGeometry *geom; */ - -/* geom = hkl_geometry_new_copy(item->geometry); */ - -/* /\* get the Q vector kf - ki *\/ */ -/* hkl_detector_compute_kf(detector, geom, &q); */ -/* hkl_source_compute_ki(&geom->source, &ki); */ -/* hkl_vector_minus_vector(&q, &ki); */ - -/* /\* compute the current orientation of the last axis *\/ */ -/* axis = container_of(darray_item(geom->axes, */ -/* darray_item(geom->holders, 0)->config->idx[last_axis]), */ -/* HklAxis, parameter); */ -/* axis_v = axis->axis_v; */ -/* hkl_quaternion_init(&qr, 1, 0, 0, 0); */ -/* for(j=0; jaxes, */ -/* darray_item(geom->holders, 0)->config->idx[j]), */ -/* HklAxis, parameter)->q); */ -/* hkl_vector_rotated_quaternion(&axis_v, &qr); */ - -/* /\* - project the center of the ewalds sphere into the same plan (c') *\/ */ -/* hkl_vector_minus_vector(&cp, &ki); */ -/* hkl_vector_project_on_plan_with_point(&cp, &axis_v, &q); */ -/* hkl_vector_project_on_plan_with_point(&op, &axis_v, &q); */ - -/* /\* - rotate q around this (o', c') line of 180° to find the (q2) solution *\/ */ -/* kf2 = q; */ -/* hkl_vector_rotated_around_line(&kf2, M_PI, &cp, &op); */ -/* angle = hkl_vector_oriented_angle_points(&q, &op, &kf2, &axis_v); */ -/* /\* TODO parameter list for geometry *\/ */ -/* if(!hkl_parameter_value_set(&axis->parameter, */ -/* hkl_parameter_value_get(&axis->parameter, HKL_UNIT_DEFAULT) + angle, */ -/* HKL_UNIT_DEFAULT, error)) */ -/* return FALSE; */ -/* hkl_geometry_update(geom); */ +/* int last_axis; */ + +/* hkl_error (error == NULL || *error == NULL); */ + +/* /\* check the input parameters *\/ */ +/* if(!hkl_is_reachable(engine, geometry->source.wave_length, */ +/* error)){ */ +/* hkl_assert(error == NULL || *error != NULL); */ +/* return FALSE; */ +/* } */ +/* hkl_assert(error == NULL || *error == NULL); */ + +/* /\* compute the mode *\/ */ +/* if(!hkl_mode_auto_set_real(self, engine, */ +/* geometry, detector, sample, */ +/* error)){ */ +/* hkl_assert(error == NULL || *error != NULL); */ +/* //fprintf(stdout, "message :%s\n", (*error)->message); */ +/* return FALSE; */ +/* } */ +/* hkl_assert(error == NULL || *error == NULL); */ + +/* /\* check that the mode allow to move a sample axis *\/ */ +/* /\* FIXME for now the sample holder is the first one *\/ */ +/* last_axis = get_last_axis_idx(geometry, 0, &self->info->axes_w); */ +/* if(last_axis >= 0){ */ +/* uint i; */ +/* const HklGeometryListItem *item; */ +/* uint len = engine->engines->geometries->n_items; */ + +/* /\* For each solution already found we will generate another one *\/ */ +/* /\* using the Ewalds construction by rotating Q around the last sample *\/ */ +/* /\* axis of the mode until it intersect again the Ewald sphere. *\/ */ +/* /\* FIXME do not work if ki is colinear with the axis. *\/ */ + +/* /\* for this we needs : *\/ */ +/* /\* - the coordinates of the end of the Q vector (q) *\/ */ +/* /\* - the last sample axis orientation of the mode (axis_v) *\/ */ +/* /\* - the coordinates of the center of the ewalds sphere (c) *\/ */ +/* /\* - the coordinates of the center of rotation of the sample (o = 0, 0, 0) *\/ */ + +/* /\* then we can : *\/ */ +/* /\* - project the origin in plane of normal axis_v containing q (o') *\/ */ +/* /\* - project the center of the ewalds sphere into the same plan (c') *\/ */ +/* /\* - rotate q around this (o', c') line of 180° to find the (q2) solution *\/ */ +/* /\* - compute the (kf2) corresponding to this q2 solution *\/ */ +/* /\* at the end we just need to solve numerically the position of the detector *\/ */ + +/* /\* we will add solution to the geometries so save its length before *\/ */ +/* for(i=0, item=list_top(&engine->engines->geometries->items, HklGeometryListItem, list); */ +/* iengines->geometries->items, item, list)){ */ +/* int j; */ +/* HklVector ki; */ +/* HklVector kf2; */ +/* HklVector q; */ +/* HklVector axis_v; */ +/* HklQuaternion qr; */ +/* HklAxis *axis; */ +/* HklVector cp = {{0}}; */ +/* HklVector op = {{0}}; */ +/* double angle; */ +/* HklGeometry *geom; */ + +/* geom = hkl_geometry_new_copy(item->geometry); */ + +/* /\* get the Q vector kf - ki *\/ */ +/* hkl_detector_compute_kf(detector, geom, &q); */ +/* hkl_source_compute_ki(&geom->source, &ki); */ +/* hkl_vector_minus_vector(&q, &ki); */ + +/* /\* compute the current orientation of the last axis *\/ */ +/* axis = container_of(darray_item(geom->axes, */ +/* darray_item(geom->holders, 0)->config->idx[last_axis]), */ +/* HklAxis, parameter); */ +/* axis_v = axis->axis_v; */ +/* hkl_quaternion_init(&qr, 1, 0, 0, 0); */ +/* for(j=0; jaxes, */ +/* darray_item(geom->holders, 0)->config->idx[j]), */ +/* HklAxis, parameter)->q); */ +/* hkl_vector_rotated_quaternion(&axis_v, &qr); */ + +/* /\* - project the center of the ewalds sphere into the same plan (c') *\/ */ +/* hkl_vector_minus_vector(&cp, &ki); */ +/* hkl_vector_project_on_plan_with_point(&cp, &axis_v, &q); */ +/* hkl_vector_project_on_plan_with_point(&op, &axis_v, &q); */ + +/* /\* - rotate q around this (o', c') line of 180° to find the (q2) solution *\/ */ +/* kf2 = q; */ +/* hkl_vector_rotated_around_line(&kf2, M_PI, &cp, &op); */ +/* angle = hkl_vector_oriented_angle_points(&q, &op, &kf2, &axis_v); */ +/* /\* TODO parameter list for geometry *\/ */ +/* if(!hkl_parameter_value_set(&axis->parameter, */ +/* hkl_parameter_value_get(&axis->parameter, HKL_UNIT_DEFAULT) + angle, */ +/* HKL_UNIT_DEFAULT, error)) */ +/* return FALSE; */ +/* hkl_geometry_update(geom); */ /* #ifdef DEBUG */ -/* fprintf(stdout, "\n- try to add a solution by rotating Q <%f, %f, %f> around the \"%s\" axis <%f, %f, %f> of %f radian", */ -/* q.data[0], q.data[1], q.data[2], */ -/* ((HklParameter *)axis)->name, */ -/* axis_v.data[0], axis_v.data[1], axis_v.data[2], */ -/* angle); */ -/* fprintf(stdout, "\n op: <%f, %f, %f>", op.data[0], op.data[1], op.data[2]); */ -/* fprintf(stdout, "\n q2: <%f, %f, %f>", kf2.data[0], kf2.data[1], kf2.data[2]); */ +/* fprintf(stdout, "\n- try to add a solution by rotating Q <%f, %f, %f> around the \"%s\" axis <%f, %f, %f> of %f radian", */ +/* q.data[0], q.data[1], q.data[2], */ +/* ((HklParameter *)axis)->name, */ +/* axis_v.data[0], axis_v.data[1], axis_v.data[2], */ +/* angle); */ +/* fprintf(stdout, "\n op: <%f, %f, %f>", op.data[0], op.data[1], op.data[2]); */ +/* fprintf(stdout, "\n q2: <%f, %f, %f>", kf2.data[0], kf2.data[1], kf2.data[2]); */ /* #endif */ -/* hkl_vector_add_vector(&kf2, &ki); */ +/* hkl_vector_add_vector(&kf2, &ki); */ -/* /\* at the end we just need to solve numerically the position of the detector *\/ */ -/* if(fit_detector_position(self, geom, detector, &kf2)) */ -/* hkl_geometry_list_add(engine->engines->geometries, */ -/* geom); */ +/* /\* at the end we just need to solve numerically the position of the detector *\/ */ +/* if(fit_detector_position(self, geom, detector, &kf2)) */ +/* hkl_geometry_list_add(engine->engines->geometries, */ +/* geom); */ -/* hkl_geometry_free(geom); */ -/* } */ -/* } */ +/* hkl_geometry_free(geom); */ +/* } */ +/* } */ return TRUE; } @@ -431,85 +431,85 @@ static HklGeometry *hkl_geometry_new_petra3_p08_lisa(const HklFactory *factory) static HklMode *k_parallel_incident(void) { - /* TODO: check if the axes are correct, add the functions and implement them */ + /* TODO: check if the axes are correct, add the functions and implement them */ - static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; - static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; - static const HklFunction *functions[] = {}; + static const HklFunction *functions[] = {}; - /* here just the description of the mode: name, axes_r, axes_w, functions */ - static const HklModeAutoInfo info = { - HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), - }; + /* here just the description of the mode: name, axes_r, axes_w, functions */ + static const HklModeAutoInfo info = { + HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), + }; - /* instantiate a new mode */ - return hkl_mode_auto_new(&info, - &hkl_mode_hkl_petra3_p08_lisa_operations, - TRUE); + /* instantiate a new mode */ + return hkl_mode_auto_new(&info, + &hkl_mode_hkl_petra3_p08_lisa_operations, + TRUE); } static HklMode *alpha_eq_beta(void) { - /* TODO: check if the axes are correct, add the functions and implement them */ + /* TODO: check if the axes are correct, add the functions and implement them */ - static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; - static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; - static const HklFunction *functions[] = {}; + static const HklFunction *functions[] = {}; - /* here just the description of the mode: name, axes_r, axes_w, functions */ - static const HklModeAutoInfo info = { - HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), - }; + /* here just the description of the mode: name, axes_r, axes_w, functions */ + static const HklModeAutoInfo info = { + HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), + }; - /* instantiate a new mode */ - return hkl_mode_auto_new(&info, - &hkl_mode_hkl_petra3_p08_lisa_operations, - TRUE); + /* instantiate a new mode */ + return hkl_mode_auto_new(&info, + &hkl_mode_hkl_petra3_p08_lisa_operations, + TRUE); } static HklMode *th_eq_tth2(void) { - /* TODO: check if the axes are correct, add the functions and implement them */ + /* TODO: check if the axes are correct, add the functions and implement them */ - static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; - static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; - static const HklFunction *functions[] = {}; + static const HklFunction *functions[] = {}; - /* here just the description of the mode: name, axes_r, axes_w, functions */ - static const HklModeAutoInfo info = { - HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), - }; + /* here just the description of the mode: name, axes_r, axes_w, functions */ + static const HklModeAutoInfo info = { + HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), + }; - /* instantiate a new mode */ - return hkl_mode_auto_new(&info, - &hkl_mode_hkl_petra3_p08_lisa_operations, - TRUE); + /* instantiate a new mode */ + return hkl_mode_auto_new(&info, + &hkl_mode_hkl_petra3_p08_lisa_operations, + TRUE); } static HklMode *k_parallel_outgoing(void) { - /* TODO: check if the axes are correct, add the functions and implement them */ + /* TODO: check if the axes are correct, add the functions and implement them */ - static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_r[] = {MCHI, SPHI, DTTH, DROT}; - static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; + static const char* axes_w[] = {MCHI, SPHI, DTTH, DROT}; - static const HklFunction *functions[] = {}; + static const HklFunction *functions[] = {}; - /* here just the description of the mode: name, axes_r, axes_w, functions */ - static const HklModeAutoInfo info = { - HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), - }; + /* here just the description of the mode: name, axes_r, axes_w, functions */ + static const HklModeAutoInfo info = { + HKL_MODE_AUTO_INFO(__func__, axes_r, axes_w, functions), + }; - /* instantiate a new mode */ - return hkl_mode_auto_new(&info, - &hkl_mode_hkl_petra3_p08_lisa_operations, - TRUE); + /* instantiate a new mode */ + return hkl_mode_auto_new(&info, + &hkl_mode_hkl_petra3_p08_lisa_operations, + TRUE); } /* lisapm modes */ @@ -535,7 +535,7 @@ static const HklParameter mode_lisa_pm_parameters[] = { static int _mode_lisa_pm_m_to_pm_func(const gsl_vector *x, void *params, gsl_vector *f) { - /* TODO: implement it */ + /* TODO: implement it */ return GSL_SUCCESS; } @@ -547,7 +547,7 @@ static const HklFunction mode_lisa_pm_m_to_pm_func = { static int _mode_lisa_pm_pm_to_m_func(const gsl_vector *x, void *params, gsl_vector *f) { - /* TODO: implement it */ + /* TODO: implement it */ return GSL_SUCCESS; } @@ -560,24 +560,24 @@ static const HklFunction mode_lisa_pm_pm_to_m_func = { static HklMode *mode_lisa_pm(void) { - static const char* axes_r[] = {MCHI, SPHI, DTTH}; /* QUESTION: these are the two motors I need for computing sth and stth positions, is this right ??? */ + static const char* axes_r[] = {MCHI, SPHI, DTTH}; /* QUESTION: these are the two motors I need for computing sth and stth positions, is this right ??? */ - static const char* axes_w[] = {MCHI, SPHI, DTTH}; /* QUESTION: these are the motors I move if I write to the pseudomotor sth or stth, is this right ??? */ + static const char* axes_w[] = {MCHI, SPHI, DTTH}; /* QUESTION: these are the motors I move if I write to the pseudomotor sth or stth, is this right ??? */ - /* here a list of functions use to solve the mode */ /* QUESTION: which functions should be here ???, I need one for computing motor positions from pseudomotor and one for computing pseudonmotor from motor positions. Why in the other diffractometers there is only one function here ??? */ - /* FRED this are not the functions in order to do get and set but only to do the set. the get/set is done in the hkl_mode_operations. */ - static const HklFunction *functions[] = {&mode_lisa_pm_m_to_pm_func, &mode_lisa_pm_pm_to_m_func}; + /* here a list of functions use to solve the mode */ /* QUESTION: which functions should be here ???, I need one for computing motor positions from pseudomotor and one for computing pseudonmotor from motor positions. Why in the other diffractometers there is only one function here ??? */ + /* FRED this are not the functions in order to do get and set but only to do the set. the get/set is done in the hkl_mode_operations. */ + static const HklFunction *functions[] = {&mode_lisa_pm_m_to_pm_func, &mode_lisa_pm_pm_to_m_func}; - /* here just the description of the mode: name, axes_r, axes_w, functions */ - static const HklModeAutoInfo info = { - HKL_MODE_AUTO_INFO_WITH_PARAMS(__func__, axes_r, axes_w, functions, mode_lisa_pm_parameters), - }; + /* here just the description of the mode: name, axes_r, axes_w, functions */ + static const HklModeAutoInfo info = { + HKL_MODE_AUTO_INFO_WITH_PARAMS(__func__, axes_r, axes_w, functions, mode_lisa_pm_parameters), + }; - /* instantiate a new mode */ - return hkl_mode_auto_new(&info, - &hkl_mode_operations, /* FRED these operation must be specifique to the pseudo motors look at the read_only emergence pseudo in hkl-pseudoaxis-common-readonly code. */ - TRUE); + /* instantiate a new mode */ + return hkl_mode_auto_new(&info, + &hkl_mode_operations, /* FRED these operation must be specifique to the pseudo motors look at the read_only emergence pseudo in hkl-pseudoaxis-common-readonly code. */ + TRUE); } /******************/ diff --git a/hkl/hkl-parameter.c b/hkl/hkl-parameter.c index 568ab0f3..d6d655e3 100644 --- a/hkl/hkl-parameter.c +++ b/hkl/hkl-parameter.c @@ -448,7 +448,7 @@ int hkl_parameter_transformation_cmp(const HklParameter *self, * Returns: the transformed #HklVector **/ HklVector hkl_parameter_transformation_apply(const HklParameter *self, - const HklVector *v) + const HklVector *v) { return self->ops->transformation_apply(self, v); } diff --git a/tests/hkl-lattice-t.c b/tests/hkl-lattice-t.c index 27f4183b..418c5b22 100644 --- a/tests/hkl-lattice-t.c +++ b/tests/hkl-lattice-t.c @@ -51,13 +51,13 @@ }while(0) \ #define SET_LATTICE(_lattice, _a, _b, _c, _alpha, _beta, _gamma) do{ \ - SET_PARAM(_lattice, a, _a); \ - SET_PARAM(_lattice, b, _b); \ - SET_PARAM(_lattice, c, _c); \ - SET_PARAM(_lattice, alpha, _alpha); \ - SET_PARAM(_lattice, beta, _beta); \ - SET_PARAM(_lattice, gamma, _gamma); \ - }while(0) +SET_PARAM(_lattice, a, _a); \ +SET_PARAM(_lattice, b, _b); \ +SET_PARAM(_lattice, c, _c); \ +SET_PARAM(_lattice, alpha, _alpha); \ +SET_PARAM(_lattice, beta, _beta); \ +SET_PARAM(_lattice, gamma, _gamma); \ +}while(0) static void new(void) { diff --git a/tests/tap/basic.h b/tests/tap/basic.h index f76dd131..82098ed0 100644 --- a/tests/tap/basic.h +++ b/tests/tap/basic.h @@ -124,24 +124,24 @@ void diag_file_remove(const char *file) /* Allocate memory, reporting a fatal error with bail on failure. */ void *bcalloc(size_t, size_t) -__attribute__((__alloc_size__(1, 2), __malloc__, __warn_unused_result__)); + __attribute__((__alloc_size__(1, 2), __malloc__, __warn_unused_result__)); void *bmalloc(size_t) -__attribute__((__alloc_size__(1), __malloc__, __warn_unused_result__)); + __attribute__((__alloc_size__(1), __malloc__, __warn_unused_result__)); void *breallocarray(void *, size_t, size_t) -__attribute__((__alloc_size__(2, 3), __malloc__, __warn_unused_result__)); + __attribute__((__alloc_size__(2, 3), __malloc__, __warn_unused_result__)); void *brealloc(void *, size_t) -__attribute__((__alloc_size__(2), __malloc__, __warn_unused_result__)); + __attribute__((__alloc_size__(2), __malloc__, __warn_unused_result__)); char *bstrdup(const char *) -__attribute__((__malloc__, __nonnull__, __warn_unused_result__)); + __attribute__((__malloc__, __nonnull__, __warn_unused_result__)); char *bstrndup(const char *, size_t) -__attribute__((__malloc__, __nonnull__, __warn_unused_result__)); + __attribute__((__malloc__, __nonnull__, __warn_unused_result__)); /* * Find a test file under BUILD or SOURCE, returning the full path. The * returned path should be freed with test_file_path_free(). */ char *test_file_path(const char *file) -__attribute__((__malloc__, __nonnull__, __warn_unused_result__)); + __attribute__((__malloc__, __nonnull__, __warn_unused_result__)); void test_file_path_free(char *path); /* @@ -149,7 +149,7 @@ void test_file_path_free(char *path); * returned path should be freed with test_tmpdir_free. */ char *test_tmpdir(void) -__attribute__((__malloc__, __warn_unused_result__)); + __attribute__((__malloc__, __warn_unused_result__)); void test_tmpdir_free(char *path); /* @@ -164,7 +164,7 @@ void test_tmpdir_free(char *path); */ typedef void (*test_cleanup_func)(int, int); void test_cleanup_register(test_cleanup_func) -__attribute__((__nonnull__)); + __attribute__((__nonnull__)); END_DECLS -- 2.11.4.GIT