aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryye00 <yye00@c78560ca-4b45-4335-b268-5f3340f3cb52>2004-08-12 22:09:28 +0000
committeryye00 <yye00@c78560ca-4b45-4335-b268-5f3340f3cb52>2004-08-12 22:09:28 +0000
commit68d84887d2e77932896c94133376b81c65e45d37 (patch)
tree631a345f0b988e920169ffb15923049971f2b107
parent238667eeb97030f71c6635b8e63c70dbba179602 (diff)
assert fix
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@210 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r--src/CartGrid3D.c12
-rw-r--r--src/Symmetry.c38
2 files changed, 33 insertions, 17 deletions
diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c
index c9ea97c..938cdc8 100644
--- a/src/CartGrid3D.c
+++ b/src/CartGrid3D.c
@@ -9,7 +9,7 @@
@enddesc
@@*/
-#include <assert.h>
+
#include <stdio.h>
#include <math.h>
@@ -269,7 +269,9 @@ void CartGrid3D(CCTK_ARGUMENTS)
ierr = GetDomainSpecification
(3, physical_min, physical_max, interior_min, interior_max,
exterior_min, exterior_max, spacing);
- assert (!ierr);
+ if (ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error returned from function GetDomainSpecification");
+
/* Adapt to convergence level */
for (d=0; d<3; ++d) {
@@ -279,7 +281,8 @@ void CartGrid3D(CCTK_ARGUMENTS)
ierr = ConvertFromPhysicalBoundary
(3, physical_min, physical_max, interior_min, interior_max,
exterior_min, exterior_max, spacing);
- assert (!ierr);
+ if (ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error returned from function ConvertFromPhysicalBoundary");
for (d=0; d<3; ++d) {
origin[d] = exterior_min[d];
@@ -289,7 +292,8 @@ void CartGrid3D(CCTK_ARGUMENTS)
}
else
{
- assert (0);
+ if (0)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "type is out of bounds");
}
}
diff --git a/src/Symmetry.c b/src/Symmetry.c
index c0a8132..386b578 100644
--- a/src/Symmetry.c
+++ b/src/Symmetry.c
@@ -14,7 +14,7 @@
@version $Id$
@@*/
-#include <assert.h>
+
#include <stdlib.h>
#include "cctk.h"
@@ -89,7 +89,8 @@ int CartSymGI (const cGH *GH, int gindex)
if (numvars > 0 && first_vindex >= 0)
{
char * groupname = CCTK_GroupName (gindex);
- assert (groupname);
+ if (!groupname)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error returned from function CCTK_GroupName");
CCTK_VWarn (3, __LINE__, __FILE__, CCTK_THORNSTRING,
"You should not call the symmetry boundary condition routines for the group \"%s\" through the CartSym* routines any more. The symmetry boundary conditions are now applied automatically when a physical boundary condition is applied.", groupname);
free (groupname);
@@ -201,7 +202,8 @@ int CartSymVI (const cGH *GH, int vindex)
if (gindex >= 0)
{
char * fullname = CCTK_FullName (vindex);
- assert (fullname);
+ if (!fullname)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error returned from function CCTK_FullName");
CCTK_VWarn (3, __LINE__, __FILE__, CCTK_THORNSTRING,
"You should not call the symmetry boundary condition routines for the variable \"%s\" through the CartSym* routines any more. The symmetry boundary conditions are now applied automatically when a physical boundary condition is applied.", fullname);
free (fullname);
@@ -695,33 +697,43 @@ void CartGrid3D_ApplyBC (CCTK_ARGUMENTS)
int i;
int ierr;
- assert (cctkGH);
+ if (!cctkGH)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "cctkGH undeclared");
nvars = Boundary_SelectedGVs (cctkGH, 0, 0, 0, 0, 0, 0);
- assert (nvars>=0);
+ if (nvars<0)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error returned from function Boundary_selectedGVs");
indices = malloc (nvars * sizeof *indices);
- assert (nvars==0 || indices);
+ if(! (nvars==0 || indices))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
faces = malloc (nvars * sizeof *faces);
- assert (nvars==0 || faces);
+ if(! (nvars==0 || faces))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
widths = malloc (nvars * sizeof *widths);
- assert (nvars==0 || widths);
+ if(! (nvars==0 || widths))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
tables = malloc (nvars * sizeof *tables);
- assert (nvars==0 || tables);
+ if(! (nvars==0 || tables))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
ierr = Boundary_SelectedGVs
(cctkGH, nvars, indices, faces, widths, tables, 0);
- assert (ierr == nvars);
+ if(! (ierr == nvars))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
for (i=0; i<nvars; ++i) {
vi = indices[i];
- assert (vi>=0 && vi<CCTK_NumVars());
+ if(! (vi>=0 && vi<CCTK_NumVars()))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
gi = CCTK_GroupIndexFromVarI (vi);
- assert (gi>=0);
+ if( (gi<0))
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
ierr = ApplySymmetry (cctkGH, gi, vi, 1);
- assert (!ierr);
+ if(ierr)
+ CCTK_VWarn ( 0, __LINE__, __FILE__, "CartGrid3D", "error in function CartGrid3D_ApplyBC");
}
free (indices);