aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetSlab/src/slab.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2004-11-17 02:42:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2004-11-17 02:42:00 +0000
commitbb3c1a0365b96773987383b7c31c15369577f099 (patch)
treefd5792fd30e31bee2fff8123641c09f4d855c49e /Carpet/CarpetSlab/src/slab.cc
parentb7ad179f0d89db134e626451a3836b1aaa57612f (diff)
CarpetSlab: Switch to singlemap mode before accessing cctk_gsh
darcs-hash:20041117024250-891bb-aa469ef874902146d300c229edf6f55ae06096f2.gz
Diffstat (limited to 'Carpet/CarpetSlab/src/slab.cc')
-rw-r--r--Carpet/CarpetSlab/src/slab.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/Carpet/CarpetSlab/src/slab.cc b/Carpet/CarpetSlab/src/slab.cc
index ff2ee5cfa..d50ee25a1 100644
--- a/Carpet/CarpetSlab/src/slab.cc
+++ b/Carpet/CarpetSlab/src/slab.cc
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
+#include <algorithm>
#include <vector>
#include "cctk.h"
@@ -32,6 +33,7 @@ extern "C" {
namespace CarpetSlab {
+ using namespace std;
using namespace Carpet;
@@ -132,7 +134,7 @@ namespace CarpetSlab {
// Check extent
for (int dd=0; dd<hdim; ++dd) {
- assert (origin[dirs[dd]-1] + length[dd] <= sizes[dirs[dd]]);
+ assert (origin[dirs[dd]-1] + length[dd] <= sizes[dirs[dd]-1]);
}
// Get insider information about variable
@@ -154,6 +156,17 @@ namespace CarpetSlab {
// Determine own rank
const int rank = CCTK_MyProc(cgh);
+ // Sanity check
+ // (if this fails, someone requested an insane number of grid points)
+ {
+ int max = INT_MAX;
+ for (int dd=0; dd<dim; ++dd) {
+ assert (length[dd] >= 0 && length[dd] <= max);
+ if (length[dd] > 0) max /= length[dd];
+ }
+ assert (typesize <= max);
+ }
+
// Calculate global size
int totalsize = 1;
for (int dd=0; dd<hdim; ++dd) {