aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-03-27 20:10:12 +0100
committerThomas White <taw@bitwiz.org.uk>2010-03-27 20:10:12 +0100
commitf15dc3d8b88c7a4a7054309fbcd5756de8a7fc0b (patch)
treef78389a5984861e3007d75fab4574eb561a27017
parentbdd2a7b4a8a5456a023d54be6fd5d6a011314c7e (diff)
Make it obvious, when using GPU simulation, if a required reflection is unavailable
-rw-r--r--src/diffraction-gpu.c8
-rw-r--r--src/diffraction-gpu.h4
-rw-r--r--src/indexamajig.c2
-rw-r--r--src/pattern_sim.c2
4 files changed, 10 insertions, 6 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c
index e142035d..91d6334f 100644
--- a/src/diffraction-gpu.c
+++ b/src/diffraction-gpu.c
@@ -342,7 +342,7 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
/* Setup the OpenCL stuff, create buffers, load the structure factor table */
struct gpu_context *setup_gpu(int no_sfac, struct image *image,
- double *intensities)
+ double *intensities, unsigned int *counts)
{
struct gpu_context *gctx;
cl_uint nplat;
@@ -403,7 +403,11 @@ struct gpu_context *setup_gpu(int no_sfac, struct image *image,
intensities_ptr = malloc(intensities_size);
if ( intensities != NULL ) {
for ( i=0; i<IDIM*IDIM*IDIM; i++ ) {
- intensities_ptr[i] = intensities[i];
+ if ( counts[i] == 1 ) {
+ intensities_ptr[i] = intensities[i];
+ } else {
+ intensities_ptr[i] = 1.0e20;
+ }
}
} else {
for ( i=0; i<IDIM*IDIM*IDIM; i++ ) {
diff --git a/src/diffraction-gpu.h b/src/diffraction-gpu.h
index a9e46b66..9d74dec4 100644
--- a/src/diffraction-gpu.h
+++ b/src/diffraction-gpu.h
@@ -26,7 +26,7 @@ struct gpu_context;
extern void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
int na, int nb, int nc, UnitCell *ucell);
extern struct gpu_context *setup_gpu(int no_sfac, struct image *image,
- double *intensities);
+ double *intensities, unsigned int *counts);
extern void cleanup_gpu(struct gpu_context *gctx);
#else
@@ -39,7 +39,7 @@ static void get_diffraction_gpu(struct gpu_context *gctx, struct image *image,
}
static struct gpu_context *setup_gpu(int no_sfac, struct image *image,
- double *intensities)
+ double *intensities, unsigned int *counts)
{
return NULL;
}
diff --git a/src/indexamajig.c b/src/indexamajig.c
index c24b0e6b..1ffae789 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -151,7 +151,7 @@ static void simulate_and_write(struct image *simage, struct gpu_context **gctx,
{
/* Set up GPU if necessary */
if ( (gctx != NULL) && (*gctx == NULL) ) {
- *gctx = setup_gpu(0, simage, intensities);
+ *gctx = setup_gpu(0, simage, intensities, counts);
}
if ( (gctx != NULL) && (*gctx != NULL) ) {
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 3fa1155f..3593e4b4 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -292,7 +292,7 @@ int main(int argc, char *argv[])
if ( config_gpu ) {
if ( gctx == NULL ) {
gctx = setup_gpu(config_nosfac, &image,
- intensities);
+ intensities, counts);
}
get_diffraction_gpu(gctx, &image, na, nb, nc, cell);
} else {