aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src
diff options
context:
space:
mode:
authorIan Hinder <hinder@paulaner.gravity.psu.edu>2008-03-19 20:14:55 -0400
committerIan Hinder <hinder@paulaner.gravity.psu.edu>2008-03-19 20:14:55 -0400
commit8e2769a2bb1a190d5b3b715b745dd30695896b77 (patch)
treef16d28c2e950e9348434c842a8029f8a955383b4 /Carpet/CarpetLib/src
parent23e0c81e9706f883c0b6d46e88f8f9ea8e092f93 (diff)
parentcaf64a5d4888ee9afb5bdc204c2b42647c586d63 (diff)
Merge branch 'master' of git://carpetcode.dyndns.org/carpet
Diffstat (limited to 'Carpet/CarpetLib/src')
-rw-r--r--Carpet/CarpetLib/src/bbox.cc11
-rw-r--r--Carpet/CarpetLib/src/gh.cc53
2 files changed, 35 insertions, 29 deletions
diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc
index 97a8641ef..214f26a66 100644
--- a/Carpet/CarpetLib/src/bbox.cc
+++ b/Carpet/CarpetLib/src/bbox.cc
@@ -2,6 +2,7 @@
#include <cassert>
#include <iostream>
#include <limits>
+#include <typeinfo>
#include "cctk.h"
@@ -27,8 +28,9 @@ void bbox<T,D>::assert_bbox_limits () const
any (_upper >= numeric_limits<T>::max() / 2) or
any (_upper <= numeric_limits<T>::min() / 2))
{
- CCTK_WARN (CCTK_WARN_ABORT,
- "Tried to create a very large bbox -- it is likely that this would lead to an integer overflow");
+ CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Tried to create a very large bbox of type %s -- it is likely that this would lead to an integer overflow",
+ typeid(*this).name());
}
}
}
@@ -46,8 +48,9 @@ typename bbox<T,D>::size_type bbox<T,D>::size () const {
size_type sz = 1, max = numeric_limits<size_type>::max();
for (int d=0; d<D; ++d) {
if (sh[d] > max) {
- CCTK_WARN (CCTK_WARN_ABORT,
- "bbox size is too large -- integer overflow");
+ CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "size of bbox of type %s is too large -- integer overflow",
+ typeid(*this).name());
}
sz *= sh[d];
max /= sh[d];
diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc
index 6a7738048..fa9ff2125 100644
--- a/Carpet/CarpetLib/src/gh.cc
+++ b/Carpet/CarpetLib/src/gh.cc
@@ -108,7 +108,7 @@ regrid (mregs const & regs)
// Check component consistency
for (int ml=0; ml<mglevels(); ++ml) {
for (int rl=0; rl<reflevels(); ++rl) {
- assert (components(rl)>0);
+ assert (components(rl)>=0);
for (int c=0; c<components(rl); ++c) {
ibbox const & b = extent(ml,rl,c);
ibbox const & b0 = extent(ml,rl,0);
@@ -136,31 +136,34 @@ regrid (mregs const & regs)
bool have_error = false;
for (int ml=0; ml<mglevels(); ++ml) {
for (int rl=1; rl<reflevels(); ++rl) {
- assert (all (extent(ml,rl,0).stride() * reffacts.AT(rl) ==
- extent(ml,rl-1,0).stride() * reffacts.AT(rl-1)));
- // Check contained-ness:
- // first take all coarse grids
- ibset coarse;
- for (int c=0; c<components(rl-1); ++c) {
- coarse += extent(ml,rl-1,c);
- }
- coarse.normalize();
- // then check all fine grids
- for (int c=0; c<components(rl); ++c) {
- ibbox const & fine =
- extent(ml,rl,c).contracted_for(extent(ml,rl-1,0));
- if (not (fine <= coarse)) {
- if (not have_error) {
- cout << "The following components are not properly nested, i.e.," << endl
- << "they are not contained within the next coarser level's components:" << endl;
- have_error = true;
- }
- cout << " ml " << ml << " rl " << rl << " c " << c << ": "
- << fine << endl;
+ if (components(rl)>0) {
+ assert (components(rl-1)>0);
+ assert (all (extent(ml,rl,0).stride() * reffacts.AT(rl) ==
+ extent(ml,rl-1,0).stride() * reffacts.AT(rl-1)));
+ // Check contained-ness:
+ // first take all coarse grids
+ ibset coarse;
+ for (int c=0; c<components(rl-1); ++c) {
+ coarse += extent(ml,rl-1,c);
}
- } // for c
- } // for rl
- } // for ml
+ coarse.normalize();
+ // then check all fine grids
+ for (int c=0; c<components(rl); ++c) {
+ ibbox const & fine =
+ extent(ml,rl,c).contracted_for(extent(ml,rl-1,0));
+ if (not (fine <= coarse)) {
+ if (not have_error) {
+ cout << "The following components are not properly nested, i.e.," << endl
+ << "they are not contained within the next coarser level's components:" << endl;
+ have_error = true;
+ }
+ cout << " ml " << ml << " rl " << rl << " c " << c << ": "
+ << fine << endl;
+ }
+ } // for c
+ } // if c
+ } // for rl
+ } // for ml
if (have_error) {
cout << "The grid hierarchy is:" << endl;
for (int ml=0; ml<mglevels(); ++ml) {