aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-07-18 18:19:29 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:33 +0100
commit8e9f89cb00f783b23b3c004976fb08b56819fe64 (patch)
treef95a0f7bb17632d238139502a321f9e8cc74038f
parent599c277480ee1d3d5a1a2ffb486e855b845c0dbe (diff)
Finish fixing compiler warnings
-rw-r--r--src/check_hkl.c17
-rw-r--r--src/cubeit.c10
-rw-r--r--src/partial_sim.c17
-rw-r--r--src/partialator.c9
-rw-r--r--tests/gpu_sim_check.c8
5 files changed, 39 insertions, 22 deletions
diff --git a/src/check_hkl.c b/src/check_hkl.c
index db807b33..8409563f 100644
--- a/src/check_hkl.c
+++ b/src/check_hkl.c
@@ -47,7 +47,7 @@ static void show_help(const char *s)
}
-static void plot_shells(RefList *list, UnitCell *cell, const char *sym,
+static void plot_shells(RefList *list, UnitCell *cell, const SymOpList *sym,
double rmin_fix, double rmax_fix)
{
double num[NBINS];
@@ -180,7 +180,7 @@ static void plot_shells(RefList *list, UnitCell *cell, const char *sym,
}
if ( bin == -1 ) continue;
- get_asymm(h, k, l, &hs, &ks, &ls, sym);
+ get_asymm(sym, h, k, l, &hs, &ks, &ls);
if ( lookup_count(counted, hs, ks, ls) ) continue;
set_count(counted, hs, ks, ls, 1);
@@ -305,7 +305,8 @@ int main(int argc, char *argv[])
int c;
UnitCell *cell;
char *file = NULL;
- char *sym = NULL;
+ char *sym_str = NULL;
+ SymOpList *sym;
RefList *raw_list;
RefList *list;
Reflection *refl;
@@ -334,7 +335,7 @@ int main(int argc, char *argv[])
return 0;
case 'y' :
- sym = strdup(optarg);
+ sym_str = strdup(optarg);
break;
case 'p' :
@@ -369,9 +370,11 @@ int main(int argc, char *argv[])
return 1;
}
- if ( sym == NULL ) {
- sym = strdup("1");
+ if ( sym_str == NULL ) {
+ sym_str = strdup("1");
}
+ sym = get_pointgroup(sym_str);
+ free(sym_str);
file = strdup(argv[optind++]);
@@ -390,7 +393,7 @@ int main(int argc, char *argv[])
/* Check that the intensities have the correct symmetry */
if ( check_list_symmetry(raw_list, sym) ) {
ERROR("The input reflection list does not appear to"
- " have symmetry %s\n", sym);
+ " have symmetry %s\n", symmetry_name(sym));
return 1;
}
diff --git a/src/cubeit.c b/src/cubeit.c
index 75e4e001..212be426 100644
--- a/src/cubeit.c
+++ b/src/cubeit.c
@@ -60,7 +60,7 @@ struct static_sum_args
signed int ht;
signed int kt;
signed int lt;
- char *sym;
+ SymOpList *sym;
};
@@ -282,7 +282,7 @@ static void sum_image(void *pg, int cookie)
* averaging, the pattern must be transformed by the
* appropriate symmetry operator(s) to bring it into
* alignment. */
- //get_asymm(h, k, l, &ha, &ka, &la, pargs->sym);
+ //get_asymm(pargs->sym, h, k, l, &ha, &ka, &la);
//if ( (ha!=pargs->ht) || (ka!=pargs->kt) || (la!=pargs->lt) ) {
// continue;
//}
@@ -464,7 +464,7 @@ int main(int argc, char *argv[])
unsigned int angles[180];
int config_angles = 0;
signed int ht, kt, lt;
- char *sym = NULL;
+ SymOpList *sym;
struct queue_args qargs;
pthread_mutex_t vals_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t angles_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -556,7 +556,7 @@ int main(int argc, char *argv[])
}
free(geomfile);
- sym = strdup("6/mmm"); /* FIXME: Should be on command line */
+ sym = get_pointgroup("6/mmm"); /* FIXME: Should be on command line */
/* Initialise histogram */
for ( i=0; i<180; i++ ) angles[i] = 0;
@@ -570,7 +570,7 @@ int main(int argc, char *argv[])
}
/* FIXME: Get indices on command line (or elsewhere) */
- get_asymm(3, 4, 5, &ht, &kt, &lt, sym);
+ get_asymm(sym, 3, 4, 5, &ht, &kt, &lt);
as = 0.0; bs = 0.0; cs = 0.0; als = 0.0; bes = 0.0; gas = 0.0;
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 6dafc4ba..04838552 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -63,7 +63,7 @@ static void mess_up_cell(UnitCell *cell)
/* For each reflection in "partial", fill in what the intensity would be
* according to "full" */
static void calculate_partials(RefList *partial, double osf,
- RefList *full, const char *sym,
+ RefList *full, const SymOpList *sym,
int random_intensities)
{
Reflection *refl;
@@ -78,7 +78,7 @@ static void calculate_partials(RefList *partial, double osf,
double p, Ip, If;
get_indices(refl, &h, &k, &l);
- get_asymm(h, k, l, &h, &k, &l, sym);
+ get_asymm(sym, h, k, l, &h, &k, &l);
p = get_partiality(refl);
rfull = find_refl(full, h, k, l);
@@ -143,7 +143,8 @@ int main(int argc, char *argv[])
struct detector *det = NULL;
struct beam_params *beam = NULL;
RefList *full = NULL;
- char *sym = NULL;
+ char *sym_str = NULL;
+ SymOpList *sym;
UnitCell *cell = NULL;
struct quaternion orientation;
struct image image;
@@ -194,7 +195,7 @@ int main(int argc, char *argv[])
break;
case 'y' :
- sym = strdup(optarg);
+ sym_str = strdup(optarg);
break;
case 'n' :
@@ -246,6 +247,10 @@ int main(int argc, char *argv[])
}
free(geomfile);
+ if ( sym_str == NULL ) sym_str = strdup("1");
+ sym = get_pointgroup(sym_str);
+ free(sym_str);
+
/* Load (full) reflections */
if ( input_file != NULL ) {
@@ -258,7 +263,7 @@ int main(int argc, char *argv[])
free(input_file);
if ( check_list_symmetry(full, sym) ) {
ERROR("The input reflection list does not appear to"
- " have symmetry %s\n", sym);
+ " have symmetry %s\n", symmetry_name(sym));
return 1;
}
@@ -339,7 +344,7 @@ int main(int argc, char *argv[])
cell_free(cell);
free_detector_geometry(det);
free(beam);
- free(sym);
+ free_symoplist(sym);
reflist_free(full);
free(image.filename);
diff --git a/src/partialator.c b/src/partialator.c
index 6c9748b6..f8db8432 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -258,7 +258,8 @@ int main(int argc, char *argv[])
char *infile = NULL;
char *outfile = NULL;
char *geomfile = NULL;
- char *sym = NULL;
+ char *sym_str = NULL;
+ SymOpList *sym;
FILE *fh;
int nthreads = 1;
struct detector *det;
@@ -322,7 +323,7 @@ int main(int argc, char *argv[])
break;
case 'y' :
- sym = strdup(optarg);
+ sym_str = strdup(optarg);
break;
case 'o' :
@@ -374,7 +375,9 @@ int main(int argc, char *argv[])
outfile = strdup("partialator.hkl");
}
- if ( sym == NULL ) sym = strdup("1");
+ if ( sym_str == NULL ) sym_str = strdup("1");
+ sym = get_pointgroup(sym_str);
+ free(sym_str);
/* Get detector geometry */
det = get_detector_geometry(geomfile);
diff --git a/tests/gpu_sim_check.c b/tests/gpu_sim_check.c
index fa8e104d..b006ea8a 100644
--- a/tests/gpu_sim_check.c
+++ b/tests/gpu_sim_check.c
@@ -23,6 +23,7 @@
#include "../src/detector.h"
#include "../src/beam-parameters.h"
#include "../src/utils.h"
+#include "../src/symmetry.h"
#ifdef HAVE_CLOCK_GETTIME
@@ -65,6 +66,7 @@ int main(int argc, char *argv[])
const double sep = 20.0;
double start, end;
double gpu_time, cpu_time;
+ SymOpList *sym;
gctx = setup_gpu(1, NULL, NULL, NULL, 0);
if ( gctx == NULL ) {
@@ -141,12 +143,16 @@ int main(int argc, char *argv[])
end = get_hires_seconds();
gpu_time = end - start;
+ sym = get_pointgroup("1");
+
start = get_hires_seconds();
get_diffraction(&cpu_image, 8, 8, 8, NULL, NULL, NULL, cell,
- GRADIENT_MOSAIC, "1");
+ GRADIENT_MOSAIC, sym);
end = get_hires_seconds();
cpu_time = end - start;
+ free_symoplist(sym);
+
STATUS("The GPU version was %5.2f times faster.\n", cpu_time/gpu_time);
gpu_min = +INFINITY; gpu_max = -INFINITY; gpu_tot = 0.0;