Commit 2c238039 authored by Thomas White's avatar Thomas White
Browse files

Move the "indexed reflection array" thing to where it can't do any harm

parent 3c896e87
......@@ -35,12 +35,14 @@ LDADD += $(top_builddir)/libcrystfel/libcrystfel.la
src_partial_sim_SOURCES = src/partial_sim.c
src_pattern_sim_SOURCES = src/pattern_sim.c
src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \
src/diffraction-gpu.c
if HAVE_OPENCL
TESTS += tests/gpu_sim_check
noinst_PROGRAMS += tests/gpu_sim_check
tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c
tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c src/diffraction.c \
src/diffraction-gpu.c
endif
src_process_hkl_SOURCES = src/process_hkl.c
......@@ -88,7 +90,7 @@ EXTRA_DIST += src/dw-hdfsee.h src/hdfsee.h src/render_hkl.h \
src/post-refinement.h src/hrs-scaling.h src/scaling-report.h
crystfeldir = $(datadir)/crystfel
crystfel_DATA = data/diffraction.cl data/defs.h data/hdfsee.ui
crystfel_DATA = data/diffraction.cl data/hdfsee.ui
EXTRA_DIST += $(crystfel_DATA)
......
......@@ -142,7 +142,8 @@ src_partialator_OBJECTS = $(am_src_partialator_OBJECTS)
src_partialator_LDADD = $(LDADD)
src_partialator_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
$(top_builddir)/libcrystfel/libcrystfel.la
am_src_pattern_sim_OBJECTS = src/pattern_sim.$(OBJEXT)
am_src_pattern_sim_OBJECTS = src/pattern_sim.$(OBJEXT) \
src/diffraction.$(OBJEXT) src/diffraction-gpu.$(OBJEXT)
src_pattern_sim_OBJECTS = $(am_src_pattern_sim_OBJECTS)
src_pattern_sim_LDADD = $(LDADD)
src_pattern_sim_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
......@@ -163,9 +164,12 @@ src_render_hkl_OBJECTS = $(am_src_render_hkl_OBJECTS)
src_render_hkl_LDADD = $(LDADD)
src_render_hkl_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
$(top_builddir)/libcrystfel/libcrystfel.la
am__tests_gpu_sim_check_SOURCES_DIST = tests/gpu_sim_check.c
am__tests_gpu_sim_check_SOURCES_DIST = tests/gpu_sim_check.c \
src/diffraction.c src/diffraction-gpu.c
@HAVE_OPENCL_TRUE@am_tests_gpu_sim_check_OBJECTS = \
@HAVE_OPENCL_TRUE@ tests/gpu_sim_check.$(OBJEXT)
@HAVE_OPENCL_TRUE@ tests/gpu_sim_check.$(OBJEXT) \
@HAVE_OPENCL_TRUE@ src/diffraction.$(OBJEXT) \
@HAVE_OPENCL_TRUE@ src/diffraction-gpu.$(OBJEXT)
tests_gpu_sim_check_OBJECTS = $(am_tests_gpu_sim_check_OBJECTS)
tests_gpu_sim_check_LDADD = $(LDADD)
tests_gpu_sim_check_DEPENDENCIES = $(top_builddir)/lib/libgnu.a \
......@@ -567,8 +571,12 @@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib \
LDADD = $(top_builddir)/lib/libgnu.a @IGNORE_UNUSED_LIBRARIES_CFLAGS@ \
$(top_builddir)/libcrystfel/libcrystfel.la
src_partial_sim_SOURCES = src/partial_sim.c
src_pattern_sim_SOURCES = src/pattern_sim.c
@HAVE_OPENCL_TRUE@tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c
src_pattern_sim_SOURCES = src/pattern_sim.c src/diffraction.c \
src/diffraction-gpu.c
@HAVE_OPENCL_TRUE@tests_gpu_sim_check_SOURCES = tests/gpu_sim_check.c src/diffraction.c \
@HAVE_OPENCL_TRUE@ src/diffraction-gpu.c
src_process_hkl_SOURCES = src/process_hkl.c
src_indexamajig_SOURCES = src/indexamajig.c
@BUILD_HDFSEE_TRUE@src_hdfsee_SOURCES = src/hdfsee.c src/dw-hdfsee.c
......@@ -588,7 +596,7 @@ tests_pr_gradient_check_SOURCES = tests/pr_gradient_check.c \
INCLUDES = -I$(top_srcdir)/libcrystfel/src -I$(top_srcdir)/data
crystfeldir = $(datadir)/crystfel
crystfel_DATA = data/diffraction.cl data/defs.h data/hdfsee.ui
crystfel_DATA = data/diffraction.cl data/hdfsee.ui
man_MANS = doc/man/indexamajig.1 doc/man/process_hkl.1 doc/man/pattern_sim.1 \
doc/man/crystfel_geometry.1 doc/man/powder_plot.1
......@@ -777,6 +785,10 @@ src/partialator$(EXEEXT): $(src_partialator_OBJECTS) $(src_partialator_DEPENDENC
$(AM_V_CCLD)$(LINK) $(src_partialator_OBJECTS) $(src_partialator_LDADD) $(LIBS)
src/pattern_sim.$(OBJEXT): src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/diffraction.$(OBJEXT): src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/diffraction-gpu.$(OBJEXT): src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/pattern_sim$(EXEEXT): $(src_pattern_sim_OBJECTS) $(src_pattern_sim_DEPENDENCIES) src/$(am__dirstamp)
@rm -f src/pattern_sim$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(src_pattern_sim_OBJECTS) $(src_pattern_sim_LDADD) $(LIBS)
......@@ -832,6 +844,8 @@ mostlyclean-compile:
-rm -f src/calibrate_detector.$(OBJEXT)
-rm -f src/check_hkl.$(OBJEXT)
-rm -f src/compare_hkl.$(OBJEXT)
-rm -f src/diffraction-gpu.$(OBJEXT)
-rm -f src/diffraction.$(OBJEXT)
-rm -f src/dw-hdfsee.$(OBJEXT)
-rm -f src/get_hkl.$(OBJEXT)
-rm -f src/hdfsee.$(OBJEXT)
......@@ -857,6 +871,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/calibrate_detector.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/check_hkl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/compare_hkl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction-gpu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dw-hdfsee.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/get_hkl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/hdfsee.Po@am__quote@
......
/*
* defs.h
*
* Constant definitions which must be consistent throughout
*
* (c) 2006-2010 Thomas White <taw@physics.org>
*
* Part of CrystFEL - crystallography with a FEL
*
*/
#ifndef DEFS_H
#define DEFS_H
/* Maxmimum index to hold values up to (can be increased if necessary) */
#define INDMAX 140
/* Array size */
#define IDIM (INDMAX*2 +1)
#endif /* DEFS_H */
......@@ -10,7 +10,11 @@
*/
#include <defs.h>
/* Maxmimum index to hold values up to (can be increased if necessary)
* WARNING: Altering this value constitutes an ABI change, and means you must
* update src/pattern_sim.h then recompile and reinstall everything. */
#define INDMAX 140
#ifndef M_PI
#define M_PI ((float)(3.14159265))
#endif
......
lib_LTLIBRARIES = libcrystfel.la
libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \
src/thread-pool.c src/image.c src/hdf5-file.c \
src/beam-parameters.c src/geometry.c src/statistics.c \
src/symmetry.c src/stream.c src/peaks.c \
src/reflist-utils.c src/filters.c src/diffraction.c \
src/diffraction-gpu.c src/cl-utils.c src/render.c \
src/index.c src/dirax.c src/mosflm.c src/reax.c
src/reflist-utils.c src/filters.c src/cl-utils.c \
src/render.c src/index.c src/dirax.c src/mosflm.c \
src/reax.c
libcrystfel_la_includedir=$(includedir)/crystfel/
libcrystfel_la_include_HEADERS = src/beam-parameters.h src/diffraction-gpu.h \
src/hdf5-file.h src/reflist.h src/symmetry.h \
src/cell.h src/diffraction.h src/image.h \
libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \
src/reflist.h src/symmetry.h src/cell.h \
src/reflist-utils.h src/thread-pool.h \
src/cl-utils.h src/filters.h src/list_tmp.h \
src/cl-utils.h src/filters.h \
src/statistics.h src/utils.h src/detector.h \
src/geometry.h src/peaks.h src/stream.h \
src/render.h src/index.h \
../data/defs.h
src/render.h src/index.h src/image.h
INCLUDES = "-I$(top_srcdir)/data"
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib
......
......@@ -88,9 +88,9 @@ am_libcrystfel_la_OBJECTS = src/reflist.lo src/utils.lo src/cell.lo \
src/detector.lo src/thread-pool.lo src/image.lo \
src/hdf5-file.lo src/beam-parameters.lo src/geometry.lo \
src/statistics.lo src/symmetry.lo src/stream.lo src/peaks.lo \
src/reflist-utils.lo src/filters.lo src/diffraction.lo \
src/diffraction-gpu.lo src/cl-utils.lo src/render.lo \
src/index.lo src/dirax.lo src/mosflm.lo src/reax.lo
src/reflist-utils.lo src/filters.lo src/cl-utils.lo \
src/render.lo src/index.lo src/dirax.lo src/mosflm.lo \
src/reax.lo
libcrystfel_la_OBJECTS = $(am_libcrystfel_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
......@@ -351,20 +351,18 @@ libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \
src/thread-pool.c src/image.c src/hdf5-file.c \
src/beam-parameters.c src/geometry.c src/statistics.c \
src/symmetry.c src/stream.c src/peaks.c \
src/reflist-utils.c src/filters.c src/diffraction.c \
src/diffraction-gpu.c src/cl-utils.c src/render.c \
src/index.c src/dirax.c src/mosflm.c src/reax.c
src/reflist-utils.c src/filters.c src/cl-utils.c \
src/render.c src/index.c src/dirax.c src/mosflm.c \
src/reax.c
libcrystfel_la_includedir = $(includedir)/crystfel/
libcrystfel_la_include_HEADERS = src/beam-parameters.h src/diffraction-gpu.h \
src/hdf5-file.h src/reflist.h src/symmetry.h \
src/cell.h src/diffraction.h src/image.h \
libcrystfel_la_include_HEADERS = src/beam-parameters.h src/hdf5-file.h \
src/reflist.h src/symmetry.h src/cell.h \
src/reflist-utils.h src/thread-pool.h \
src/cl-utils.h src/filters.h src/list_tmp.h \
src/cl-utils.h src/filters.h \
src/statistics.h src/utils.h src/detector.h \
src/geometry.h src/peaks.h src/stream.h \
src/render.h src/index.h \
../data/defs.h
src/render.h src/index.h src/image.h
INCLUDES = "-I$(top_srcdir)/data"
AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib \
......@@ -457,9 +455,6 @@ src/peaks.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/reflist-utils.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/filters.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/diffraction.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/diffraction-gpu.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/cl-utils.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/render.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/index.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
......@@ -479,10 +474,6 @@ mostlyclean-compile:
-rm -f src/cl-utils.lo
-rm -f src/detector.$(OBJEXT)
-rm -f src/detector.lo
-rm -f src/diffraction-gpu.$(OBJEXT)
-rm -f src/diffraction-gpu.lo
-rm -f src/diffraction.$(OBJEXT)
-rm -f src/diffraction.lo
-rm -f src/dirax.$(OBJEXT)
-rm -f src/dirax.lo
-rm -f src/filters.$(OBJEXT)
......@@ -525,8 +516,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cell.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/cl-utils.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/detector.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction-gpu.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/diffraction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dirax.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/filters.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/geometry.Plo@am__quote@
......
......@@ -29,7 +29,6 @@
#include "peaks.h"
#include "detector.h"
#include "filters.h"
#include "diffraction.h"
#include "reflist-utils.h"
#include "beam-parameters.h"
......
......@@ -34,76 +34,6 @@
**/
double *intensities_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
double *out = new_list_intensity();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
double intensity = get_intensity(refl);
get_indices(refl, &h, &k, &l);
set_intensity(out, h, k, l, intensity);
}
return out;
}
double *phases_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
double *out = new_list_phase();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
double phase = get_phase(refl, NULL);
get_indices(refl, &h, &k, &l);
set_phase(out, h, k, l, phase);
}
return out;
}
unsigned char *flags_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
unsigned char *out = new_list_flag();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
get_indices(refl, &h, &k, &l);
set_flag(out, h, k, l, 1);
}
return out;
}
int check_list_symmetry(RefList *list, const SymOpList *sym)
{
Reflection *refl;
......
......@@ -33,10 +33,6 @@ extern RefList *read_reflections_from_file(FILE *fh);
extern RefList *read_reflections(const char *filename);
extern double *intensities_from_list(RefList *list);
extern double *phases_from_list(RefList *list);
extern unsigned char *flags_from_list(RefList *list);
extern int check_list_symmetry(RefList *list, const SymOpList *sym);
extern int find_equiv_in_list(RefList *list, signed int h, signed int k,
signed int l, const SymOpList *sym, signed int *hu,
......
......@@ -175,32 +175,6 @@ static inline int within_tolerance(double a, double b, double percent)
#define UNUSED __attribute__((unused))
/* -------------------- Indexed lists for specified types ------------------- */
#include "defs.h"
#define LIST_SIZE (IDIM*IDIM*IDIM)
/* Create functions for storing reflection intensities indexed as h,k,l */
#define LABEL(x) x##_intensity
#define TYPE double
#include "list_tmp.h"
/* CAs above, but for phase values */
#define LABEL(x) x##_phase
#define TYPE double
#include "list_tmp.h"
/* As above, but for (unsigned) integer counts */
#define LABEL(x) x##_count
#define TYPE unsigned int
#include "list_tmp.h"
/* As above, but for simple flags */
#define LABEL(x) x##_flag
#define TYPE unsigned char
#include "list_tmp.h"
/* ------------------------------ Message macros ---------------------------- */
......
......@@ -31,6 +31,7 @@
#include "diffraction.h"
#include "cl-utils.h"
#include "beam-parameters.h"
#include "pattern_sim.h"
#define SAMPLING (4)
......
......@@ -24,6 +24,7 @@
#include "diffraction.h"
#include "beam-parameters.h"
#include "symmetry.h"
#include "pattern_sim.h"
#define SAMPLING (4)
......
......@@ -33,6 +33,7 @@
#include "symmetry.h"
#include "reflist.h"
#include "reflist-utils.h"
#include "pattern_sim.h"
static void show_help(const char *s)
......@@ -141,6 +142,76 @@ static void show_details()
}
static double *intensities_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
double *out = new_list_intensity();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
double intensity = get_intensity(refl);
get_indices(refl, &h, &k, &l);
set_intensity(out, h, k, l, intensity);
}
return out;
}
static double *phases_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
double *out = new_list_phase();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
double phase = get_phase(refl, NULL);
get_indices(refl, &h, &k, &l);
set_phase(out, h, k, l, phase);
}
return out;
}
static unsigned char *flags_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
unsigned char *out = new_list_flag();
for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) ) {
signed int h, k, l;
get_indices(refl, &h, &k, &l);
set_flag(out, h, k, l, 1);
}
return out;
}
static struct quaternion read_quaternion()
{
do {
......
/*
* pattern_sim.h
*
* Simulate diffraction patterns from small crystals
*
* (c) 2006-2011 Thomas White <taw@physics.org>
*
* Part of CrystFEL - crystallography with a FEL
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef PATTERN_SIM_H
#define PATTERN_SIM_H
/* Maxmimum index to hold values up to (can be increased if necessary)
* WARNING: Altering this value constitutes an ABI change, and means you must
* update data/diffraction.cl then recompile and reinstall everything. */
#define INDMAX 140
/* Array size */
#define IDIM (INDMAX*2 +1)
#define LIST_SIZE (IDIM*IDIM*IDIM)
/* Create functions for storing reflection intensities indexed as h,k,l */
#define LABEL(x) x##_intensity
#define TYPE double
#include "list_tmp.h"
/* CAs above, but for phase values */
#define LABEL(x) x##_phase
#define TYPE double
#include "list_tmp.h"
/* As above, but for (unsigned) integer counts */
#define LABEL(x) x##_count
#define TYPE unsigned int
#include "list_tmp.h"
/* As above, but for simple flags */
#define LABEL(x) x##_flag
#define TYPE unsigned char
#include "list_tmp.h"
#endif /* PATTERN_SIM_H */
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