summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-06-22 11:00:07 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-06-22 11:00:07 +0000
commit6e672eb319eebb16951cacb42dc4b6456594aceb (patch)
tree96047732e262852ddd98743383cb42a76f319e3b /src
parent9f97053dbc989e3455c4308254c3398860a20e4a (diff)
Some more stuff to do with precision and variables.
Now the floating point precision is controlled with REAL_PRECISION with allowed values 16,8,4 , default 8. This maps onto a #define of CCTK_REAL_PRECISION_* . Comples types CCTK_COMPLEX* and CCTK_COMPLEX, as well as the character type CCTK_CHAR have also been defined. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@559 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/include/cctk.h5
-rw-r--r--src/include/cctk_types.h59
2 files changed, 56 insertions, 8 deletions
diff --git a/src/include/cctk.h b/src/include/cctk.h
index eaa58c34..8a4c0292 100644
--- a/src/include/cctk.h
+++ b/src/include/cctk.h
@@ -79,11 +79,6 @@
#define CCTK_STORAGESIZE(xGH, group, dim) (CCTK_QueryGroupStorage(xGH,group) ?\
(CCTK_ArrayGroupSize(xGH, group, dim)) : &(_cctk_one))
-typedef struct
-{
- CCTK_REAL Re;
- CCTK_REAL Im;
-} Complex;
extern int _cctk_one;
diff --git a/src/include/cctk_types.h b/src/include/cctk_types.h
index 0e9c21eb..b90a8ffa 100644
--- a/src/include/cctk_types.h
+++ b/src/include/cctk_types.h
@@ -18,6 +18,40 @@
#include "config.h"
#endif
+/* Define stuff for C. */
+#ifdef CCODE
+
+/* Structures for complex types */
+
+#ifdef CCTK_REAL16
+typedef struct
+{
+ CCTK_REAL16 Re;
+ CCTK_REAL16 Im;
+} CCTK_COMPLEX16;
+#endif
+
+#ifdef CCTK_REAL8
+typedef struct
+{
+ CCTK_REAL8 Re;
+ CCTK_REAL8 Im;
+} CCTK_COMPLEX8;
+#endif
+
+#ifdef CCTK_REAL4
+typedef struct
+{
+ CCTK_REAL4 Re;
+ CCTK_REAL4 Im;
+} CCTK_COMPLEX4;
+#endif
+
+/* Character type */
+typedef unsigned char CCTK_CHAR;
+
+#endif /* CCODE */
+
/* Define stuff for fortran. */
#ifdef FCODE
@@ -33,20 +67,26 @@
#define CCTK_INT4 INTEGER*4
#define CCTK_INT2 INTEGER*2
+#define CCTK_COMPLEX16 COMPLEX*16
+#define CCTK_COMPLEX8 COMPLEX*8
+#define CCTK_COMPLEX4 COMPLEX*4
+
+#define CCTK_CHAR CHARACTER
+
#endif /*FCODE */
/* Now pick the types based upon the precision variable. */
/* Floating point precision */
-#ifdef CCTK_PRECISION_QUAD
+#ifdef CCTK_REAL_PRECISION_16
#define CCTK_REAL CCTK_REAL16
#endif
-#ifdef CCTK_PRECISION_DOUBLE
+#ifdef CCTK_REAL_PRECISION_8
#define CCTK_REAL CCTK_REAL8
#endif
-#ifdef CCTK_PRECISION_SINGLE
+#ifdef CCTK_REAL_PRECISION_4
#define CCTK_REAL CCTK_REAL4
#endif
@@ -64,5 +104,18 @@
#define CCTK_INT CCTK_INT2
#endif
+/* Complex precision */
+#ifdef CCTK_REAL_PRECISION_16
+#define CCTK_COMPLEX CCTK_COMPLEX16
+#endif
+
+#ifdef CCTK_REAL_PRECISION_8
+#define CCTK_COMPLEX CCTK_COMPLEX8
+#endif
+
+#ifdef CCTK_REAL_PRECISION_4
+#define CCTK_COMPLEX CCTK_COMPLEX4
+#endif
+
#endif /*_CCTK_TYPES_H_ */