From 4ce71a1912ddf9a035a7eabb8fe1107fa0d0e8aa Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 15 May 2012 05:03:37 +0000 Subject: slitely change the way ADMMass computes corners/edges. This doesn't change results much (as long as domain is centered), but enough for testsuites to be regenerated - and it fixes off-centered domains git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/ADMMass/trunk@50 54511f98-0e4f-0410-826e-eb8b393f5a1e --- src/surface_integral.c | 62 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 25 deletions(-) (limited to 'src/surface_integral.c') diff --git a/src/surface_integral.c b/src/surface_integral.c index 30b3572..e4b6e0d 100644 --- a/src/surface_integral.c +++ b/src/surface_integral.c @@ -215,36 +215,48 @@ void ADMMass_Surface(CCTK_ARGUMENTS) ds[1] = 0.0; ds[2] = 0.0; - /* Select the points on the surfaces of the requested cube, - paying attention not to compute the corners (and the edges) - more than once. */ - - /* the whole face of the cube */ - if (i == x_min_i) ds[0] = -oneDY*oneDZ; - - /* the whole face of the cube */ - if (i == x_max_i) ds[0] = oneDY*oneDZ; - - /* face, excluding the two corners (and the four edges) that - were already computed above*/ - if ((j == y_min_j) && (i != x_min_i) && (i != x_max_i)) - ds[1] = -oneDX*oneDZ; + /* Select the points on the surfaces of the requested cube */ + CCTK_INT n_bound = 0; + if (i == x_min_i) + { + n_bound++; + ds[0] = -oneDY*oneDZ; + } + if (i == x_max_i) + { + n_bound++; + ds[0] = oneDY*oneDZ; + } - /* face, excluding the other two corners (and the four edges) - that were already computed above*/ - if ((j == y_max_j) && (i != x_min_i) && (i != x_max_i)) + if (j == y_min_j) + { + n_bound++; + ds[1] = -oneDX*oneDZ; + } + if (j == y_max_j) + { + n_bound++; ds[1] = oneDX*oneDZ; + } - /* face, excluding all corners (and edges), since they were - already computed above */ - if ((k == z_min_k) && (j != y_min_j) && (i != x_min_i) && (j != y_max_j) && (i != x_max_i)) + if (k == z_min_k) + { + n_bound++; ds[2] = -oneDX*oneDY; - - /* face, excluding all corners (and edges), since they were - already computed above */ - if ((k == z_max_k) && (j != y_min_j) && (i != x_min_i) && - (j != y_max_j) && (i != x_max_i)) + } + if (k == z_max_k) + { + n_bound++; ds[2] = oneDX*oneDY; + } + + /* Take care of corners and edges */ + if (n_bound == 2) + for (ti=0; ti<3; ti++) + ds[ti] /= 2; + if (n_bound == 3) + for (ti=0; ti<3; ti++) + ds[ti] /= 4; if ((ds[0] != 0.0) || (ds[1] != 0.0) || (ds[2] != 0.0)) { -- cgit v1.2.3