From 986e26469db4081d628ac049ff40a2faa707accd Mon Sep 17 00:00:00 2001 From: schnetter Date: Wed, 4 Feb 2004 09:57:20 +0000 Subject: The number of ghost zones is now per surfaces. Do more error checking. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/SphericalSurface/trunk@6 40f6ab95-0e4f-0410-8daa-ee8d7420be1d --- src/setup.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/setup.c b/src/setup.c index fc6420c..f2d5649 100644 --- a/src/setup.c +++ b/src/setup.c @@ -21,8 +21,10 @@ void SphericalSurfaceInfo_Setup (CCTK_ARGUMENTS) for (n=0; n= 3*nghoststheta && ntheta[n] <= maxntheta); - assert (nphi[n] >= 3*nghostsphi && nphi[n] <= maxnphi); + assert (nghoststheta[n] >= 0 && nghoststheta[n] <= maxnghoststheta); + assert (nghostsphi[n] >= 0 && nghostsphi[n] <= maxnghostsphi); + assert (ntheta[n] >= 3*nghoststheta[n] && ntheta[n] <= maxntheta); + assert (nphi[n] >= 3*nghostsphi[n] && nphi[n] <= maxnphi); @@ -31,14 +33,14 @@ void SphericalSurfaceInfo_Setup (CCTK_ARGUMENTS) if (symmetric_z[n]) { /* upper hemisphere: z>=0, theta in (0, pi/2) */ - sf_delta_theta[n] = pi/2 / (ntheta[n] - 2*nghoststheta - 0.5); - sf_origin_theta[n] = - (nghoststheta - 0.5) * sf_delta_theta[n]; + sf_delta_theta[n] = pi/2 / (ntheta[n] - 2*nghoststheta[n] - 0.5); + sf_origin_theta[n] = - (nghoststheta[n] - 0.5) * sf_delta_theta[n]; } else { /* both hemispheres: theta in (0, pi) */ - sf_delta_theta[n] = pi / (ntheta[n] - 2*nghoststheta); - sf_origin_theta[n] = - (nghoststheta - 0.5) * sf_delta_theta[n]; + sf_delta_theta[n] = pi / (ntheta[n] - 2*nghoststheta[n]); + sf_origin_theta[n] = - (nghoststheta[n] - 0.5) * sf_delta_theta[n]; } @@ -50,32 +52,32 @@ void SphericalSurfaceInfo_Setup (CCTK_ARGUMENTS) if (symmetric_y[n]) { /* one quadrant: x>=0, y>=0, phi in [0, pi/2] */ - assert (nphi[n] - 2*nghostsphi >= 1); - sf_delta_phi[n] = pi/2 / (nphi[n] - 2*nghostsphi - 1); - sf_origin_phi[n] = - nghostsphi * sf_delta_phi[n]; + assert (nphi[n] - 2*nghostsphi[n] >= 1); + sf_delta_phi[n] = pi/2 / (nphi[n] - 2*nghostsphi[n] - 1); + sf_origin_phi[n] = - nghostsphi[n] * sf_delta_phi[n]; } else { /* two quadrants: x>=0, phi in [-pi/2, pi/2] */ - assert (nphi[n] - 2*nghostsphi >= 2); - sf_delta_phi[n] = pi / (nphi[n] - 2*nghostsphi - 1); - sf_origin_phi[n] = - pi/2 - nghostsphi * sf_delta_phi[n]; + assert (nphi[n] - 2*nghostsphi[n] >= 2); + sf_delta_phi[n] = pi / (nphi[n] - 2*nghostsphi[n] - 1); + sf_origin_phi[n] = - pi/2 - nghostsphi[n] * sf_delta_phi[n]; } } else { if (symmetric_y[n]) { /* two quadrants: y>=0, phi in [0, pi] */ - assert (nphi[n] - 2*nghostsphi >= 2); - sf_delta_phi[n] = pi / (nphi[n] - 2*nghostsphi - 1); - sf_origin_phi[n] = - nghostsphi * sf_delta_phi[n]; + assert (nphi[n] - 2*nghostsphi[n] >= 2); + sf_delta_phi[n] = pi / (nphi[n] - 2*nghostsphi[n] - 1); + sf_origin_phi[n] = - nghostsphi[n] * sf_delta_phi[n]; } else { /* all quadrants: phi in [0, 2pi) */ - assert (nphi[n] - 2*nghostsphi >= 4); - sf_delta_phi[n] = 2*pi / (nphi[n] - 2*nghostsphi); - sf_origin_phi[n] = - nghostsphi * sf_delta_phi[n]; + assert (nphi[n] - 2*nghostsphi[n] >= 4); + sf_delta_phi[n] = 2*pi / (nphi[n] - 2*nghostsphi[n]); + sf_origin_phi[n] = - nghostsphi[n] * sf_delta_phi[n]; } } -- cgit v1.2.3