From 68d84887d2e77932896c94133376b81c65e45d37 Mon Sep 17 00:00:00 2001 From: yye00 Date: Thu, 12 Aug 2004 22:09:28 +0000 Subject: assert fix git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@210 c78560ca-4b45-4335-b268-5f3340f3cb52 --- src/CartGrid3D.c | 12 ++++++++---- src/Symmetry.c | 38 +++++++++++++++++++++++++------------- 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 + #include #include @@ -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 + #include #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=0 && vi=0 && vi=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); -- cgit v1.2.3