aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-03-06 14:46:13 +0100
committerThomas White <taw@physics.org>2012-03-06 14:46:13 +0100
commit3710defb709b7ab33ae7849873c4fb62de96e138 (patch)
tree0c50ad73099324891826efb2bbfc33a8ec03d8a3 /src
parent95f05d7d455c9bfd28af83b72dfeb47b77fca621 (diff)
Rename old array functions to get them out of the way of API consistency
Diffstat (limited to 'src')
-rw-r--r--src/compare_hkl.c4
-rw-r--r--src/diffraction.c8
-rw-r--r--src/get_hkl.c12
-rw-r--r--src/hrs-scaling.c2
-rw-r--r--src/list_tmp.h32
-rw-r--r--src/partial_sim.c4
-rw-r--r--src/pattern_sim.c12
-rw-r--r--src/process_hkl.c9
8 files changed, 28 insertions, 55 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 3fc18fea..dde90990 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -446,12 +446,12 @@ int main(int argc, char *argv[])
/* Add divided version to 'output' list */
tr = add_refl(ratio, h, k, l);
- set_int(tr, val1/val2);
+ set_intensity(tr, val1/val2);
set_redundancy(tr, 1);
}
if ( ratiofile != NULL ) {
- write_reflist(ratiofile, ratio, cell);
+ write_reflist(ratiofile, ratio);
}
reflist_free(ratio);
diff --git a/src/diffraction.c b/src/diffraction.c
index d0413863..429931c2 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -120,8 +120,8 @@ static double sym_lookup_intensity(const double *intensities,
get_equiv(sym, NULL, i, h, k, l, &he, &ke, &le);
- f = (double)lookup_flag(flags, he, ke, le);
- val = lookup_intensity(intensities, he, ke, le);
+ f = (double)lookup_arr_flag(flags, he, ke, le);
+ val = lookup_arr_intensity(intensities, he, ke, le);
ret += f*val;
@@ -147,8 +147,8 @@ static double sym_lookup_phase(const double *phases,
get_equiv(sym, NULL, i, h, k, l, &he, &ke, &le);
- f = (double)lookup_flag(flags, he, ke, le);
- val = lookup_phase(phases, he, ke, le);
+ f = (double)lookup_arr_flag(flags, he, ke, le);
+ val = lookup_arr_phase(phases, he, ke, le);
ret += f*val;
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 4afefd51..c1310418 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -98,7 +98,7 @@ static void poisson_reflections(RefList *list, double adu_per_photon)
val = get_intensity(refl);
c = adu_per_photon * poisson_noise(val/adu_per_photon);
- set_int(refl, c);
+ set_intensity(refl, c);
}
}
@@ -121,7 +121,7 @@ static void noise_reflections(RefList *list)
r = (double)random()/RAND_MAX;
val += 0.1 * val * r;
- set_int(refl, val);
+ set_intensity(refl, val);
}
}
@@ -233,7 +233,7 @@ static RefList *twin_reflections(RefList *in,
if ( !skip ) {
Reflection *new = add_refl(out, h, k, l);
- set_int(new, total);
+ set_intensity(new, total);
set_esd_intensity(new, sqrt(sigma));
}
@@ -297,9 +297,7 @@ static RefList *expand_reflections(RefList *in, const SymOpList *target,
/* FIXME: Make phase negative if the reflection is
* separated from the original via an inversion */
get_phase(refl, &have_phase);
- if ( have_phase ) {
- set_ph(new, -ph);
- }
+ if ( have_phase ) set_phase(new, -ph);
}
@@ -569,7 +567,7 @@ int main(int argc, char *argv[])
special_position(mero, m, h, k, l);
inty *= (double)num_equivs(mero, m);
- set_int(refl, inty);
+ set_intensity(refl, inty);
}
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c
index fd82536f..21a34bbf 100644
--- a/src/hrs-scaling.c
+++ b/src/hrs-scaling.c
@@ -293,7 +293,7 @@ static RefList *lsq_intensities(struct image *images, int n, int n_threads)
{
double Ih;
Ih = get_temp1(refl) / get_temp2(refl);
- set_int(refl, Ih);
+ set_intensity(refl, Ih);
}
return full;
diff --git a/src/list_tmp.h b/src/list_tmp.h
index 63d4ef20..064efc8d 100644
--- a/src/list_tmp.h
+++ b/src/list_tmp.h
@@ -42,28 +42,8 @@
#define ERROR_T(...) fprintf(stderr, __VA_ARGS__)
-static inline void LABEL(integrate)(TYPE *ref, signed int h,
- signed int k, signed int l,
- TYPE i)
-{
- int idx;
-
- if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) {
- ERROR_T("\nReflection %i %i %i is out of range!\n", h, k, l);
- ERROR_T("You need to re-configure INDMAX and re-run.\n");
- exit(1);
- }
-
- if ( h < 0 ) h += IDIM;
- if ( k < 0 ) k += IDIM;
- if ( l < 0 ) l += IDIM;
-
- idx = h + (IDIM*k) + (IDIM*IDIM*l);
- ref[idx] += i;
-}
-
-static inline void LABEL(set)(TYPE *ref, signed int h,
+static inline void LABEL(set_arr)(TYPE *ref, signed int h,
signed int k, signed int l,
TYPE i)
{
@@ -84,7 +64,7 @@ static inline void LABEL(set)(TYPE *ref, signed int h,
}
-static inline TYPE LABEL(lookup)(const TYPE *ref, signed int h,
+static inline TYPE LABEL(lookup_arr)(const TYPE *ref, signed int h,
signed int k, signed int l)
{
int idx;
@@ -104,7 +84,7 @@ static inline TYPE LABEL(lookup)(const TYPE *ref, signed int h,
}
-static inline TYPE *LABEL(new_list)(void)
+static inline TYPE *LABEL(new_arr)(void)
{
TYPE *r;
size_t r_size;
@@ -115,12 +95,6 @@ static inline TYPE *LABEL(new_list)(void)
}
-static inline void LABEL(zero_list)(TYPE *ref)
-{
- memset(ref, 0, IDIM*IDIM*IDIM*sizeof(TYPE));
-}
-
-
#undef LABEL
#undef TYPE
#undef ERROR_T
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 7a60f5c8..b9cb69e5 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -114,7 +114,7 @@ static void calculate_partials(RefList *partial, double osf,
pthread_mutex_lock(full_lock);
rfull = add_refl(full, h, k, l);
If = fabs(gaussian_noise(0.0, 1000.0));
- set_int(rfull, If);
+ set_intensity(rfull, If);
set_redundancy(rfull, 1);
pthread_mutex_unlock(full_lock);
@@ -146,7 +146,7 @@ static void calculate_partials(RefList *partial, double osf,
Ip = gaussian_noise(Ip, 100.0);
- set_int(refl, Ip);
+ set_intensity(refl, Ip);
set_esd_intensity(refl, 100.0);
}
}
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 19f58589..1ed6b8ba 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -113,7 +113,7 @@ static double *intensities_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- double *out = new_list_intensity();
+ double *out = new_arr_intensity();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -124,7 +124,7 @@ static double *intensities_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_intensity(out, h, k, l, intensity);
+ set_arr_intensity(out, h, k, l, intensity);
}
@@ -136,7 +136,7 @@ static double *phases_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- double *out = new_list_phase();
+ double *out = new_arr_phase();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -147,7 +147,7 @@ static double *phases_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_phase(out, h, k, l, phase);
+ set_arr_phase(out, h, k, l, phase);
}
@@ -160,7 +160,7 @@ static unsigned char *flags_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- unsigned char *out = new_list_flag();
+ unsigned char *out = new_arr_flag();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -170,7 +170,7 @@ static unsigned char *flags_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_flag(out, h, k, l, 1);
+ set_arr_flag(out, h, k, l, 1);
}
diff --git a/src/process_hkl.c b/src/process_hkl.c
index d90bc9ef..fb0f7fa4 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -169,10 +169,11 @@ static void merge_pattern(RefList *model, RefList *new, int max_only,
/* User asked for max only? */
if ( !max_only ) {
- set_int(model_version, model_int + intensity);
+ set_intensity(model_version,
+ model_int + intensity);
} else {
if ( intensity>get_intensity(model_version) ) {
- set_int(model_version, intensity);
+ set_intensity(model_version, intensity);
}
}
@@ -298,7 +299,7 @@ static void scale_intensities(RefList *model, RefList *new, const SymOpList *sym
refl = next_refl(refl, iter) ) {
double intensity = get_intensity(refl);
- set_int(refl, intensity*s);
+ set_intensity(refl, intensity*s);
}
}
@@ -375,7 +376,7 @@ static void merge_all(FILE *fh, RefList *model,
double intensity = get_intensity(refl);
int red = get_redundancy(refl);
- set_int(refl, intensity / (double)red);
+ set_intensity(refl, intensity / (double)red);
}