aboutsummaryrefslogtreecommitdiff
path: root/src/list_tmp.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-25 16:19:05 +0100
committerThomas White <taw@physics.org>2009-11-25 16:19:05 +0100
commit76cbb192f4abdd5f5c280cee964357c64364c783 (patch)
treeee643b3122cc168c9c6cdcbeb03ffeb8bfed69e7 /src/list_tmp.h
parent36addbc39e3d1a9da88959b6c07af9438402b016 (diff)
Introduce integr_sim
Diffstat (limited to 'src/list_tmp.h')
-rw-r--r--src/list_tmp.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/list_tmp.h b/src/list_tmp.h
new file mode 100644
index 00000000..ffb5f393
--- /dev/null
+++ b/src/list_tmp.h
@@ -0,0 +1,74 @@
+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) ) {
+ printf("\nReflection %i %i %i is out of range!\n", h, k, l);
+ printf("You need to re-configure INDMAX, delete the reflection"
+ " cache file 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,
+ signed int k, signed int l,
+ TYPE i)
+{
+ int idx;
+
+ if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) {
+ printf("\nReflection %i %i %i is out of range!\n", h, k, l);
+ printf("You need to re-configure INDMAX, delete the reflection"
+ " cache file 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 TYPE LABEL(lookup)(TYPE *ref, signed int h,
+ signed int k, signed int l)
+{
+ int idx;
+
+ if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) {
+ printf("\nReflection %i %i %i is out of range!\n", h, k, l);
+ printf("You need to re-configure INDMAX, delete the reflection"
+ " cache file 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);
+ return ref[idx];
+}
+
+
+static inline TYPE *LABEL(new_list)(void)
+{
+ TYPE *r;
+ size_t r_size;
+ r_size = IDIM*IDIM*IDIM*sizeof(TYPE);
+ r = malloc(r_size);
+ memset(r, 0, r_size);
+ return r;
+}