aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-02-13 18:33:30 -0600
committerErik Schnetter <schnetter@cct.lsu.edu>2010-02-13 18:33:30 -0600
commitee5147b5f60d463903a617bb6cd32993ffef5695 (patch)
tree0bc7877daa53a00de61be4cd05a2b6d6b2bfb71a
parent4a378384947c1b13002d0dcb93e95ee38e8ad75e (diff)
Combine CarpetLib's INSTANTIATE and Carpet's TYPECASE mechanism into a
single mechanism provided by CarpetLib. Use this mechanism everywhere.
-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/CarpetEvolutionMask/interface.ccl1
-rw-r--r--Carpet/CarpetIOASCII/interface.ccl3
-rw-r--r--Carpet/CarpetIOASCII/src/ioascii.cc10
-rw-r--r--Carpet/CarpetIOBasic/interface.ccl3
-rw-r--r--Carpet/CarpetIOBasic/src/iobasic.cc12
-rw-r--r--Carpet/CarpetIOHDF5/interface.ccl3
-rw-r--r--Carpet/CarpetIOHDF5/src/Output.cc5
-rw-r--r--Carpet/CarpetIOHDF5/src/OutputSlice.cc6
-rw-r--r--Carpet/CarpetIOScalar/interface.ccl3
-rw-r--r--Carpet/CarpetIOScalar/src/ioscalar.cc8
-rw-r--r--Carpet/CarpetInterp/interface.ccl2
-rw-r--r--Carpet/CarpetInterp/src/interp.cc5
-rw-r--r--Carpet/CarpetLib/interface.ccl2
-rw-r--r--Carpet/CarpetLib/src/commstate.cc6
-rw-r--r--Carpet/CarpetLib/src/copy_3d.cc6
-rw-r--r--Carpet/CarpetLib/src/copy_4d.cc6
-rw-r--r--Carpet/CarpetLib/src/data.cc6
-rw-r--r--Carpet/CarpetLib/src/gf.cc6
-rw-r--r--Carpet/CarpetLib/src/instantiate178
-rw-r--r--Carpet/CarpetLib/src/interpolate_3d_2tl.cc6
-rw-r--r--Carpet/CarpetLib/src/interpolate_3d_3tl.cc6
-rw-r--r--Carpet/CarpetLib/src/interpolate_3d_4tl.cc6
-rw-r--r--Carpet/CarpetLib/src/interpolate_3d_5tl.cc6
-rw-r--r--Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc6
-rw-r--r--Carpet/CarpetLib/src/mem.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_cc_o0_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_cc_o1_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_cc_o2_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_cc_rf2.cc12
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o11_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o1_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o3_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o5_monotone_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o5_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o7_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_3d_o9_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/prolongate_4d_o1_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/restrict_3d_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/restrict_4d_rf2.cc6
-rw-r--r--Carpet/CarpetLib/src/typecase.hh (renamed from Carpet/Carpet/src/typecase)82
-rw-r--r--Carpet/CarpetLib/src/typeprops.hh45
-rw-r--r--Carpet/CarpetReduce/interface.ccl3
-rw-r--r--Carpet/CarpetReduce/src/reduce.cc16
48 files changed, 230 insertions, 338 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/CarpetEvolutionMask/interface.ccl b/Carpet/CarpetEvolutionMask/interface.ccl
index 9cea0b632..ee09bf695 100644
--- a/Carpet/CarpetEvolutionMask/interface.ccl
+++ b/Carpet/CarpetEvolutionMask/interface.ccl
@@ -13,7 +13,6 @@ USES INCLUDE HEADER: dist.hh
USES INCLUDE HEADER: vect.hh
USES INCLUDE HEADER: carpet.hh
-USES INCLUDE HEADER: carpet_typecase.hh
diff --git a/Carpet/CarpetIOASCII/interface.ccl b/Carpet/CarpetIOASCII/interface.ccl
index 5de734da9..709c7ba5d 100644
--- a/Carpet/CarpetIOASCII/interface.ccl
+++ b/Carpet/CarpetIOASCII/interface.ccl
@@ -15,7 +15,8 @@ uses include header: gdata.hh
uses include header: gf.hh
uses include header: ggf.hh
-uses include header: carpet_typecase.hh
+uses include header: typecase.hh
+uses include header: typeprops.hh
CCTK_INT last_output_iteration[4] TYPE=scalar
CCTK_REAL last_output_time[4] TYPE=scalar
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc
index 7253de9c5..f120ddd2a 100644
--- a/Carpet/CarpetIOASCII/src/ioascii.cc
+++ b/Carpet/CarpetIOASCII/src/ioascii.cc
@@ -24,6 +24,8 @@
#include "carpet.hh"
#include "CarpetTimers.hh"
+#include "typeprops.hh"
+
#include "ioascii.hh"
@@ -1370,12 +1372,12 @@ namespace CarpetIOASCII {
for (size_t n=0; n<gfdatas.size(); ++n) {
const gdata* gfdata = gfdatas.at(n);
if (n > 0) os << " ";
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: \
os << (*(const data<T>*)gfdata)[index]; \
break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType(vi);
@@ -1443,12 +1445,12 @@ namespace CarpetIOASCII {
for (size_t n=0; n<gfdatas.size(); ++n) {
const gdata* gfdata = gfdatas.at(n);
if (n > 0) os << " ";
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: \
os << (*(const data<T>*)gfdata)[pos]; \
break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType(vi);
diff --git a/Carpet/CarpetIOBasic/interface.ccl b/Carpet/CarpetIOBasic/interface.ccl
index d55a84b38..8e1c7a72e 100644
--- a/Carpet/CarpetIOBasic/interface.ccl
+++ b/Carpet/CarpetIOBasic/interface.ccl
@@ -9,5 +9,6 @@ CCTK_REAL last_output_time TYPE=scalar
CCTK_INT this_iteration TYPE=scalar
USES INCLUDE HEADER: carpet.hh
-USES INCLUDE HEADER: carpet_typecase.hh
+USES INCLUDE HEADER: typecase.hh
+USES INCLUDE HEADER: typeprops.hh
USES INCLUDE HEADER: CarpetTimers.hh
diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc
index 154793c66..8dd73614d 100644
--- a/Carpet/CarpetIOBasic/src/iobasic.cc
+++ b/Carpet/CarpetIOBasic/src/iobasic.cc
@@ -23,6 +23,8 @@
#include "carpet.hh"
#include "CarpetTimers.hh"
+#include "typeprops.hh"
+
using namespace CarpetLib;
@@ -409,7 +411,7 @@ namespace CarpetIOBasic {
void const * const vardataptr = CCTK_VarDataPtrI (cctkGH, 0, n);
assert (vardataptr);
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: \
{ \
@@ -424,7 +426,7 @@ namespace CarpetIOBasic {
cout << val; \
} \
break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType (n);
@@ -444,7 +446,7 @@ namespace CarpetIOBasic {
union {
#define TYPECASE(N,T) T var_##T;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
} result;
@@ -456,7 +458,7 @@ namespace CarpetIOBasic {
cout << " " << setw(width);
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: \
{ \
@@ -471,7 +473,7 @@ namespace CarpetIOBasic {
cout << val; \
} \
break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType (n);
diff --git a/Carpet/CarpetIOHDF5/interface.ccl b/Carpet/CarpetIOHDF5/interface.ccl
index 521e023a9..e14a9c143 100644
--- a/Carpet/CarpetIOHDF5/interface.ccl
+++ b/Carpet/CarpetIOHDF5/interface.ccl
@@ -18,6 +18,9 @@ uses include header: gdata.hh
uses include header: ggf.hh
uses include header: gh.hh
+uses include header: typecase.hh
+uses include header: typeprops.hh
+
CCTK_INT next_output_iteration TYPE=scalar
diff --git a/Carpet/CarpetIOHDF5/src/Output.cc b/Carpet/CarpetIOHDF5/src/Output.cc
index 62f9d9778..70aa35af9 100644
--- a/Carpet/CarpetIOHDF5/src/Output.cc
+++ b/Carpet/CarpetIOHDF5/src/Output.cc
@@ -9,6 +9,7 @@
#include "util_Table.h"
#include "operators.hh"
+#include "typeprops.hh"
#include "CarpetIOHDF5.hh"
#include "CactusBase/IOUtil/src/ioGH.h"
@@ -530,10 +531,10 @@ int WriteVarChunkedParallel (const cGH* const cctkGH,
if (group.disttype == CCTK_DISTRIB_CONSTANT) {
MPI_Datatype datatype;
- switch (group.vartype) {
+ switch (specific_cactus_type(group.vartype)) {
#define TYPECASE(N,T) \
case N: { T dummy; datatype = dist::mpi_datatype(dummy); } break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default: assert (0 and "invalid datatype");
}
diff --git a/Carpet/CarpetIOHDF5/src/OutputSlice.cc b/Carpet/CarpetIOHDF5/src/OutputSlice.cc
index 77d0680e4..09005e9a7 100644
--- a/Carpet/CarpetIOHDF5/src/OutputSlice.cc
+++ b/Carpet/CarpetIOHDF5/src/OutputSlice.cc
@@ -15,6 +15,8 @@
#include "CarpetTimers.hh"
+#include "typeprops.hh"
+
#include "CarpetIOHDF5.hh"
@@ -1393,14 +1395,14 @@ namespace CarpetIOHDF5 {
ivect const pos = ivect(i,i,i);
if(gfext.contains(pos)) {
for (size_t n = 0; n < gfdatas.size(); n++) {
- switch (groupdata.vartype) {
+ switch (specific_cactus_type(groupdata.vartype)) {
#define TYPECASE(N,T) \
case N: { T* typed_buffer = (T*) &buffer.front(); \
typed_buffer[offset + n*npoints] = \
(*(const data<T>*)gfdatas.at(n))[pos]; \
break; \
}
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
}
}
diff --git a/Carpet/CarpetIOScalar/interface.ccl b/Carpet/CarpetIOScalar/interface.ccl
index 1febe145c..8fe7a4359 100644
--- a/Carpet/CarpetIOScalar/interface.ccl
+++ b/Carpet/CarpetIOScalar/interface.ccl
@@ -7,7 +7,8 @@ CCTK_REAL last_output_time TYPE=scalar
CCTK_INT this_iteration TYPE=scalar
USES INCLUDE HEADER: carpet.hh
-USES INCLUDE HEADER: carpet_typecase.hh
+USES INCLUDE HEADER: typecase.hh
+USES INCLUDE HEADER: typeprops.hh
USES INCLUDE HEADER: CarpetTimers.hh
# function to check whether existing output files should be truncated or not
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc
index 02f975d6a..382330d60 100644
--- a/Carpet/CarpetIOScalar/src/ioscalar.cc
+++ b/Carpet/CarpetIOScalar/src/ioscalar.cc
@@ -21,6 +21,8 @@
#include "carpet.hh"
#include "CarpetTimers.hh"
+#include "typeprops.hh"
+
// That's a hack
@@ -397,7 +399,7 @@ namespace CarpetIOScalar {
union {
#define TYPECASE(N,T) T var_##T;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
} result;
@@ -422,12 +424,12 @@ namespace CarpetIOScalar {
if (CCTK_MyProc(cctkGH)==0) {
file << " ";
- switch (vartype) {
+ switch (specific_cactus_type(vartype)) {
#define TYPECASE(N,T) \
case N: \
file << result.var_##T; \
break;
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default:
UnsupportedVarType (n);
diff --git a/Carpet/CarpetInterp/interface.ccl b/Carpet/CarpetInterp/interface.ccl
index 506f0a1db..85d5f38b0 100644
--- a/Carpet/CarpetInterp/interface.ccl
+++ b/Carpet/CarpetInterp/interface.ccl
@@ -9,6 +9,8 @@ uses include header: defs.hh
uses include header: dist.hh
uses include header: ggf.hh
uses include header: timestat.hh
+uses include header: typecase.hh
+uses include header: typeprops.hh
uses include header: vect.hh
uses include header: carpet.hh
diff --git a/Carpet/CarpetInterp/src/interp.cc b/Carpet/CarpetInterp/src/interp.cc
index d6e791261..936b7d5d6 100644
--- a/Carpet/CarpetInterp/src/interp.cc
+++ b/Carpet/CarpetInterp/src/interp.cc
@@ -21,6 +21,7 @@
#include "dist.hh"
#include "ggf.hh"
#include "timestat.hh"
+#include "typeprops.hh"
#include "vect.hh"
#include "carpet.hh"
@@ -701,10 +702,10 @@ namespace CarpetInterp {
vector<char> tmp (N_interp_points * N_output_arrays * vtypesize);
MPI_Datatype datatype;
- switch (vtype) {
+ switch (specific_cactus_type(vtype)) {
#define TYPECASE(N,T) \
case N: { T dummy; datatype = dist::mpi_datatype(dummy); break; }
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
default: { CCTK_WARN (0, "invalid datatype"); abort(); }
}
diff --git a/Carpet/CarpetLib/interface.ccl b/Carpet/CarpetLib/interface.ccl
index 82d9e83f5..8ad84179a 100644
--- a/Carpet/CarpetLib/interface.ccl
+++ b/Carpet/CarpetLib/interface.ccl
@@ -8,6 +8,7 @@ includes header: mpi_string.hh in mpi_string.hh
includes header: defs.hh in defs.hh
includes header: dist.hh in dist.hh
+includes header: typecase.hh in typecase.hh
includes header: typeprops.hh in typeprops.hh
includes header: bbox.hh in bbox.hh
@@ -31,7 +32,6 @@ includes header: th.hh in th.hh
includes header: operators.hh in operators.hh
-uses include header: carpet_typecase.hh
uses include header: CarpetTimers.hh
diff --git a/Carpet/CarpetLib/src/commstate.cc b/Carpet/CarpetLib/src/commstate.cc
index ef1b64cdb..a340c0896 100644
--- a/Carpet/CarpetLib/src/commstate.cc
+++ b/Carpet/CarpetLib/src/commstate.cc
@@ -46,15 +46,15 @@ comm_state::comm_state ()
thestate = state_get_buffer_sizes;
typebufs.resize (dist::c_ndatatypes());
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
{ \
T dummy; \
unsigned const type = dist::c_datatype (dummy); \
typebufs.AT(type).mpi_datatype = dist::mpi_datatype (dummy); \
typebufs.AT(type).datatypesize = sizeof dummy; \
}
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
srequests.reserve (dist::c_ndatatypes() * dist::size());
rrequests.reserve (dist::c_ndatatypes() * dist::size());
diff --git a/Carpet/CarpetLib/src/copy_3d.cc b/Carpet/CarpetLib/src/copy_3d.cc
index 4c0319658..f09a40bb7 100644
--- a/Carpet/CarpetLib/src/copy_3d.cc
+++ b/Carpet/CarpetLib/src/copy_3d.cc
@@ -116,7 +116,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
copy_3d (T const * restrict const src, \
@@ -126,8 +126,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/copy_4d.cc b/Carpet/CarpetLib/src/copy_4d.cc
index 9382ff82a..5b0fcecb2 100644
--- a/Carpet/CarpetLib/src/copy_4d.cc
+++ b/Carpet/CarpetLib/src/copy_4d.cc
@@ -123,7 +123,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
copy_4d (T const * restrict const src, \
@@ -133,8 +133,8 @@ namespace CarpetLib {
ibbox4 const & restrict srcbbox, \
ibbox4 const & restrict dstbbox, \
ibbox4 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc
index 43fe64a32..7b6f4e0a8 100644
--- a/Carpet/CarpetLib/src/data.cc
+++ b/Carpet/CarpetLib/src/data.cc
@@ -1252,7 +1252,7 @@ output (ostream & os)
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template class data<T>;
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/gf.cc b/Carpet/CarpetLib/src/gf.cc
index 696628c59..ef5ae7889 100644
--- a/Carpet/CarpetLib/src/gf.cc
+++ b/Carpet/CarpetLib/src/gf.cc
@@ -87,9 +87,9 @@ ostream& gf<T>::output (ostream& os) const
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template class gf<T>;
-#include "instantiate"
+#include "typecase.hh"
-#undef INSTANTIATE
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/instantiate b/Carpet/CarpetLib/src/instantiate
deleted file mode 100644
index 788211f2f..000000000
--- a/Carpet/CarpetLib/src/instantiate
+++ /dev/null
@@ -1,178 +0,0 @@
-// Instantiate templates for all available types -*-C++-*-
-// (C) 2001 Erik Schnetter <schnetter@uni-tuebingen.de>
-
-// Usage:
-// Define the macro INSTANTIATE(T) to instantiate for the type T,
-// then include this file,
-// then undefine the macro INSTANTIATE.
-
-
-
-// Decide which types to instantiate
-
-#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
-
-
-
-// Instantiate the desired types
-
-#ifdef CARPET_BYTE
-INSTANTIATE(CCTK_BYTE)
-#endif
-
-#ifdef CARPET_INT1
-# ifdef HAVE_CCTK_INT1
-INSTANTIATE(CCTK_INT1)
-# endif
-#endif
-#ifdef CARPET_INT2
-# ifdef HAVE_CCTK_INT2
-INSTANTIATE(CCTK_INT2)
-# endif
-#endif
-#ifdef CARPET_INT4
-# ifdef HAVE_CCTK_INT4
-INSTANTIATE(CCTK_INT4)
-# endif
-#endif
-#ifdef CARPET_INT8
-# ifdef HAVE_CCTK_INT8
-INSTANTIATE(CCTK_INT8)
-# endif
-#endif
-
-#ifdef CARPET_REAL4
-# ifdef HAVE_CCTK_REAL4
-INSTANTIATE(CCTK_REAL4)
-# endif
-#endif
-#ifdef CARPET_REAL8
-# ifdef HAVE_CCTK_REAL8
-INSTANTIATE(CCTK_REAL8)
-# endif
-#endif
-#ifdef CARPET_REAL16
-# ifdef HAVE_CCTK_REAL16
-INSTANTIATE(CCTK_REAL16)
-# endif
-#endif
-
-#ifndef CARPET_NO_COMPLEX
-# ifdef CARPET_COMPLEX8
-# ifdef HAVE_CCTK_COMPLEX8
-INSTANTIATE(CCTK_COMPLEX8)
-# endif
-# endif
-# ifdef CARPET_COMPLEX16
-# ifdef HAVE_CCTK_COMPLEX16
-INSTANTIATE(CCTK_COMPLEX16)
-# endif
-# endif
-# ifdef CARPET_COMPLEX32
-# ifdef HAVE_CCTK_COMPLEX32
-INSTANTIATE(CCTK_COMPLEX32)
-# endif
-# endif
-#endif
diff --git a/Carpet/CarpetLib/src/interpolate_3d_2tl.cc b/Carpet/CarpetLib/src/interpolate_3d_2tl.cc
index 1393369ea..339453f55 100644
--- a/Carpet/CarpetLib/src/interpolate_3d_2tl.cc
+++ b/Carpet/CarpetLib/src/interpolate_3d_2tl.cc
@@ -137,7 +137,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
interpolate_3d_2tl (T const * restrict const src1, \
@@ -151,8 +151,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/interpolate_3d_3tl.cc b/Carpet/CarpetLib/src/interpolate_3d_3tl.cc
index 150fdec0f..41762727b 100644
--- a/Carpet/CarpetLib/src/interpolate_3d_3tl.cc
+++ b/Carpet/CarpetLib/src/interpolate_3d_3tl.cc
@@ -142,7 +142,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
interpolate_3d_3tl (T const * restrict const src1, \
@@ -158,8 +158,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/interpolate_3d_4tl.cc b/Carpet/CarpetLib/src/interpolate_3d_4tl.cc
index 4f0cccc30..0ed5cf3d1 100644
--- a/Carpet/CarpetLib/src/interpolate_3d_4tl.cc
+++ b/Carpet/CarpetLib/src/interpolate_3d_4tl.cc
@@ -150,7 +150,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
interpolate_3d_4tl (T const * restrict const src1, \
@@ -168,8 +168,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/interpolate_3d_5tl.cc b/Carpet/CarpetLib/src/interpolate_3d_5tl.cc
index d8af6833b..f053634c8 100644
--- a/Carpet/CarpetLib/src/interpolate_3d_5tl.cc
+++ b/Carpet/CarpetLib/src/interpolate_3d_5tl.cc
@@ -156,7 +156,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
interpolate_3d_5tl (T const * restrict const src1, \
@@ -176,8 +176,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc b/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc
index e6ca8f681..3c9e5beef 100644
--- a/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc
+++ b/Carpet/CarpetLib/src/interpolate_eno_3d_3tl.cc
@@ -260,7 +260,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
interpolate_eno_3d_3tl (T const * restrict const src1, \
@@ -277,9 +277,9 @@ namespace CarpetLib {
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
#define CARPET_NO_COMPLEX
-#include "instantiate"
+#include "typecase.hh"
#undef CARPET_NO_COMPLEX
-#undef INSTANTIATE
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/mem.cc b/Carpet/CarpetLib/src/mem.cc
index b3840a115..e81e86aa9 100644
--- a/Carpet/CarpetLib/src/mem.cc
+++ b/Carpet/CarpetLib/src/mem.cc
@@ -403,9 +403,9 @@ void CarpetLib_printmemstats (CCTK_ARGUMENTS)
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template class mem<T>;
-#include "instantiate"
+#include "typecase.hh"
-#undef INSTANTIATE
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_cc_o0_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_cc_o0_rf2.cc
index 352f4c380..1a283b2c1 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_cc_o0_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_cc_o0_rf2.cc
@@ -302,7 +302,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_cc_o0_rf2 (T const * restrict const src, \
@@ -312,8 +312,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_cc_o1_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_cc_o1_rf2.cc
index 42fc078ee..6efc14479 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_cc_o1_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_cc_o1_rf2.cc
@@ -372,7 +372,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_cc_o1_rf2 (T const * restrict const src, \
@@ -382,8 +382,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_cc_o2_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_cc_o2_rf2.cc
index f55dfe9fa..e6372f861 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_cc_o2_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_cc_o2_rf2.cc
@@ -527,7 +527,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_cc_o2_rf2 (T const * restrict const src, \
@@ -537,8 +537,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_cc_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_cc_rf2.cc
index 04e00b255..370d91723 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_cc_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_cc_rf2.cc
@@ -156,7 +156,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_cc_rf2_std2prim (T const * restrict const src, \
@@ -166,8 +166,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
@@ -275,7 +275,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_cc_rf2_prim2std (T const * restrict const src, \
@@ -285,8 +285,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o11_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o11_rf2.cc
index 3469b2541..78fa64569 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o11_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o11_rf2.cc
@@ -404,7 +404,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o11_rf2 (T const * restrict const src, \
@@ -414,8 +414,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o1_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o1_rf2.cc
index 0b1ff0751..50e1a4126 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o1_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o1_rf2.cc
@@ -336,7 +336,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o1_rf2 (T const * restrict const src, \
@@ -346,8 +346,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o3_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o3_rf2.cc
index 91b3e5bc1..d97c427b5 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o3_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o3_rf2.cc
@@ -440,7 +440,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o3_rf2 (T const * restrict const src, \
@@ -450,8 +450,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o5_monotone_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o5_monotone_rf2.cc
index 9ac0b2f7e..0cff2b8a0 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o5_monotone_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o5_monotone_rf2.cc
@@ -819,7 +819,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o5_monotone_rf2 (T const * restrict const src, \
@@ -830,9 +830,9 @@ namespace CarpetLib {
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
#define CARPET_NO_COMPLEX
-#include "instantiate"
+#include "typecase.hh"
#undef CARPET_NO_COMPLEX
-#undef INSTANTIATE
+#undef TYPECASE
template <>
void
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o5_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o5_rf2.cc
index 6cbde8cde..c3d9304a7 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o5_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o5_rf2.cc
@@ -660,7 +660,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o5_rf2 (T const * restrict const src, \
@@ -670,8 +670,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o7_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o7_rf2.cc
index 23c513896..8393d4af5 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o7_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o7_rf2.cc
@@ -400,7 +400,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o7_rf2 (T const * restrict const src, \
@@ -410,8 +410,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_3d_o9_rf2.cc b/Carpet/CarpetLib/src/prolongate_3d_o9_rf2.cc
index d600f6de7..1019a4fd7 100644
--- a/Carpet/CarpetLib/src/prolongate_3d_o9_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_3d_o9_rf2.cc
@@ -402,7 +402,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_3d_o9_rf2 (T const * restrict const src, \
@@ -412,8 +412,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/prolongate_4d_o1_rf2.cc b/Carpet/CarpetLib/src/prolongate_4d_o1_rf2.cc
index 4c8022916..95017c3e2 100644
--- a/Carpet/CarpetLib/src/prolongate_4d_o1_rf2.cc
+++ b/Carpet/CarpetLib/src/prolongate_4d_o1_rf2.cc
@@ -584,7 +584,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
prolongate_4d_o1_rf2 (T const * restrict const src, \
@@ -594,8 +594,8 @@ namespace CarpetLib {
ibbox4 const & restrict srcbbox, \
ibbox4 const & restrict dstbbox, \
ibbox4 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc b/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc
index ee9d246cb..a0f74acde 100644
--- a/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc
+++ b/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc
@@ -136,7 +136,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
restrict_3d_cc_rf2 (T const * restrict const src, \
@@ -146,8 +146,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/restrict_3d_rf2.cc b/Carpet/CarpetLib/src/restrict_3d_rf2.cc
index 63470f13f..ba999cd91 100644
--- a/Carpet/CarpetLib/src/restrict_3d_rf2.cc
+++ b/Carpet/CarpetLib/src/restrict_3d_rf2.cc
@@ -117,7 +117,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
restrict_3d_rf2 (T const * restrict const src, \
@@ -127,8 +127,8 @@ namespace CarpetLib {
ibbox3 const & restrict srcbbox, \
ibbox3 const & restrict dstbbox, \
ibbox3 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/CarpetLib/src/restrict_4d_rf2.cc b/Carpet/CarpetLib/src/restrict_4d_rf2.cc
index 600e25178..46f7f1b57 100644
--- a/Carpet/CarpetLib/src/restrict_4d_rf2.cc
+++ b/Carpet/CarpetLib/src/restrict_4d_rf2.cc
@@ -122,7 +122,7 @@ namespace CarpetLib {
-#define INSTANTIATE(T) \
+#define TYPECASE(N,T) \
template \
void \
restrict_4d_rf2 (T const * restrict const src, \
@@ -132,8 +132,8 @@ namespace CarpetLib {
ibbox4 const & restrict srcbbox, \
ibbox4 const & restrict dstbbox, \
ibbox4 const & restrict regbbox);
-#include "instantiate"
-#undef INSTANTIATE
+#include "typecase.hh"
+#undef TYPECASE
diff --git a/Carpet/Carpet/src/typecase b/Carpet/CarpetLib/src/typecase.hh
index 8c87da5cd..cf87394ef 100644
--- a/Carpet/Carpet/src/typecase
+++ b/Carpet/CarpetLib/src/typecase.hh
@@ -10,17 +10,19 @@
// Decide which types to typecase
+// Should all types be used?
#ifdef CARPET_ALL
# undef CARPET_BYTE
-# undef CARPET_INT
-# undef CARPET_REAL
-# undef CARPET_COMPLEX
+# undef CARPET_ALL_INT
+# undef CARPET_ALL_REAL
+# undef CARPET_ALL_COMPLEX
# define CARPET_BYTE
-# define CARPET_INT
-# define CARPET_REAL
-# define CARPET_COMPLEX
+# define CARPET_ALL_INT
+# define CARPET_ALL_REAL
+# define CARPET_ALL_COMPLEX
#endif
+// Should all integer/real/complex types be used?
#ifdef CARPET_ALL_INT
# undef CARPET_INT1
# undef CARPET_INT2
@@ -50,16 +52,28 @@
# 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)
+// If no types are specified, use a sensible default
+#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
+// Translate the default types to their specific counterparts
#ifdef CARPET_INT
# ifdef CCTK_INTEGER_PRECISION_1
# undef CARPET_INT1
@@ -109,27 +123,15 @@
-// // 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_INT
+// TYPECASE(CCTK_VARIABLE_INT, CCTK_INT)
+// #endif
#ifdef CARPET_INT1
# ifdef HAVE_CCTK_INT1
TYPECASE(CCTK_VARIABLE_INT1, CCTK_INT1)
@@ -151,9 +153,9 @@ TYPECASE(CCTK_VARIABLE_INT8, CCTK_INT8)
# endif
#endif
-#ifdef CARPET_REAL
-TYPECASE(CCTK_VARIABLE_REAL, CCTK_REAL)
-#endif
+// #ifdef CARPET_REAL
+// TYPECASE(CCTK_VARIABLE_REAL, CCTK_REAL)
+// #endif
#ifdef CARPET_REAL4
# ifdef HAVE_CCTK_REAL4
TYPECASE(CCTK_VARIABLE_REAL4, CCTK_REAL4)
@@ -170,21 +172,23 @@ 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
+#ifndef CARPET_NO_COMPLEX
+// # 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
-#endif
-#ifdef CARPET_COMPLEX16
-# ifdef HAVE_CCTK_COMPLEX16
+# ifdef CARPET_COMPLEX16
+# ifdef HAVE_CCTK_COMPLEX16
TYPECASE(CCTK_VARIABLE_COMPLEX16, CCTK_COMPLEX16)
+# endif
# endif
-#endif
-#ifdef CARPET_COMPLEX32
-# ifdef HAVE_CCTK_COMPLEX32
+# ifdef CARPET_COMPLEX32
+# ifdef HAVE_CCTK_COMPLEX32
TYPECASE(CCTK_VARIABLE_COMPLEX32, CCTK_COMPLEX32)
+# endif
# endif
#endif
diff --git a/Carpet/CarpetLib/src/typeprops.hh b/Carpet/CarpetLib/src/typeprops.hh
index e8a1ec342..9e82a8a19 100644
--- a/Carpet/CarpetLib/src/typeprops.hh
+++ b/Carpet/CarpetLib/src/typeprops.hh
@@ -41,4 +41,49 @@ struct typeprops <CCTK_COMPLEX32> {
+static inline int specific_cactus_type (int const vartype)
+{
+ switch (vartype) {
+ case CCTK_VARIABLE_INT:
+#ifdef CCTK_INTEGER_PRECISION_1
+ return CCTK_VARIABLE_INT1;
+#endif
+#ifdef CCTK_INTEGER_PRECISION_2
+ return CCTK_VARIABLE_INT2;
+#endif
+#ifdef CCTK_INTEGER_PRECISION_4
+ return CCTK_VARIABLE_INT4;
+#endif
+#ifdef CCTK_INTEGER_PRECISION_8
+ return CCTK_VARIABLE_INT8;
+#endif
+ return -1;
+ case CCTK_VARIABLE_REAL:
+#ifdef CCTK_REAL_PRECISION_4
+ return CCTK_VARIABLE_REAL4;
+#endif
+#ifdef CCTK_REAL_PRECISION_8
+ return CCTK_VARIABLE_REAL8;
+#endif
+#ifdef CCTK_REAL_PRECISION_16
+ return CCTK_VARIABLE_REAL16;
+#endif
+ return -1;
+ case CCTK_VARIABLE_COMPLEX:
+#ifdef CCTK_REAL_PRECISION_4
+ return CCTK_VARIABLE_COMPLEX8;
+#endif
+#ifdef CCTK_REAL_PRECISION_8
+ return CCTK_VARIABLE_COMPLEX16;
+#endif
+#ifdef CCTK_REAL_PRECISION_16
+ return CCTK_VARIABLE_COMPLEX32;
+#endif
+ return -1;
+ }
+ return vartype;
+}
+
+
+
#endif // #ifndef TYPEPROPS_HH
diff --git a/Carpet/CarpetReduce/interface.ccl b/Carpet/CarpetReduce/interface.ccl
index 467607cb5..98d9c3d86 100644
--- a/Carpet/CarpetReduce/interface.ccl
+++ b/Carpet/CarpetReduce/interface.ccl
@@ -8,7 +8,8 @@ uses include header: vect.hh
uses include header: carpet.hh
-uses include header: carpet_typecase.hh
+uses include header: typecase.hh
+uses include header: typeprops.hh
uses include header: loopcontrol.h
diff --git a/Carpet/CarpetReduce/src/reduce.cc b/Carpet/CarpetReduce/src/reduce.cc
index b72c089f9..cebda71db 100644
--- a/Carpet/CarpetReduce/src/reduce.cc
+++ b/Carpet/CarpetReduce/src/reduce.cc
@@ -687,7 +687,7 @@ namespace CarpetReduce {
for (int n=0; n<num_outvals; ++n) {
- switch (outtype) {
+ switch (specific_cactus_type(outtype)) {
#define INITIALISE(OP,S) \
case do_##OP: { \
typedef typeconv<S>::goodtype T; \
@@ -715,7 +715,7 @@ namespace CarpetReduce {
} \
break; \
}
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
#undef INITIALISE
default:
@@ -757,7 +757,7 @@ namespace CarpetReduce {
for (int m=0; m<num_inarrays; ++m) {
for (int n=0; n<lsize; ++n) {
- switch (outtype) {
+ switch (specific_cactus_type(outtype)) {
#define COPY(S) \
{ \
typedef typeconv<S>::goodtype T; \
@@ -769,7 +769,7 @@ namespace CarpetReduce {
COPY(T); \
break; \
}
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
#undef COPY
default:
@@ -831,7 +831,7 @@ namespace CarpetReduce {
myinarrays.at(tl) = inarrays.at(tl)[n];
}
- switch (outtype) {
+ switch (specific_cactus_type(outtype)) {
#define REDUCE(OP,S) \
case do_##OP: { \
typedef typeconv<S>::goodtype T; \
@@ -862,7 +862,7 @@ namespace CarpetReduce {
} \
break; \
}
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
#undef REDUCE
default:
@@ -942,7 +942,7 @@ namespace CarpetReduce {
for (int n=0; n<num_outvals; ++n) {
- switch (outtype) {
+ switch (specific_cactus_type(outtype)) {
#define FINALISE(OP,S) \
case do_##OP: { \
typedef typeconv<S>::goodtype T; \
@@ -970,7 +970,7 @@ namespace CarpetReduce {
} \
break; \
}
-#include "carpet_typecase.hh"
+#include "typecase.hh"
#undef TYPECASE
#undef FINALISE
default: