aboutsummaryrefslogtreecommitdiff
path: root/src/surface_integral.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/surface_integral.c')
-rw-r--r--src/surface_integral.c62
1 files changed, 37 insertions, 25 deletions
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))
{