Commit 3710defb authored by Thomas White's avatar Thomas White
Browse files

Rename old array functions to get them out of the way of API consistency

parent 95f05d7d
......@@ -35,12 +35,12 @@ get_temp2
<SUBSECTION>
set_detector_pos
set_partial
set_int
set_intensity
set_scalable
set_refinable
set_redundancy
set_esd_intensity
set_ph
set_phase
set_symmetric_indices
set_temp1
set_temp2
......
......@@ -672,7 +672,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
/* Record intensity and set redundancy to 1 on success */
if ( r == 0 ) {
set_int(refl, intensity);
set_intensity(refl, intensity);
set_esd_intensity(refl, sigma);
set_redundancy(refl, 1);
} else {
......
......@@ -299,13 +299,13 @@ RefList *read_reflections_from_file(FILE *fh)
char *v;
refl = add_refl(out, h, k, l);
set_int(refl, intensity);
set_intensity(refl, intensity);
set_detector_pos(refl, 0.0, fs, ss);
set_esd_intensity(refl, sigma);
set_redundancy(refl, cts);
ph = strtod(phs, &v);
if ( v != NULL ) set_ph(refl, deg2rad(ph));
if ( v != NULL ) set_phase(refl, deg2rad(ph));
/* The 1/d value is actually ignored. */
......
......@@ -596,14 +596,14 @@ void set_partial(Reflection *refl, double r1, double r2, double p,
/**
* set_int:
* set_intensity:
* @refl: A %Reflection
* @intensity: The intensity for the reflection.
*
* Set the intensity for the reflection. Note that retrieval is done with
* get_intensity().
**/
void set_int(Reflection *refl, double intensity)
void set_intensity(Reflection *refl, double intensity)
{
refl->data.intensity = intensity;
}
......@@ -665,12 +665,12 @@ void set_esd_intensity(Reflection *refl, double esd)
/**
* set_ph:
* set_phase:
* @refl: A %Reflection
* @phase: New phase for the reflection
*
**/
void set_ph(Reflection *refl, double phase)
void set_phase(Reflection *refl, double phase)
{
refl->data.phase = phase;
refl->data.have_phase = 1;
......
......@@ -96,14 +96,14 @@ extern void set_detector_pos(Reflection *refl, double exerr,
double fs, double ss);
extern void set_partial(Reflection *refl, double r1, double r2, double p,
double clamp_low, double clamp_high);
extern void set_int(Reflection *refl, double intensity);
extern void set_intensity(Reflection *refl, double intensity);
extern void set_scalable(Reflection *refl, int scalable);
extern void set_refinable(Reflection *refl, int refinable);
extern void set_redundancy(Reflection *refl, int red);
extern void set_temp1(Reflection *refl, double temp);
extern void set_temp2(Reflection *refl, double temp);
extern void set_esd_intensity(Reflection *refl, double esd);
extern void set_ph(Reflection *refl, double phase);
extern void set_phase(Reflection *refl, double phase);
extern void set_symmetric_indices(Reflection *refl,
signed int hs, signed int ks, signed int ls);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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
......@@ -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);
}
}
......
......@@ -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);
}
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment