aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryye00 <yye00@0337457d-221f-4ee6-a5f0-14255d5370d8>2004-08-12 22:10:01 +0000
committeryye00 <yye00@0337457d-221f-4ee6-a5f0-14255d5370d8>2004-08-12 22:10:01 +0000
commit1e40450c3dd3ee7d6a13bfbb6adb595eb09eba1c (patch)
tree7c45c10e01426ecfdeedd15f47f2220bdd5ff1f9
parent7fa05348da5b4413624195108003ab38d0e12887 (diff)
assert fix
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CoordBase/trunk@20 0337457d-221f-4ee6-a5f0-14255d5370d8
-rw-r--r--src/CoordBase.c5
-rw-r--r--src/Domain.c156
2 files changed, 104 insertions, 57 deletions
diff --git a/src/CoordBase.c b/src/CoordBase.c
index c53837a..c73f438 100644
--- a/src/CoordBase.c
+++ b/src/CoordBase.c
@@ -10,7 +10,7 @@
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
+
#include "cctk.h"
#include "util_Table.h"
@@ -552,7 +552,8 @@ CCTK_INT CoordBase_GroupSystem(CCTK_POINTER_TO_CONST GH,
/* Check for a default for all GF variables of this dimension */
gindex = CCTK_GroupIndex(groupname);
- assert(gindex>=0);
+ if(gindex<0)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "group index is out of bounds");
if (system_handle == -9999 && CCTK_GroupTypeI(gindex) == CCTK_GF)
{
GHex = CCTK_GHExtension(GH,"CoordBase");
diff --git a/src/Domain.c b/src/Domain.c
index 004bf6a..d4bb897 100644
--- a/src/Domain.c
+++ b/src/Domain.c
@@ -1,6 +1,6 @@
/* $Header$ */
-#include <assert.h>
+
#include "cctk.h"
#include "cctk_Parameters.h"
@@ -16,14 +16,20 @@ CCTK_INT CoordBase_GetBoundarySpecification
{
DECLARE_CCTK_PARAMETERS;
- assert (size>=0);
- assert (nboundaryzones);
- assert (is_internal);
- assert (is_staggered);
- assert (shiftout);
-
- assert (size == 6);
-
+ if(! (size>=0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is less than zero");
+ if(! (nboundaryzones))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "nboundaryzones is out of bounds");
+ if(! (is_internal))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "is_internal is out of bounds");
+ if(! (is_staggered))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "is_staggered is out of bounds");
+ if(! (shiftout))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "shiftout is out of bounds");
+
+ if(! (size == 6))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
+
nboundaryzones[0] = boundary_size_x_lower;
nboundaryzones[1] = boundary_size_x_upper;
nboundaryzones[2] = boundary_size_y_lower;
@@ -71,17 +77,25 @@ CCTK_INT CoordBase_GetDomainSpecification
int ierr;
- assert (size>=0);
- assert (physical_min);
- assert (physical_max);
- assert (interior_min);
- assert (interior_max);
- assert (exterior_min);
- assert (exterior_max);
- assert (thespacing);
-
- assert (size == 3);
-
+ if(! (size>=0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
+ if(! (physical_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_min is out of bounds");
+ if(! (physical_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_max is out of bounds");
+ if(! (interior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_min is out of bounds");
+ if(! (interior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_max is out of bounds");
+ if(! (exterior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_min is out of bounds");
+ if(! (exterior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_max is out of bounds");
+ if(! (thespacing))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "thespacing is out of bounds");
+
+ if(! (size == 3))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
if (CCTK_EQUALS (domainsize, "minmax")) {
@@ -163,13 +177,15 @@ CCTK_INT CoordBase_GetDomainSpecification
thespacing[2] = dz;
} else {
- assert (0);
+ if (0)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "domainsize is out of bounds");
}
ierr = ConvertFromPhysicalBoundary
(size, physical_min, physical_max, interior_min, interior_max,
exterior_min, exterior_max, thespacing);
- assert (!ierr);
+ if(ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "Error returned from ConvertFromPhysicalBoundary");
return 0;
}
@@ -194,20 +210,30 @@ CCTK_INT CoordBase_ConvertFromPhysicalBoundary
int d;
int ierr;
- assert (size>=0);
- assert (physical_min);
- assert (physical_max);
- assert (interior_min);
- assert (interior_max);
- assert (exterior_min);
- assert (exterior_max);
- assert (thespacing);
-
- assert (size == 3);
+ if(! (size>=0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
+ if(! (physical_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_min is out of bounds");
+ if(! (physical_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_max is out of bounds");
+ if(! (interior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_min is out of bounds");
+ if(! (interior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_max is out of bounds");
+ if(! (exterior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_min is out of bounds");
+ if(! (exterior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_max is out of bounds");
+ if(! (thespacing))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "thespacing is out of bounds");
+
+ if(! (size == 3))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
ierr = CoordBase_GetBoundarySpecification
(6, nboundaryzones, is_internal, is_staggered, shiftout);
- assert (!ierr);
+ if (ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "error returned from function CoordBase_GetBoundarySpecification");
for (d=0; d<3; ++d) {
@@ -248,20 +274,30 @@ CCTK_INT CoordBase_ConvertFromInteriorBoundary
int d;
int ierr;
- assert (size>=0);
- assert (physical_min);
- assert (physical_max);
- assert (interior_min);
- assert (interior_max);
- assert (exterior_min);
- assert (exterior_max);
- assert (thespacing);
-
- assert (size == 3);
+ if(! (size>=0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
+ if(! (physical_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_min is out of bounds");
+ if(! (physical_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_max is out of bounds");
+ if(! (interior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_min is out of bounds");
+ if(! (interior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_max is out of bounds");
+ if(! (exterior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_min is out of bounds");
+ if(! (exterior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_max is out of bounds");
+ if(! (thespacing))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "thespacing is out of bounds");
+
+ if(! (size == 3))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
ierr = CoordBase_GetBoundarySpecification
(6, nboundaryzones, is_internal, is_staggered, shiftout);
- assert (!ierr);
+ if (ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CactusBase", "error returned from function CoordBase_GetBoundarySpecification");
for (d=0; d<3; ++d) {
@@ -302,20 +338,30 @@ CCTK_INT CoordBase_ConvertFromExteriorBoundary
int d;
int ierr;
- assert (size>=0);
- assert (physical_min);
- assert (physical_max);
- assert (interior_min);
- assert (interior_max);
- assert (exterior_min);
- assert (exterior_max);
- assert (thespacing);
-
- assert (size == 3);
+ if(! (size>=0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
+ if(! (physical_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_min is out of bounds");
+ if(! (physical_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "physical_max is out of bounds");
+ if(! (interior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_min is out of bounds");
+ if(! (interior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "interior_max is out of bounds");
+ if(! (exterior_min))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_min is out of bounds");
+ if(! (exterior_max))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "exterior_max is out of bounds");
+ if(! (thespacing))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "thespacing is out of bounds");
+
+ if(! (size == 3))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "size is out of bounds");
ierr = CoordBase_GetBoundarySpecification
(6, nboundaryzones, is_internal, is_staggered, shiftout);
- assert (!ierr);
+ if (ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CoordBase", "Error returned from CoordBase_GetBoundarySpecification");
for (d=0; d<3; ++d) {