aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-02-13 18:33:30 -0600
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:26 +0000
commit3b52b3721d634461b2d3840db16735b78a4a8cad (patch)
treebf192abc623573e7124f3810a7336d1f85fe3c54 /Carpet/Carpet
parent23a591ba88475bf0842257215f04c9f76a1c3fc4 (diff)
Combine CarpetLib's INSTANTIATE and Carpet's TYPECASE mechanism into a
single mechanism provided by CarpetLib. Use this mechanism everywhere.
Diffstat (limited to 'Carpet/Carpet')
-rw-r--r--Carpet/Carpet/interface.ccl4
-rw-r--r--Carpet/Carpet/src/Poison.cc5
-rw-r--r--Carpet/Carpet/src/Storage.cc5
-rw-r--r--Carpet/Carpet/src/helpers.cc5
-rw-r--r--Carpet/Carpet/src/typecase190
5 files changed, 11 insertions, 198 deletions
diff --git a/Carpet/Carpet/interface.ccl b/Carpet/Carpet/interface.ccl
index b0c24b904..01241b4eb 100644
--- a/Carpet/Carpet/interface.ccl
+++ b/Carpet/Carpet/interface.ccl
@@ -28,11 +28,11 @@ uses include header: gf.hh
uses include header: ggf.hh
uses include header: gh.hh
uses include header: th.hh
+uses include header: typecase.hh
+uses include header: typeprops.hh
uses include header: operators.hh
-INCLUDE HEADER: typecase in carpet_typecase.hh
-
# Get access to communicators
diff --git a/Carpet/Carpet/src/Poison.cc b/Carpet/Carpet/src/Poison.cc
index 83b4650b5..9adee4690 100644
--- a/Carpet/Carpet/src/Poison.cc
+++ b/Carpet/Carpet/src/Poison.cc
@@ -8,6 +8,7 @@
#include <util_Table.h>
#include <defs.hh>
+#include <typeprops.hh>
#include <carpet.hh>
@@ -204,7 +205,7 @@ namespace Carpet {
for (int i=0; i<size[0]; ++i) {
int const idx = i + size[0] * (j + size[1] * k);
bool poisoned=false;
- switch (tp) {
+ switch (specific_cactus_type(tp)) {
#define TYPECASE(N,T) \
case N: { \
T worm; \
@@ -213,7 +214,7 @@ namespace Carpet {
poisoned = memcmp (&worm, &val, sizeof worm) == 0; \
break; \
}
-#include "typecase"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType(n);
diff --git a/Carpet/Carpet/src/Storage.cc b/Carpet/Carpet/src/Storage.cc
index 636247d20..b6ff7e82b 100644
--- a/Carpet/Carpet/src/Storage.cc
+++ b/Carpet/Carpet/src/Storage.cc
@@ -8,6 +8,7 @@
#include <dh.hh>
#include <gf.hh>
#include <operators.hh>
+#include <typeprops.hh>
#include <carpet.hh>
@@ -158,7 +159,7 @@ namespace Carpet {
const int varindex = firstvarindex + var;
#warning "TODO: allocate these in SetupGH, and after recomposing"
if (not arrdata.AT(group).AT(m).data.AT(var)) {
- switch (gp.vartype) {
+ switch (specific_cactus_type(gp.vartype)) {
#define TYPECASE(N,T) \
case N: \
arrdata.AT(group).AT(m).data.AT(var) = new gf<T> \
@@ -169,7 +170,7 @@ namespace Carpet {
prolongation_order_time, \
vectorlength, vectorindex, (gf<T>*)vectorleader); \
break;
-#include "typecase"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType (varindex);
diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc
index f1c82e924..c3999377f 100644
--- a/Carpet/Carpet/src/helpers.cc
+++ b/Carpet/Carpet/src/helpers.cc
@@ -13,6 +13,7 @@
#include <defs.hh>
#include <dist.hh>
#include <ggf.hh>
+#include <typeprops.hh>
#include <carpet.hh>
@@ -257,13 +258,13 @@ namespace Carpet {
MPI_Datatype CarpetMPIDatatype (const int vartype)
{
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: { \
T dummy; \
return dist::mpi_datatype(dummy); \
}
-#include "typecase"
+#include "typecase.hh"
#undef TYPECASE
default:
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
diff --git a/Carpet/Carpet/src/typecase b/Carpet/Carpet/src/typecase
deleted file mode 100644
index 8c87da5cd..000000000
--- a/Carpet/Carpet/src/typecase
+++ /dev/null
@@ -1,190 +0,0 @@
-// Instantiate type cases for all available types -*-C++-*-
-// (C) 2001 Erik Schnetter <schnetter@uni-tuebingen.de>
-
-// Usage:
-// Define the macro TYPECASE(N,T) to be a typecase for the type T with name N,
-// then include this file,
-// then undefine the macro TYPECASE.
-
-
-
-// Decide which types to typecase
-
-#ifdef CARPET_ALL
-# undef CARPET_BYTE
-# undef CARPET_INT
-# undef CARPET_REAL
-# undef CARPET_COMPLEX
-# define CARPET_BYTE
-# define CARPET_INT
-# define CARPET_REAL
-# define CARPET_COMPLEX
-#endif
-
-#ifdef CARPET_ALL_INT
-# undef CARPET_INT1
-# undef CARPET_INT2
-# undef CARPET_INT4
-# undef CARPET_INT8
-# define CARPET_INT1
-# define CARPET_INT2
-# define CARPET_INT4
-# define CARPET_INT8
-#endif
-
-#ifdef CARPET_ALL_REAL
-# undef CARPET_REAL4
-# undef CARPET_REAL8
-# undef CARPET_REAL16
-# define CARPET_REAL4
-# define CARPET_REAL8
-# define CARPET_REAL16
-#endif
-
-#ifdef CARPET_ALL_COMPLEX
-# undef CARPET_COMPLEX8
-# undef CARPET_COMPLEX16
-# undef CARPET_COMPLEX32
-# define CARPET_COMPLEX8
-# define CARPET_COMPLEX16
-# define CARPET_COMPLEX32
-#endif
-
-#if !defined(CARPET_BYTE) && !defined(CARPET_INT) && !defined(CARPET_INT1) && !defined(CARPET_INT2) && !defined(CARPET_INT4) && !defined(CARPET_INT8) && !defined(CARPET_REAL) && !defined(CARPET_REAL4) && !defined(CARPET_REAL8) && !defined(CARPET_REAL16) && !defined(CARPET_COMPLEX) && !defined(CARPET_COMPLEX8) && !defined(CARPET_COMPLEX16) && !defined(CARPET_COMPLEX32)
-// Assume the user just wants INT, REAL, and COMPLEX
-# undef CARPET_INT
-# define CARPET_INT
-# undef CARPET_REAL
-# define CARPET_REAL
-# undef CARPET_COMPLEX
-# define CARPET_COMPLEX
-#endif
-
-#ifdef CARPET_INT
-# ifdef CCTK_INTEGER_PRECISION_1
-# undef CARPET_INT1
-# define CARPET_INT1
-# endif
-# ifdef CCTK_INTEGER_PRECISION_2
-# undef CARPET_INT2
-# define CARPET_INT2
-# endif
-# ifdef CCTK_INTEGER_PRECISION_4
-# undef CARPET_INT4
-# define CARPET_INT4
-# endif
-# ifdef CCTK_INTEGER_PRECISION_8
-# undef CARPET_INT8
-# define CARPET_INT8
-# endif
-#endif
-#ifdef CARPET_REAL
-# ifdef CCTK_REAL_PRECISION_4
-# undef CARPET_REAL4
-# define CARPET_REAL4
-# endif
-# ifdef CCTK_REAL_PRECISION_8
-# undef CARPET_REAL8
-# define CARPET_REAL8
-# endif
-# ifdef CCTK_REAL_PRECISION_16
-# undef CARPET_REAL16
-# define CARPET_REAL16
-# endif
-#endif
-#ifdef CARPET_COMPLEX
-# ifdef CCTK_REAL_PRECISION_4
-# undef CARPET_COMPLEX8
-# define CARPET_COMPLEX8
-# endif
-# ifdef CCTK_REAL_PRECISION_8
-# undef CARPET_COMPLEX16
-# define CARPET_COMPLEX16
-# endif
-# ifdef CCTK_REAL_PRECISION_16
-# undef CARPET_COMPLEX32
-# define CARPET_COMPLEX32
-# endif
-#endif
-
-
-
-// // Check
-// #if !defined(CARPET_BYTE) && !defined(CARPET_INT1) && !defined(CARPET_INT2) && !defined(CARPET_INT4) && !defined(CARPET_INT8) && !defined(CARPET_REAL4) && !defined(CARPET_REAL8) && !defined(CARPET_REAL16) && !defined(CARPET_COMPLEX8) && !defined(CARPET_COMPLEX16) && !defined(CARPET_COMPLEX32)
-// # error "You have not defined which grid function types to instantiate."
-// #endif
-
-
-
-// Typecase the desired types
-
-// TODO: Find a way to collapse e.g. CCTK_INT and CCTK_INT4, if both
-// are the same. Remember that the TYPECASE statements need not be
-// executable. Maybe find a way to convert CCTK_VARIABLE_INT to
-// CCTK_VARIABLE_INT4?
-
-#ifdef CARPET_BYTE
-TYPECASE(CCTK_VARIABLE_BYTE, CCTK_BYTE)
-#endif
-
-#ifdef CARPET_INT
-TYPECASE(CCTK_VARIABLE_INT, CCTK_INT)
-#endif
-#ifdef CARPET_INT1
-# ifdef HAVE_CCTK_INT1
-TYPECASE(CCTK_VARIABLE_INT1, CCTK_INT1)
-# endif
-#endif
-#ifdef CARPET_INT2
-# ifdef HAVE_CCTK_INT2
-TYPECASE(CCTK_VARIABLE_INT2, CCTK_INT2)
-# endif
-#endif
-#ifdef CARPET_INT4
-# ifdef HAVE_CCTK_INT4
-TYPECASE(CCTK_VARIABLE_INT4, CCTK_INT4)
-# endif
-#endif
-#ifdef CARPET_INT8
-# ifdef HAVE_CCTK_INT8
-TYPECASE(CCTK_VARIABLE_INT8, CCTK_INT8)
-# endif
-#endif
-
-#ifdef CARPET_REAL
-TYPECASE(CCTK_VARIABLE_REAL, CCTK_REAL)
-#endif
-#ifdef CARPET_REAL4
-# ifdef HAVE_CCTK_REAL4
-TYPECASE(CCTK_VARIABLE_REAL4, CCTK_REAL4)
-# endif
-#endif
-#ifdef CARPET_REAL8
-# ifdef HAVE_CCTK_REAL8
-TYPECASE(CCTK_VARIABLE_REAL8, CCTK_REAL8)
-# endif
-#endif
-#ifdef CARPET_REAL16
-# ifdef HAVE_CCTK_REAL16
-TYPECASE(CCTK_VARIABLE_REAL16, CCTK_REAL16)
-# endif
-#endif
-
-#ifdef CARPET_COMPLEX
-TYPECASE(CCTK_VARIABLE_COMPLEX, CCTK_COMPLEX)
-#endif
-#ifdef CARPET_COMPLEX8
-# ifdef HAVE_CCTK_COMPLEX8
-TYPECASE(CCTK_VARIABLE_COMPLEX8, CCTK_COMPLEX8)
-# endif
-#endif
-#ifdef CARPET_COMPLEX16
-# ifdef HAVE_CCTK_COMPLEX16
-TYPECASE(CCTK_VARIABLE_COMPLEX16, CCTK_COMPLEX16)
-# endif
-#endif
-#ifdef CARPET_COMPLEX32
-# ifdef HAVE_CCTK_COMPLEX32
-TYPECASE(CCTK_VARIABLE_COMPLEX32, CCTK_COMPLEX32)
-# endif
-#endif