aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2005-01-01 18:22:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2005-01-01 18:22:00 +0000
commit2a38d7eb6a6db8b150a9f6fd5f1c844b8d0ef74a (patch)
tree1c5e763b0ffee9744ee708d6016bdbd36b8f8312 /Carpet/CarpetLib/src/defs.hh
parent049cec8e042a508511fdb0f0948de63f84f9b8be (diff)
global: Turn CarpetLib templates into classes
Turn most of the templates in CarpetLib, which used to have the form template<int D> class XXX into classes, i.e., into something like class XXX by setting D to the new global integer constant dim, which in turn is set to 3. The templates gf and data, which used to be of the form template<typename T, int D> class XXX are now of the form template<typename T> class XXX The templates vect, bbox, and bboxset remain templates. This change simplifies the code somewhat. darcs-hash:20050101182234-891bb-c3063528841f0d078b12cc506309ea27d8ce730d.gz
Diffstat (limited to 'Carpet/CarpetLib/src/defs.hh')
-rw-r--r--Carpet/CarpetLib/src/defs.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 54219ecc3..0ca508771 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -18,11 +18,37 @@
#include "cctk.h"
+
+
using namespace std;
+
+
+// Number of dimensions
+const int dim = 3;
+
+
+
+// Some shortcuts for type names
+template<typename T, int D> class bbox;
+template<typename T, int D> class bboxset;
+template<typename T, int D> class vect;
+
+typedef vect<bool,dim> bvect;
+typedef vect<int,dim> ivect;
+typedef bbox<int,dim> ibbox;
+typedef bboxset<int,dim> ibset;
+
+typedef vect<vect<bool,2>,dim> bbvect;
+typedef vect<vect<int,2>,dim> iivect;
+
+
+
// A general type
enum centering { vertex_centered, cell_centered };
+
+
// Useful helper
template<class T>
inline T square (const T& x) { return x*x; }