Add missing RegisterSymmetries.cc in McLachlan/ML_BSSN (einsteintoolkit/Cactus#37)

This PR adds the missing source file RegisterSymmetries.cc to complete the McLachlan/ML_BSSN thorn implementation.

Implement the full functionality of ML_BSSN

Please implement the full functionality of `ML_BSSN` by finishing the code in `RegisterSymmetries.cc`.

## Thorn Information:
- Name: ML_BSSN
- Target file: RegisterSymmetries.cc

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/McLachlan/ML_BSSN/src/RegisterSymmetries.cc b/arrangements/McLachlan/ML_BSSN/src/RegisterSymmetries.cc
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/McLachlan/ML_BSSN/src/RegisterSymmetries.cc
@@ -0,0 +1,187 @@
+/*  File produced by Kranc */
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Symmetry.h"
+
+extern "C" void ML_BSSN_RegisterSymmetries(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  /* array holding symmetry definitions */
+  int sym[3];
+
+  /* Register symmetries of grid functions */
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::phi");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt11");
+
+  sym[0] = -1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt12");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt13");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt22");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt23");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::gt33");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt1");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt2");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::Xt3");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::trK");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At11");
+
+  sym[0] = -1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At12");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At13");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At22");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At23");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::At33");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::alpha");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::A");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::beta1");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::beta2");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::beta3");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::B1");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::B2");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::B3");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::H");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::M1");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::M2");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::M3");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::cS");
+
+  sym[0] = -1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt1");
+
+  sym[0] = 1;
+  sym[1] = -1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt2");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = -1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::cXt3");
+
+  sym[0] = 1;
+  sym[1] = 1;
+  sym[2] = 1;
+  SetCartSymVN(cctkGH, sym, "ML_BSSN::cA");
+
+}

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,6 @@
+ML_BSSN_EE_sgw3d
+ML_BSSN_EE_sgw3d_rhs
+ML_BSSN_NewRad
+ML_BSSN_sgw3d_harmonic
+ML_BSSN_sgw3d_harmonic_phi
+ML_BSSN_sgw3d_rhs


Add missing ML_CCZ4_ADMBaseBoundaryScalar.cc in McLachlan/ML_CCZ4 (einsteintoolkit/Cactus#38)

This PR adds the missing source file ML_CCZ4_ADMBaseBoundaryScalar.cc to complete the McLachlan/ML_CCZ4 thorn implementation.

Implement the full functionality of ML_CCZ4

Please implement the full functionality of `ML_CCZ4` by finishing the code in `ML_CCZ4_ADMBaseBoundaryScalar.cc`.

## Thorn Information:
- Name: ML_CCZ4
- Target file: ML_CCZ4_ADMBaseBoundaryScalar.cc

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/McLachlan/ML_CCZ4/src/ML_CCZ4_ADMBaseBoundaryScalar.cc b/arrangements/McLachlan/ML_CCZ4/src/ML_CCZ4_ADMBaseBoundaryScalar.cc
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/McLachlan/ML_CCZ4/src/ML_CCZ4_ADMBaseBoundaryScalar.cc
@@ -0,0 +1,352 @@
+/*  File produced by Kranc */
+
+#define KRANC_C
+
+#include <algorithm>
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Kranc.hh"
+#include "Differencing.h"
+#include "loopcontrol.h"
+#include "vectors.h"
+
+namespace ML_CCZ4 {
+
+extern "C" void ML_CCZ4_ADMBaseBoundaryScalar_SelectBCs(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  if (cctk_iteration % ML_CCZ4_ADMBaseBoundaryScalar_calc_every != ML_CCZ4_ADMBaseBoundaryScalar_calc_offset)
+    return;
+  CCTK_INT ierr CCTK_ATTRIBUTE_UNUSED = 0;
+  ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtlapse","flat");
+  if (ierr < 0)
+    CCTK_WARN(CCTK_WARN_ALERT, "Failed to register flat BC for ADMBase::dtlapse.");
+  ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GetBoundaryWidth(cctkGH), -1 /* no table */, "ADMBase::dtshift","flat");
+  if (ierr < 0)
+    CCTK_WARN(CCTK_WARN_ALERT, "Failed to register flat BC for ADMBase::dtshift.");
+  return;
+}
+
+static void ML_CCZ4_ADMBaseBoundaryScalar_Body(const cGH* restrict const cctkGH, const int dir, const int face, const CCTK_REAL normal[3], const CCTK_REAL tangentA[3], const CCTK_REAL tangentB[3], const int imin[3], const int imax[3], const int n_subblock_gfs, CCTK_REAL* restrict const subblock_gfs[])
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  /* Include user-supplied include files */
+  /* Initialise finite differencing variables */
+  const ptrdiff_t di CCTK_ATTRIBUTE_UNUSED = 1;
+  const ptrdiff_t dj CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t dk CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t cdi CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * di;
+  const ptrdiff_t cdj CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dj;
+  const ptrdiff_t cdk CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dk;
+  const ptrdiff_t cctkLbnd1 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[0];
+  const ptrdiff_t cctkLbnd2 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[1];
+  const ptrdiff_t cctkLbnd3 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[2];
+  const CCTK_REAL_VEC t CCTK_ATTRIBUTE_UNUSED = ToReal(cctk_time);
+  const CCTK_REAL_VEC cctkOriginSpace1 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(0));
+  const CCTK_REAL_VEC cctkOriginSpace2 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(1));
+  const CCTK_REAL_VEC cctkOriginSpace3 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(2));
+  const CCTK_REAL_VEC dt CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_TIME);
+  const CCTK_REAL_VEC dx CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(0));
+  const CCTK_REAL_VEC dy CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(1));
+  const CCTK_REAL_VEC dz CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(2));
+  const CCTK_REAL_VEC dxi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dx);
+  const CCTK_REAL_VEC dyi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dy);
+  const CCTK_REAL_VEC dzi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dz);
+  const CCTK_REAL_VEC khalf CCTK_ATTRIBUTE_UNUSED = ToReal(0.5);
+  const CCTK_REAL_VEC kthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.333333333333333333333333333333);
+  const CCTK_REAL_VEC ktwothird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.666666666666666666666666666667);
+  const CCTK_REAL_VEC kfourthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(1.33333333333333333333333333333);
+  const CCTK_REAL_VEC hdxi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dxi,ToReal(0.5));
+  const CCTK_REAL_VEC hdyi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dyi,ToReal(0.5));
+  const CCTK_REAL_VEC hdzi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dzi,ToReal(0.5));
+  /* Initialize predefined quantities */
+  const CCTK_REAL_VEC p1o1024dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0009765625),dx);
+  const CCTK_REAL_VEC p1o1024dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0009765625),dy);
+  const CCTK_REAL_VEC p1o1024dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0009765625),dz);
+  const CCTK_REAL_VEC p1o120dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC p1o120dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC p1o120dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC p1o12dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC p1o12dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC p1o12dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC p1o144dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o144dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o144dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dy,dz));
+  const CCTK_REAL_VEC p1o1680dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000595238095238095238095238095238),dx);
+  const CCTK_REAL_VEC p1o1680dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000595238095238095238095238095238),dy);
+  const CCTK_REAL_VEC p1o1680dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000595238095238095238095238095238),dz);
+  const CCTK_REAL_VEC p1o180dx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00555555555555555555555555555556),kmul(dx,dx));
+  const CCTK_REAL_VEC p1o180dy2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00555555555555555555555555555556),kmul(dy,dy));
+  const CCTK_REAL_VEC p1o180dz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00555555555555555555555555555556),kmul(dz,dz));
+  const CCTK_REAL_VEC p1o24dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0416666666666666666666666666667),dx);
+  const CCTK_REAL_VEC p1o24dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0416666666666666666666666666667),dy);
+  const CCTK_REAL_VEC p1o24dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0416666666666666666666666666667),dz);
+  const CCTK_REAL_VEC p1o2dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.5),dx);
+  const CCTK_REAL_VEC p1o2dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.5),dy);
+  const CCTK_REAL_VEC p1o2dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.5),dz);
+  const CCTK_REAL_VEC p1o3600dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000277777777777777777777777777778),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o3600dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000277777777777777777777777777778),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o3600dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000277777777777777777777777777778),kmul(dy,dz));
+  const CCTK_REAL_VEC p1o4dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),dx);
+  const CCTK_REAL_VEC p1o4dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o4dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o4dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),dy);
+  const CCTK_REAL_VEC p1o4dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),kmul(dy,dz));
+  const CCTK_REAL_VEC p1o4dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.25),dz);
+  const CCTK_REAL_VEC p1o5040dx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000198412698412698412698412698413),kmul(dx,dx));
+  const CCTK_REAL_VEC p1o5040dy2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000198412698412698412698412698413),kmul(dy,dy));
+  const CCTK_REAL_VEC p1o5040dz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.000198412698412698412698412698413),kmul(dz,dz));
+  const CCTK_REAL_VEC p1o560dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00178571428571428571428571428571),dx);
+  const CCTK_REAL_VEC p1o560dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00178571428571428571428571428571),dy);
+  const CCTK_REAL_VEC p1o560dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00178571428571428571428571428571),dz);
+  const CCTK_REAL_VEC p1o60dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0166666666666666666666666666667),dx);
+  const CCTK_REAL_VEC p1o60dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0166666666666666666666666666667),dy);
+  const CCTK_REAL_VEC p1o60dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0166666666666666666666666666667),dz);
+  const CCTK_REAL_VEC p1o64dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.015625),dx);
+  const CCTK_REAL_VEC p1o64dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.015625),dy);
+  const CCTK_REAL_VEC p1o64dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.015625),dz);
+  const CCTK_REAL_VEC p1o6dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.166666666666666666666666666667),dx);
+  const CCTK_REAL_VEC p1o6dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.166666666666666666666666666667),dy);
+  const CCTK_REAL_VEC p1o6dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.166666666666666666666666666667),dz);
+  const CCTK_REAL_VEC p1o705600dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1.41723356009070294784580498866e-6),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o705600dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1.41723356009070294784580498866e-6),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o705600dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1.41723356009070294784580498866e-6),kmul(dy,dz));
+  const CCTK_REAL_VEC p1o840dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00119047619047619047619047619048),dx);
+  const CCTK_REAL_VEC p1o840dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00119047619047619047619047619048),dy);
+  const CCTK_REAL_VEC p1o840dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00119047619047619047619047619048),dz);
+  const CCTK_REAL_VEC p1odx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),kmul(dx,dx));
+  const CCTK_REAL_VEC p1ody2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),kmul(dy,dy));
+  const CCTK_REAL_VEC p1odz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),kmul(dz,dz));
+  const CCTK_REAL_VEC pm1o120dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC pm1o120dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC pm1o120dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC pm1o12dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC pm1o12dx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dx,dx));
+  const CCTK_REAL_VEC pm1o12dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC pm1o12dy2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dy,dy));
+  const CCTK_REAL_VEC pm1o12dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC pm1o12dz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dz,dz));
+  const CCTK_REAL_VEC pm1o16dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0625),dx);
+  const CCTK_REAL_VEC pm1o16dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0625),dy);
+  const CCTK_REAL_VEC pm1o16dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0625),dz);
+  const CCTK_REAL_VEC pm1o256dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00390625),dx);
+  const CCTK_REAL_VEC pm1o256dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00390625),dy);
+  const CCTK_REAL_VEC pm1o256dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.00390625),dz);
+  const CCTK_REAL_VEC pm1o2dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.5),dx);
+  const CCTK_REAL_VEC pm1o2dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.5),dy);
+  const CCTK_REAL_VEC pm1o2dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.5),dz);
+  const CCTK_REAL_VEC pm1o4dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.25),dx);
+  const CCTK_REAL_VEC pm1o4dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.25),dy);
+  const CCTK_REAL_VEC pm1o4dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.25),dz);
+  const CCTK_REAL_VEC pm1o60dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0166666666666666666666666666667),dx);
+  const CCTK_REAL_VEC pm1o60dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0166666666666666666666666666667),dy);
+  const CCTK_REAL_VEC pm1o60dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0166666666666666666666666666667),dz);
+  /* Jacobian variable pointers */
+  const bool usejacobian1 = (!CCTK_IsFunctionAliased("MultiPatch_GetMap") || MultiPatch_GetMap(cctkGH) != jacobian_identity_map)
+                        && strlen(jacobian_group) > 0;
+  const bool usejacobian = assume_use_jacobian>=0 ? assume_use_jacobian : usejacobian1;
+  if (usejacobian && (strlen(jacobian_derivative_group) == 0))
+  {
+    CCTK_WARN(CCTK_WARN_ALERT, "GenericFD::jacobian_group and GenericFD::jacobian_derivative_group must both be set to valid group names");
+  }
+
+  const CCTK_REAL* restrict jacobian_ptrs[9];
+  if (usejacobian) GroupDataPointers(cctkGH, jacobian_group,
+                                                9, jacobian_ptrs);
+
+  const CCTK_REAL* restrict const J11 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[0] : 0;
+  const CCTK_REAL* restrict const J12 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[1] : 0;
+  const CCTK_REAL* restrict const J13 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[2] : 0;
+  const CCTK_REAL* restrict const J21 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[3] : 0;
+  const CCTK_REAL* restrict const J22 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[4] : 0;
+  const CCTK_REAL* restrict const J23 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[5] : 0;
+  const CCTK_REAL* restrict const J31 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[6] : 0;
+  const CCTK_REAL* restrict const J32 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[7] : 0;
+  const CCTK_REAL* restrict const J33 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_ptrs[8] : 0;
+
+  const CCTK_REAL* restrict jacobian_determinant_ptrs[1] CCTK_ATTRIBUTE_UNUSED;
+  if (usejacobian && strlen(jacobian_determinant_group) > 0) GroupDataPointers(cctkGH, jacobian_determinant_group,
+                                                1, jacobian_determinant_ptrs);
+
+  const CCTK_REAL* restrict const detJ CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_determinant_ptrs[0] : 0;
+
+  const CCTK_REAL* restrict jacobian_inverse_ptrs[9] CCTK_ATTRIBUTE_UNUSED;
+  if (usejacobian && strlen(jacobian_inverse_group) > 0) GroupDataPointers(cctkGH, jacobian_inverse_group,
+                                                9, jacobian_inverse_ptrs);
+
+  const CCTK_REAL* restrict const iJ11 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[0] : 0;
+  const CCTK_REAL* restrict const iJ12 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[1] : 0;
+  const CCTK_REAL* restrict const iJ13 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[2] : 0;
+  const CCTK_REAL* restrict const iJ21 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[3] : 0;
+  const CCTK_REAL* restrict const iJ22 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[4] : 0;
+  const CCTK_REAL* restrict const iJ23 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[5] : 0;
+  const CCTK_REAL* restrict const iJ31 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[6] : 0;
+  const CCTK_REAL* restrict const iJ32 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[7] : 0;
+  const CCTK_REAL* restrict const iJ33 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_inverse_ptrs[8] : 0;
+
+  const CCTK_REAL* restrict jacobian_derivative_ptrs[18] CCTK_ATTRIBUTE_UNUSED;
+  if (usejacobian) GroupDataPointers(cctkGH, jacobian_derivative_group,
+                                      18, jacobian_derivative_ptrs);
+
+  const CCTK_REAL* restrict const dJ111 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[0] : 0;
+  const CCTK_REAL* restrict const dJ112 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[1] : 0;
+  const CCTK_REAL* restrict const dJ113 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[2] : 0;
+  const CCTK_REAL* restrict const dJ122 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[3] : 0;
+  const CCTK_REAL* restrict const dJ123 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[4] : 0;
+  const CCTK_REAL* restrict const dJ133 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[5] : 0;
+  const CCTK_REAL* restrict const dJ211 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[6] : 0;
+  const CCTK_REAL* restrict const dJ212 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[7] : 0;
+  const CCTK_REAL* restrict const dJ213 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[8] : 0;
+  const CCTK_REAL* restrict const dJ222 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[9] : 0;
+  const CCTK_REAL* restrict const dJ223 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[10] : 0;
+  const CCTK_REAL* restrict const dJ233 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[11] : 0;
+  const CCTK_REAL* restrict const dJ311 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[12] : 0;
+  const CCTK_REAL* restrict const dJ312 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[13] : 0;
+  const CCTK_REAL* restrict const dJ313 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[14] : 0;
+  const CCTK_REAL* restrict const dJ322 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[15] : 0;
+  const CCTK_REAL* restrict const dJ323 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[16] : 0;
+  const CCTK_REAL* restrict const dJ333 CCTK_ATTRIBUTE_UNUSED = usejacobian ? jacobian_derivative_ptrs[17] : 0;
+  /* Assign local copies of arrays functions */
+
+
+  /* Calculate temporaries and arrays functions */
+  /* Copy local copies back to grid functions */
+  /* Loop over the grid points */
+  const int imin0=imin[0];
+  const int imin1=imin[1];
+  const int imin2=imin[2];
+  const int imax0=imax[0];
+  const int imax1=imax[1];
+  const int imax2=imax[2];
+  #pragma omp parallel
+  CCTK_LOOP3STR(ML_CCZ4_ADMBaseBoundaryScalar,
+    i,j,k, imin0,imin1,imin2, imax0,imax1,imax2,
+    cctk_ash[0],cctk_ash[1],cctk_ash[2],
+    vecimin,vecimax, CCTK_REAL_VEC_SIZE)
+  {
+    const ptrdiff_t index CCTK_ATTRIBUTE_UNUSED = di*i + dj*j + dk*k;
+    /* Assign local copies of grid functions */
+
+
+
+    /* Include user supplied include files */
+    /* Precompute derivatives */
+
+    switch (fdOrder)
+    {
+      case 2:
+      {
+        break;
+      }
+
+      case 4:
+      {
+        break;
+      }
+
+      case 6:
+      {
+        break;
+      }
+
+      case 8:
+      {
+        break;
+      }
+      default:
+        CCTK_BUILTIN_UNREACHABLE();
+    }
+    /* Calculate temporaries and grid functions */
+    CCTK_REAL_VEC dtalpL CCTK_ATTRIBUTE_UNUSED = ToReal(0);
+
+    CCTK_REAL_VEC dtbetaxL CCTK_ATTRIBUTE_UNUSED = ToReal(0);
+
+    CCTK_REAL_VEC dtbetayL CCTK_ATTRIBUTE_UNUSED = ToReal(0);
+
+    CCTK_REAL_VEC dtbetazL CCTK_ATTRIBUTE_UNUSED = ToReal(0);
+    /* Copy local copies back to grid functions */
+    vec_store_partial_prepare(i,vecimin,vecimax);
+    vec_store_nta_partial(dtalp[index],dtalpL);
+    vec_store_nta_partial(dtbetax[index],dtbetaxL);
+    vec_store_nta_partial(dtbetay[index],dtbetayL);
+    vec_store_nta_partial(dtbetaz[index],dtbetazL);
+  }
+  CCTK_ENDLOOP3STR(ML_CCZ4_ADMBaseBoundaryScalar);
+}
+extern "C" void ML_CCZ4_ADMBaseBoundaryScalar(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Entering ML_CCZ4_ADMBaseBoundaryScalar_Body");
+  }
+  if (cctk_iteration % ML_CCZ4_ADMBaseBoundaryScalar_calc_every != ML_CCZ4_ADMBaseBoundaryScalar_calc_offset)
+  {
+    return;
+  }
+
+  const char* const groups[] = {
+    "ADMBase::dtlapse",
+    "ADMBase::dtshift"};
+  AssertGroupStorage(cctkGH, "ML_CCZ4_ADMBaseBoundaryScalar", 2, groups);
+
+  switch (fdOrder)
+  {
+    case 2:
+    {
+      break;
+    }
+
+    case 4:
+    {
+      break;
+    }
+
+    case 6:
+    {
+      break;
+    }
+
+    case 8:
+    {
+      break;
+    }
+    default:
+      CCTK_BUILTIN_UNREACHABLE();
+  }
+
+  LoopOverBoundary(cctkGH, ML_CCZ4_ADMBaseBoundaryScalar_Body);
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Leaving ML_CCZ4_ADMBaseBoundaryScalar_Body");
+  }
+}
+
+} // namespace ML_CCZ4

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,2 @@
+ML_CCZ4_sgw3d
+ML_CCZ4_sgw3d_rhs


Add missing WT_Energy.cc in McLachlan/ML_WaveToy (einsteintoolkit/Cactus#39)

This PR adds the missing source file WT_Energy.cc to complete the McLachlan/ML_WaveToy thorn implementation.

Implement the full functionality of ML_WaveToy

Please implement the full functionality of `ML_WaveToy` by finishing the code in `WT_Energy.cc`.

## Thorn Information:
- Name: ML_WaveToy
- Target file: WT_Energy.cc

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/McLachlan/ML_WaveToy/src/WT_Energy.cc b/arrangements/McLachlan/ML_WaveToy/src/WT_Energy.cc
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/McLachlan/ML_WaveToy/src/WT_Energy.cc
@@ -0,0 +1,161 @@
+/*  File produced by Kranc */
+
+#define KRANC_C
+
+#include <algorithm>
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Kranc.hh"
+#include "Differencing.h"
+#include "loopcontrol.h"
+#include "vectors.h"
+
+namespace ML_WaveToy {
+
+extern "C" void WT_Energy_SelectBCs(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  if (cctk_iteration % WT_Energy_calc_every != WT_Energy_calc_offset)
+    return;
+  CCTK_INT ierr CCTK_ATTRIBUTE_UNUSED = 0;
+  ierr = Boundary_SelectGroupForBC(cctkGH, CCTK_ALL_FACES, GetBoundaryWidth(cctkGH), -1 /* no table */, "ML_WaveToy::WT_eps","flat");
+  if (ierr < 0)
+    CCTK_WARN(CCTK_WARN_ALERT, "Failed to register flat BC for ML_WaveToy::WT_eps.");
+  return;
+}
+
+static void WT_Energy_Body(const cGH* restrict const cctkGH, const int dir, const int face, const CCTK_REAL normal[3], const CCTK_REAL tangentA[3], const CCTK_REAL tangentB[3], const int imin[3], const int imax[3], const int n_subblock_gfs, CCTK_REAL* restrict const subblock_gfs[])
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  /* Include user-supplied include files */
+  /* Initialise finite differencing variables */
+  const ptrdiff_t di CCTK_ATTRIBUTE_UNUSED = 1;
+  const ptrdiff_t dj CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t dk CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t cdi CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * di;
+  const ptrdiff_t cdj CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dj;
+  const ptrdiff_t cdk CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dk;
+  const ptrdiff_t cctkLbnd1 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[0];
+  const ptrdiff_t cctkLbnd2 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[1];
+  const ptrdiff_t cctkLbnd3 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[2];
+  const CCTK_REAL_VEC t CCTK_ATTRIBUTE_UNUSED = ToReal(cctk_time);
+  const CCTK_REAL_VEC cctkOriginSpace1 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(0));
+  const CCTK_REAL_VEC cctkOriginSpace2 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(1));
+  const CCTK_REAL_VEC cctkOriginSpace3 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(2));
+  const CCTK_REAL_VEC dt CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_TIME);
+  const CCTK_REAL_VEC dx CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(0));
+  const CCTK_REAL_VEC dy CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(1));
+  const CCTK_REAL_VEC dz CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(2));
+  const CCTK_REAL_VEC dxi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dx);
+  const CCTK_REAL_VEC dyi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dy);
+  const CCTK_REAL_VEC dzi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dz);
+  const CCTK_REAL_VEC khalf CCTK_ATTRIBUTE_UNUSED = ToReal(0.5);
+  const CCTK_REAL_VEC kthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.333333333333333333333333333333);
+  const CCTK_REAL_VEC ktwothird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.666666666666666666666666666667);
+  const CCTK_REAL_VEC kfourthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(1.33333333333333333333333333333);
+  const CCTK_REAL_VEC hdxi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dxi,ToReal(0.5));
+  const CCTK_REAL_VEC hdyi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dyi,ToReal(0.5));
+  const CCTK_REAL_VEC hdzi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dzi,ToReal(0.5));
+  /* Initialize predefined quantities */
+  const CCTK_REAL_VEC p1o12dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC p1o12dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC p1o12dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC p1o144dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o144dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o144dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dy,dz));
+  const CCTK_REAL_VEC pm1o12dx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dx,dx));
+  const CCTK_REAL_VEC pm1o12dy2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dy,dy));
+  const CCTK_REAL_VEC pm1o12dz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dz,dz));
+  /* Assign local copies of arrays functions */
+
+
+  /* Calculate temporaries and arrays functions */
+  /* Copy local copies back to grid functions */
+  /* Loop over the grid points */
+  const int imin0=imin[0];
+  const int imin1=imin[1];
+  const int imin2=imin[2];
+  const int imax0=imax[0];
+  const int imax1=imax[1];
+  const int imax2=imax[2];
+  #pragma omp parallel
+  CCTK_LOOP3STR(WT_Energy,
+    i,j,k, imin0,imin1,imin2, imax0,imax1,imax2,
+    cctk_ash[0],cctk_ash[1],cctk_ash[2],
+    vecimin,vecimax, CCTK_REAL_VEC_SIZE)
+  {
+    const ptrdiff_t index CCTK_ATTRIBUTE_UNUSED = di*i + dj*j + dk*k;
+    /* Assign local copies of grid functions */
+
+    CCTK_REAL_VEC rhoL CCTK_ATTRIBUTE_UNUSED = vec_load(rho[index]);
+    CCTK_REAL_VEC uL CCTK_ATTRIBUTE_UNUSED = vec_load(u[index]);
+
+    /* Include user supplied include files */
+    /* Precompute derivatives */
+    const CCTK_REAL_VEC PDstandardNth1u CCTK_ATTRIBUTE_UNUSED = PDstandardNth1(&u[index]);
+    const CCTK_REAL_VEC PDstandardNth2u CCTK_ATTRIBUTE_UNUSED = PDstandardNth2(&u[index]);
+    const CCTK_REAL_VEC PDstandardNth3u CCTK_ATTRIBUTE_UNUSED = PDstandardNth3(&u[index]);
+    /* Calculate temporaries and grid functions */
+    CCTK_REAL_VEC epsL CCTK_ATTRIBUTE_UNUSED =
+      kmul(kmadd(rhoL,rhoL,kmadd(PDstandardNth1u,PDstandardNth1u,kmadd(PDstandardNth2u,PDstandardNth2u,kmul(PDstandardNth3u,PDstandardNth3u)))),ToReal(0.5));
+    /* Copy local copies back to grid functions */
+    vec_store_partial_prepare(i,vecimin,vecimax);
+    vec_store_nta_partial(eps[index],epsL);
+  }
+  CCTK_ENDLOOP3STR(WT_Energy);
+}
+extern "C" void WT_Energy(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Entering WT_Energy_Body");
+  }
+  if (cctk_iteration % WT_Energy_calc_every != WT_Energy_calc_offset)
+  {
+    return;
+  }
+
+  const char* const groups[] = {
+    "ML_WaveToy::WT_eps",
+    "ML_WaveToy::WT_rho",
+    "ML_WaveToy::WT_u"};
+  AssertGroupStorage(cctkGH, "WT_Energy", 3, groups);
+
+  EnsureStencilFits(cctkGH, "WT_Energy", 2, 2, 2);
+
+  LoopOverInterior(cctkGH, WT_Energy_Body);
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Leaving WT_Energy_Body");
+  }
+}
+
+} // namespace ML_WaveToy

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,3 @@
+gaussian-RK4
+gaussian-RK45
+gaussian-RK45-adaptive


Add missing WaveToy.F90 in CactusWave/WaveToyFreeF90 (einsteintoolkit/Cactus#4)

This PR adds the missing source file WaveToy.F90 to complete the CactusWave/WaveToyFreeF90 thorn implementation.

Implement the full functionality of WaveToyFreeF90

Please implement the full functionality of `WaveToyFreeF90` by finishing the code in `WaveToy.F90`.

## Thorn Information:
- Name: WaveToyFreeF90
- Target file: WaveToy.F90

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/CactusWave/WaveToyFreeF90/src/WaveToy.F90 b/arrangements/CactusWave/WaveToyFreeF90/src/WaveToy.F90
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/CactusWave/WaveToyFreeF90/src/WaveToy.F90
@@ -0,0 +1,151 @@
+ /*@@
+   @file      WaveToy.F90
+   @date
+   @author    Tom Goodale
+   @desc
+              Evolution routines for the wave equation solver
+   @enddesc
+   @version $Header$
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
+
+
+ /*@@
+   @routine    WaveToyFreeF90_Evolution
+   @date
+   @author     Tom Goodale
+   @desc
+               Evolution for the wave equation
+   @enddesc
+   @calls      CCTK_SyncGroup, wavetoy_boundaries
+   @calledby
+   @history
+
+   @endhistory
+
+@@*/
+
+subroutine WaveToyFreeF90_Evolution(CCTK_ARGUMENTS)
+
+  implicit none
+
+  DECLARE_CCTK_ARGUMENTS
+  DECLARE_CCTK_PARAMETERS
+
+  !  Declare local variables
+  INTEGER   :: i,j,k
+  INTEGER   :: istart, jstart, kstart, iend, jend, kend
+
+  CCTK_REAL :: dx,dy,dz,dt
+  CCTK_REAL :: dx2,dy2,dz2,dt2
+  CCTK_REAL :: dx2i,dy2i,dz2i
+
+  CCTK_REAL :: factor
+
+  ! Set up shorthands
+  ! -----------------
+  dx = CCTK_DELTA_SPACE(1)
+  dy = CCTK_DELTA_SPACE(2)
+  dz = CCTK_DELTA_SPACE(3)
+  dt = CCTK_DELTA_TIME
+
+  dx2 = dx*dx
+  dy2 = dy*dy
+  dz2 = dz*dz
+  dt2 = dt*dt
+
+  dx2i = 1.0/dx2
+  dy2i = 1.0/dy2
+  dz2i = 1.0/dz2
+
+  istart = 2
+  jstart = 2
+  kstart = 2
+
+  iend = cctk_lsh(1)-1
+  jend = cctk_lsh(2)-1
+  kend = cctk_lsh(3)-1
+
+  factor = 2*(1 - (dt2)*(dx2i + dy2i + dz2i))
+
+  ! Do the evolution
+  ! ----------------
+  do k = kstart, kend
+     do j = jstart, jend
+        do i = istart, iend
+
+           phi(i,j,k) = factor*phi_p(i,j,k) -           &
+                phi_p_p(i,j,k) + (dt2) *                &
+                ((phi_p(i+1,j,k)+phi_p(i-1,j,k))*dx2i   &
+                +(phi_p(i,j+1,k)+phi_p(i,j-1,k))*dy2i   &
+                +(phi_p(i,j,k+1)+phi_p(i,j,k-1))*dz2i)
+
+        end do
+     end do
+  end do
+
+end subroutine WaveToyFreeF90_Evolution
+
+
+ /*@@
+   @routine    WaveToyFortran_Boundaries
+   @date
+   @author     Tom Goodale
+   @desc
+               Boundary conditions for the wave equation
+   @enddesc
+   @calls      CartSymGH,FlatBC,RadiativeBC
+   @calledby
+   @history
+
+   @endhistory
+
+@@*/
+
+subroutine WaveToyFreeF90_Boundaries(CCTK_ARGUMENTS)
+
+  implicit none
+
+  DECLARE_CCTK_ARGUMENTS
+  DECLARE_CCTK_PARAMETERS
+  DECLARE_CCTK_FUNCTIONS
+
+  CCTK_INT, parameter :: izero = 0
+  integer, parameter :: ik = kind(izero)
+
+! Local declarations
+  CCTK_INT :: ierr
+
+  CHARACTER (len=100) :: boundary
+  INTEGER :: length
+
+  ierr = 0
+
+! The "bound" parameter needs to be converted into a Fortran string.
+  call CCTK_FortranString(length,bound,boundary)
+
+! Apply the outer boundary conditions
+! -----------------------------------
+! Note: In each of the following calls to Boundary_SelectVarForBC,
+! default arguments are used, so an invalid table handle of -1 can
+! be passed
+
+  if (CCTK_EQUALS(bound,"flat") .or. CCTK_EQUALS(bound,"static")    .or. &
+     CCTK_EQUALS(bound,"radiation") .or. CCTK_EQUALS(bound,"robin") .or. &
+     CCTK_EQUALS(bound,"none") ) then
+     ierr = Boundary_SelectVarForBC(cctkGH, int(CCTK_ALL_FACES,ik), 1_ik, -1_ik,  &
+          "wavetoy::phi", boundary)
+  else if (CCTK_EQUALS(bound,"zero")) then
+     ierr = Boundary_SelectVarForBC(cctkGH, int(CCTK_ALL_FACES,ik), 1_ik, -1_ik,  &
+          "wavetoy::phi", "Scalar")
+  end if
+
+  if (ierr < 0)  then
+     call CCTK_WARN(0,"WaveToyFreeF90_Boundaries: Error selecting boundary condition")
+  end if
+
+end subroutine WaveToyFreeF90_Boundaries

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,1 @@
+test_rad


Add missing WT_Standing.cc in McLachlan/ML_WaveToy (einsteintoolkit/Cactus#40)

This PR adds the missing source file WT_Standing.cc to complete the McLachlan/ML_WaveToy thorn implementation.

Implement the full functionality of ML_WaveToy

Please implement the full functionality of `ML_WaveToy` by finishing the code in `WT_Standing.cc`.

## Thorn Information:
- Name: ML_WaveToy
- Target file: WT_Standing.cc

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/McLachlan/ML_WaveToy/src/WT_Standing.cc b/arrangements/McLachlan/ML_WaveToy/src/WT_Standing.cc
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/McLachlan/ML_WaveToy/src/WT_Standing.cc
@@ -0,0 +1,155 @@
+/*  File produced by Kranc */
+
+#define KRANC_C
+
+#include <algorithm>
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "Kranc.hh"
+#include "Differencing.h"
+#include "loopcontrol.h"
+#include "vectors.h"
+
+namespace ML_WaveToy {
+
+
+static void WT_Standing_Body(const cGH* restrict const cctkGH, const int dir, const int face, const CCTK_REAL normal[3], const CCTK_REAL tangentA[3], const CCTK_REAL tangentB[3], const int imin[3], const int imax[3], const int n_subblock_gfs, CCTK_REAL* restrict const subblock_gfs[])
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  /* Include user-supplied include files */
+  /* Initialise finite differencing variables */
+  const ptrdiff_t di CCTK_ATTRIBUTE_UNUSED = 1;
+  const ptrdiff_t dj CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,1,0) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t dk CCTK_ATTRIBUTE_UNUSED =
+    CCTK_GFINDEX3D(cctkGH,0,0,1) - CCTK_GFINDEX3D(cctkGH,0,0,0);
+  const ptrdiff_t cdi CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * di;
+  const ptrdiff_t cdj CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dj;
+  const ptrdiff_t cdk CCTK_ATTRIBUTE_UNUSED = sizeof(CCTK_REAL) * dk;
+  const ptrdiff_t cctkLbnd1 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[0];
+  const ptrdiff_t cctkLbnd2 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[1];
+  const ptrdiff_t cctkLbnd3 CCTK_ATTRIBUTE_UNUSED = cctk_lbnd[2];
+  const CCTK_REAL_VEC t CCTK_ATTRIBUTE_UNUSED = ToReal(cctk_time);
+  const CCTK_REAL_VEC cctkOriginSpace1 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(0));
+  const CCTK_REAL_VEC cctkOriginSpace2 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(1));
+  const CCTK_REAL_VEC cctkOriginSpace3 CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_ORIGIN_SPACE(2));
+  const CCTK_REAL_VEC dt CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_TIME);
+  const CCTK_REAL_VEC dx CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(0));
+  const CCTK_REAL_VEC dy CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(1));
+  const CCTK_REAL_VEC dz CCTK_ATTRIBUTE_UNUSED =
+    ToReal(CCTK_DELTA_SPACE(2));
+  const CCTK_REAL_VEC dxi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dx);
+  const CCTK_REAL_VEC dyi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dy);
+  const CCTK_REAL_VEC dzi CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(1),dz);
+  const CCTK_REAL_VEC khalf CCTK_ATTRIBUTE_UNUSED = ToReal(0.5);
+  const CCTK_REAL_VEC kthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.333333333333333333333333333333);
+  const CCTK_REAL_VEC ktwothird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(0.666666666666666666666666666667);
+  const CCTK_REAL_VEC kfourthird CCTK_ATTRIBUTE_UNUSED =
+    ToReal(1.33333333333333333333333333333);
+  const CCTK_REAL_VEC hdxi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dxi,ToReal(0.5));
+  const CCTK_REAL_VEC hdyi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dyi,ToReal(0.5));
+  const CCTK_REAL_VEC hdzi CCTK_ATTRIBUTE_UNUSED =
+    kmul(dzi,ToReal(0.5));
+  /* Initialize predefined quantities */
+  const CCTK_REAL_VEC p1o12dx CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dx);
+  const CCTK_REAL_VEC p1o12dy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dy);
+  const CCTK_REAL_VEC p1o12dz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.0833333333333333333333333333333),dz);
+  const CCTK_REAL_VEC p1o144dxdy CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dy));
+  const CCTK_REAL_VEC p1o144dxdz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dx,dz));
+  const CCTK_REAL_VEC p1o144dydz CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(0.00694444444444444444444444444444),kmul(dy,dz));
+  const CCTK_REAL_VEC pm1o12dx2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dx,dx));
+  const CCTK_REAL_VEC pm1o12dy2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dy,dy));
+  const CCTK_REAL_VEC pm1o12dz2 CCTK_ATTRIBUTE_UNUSED = kdiv(ToReal(-0.0833333333333333333333333333333),kmul(dz,dz));
+  /* Assign local copies of arrays functions */
+
+
+  /* Calculate temporaries and arrays functions */
+  /* Copy local copies back to grid functions */
+  /* Loop over the grid points */
+  const int imin0=imin[0];
+  const int imin1=imin[1];
+  const int imin2=imin[2];
+  const int imax0=imax[0];
+  const int imax1=imax[1];
+  const int imax2=imax[2];
+  #pragma omp parallel
+  CCTK_LOOP3STR(WT_Standing,
+    i,j,k, imin0,imin1,imin2, imax0,imax1,imax2,
+    cctk_ash[0],cctk_ash[1],cctk_ash[2],
+    vecimin,vecimax, CCTK_REAL_VEC_SIZE)
+  {
+    const ptrdiff_t index CCTK_ATTRIBUTE_UNUSED = di*i + dj*j + dk*k;
+    /* Assign local copies of grid functions */
+
+    CCTK_REAL_VEC xL CCTK_ATTRIBUTE_UNUSED = vec_load(x[index]);
+    CCTK_REAL_VEC yL CCTK_ATTRIBUTE_UNUSED = vec_load(y[index]);
+    CCTK_REAL_VEC zL CCTK_ATTRIBUTE_UNUSED = vec_load(z[index]);
+
+    /* Include user supplied include files */
+    /* Precompute derivatives */
+    /* Calculate temporaries and grid functions */
+    CCTK_REAL_VEC kvec CCTK_ATTRIBUTE_UNUSED =
+      ToReal(3.14159265358979323846264338328*pow(width,-1));
+
+    CCTK_REAL_VEC omega CCTK_ATTRIBUTE_UNUSED =
+      kmul(kpow(kmul(kvec,kvec),0.5),ToReal(1.73205080756887729352744634151));
+
+    CCTK_REAL_VEC uL CCTK_ATTRIBUTE_UNUSED =
+      kmul(kmul(kcos(kmul(xL,kvec)),kmul(kcos(kmul(yL,kvec)),kmul(kcos(kmul(zL,kvec)),kcos(kmul(omega,t))))),ToReal(amplitude));
+
+    CCTK_REAL_VEC rhoL CCTK_ATTRIBUTE_UNUSED =
+      kneg(kmul(kmul(omega,kmul(kcos(kmul(xL,kvec)),kmul(kcos(kmul(yL,kvec)),kmul(kcos(kmul(zL,kvec)),ksin(kmul(omega,t)))))),ToReal(amplitude)));
+    /* Copy local copies back to grid functions */
+    vec_store_partial_prepare(i,vecimin,vecimax);
+    vec_store_nta_partial(rho[index],rhoL);
+    vec_store_nta_partial(u[index],uL);
+  }
+  CCTK_ENDLOOP3STR(WT_Standing);
+}
+extern "C" void WT_Standing(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Entering WT_Standing_Body");
+  }
+  if (cctk_iteration % WT_Standing_calc_every != WT_Standing_calc_offset)
+  {
+    return;
+  }
+
+  const char* const groups[] = {
+    "grid::coordinates",
+    "ML_WaveToy::WT_rho",
+    "ML_WaveToy::WT_u"};
+  AssertGroupStorage(cctkGH, "WT_Standing", 3, groups);
+
+
+  LoopOverEverything(cctkGH, WT_Standing_Body);
+  if (verbose > 1)
+  {
+    CCTK_VInfo(CCTK_THORNSTRING,"Leaving WT_Standing_Body");
+  }
+}
+
+} // namespace ML_WaveToy


Add missing AHFinder_dis.F in EinsteinAnalysis/AHFinder (einsteintoolkit/Cactus#5)

This PR adds the missing source file AHFinder_dis.F to complete the EinsteinAnalysis/AHFinder thorn implementation.

Implement the full functionality of AHFinder

Please implement the full functionality of `AHFinder` by finishing the code in `AHFinder_dis.F`.

## Thorn Information:
- Name: AHFinder
- Target file: AHFinder_dis.F

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_dis.F b/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_dis.F
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_dis.F
@@ -0,0 +1,618 @@
+/*@@
+  @file      AHFinder_dis.F
+  @date      September 2001
+  @author    Miguel Alcubierre
+  @desc
+             Routine to calculate proper distances between horizons.
+  @enddesc
+@@*/
+
+#include "cctk.h"
+
+#include "cctk_Arguments.h"
+#include "cctk_Functions.h"
+#include "cctk_Parameters.h"
+
+      subroutine AHFinder_dis(CCTK_ARGUMENTS)
+
+      use AHFinder_dat
+
+      implicit none
+
+      DECLARE_CCTK_ARGUMENTS
+      DECLARE_CCTK_PARAMETERS
+      DECLARE_CCTK_FUNCTIONS
+
+      integer i,l,m
+      integer np,npoints,vindex,ierror
+      integer param_table_handle,interp_handle,coord_system_handle
+      character(30) options_string
+      character(128) operator
+      CCTK_INT nchars
+
+      CCTK_POINTER, dimension(3) :: interp_coords
+      CCTK_INT, dimension(6) :: in_array_indices
+      CCTK_POINTER, dimension(6) :: out_arrays
+      CCTK_INT, dimension(6) :: out_array_type_codes
+
+      CCTK_REAL LEGEN
+      CCTK_REAL zero,half,one,two,pi
+      CCTK_REAL x12,y12,z12,r12,rho12
+      CCTK_REAL phi,cost,sint,cosp,sinp
+      CCTK_REAL x1,y1,z1,r1
+      CCTK_REAL x2,y2,z2,r2
+      CCTK_REAL ddx,ddy,ddz,d12
+      CCTK_REAL aux,cosa,sina,factor
+
+      CCTK_REAL, allocatable, dimension(:) :: xa,ya,za
+      CCTK_REAL, allocatable, dimension(:) :: txx,tyy,tzz,txy,txz,tyz
+
+      character(200) disf
+      logical disf_exists
+
+!     **************************
+!     ***   DEFINE NUMBERS   ***
+!     **************************
+
+      zero  = 0.0D0
+      half  = 0.5D0
+      one   = 1.0D0
+      two   = 2.0D0
+
+      pi = acos(-one)
+
+      factor = one
+
+
+!     ****************************************
+!     ***   FIND LINE CONNECTING CENTERS   ***
+!     ****************************************
+
+!     For the moment, horizons 1 and 2 only.
+
+      write(*,*)
+      write(*,*) 'Integrating distances between horizons 1 and 2 ...'
+
+      x1 = ahf_xc_1
+      y1 = ahf_yc_1
+      z1 = ahf_zc_1
+
+      x2 = ahf_xc_2
+      y2 = ahf_yc_2
+      z2 = ahf_zc_2
+
+!     Find line connecting centers.
+
+!     Neither horizon exists.
+
+      if ((.not.status_old_1).and.(.not.status_old_2)) then
+
+         write(*,*)
+         write(*,*) 'Neither horizon 1 nor horizon 2 exist,'
+         write(*,*) 'giving up.'
+         write(*,*)
+
+         d12 = zero
+         goto 100
+
+!     Just horizon 1 exists.
+
+      else if (status_old_1.and.(.not.status_old_2)) then
+
+         write(*,*)
+         write(*,*) 'Only horizon 1 exists.'
+         write(*,*)
+
+!        Check symmetries.
+
+         if (CCTK_Equals(domain,"octant").eq.1) then
+
+            write(*,*) 'Octant symmetry: calculating twice'
+            write(*,*) 'twice the distance from horizon 1 to origin.'
+
+            factor = two
+
+            x2 = zero
+            y2 = zero
+            z2 = zero
+
+         else if (CCTK_Equals(domain,"quadrant").eq.1) then
+
+            if (CCTK_Equals(quadrant_direction,"x").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, x direction: calculating'
+               write(*,*) 'twice the distance from horizon 1 to x axis.'
+
+               factor = two
+
+               x2 = x1
+               y2 = zero
+               z2 = zero
+
+            else if (CCTK_Equals(quadrant_direction,"y").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, y direction: calculating'
+               write(*,*) 'twice the distance from horizon 1 to y axis.'
+
+               factor = two
+
+               x2 = zero
+               y2 = y1
+               z2 = zero
+
+            else if (CCTK_Equals(quadrant_direction,"z").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, z direction: calculating'
+               write(*,*) 'twice the distance from horizon 1 to z axis.'
+
+               factor = two
+
+               x2 = zero
+               y2 = zero
+               z2 = z1
+
+            end if
+
+         else if (CCTK_Equals(domain,"bitant").eq.1) then
+
+            if (CCTK_Equals(bitant_plane,"xy").eq.1) then
+
+               write(*,*) 'Bitant symmetry, xy plane: calculating twice'
+               write(*,*) 'the distance from horizon 1 to xy plane.'
+
+               factor = two
+
+               x2 = x1
+               y2 = y1
+               z2 = zero
+
+            else if (CCTK_Equals(bitant_plane,"xz").eq.1) then
+
+               write(*,*) 'Bitant symmetry, xz plane: calculating twice'
+               write(*,*) 'the distance from horizon 1 to xz plane.'
+
+               factor = two
+
+               x2 = x1
+               y2 = zero
+               z2 = z1
+
+            else if (CCTK_Equals(bitant_plane,"yz").eq.1) then
+
+               write(*,*) 'Bitant symmetry, yz plane: calculating twice'
+               write(*,*) 'the distance from horizon 1 to yz plane.'
+
+               factor = two
+
+               x2 = zero
+               y2 = y1
+               z2 = z1
+
+            end if
+
+         else
+
+            write(*,*) 'No grid symmetries: no distance to calculate,'
+            write(*,*) 'giving up.'
+
+            d12 = zero
+            goto 100
+
+         end if
+
+!     Just horizon 2 exists.
+
+      else if (status_old_2.and.(.not.status_old_1)) then
+
+         write(*,*)
+         write(*,*) 'Only horizon 2 exists.'
+         write(*,*)
+
+!        Check symmetries.
+
+         if (CCTK_Equals(domain,"octant").eq.1) then
+
+            write(*,*) 'Octant symmetry: calculating'
+            write(*,*) 'twice the distance from horizon 2 to origin.'
+
+            factor = two
+
+            x1 = zero
+            y1 = zero
+            z1 = zero
+
+         else if (CCTK_Equals(domain,"quadrant").eq.1) then
+
+            if (CCTK_Equals(quadrant_direction,"x").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, x direction: calculating'
+               write(*,*) 'twice the distance from horizon 2 to x axis.'
+
+               factor = two
+
+               x1 = x2
+               y1 = zero
+               z1 = zero
+
+            else if (CCTK_Equals(quadrant_direction,"y").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, y direction: calculating'
+               write(*,*) 'twice the distance from horizon 2 to y axis.'
+
+               factor = two
+
+               x1 = zero
+               y1 = y2
+               z1 = zero
+
+            else if (CCTK_Equals(quadrant_direction,"z").eq.1) then
+
+               write(*,*) 'Quadrant symmetry, z direction: calculating'
+               write(*,*) 'twice the distance from horizon 2 to z axis.'
+
+               factor = two
+
+               x1 = zero
+               y1 = zero
+               z1 = z2
+
+            end if
+
+         else if (CCTK_Equals(domain,"bitant").eq.1) then
+
+            if (CCTK_Equals(bitant_plane,"xy").eq.1) then
+
+               write(*,*) 'Bitant symmetry, xy plane: calculating twice'
+               write(*,*) 'the distance from horizon 2 to xy plane.'
+
+               factor = two
+
+               x1 = x2
+               y1 = y2
+               z1 = zero
+
+            else if (CCTK_Equals(bitant_plane,"xz").eq.1) then
+
+               write(*,*) 'Bitant symmetry, xz plane: calculating twice'
+               write(*,*) 'the distance from horizon 2 to xz plane.'
+
+               factor = two
+
+               x1 = x2
+               y1 = zero
+               z1 = z2
+
+            else if (CCTK_Equals(bitant_plane,"yz").eq.1) then
+
+               write(*,*) 'Bitant symmetry, yz plane: calculating twice'
+               write(*,*) 'the distance from horizon 2 to yz plane.'
+
+               factor = two
+
+               x1 = zero
+               y1 = y2
+               z1 = z2
+
+            end if
+
+         else
+
+            write(*,*) 'No grid symmetries: no distance to calculate.'
+            write(*,*) 'giving up.'
+
+            d12 = zero
+            goto 100
+
+         end if
+
+      end if
+
+!     Find connecting line.
+
+      x12 = x2 - x1
+      y12 = y2 - y1
+      z12 = z2 - z1
+
+      rho12 = sqrt(x12**2 + y12**2)
+      r12   = sqrt(x12**2 + y12**2 + z12**2)
+
+
+!     ***********************************************************
+!     ***   FIND LOCATION OF HORIZONS ALONG CONNECTING LINE   ***
+!     ***********************************************************
+
+!     Find angles for horizon 1.
+
+      if (r12.ne.zero) then
+         cost = z12/r12
+      else
+         write(*,*)
+         write(*,*) 'Coordinate distance is zero,'
+         write(*,*) 'giving up.'
+         write(*,*)
+         d12 = zero
+         goto 100
+      end if
+
+      sint = sqrt(one - cost**2)
+
+      if (y12.ne.zero) then
+         phi = atan2(y12,x12)
+      else
+         phi = zero
+      end if
+
+      sinp = sin(phi)
+      cosp = cos(phi)
+
+!     Find point in horizon 1.
+
+      if (status_old_1) then
+
+         r1 = c0(0)
+
+         do l=1+stepz,lmax,1+stepz
+            r1 = r1 + c0(l)*LEGEN(l,0,cost)
+         end do
+
+         if (nonaxi) then
+            do m=1,lmax
+               aux = dble(m)*phi
+               sina = sin(aux)
+               cosa = cos(aux)
+               do l=m,lmax
+                  aux = LEGEN(l,m,cost)
+                  r1 = r1 + aux*cc(l,m)*cosa
+                  if (.not.refy) then
+                     r1 = r1 + aux*cs(l,m)*sina
+                  end if
+               end do
+           end do
+         end if
+
+         x1 = x1 + r1*sint*cosp
+         y1 = y1 + r1*sint*sinp
+         z1 = z1 + r1*cost
+
+      end if
+
+!     Find angles for horizon 2.
+
+      cost = -cost
+      sint = +sint
+
+      cosp = -cosp
+      sinp = -sinp
+
+      phi = phi + pi
+
+!     Find point in horizon 2.
+
+      if (status_old_2) then
+
+         r2 = c0(0)
+
+         do l=1+stepz,lmax,1+stepz
+            r2 = r2 + c0(l)*LEGEN(l,0,cost)
+         end do
+
+         if (nonaxi) then
+            do m=1,lmax
+               aux = dble(m)*phi
+               sina = sin(aux)
+               cosa = cos(aux)
+               do l=m,lmax
+                  aux = LEGEN(l,m,cost)
+                  r2 = r2 + aux*cc(l,m)*cosa
+                  if (.not.refy) then
+                     r2 = r2 + aux*cs(l,m)*sina
+                  end if
+               end do
+            end do
+         end if
+
+         x2 = x2 + r2*sint*cosp
+         y2 = y2 + r2*sint*sinp
+         z2 = z2 + r2*cost
+
+      end if
+
+
+!     **************************************
+!     ***   ALLOCATE MEMORY FOR ARRAYS   ***
+!     **************************************
+
+      aux = sqrt((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)/dx
+
+      np = int(aux)
+
+      if (myproc.eq.0) then
+
+         allocate(xa(0:np))
+         allocate(ya(0:np))
+         allocate(za(0:np))
+
+         allocate(txx(0:np))
+         allocate(tyy(0:np))
+         allocate(tzz(0:np))
+         allocate(txy(0:np))
+         allocate(txz(0:np))
+         allocate(tyz(0:np))
+
+      else
+
+         allocate(xa(1))
+         allocate(ya(1))
+         allocate(za(1))
+
+         allocate(txx(1))
+         allocate(tyy(1))
+         allocate(tzz(1))
+         allocate(txy(1))
+         allocate(txz(1))
+         allocate(tyz(1))
+
+      end if
+
+
+!     *************************************
+!     ***   FIND INTERPOLATING POINTS   ***
+!     *************************************
+
+      if (myproc.eq.0) then
+
+         npoints = np + 1
+
+         do i=0,np
+
+            aux = dble(i)/dble(np)
+
+            xa(i) = x1 + aux*(x2-x1)
+            ya(i) = y1 + aux*(y2-y1)
+            za(i) = z1 + aux*(z2-z1)
+
+         end do
+
+      else
+
+         npoints = 1
+
+         xa = half*(x1 + x2)
+         ya = half*(y1 + y2)
+         za = half*(z1 + z2)
+
+      end if
+
+
+!     ******************************
+!     ***   INTERPOLATE METRIC   ***
+!     ******************************
+
+!     parameter, local interpolator, and coordinate system handle.
+      param_table_handle = -1
+      interp_handle = -1
+      coord_system_handle = -1
+
+      options_string = "order = " // char(ichar('0') + interpolation_order)
+      call Util_TableCreateFromString (param_table_handle, options_string)
+      if (param_table_handle .lt. 0) then
+        call CCTK_WARN(0,"Cannot create parameter table for interpolator")
+      endif
+
+      call CCTK_FortranString (nchars, interpolation_operator, operator)
+      call CCTK_InterpHandle (interp_handle, operator)
+      if (interp_handle.lt.0) then
+        call CCTK_WARN(0,"Cannot get handle for interpolation ! Forgot to activate an implementation providing interpolation operators ??")
+      endif
+
+      call CCTK_CoordSystemHandle (coord_system_handle, "cart3d")
+      if (coord_system_handle .lt. 0) then
+        call CCTK_WARN(0,"Cannot get handle for cart3d coordinate system ! Forgot to activate an implementation providing coordinates ??")
+      endif
+
+
+!     fill in the input/output arrays for the interpolator
+      interp_coords(1) = CCTK_PointerTo(xa)
+      interp_coords(2) = CCTK_PointerTo(ya)
+      interp_coords(3) = CCTK_PointerTo(za)
+
+      call CCTK_VarIndex (vindex, "admbase::gxx")
+      in_array_indices(1) = vindex
+      call CCTK_VarIndex (vindex, "admbase::gyy")
+      in_array_indices(2) = vindex
+      call CCTK_VarIndex (vindex, "admbase::gzz")
+      in_array_indices(3) = vindex
+      call CCTK_VarIndex (vindex, "admbase::gxy")
+      in_array_indices(4) = vindex
+      call CCTK_VarIndex (vindex, "admbase::gxz")
+      in_array_indices(5) = vindex
+      call CCTK_VarIndex (vindex, "admbase::gyz")
+      in_array_indices(6) = vindex
+
+      out_arrays(1) = CCTK_PointerTo(txx)
+      out_arrays(2) = CCTK_PointerTo(tyy)
+      out_arrays(3) = CCTK_PointerTo(tzz)
+      out_arrays(4) = CCTK_PointerTo(txy)
+      out_arrays(5) = CCTK_PointerTo(txz)
+      out_arrays(6) = CCTK_PointerTo(tyz)
+
+      out_array_type_codes = CCTK_VARIABLE_REAL
+
+
+!     Interpolation.
+
+      call CCTK_InterpGridArrays (ierror, cctkGH, 3, interp_handle,
+     .                            param_table_handle, coord_system_handle,
+     .                            npoints, CCTK_VARIABLE_REAL, interp_coords,
+     .                            6, in_array_indices,
+     .                            6, out_array_type_codes, out_arrays)
+      if (ierror < 0) then
+        call CCTK_WARN (1, "interpolator call returned an error code");
+      endif
+
+!     release parameter table
+      call Util_TableDestroy (ierror, param_table_handle)
+
+
+!     ******************************
+!     ***   INTEGRATE DISTANCE   ***
+!     ******************************
+
+      ddx = (x2-x1)/dble(np)
+      ddy = (y2-y1)/dble(np)
+      ddz = (z2-z1)/dble(np)
+
+      if (myproc.eq.0) then
+
+!        Integrate using trapezoidal rule.
+
+         d12 = zero
+
+         do i=1,np
+
+            d12 = d12 + half
+     .          *(sqrt(txx(i-1)*ddx**2  + tyy(i-1)*ddy**2  + tzz(i-1)*ddz**2
+     .          +  two*(txy(i-1)*ddx*ddy + txz(i-1)*ddx*ddz + tyz(i-1)*ddy*ddz))
+     .          + sqrt(txx(i  )*ddx**2  + tyy(i  )*ddy**2  + tzz(i  )*ddz**2
+     .          +  two*(txy(i  )*ddx*ddy + txz(i  )*ddx*ddz + tyz(i  )*ddy*ddz)))
+
+         end do
+
+      end if
+
+      d12 = factor*d12
+
+
+!     *****************************
+!     ***   DEALLOCATE MEMORY   ***
+!     *****************************
+
+      deallocate(xa,ya,za)
+      deallocate(txx,tyy,tzz,txy,txz,tyz)
+
+
+!     ******************
+!     ***   OUTPUT   ***
+!     ******************
+
+  100 continue
+
+      disf = filestr(1:nfile) // "/ahf_d12" // ".tl"
+      if (myproc.eq.0) then
+        inquire(file=disf, exist=disf_exists)
+        if (disf_exists) then
+          open(11,file=disf,form='formatted',status='old', position='append')
+        else
+          open(11,file=disf,form='formatted',status='replace')
+          write(11,"(A18)") '" Horizon distance'
+        end if
+        write(11,"(2ES14.6)") cctk_time,d12
+        close(11)
+      end if
+
+
+!     ***************
+!     ***   END   ***
+!     ***************
+
+      end subroutine AHFinder_dis

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,1 @@
+test_AHF_2


Add missing AHFinder_calcsigma.F in EinsteinAnalysis/AHFinder (einsteintoolkit/Cactus#6)

This PR adds the missing source file AHFinder_calcsigma.F to complete the EinsteinAnalysis/AHFinder thorn implementation.

Implement the full functionality of AHFinder

Please implement the full functionality of `AHFinder` by finishing the code in `AHFinder_calcsigma.F`.

## Thorn Information:
- Name: AHFinder
- Target file: AHFinder_calcsigma.F

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_calcsigma.F b/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_calcsigma.F
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/EinsteinAnalysis/AHFinder/src/AHFinder_calcsigma.F
@@ -0,0 +1,312 @@
+/*@@
+  @file      AHFinder_calcsigma.F
+  @date      July 1999
+  @author    Lars Nerger
+  @desc
+             Calculate weight sigma for Nakamura flow
+  @enddesc
+@@*/
+
+#include "cctk.h"
+#include "cctk_Parameters.h"
+#include "cctk_Arguments.h"
+
+      subroutine AHFinder_calcsigma(CCTK_ARGUMENTS,xp,yp,zp,gupij,sigma)
+
+      use AHFinder_dat
+
+      implicit none
+
+      DECLARE_CCTK_ARGUMENTS
+      DECLARE_CCTK_PARAMETERS
+
+      integer nmax
+      integer l,m
+      integer indx1,indx2
+      integer indx,idir,jdir
+
+      CCTK_REAL zero, sigma
+      CCTK_REAL ni(3),si(3),supi(3),pij(3,3)
+      CCTK_REAL ylmi((lmax+1)**2,3)
+      CCTK_REAL alm((lmax+1)**2)
+      CCTK_REAL xp,yp,zp,er,sum
+      CCTK_REAL rho,costheta,sintheta,sinthetal(-1:lmax),prod
+      CCTK_REAL zlm0(0:lmax,0:lmax),zlm1(0:lmax,0:lmax)
+      CCTK_REAL cosphi,sinphi,cosmphi(0:lmax),sinmphi(0:lmax)
+      CCTK_REAL thetax,thetay,thetaz
+      CCTK_REAL phix,phiy
+      CCTK_REAL c1,c2,c3,metnorm
+      CCTK_REAL fi(3)
+      CCTK_REAL gupij(3,3)
+
+!     Description of variables
+!
+!     sigma   Weight of Nakamura Flow
+
+
+!     **************************
+!     ***   DEFINE NUMBERS   ***
+!     **************************
+
+      zero    = 0.0D0
+      nmax = (lmax+1)**2
+
+!     ******************************************************
+!     ***   Calculate gradient of Y_lm(x,y,z)            ***
+!     ***   Adopted from thorn_SpectralAHF by Gundlach  ***
+!     ******************************************************
+
+
+!     Initialize arrays
+      ylmi = zero
+      zlm0 = zero
+      zlm1 = zero
+      ni = zero
+      si = zero
+      supi = zero
+      pij = zero
+      alm = zero
+      sinthetal = zero
+      cosmphi = zero
+      sinmphi = zero
+
+
+!     Calculate quantities in spherical coordinates.
+      er = sqrt(xp**2 + yp**2 + zp**2)
+      if (er .eq. 0.d0) then
+         call CCTK_WARN(0,'r=0 in AHFinder_calcsigma')
+      end if
+
+C     ********PATCH******************************************
+C     Keep away from the z-axis, artificially.
+      if (xp**2 + yp**2 .lt. 1.d-16) then
+C         write(6,*) 'patch on axis in ylmder2'
+         xp = 0.d0
+         yp = 1.d-8
+      end if
+
+C     Polar angle theta.
+      rho = sqrt(xp**2 + yp**2)
+      costheta = zp / er
+      sintheta = rho / er
+C     Array sinthetal(l) contains [sin(theta)]^l
+      sinthetal(-1) = 0.d0
+      sinthetal(0) = 1.d0
+      sinthetal(1) = sintheta
+      do l=2,lmax
+         sinthetal(l) = sinthetal(l-1) * sinthetal(1)
+      end do
+
+C     zlm0 is Y_lm stripped of exp(i m phi) and multiplied by sqrt(4pi).
+C     zlm1 and zlm2 are the first and second derivative of zlm0
+C     with respect to theta. l=0 and m=l are treated separately.
+C     We only need zlm0,1,2 for positive m.
+C     Treat l=0 separately:
+      zlm0(0,0) = 1.d0
+      zlm1(0,0) = 0.d0
+
+C     Other l>0.
+      prod = 1.d0
+      do l=1,lmax
+
+C     Initialize m = l:
+C     c1 = sqrt(2l+1) * sqrt(2l!) / 2^l / l!
+C     Y_ll = c1 * sin(theta)^l
+C     Y_llp = c1 * l * sin(theta)^(l-1) * costheta
+         m = l
+         prod = - prod * sqrt(dble(2*l-1) / dble(2*l))
+         c1 = sqrt(dble(2*l+1)) * prod
+         zlm0(l,m) = c1 * sinthetal(l)
+         zlm1(l,m) = c1 * dble(l) * sinthetal(l-1) * costheta
+
+C     Recursion relations for the other m:
+C     c2 = sqrt[(2l+1)(2l-1)/(l^2-m^2)]
+C     c3 = sqrt[((l-1)^2-m^2)(2l=1)/(l^2-m^2)/(2l-3)]
+C     Y_lm = c2 Y_l-1,m cos(theta) + c3 Y_l-2,m
+C     Y_lmp = c2 Y_l-1,mp cos(theta) + c2 Y_l-1,m + c3 Y_l-2,mp
+         m = l-1
+         c2 = sqrt(dble((2*l+1)*(2*l-1))
+     $        / dble(l**2-m**2))
+         zlm0(l,m) = c2 * zlm0(l-1,m) * costheta
+         zlm1(l,m) = c2 * (zlm1(l-1,m) * costheta
+     $           - zlm0(l-1,m) * sintheta)
+
+         do m=0,l-2
+            c2 = sqrt(dble((2*l+1)*(2*l-1))
+     $           / dble(l**2-m**2))
+            c3 =sqrt(dble((2*l+1)*((l-1)**2-m**2))
+     $           / dble((l**2 - m**2)*(2*l-3)))
+            zlm0(l,m) = c2 * zlm0(l-1,m) * costheta
+     $           - c3 * zlm0(l-2,m)
+            zlm1(l,m) = c2 * (zlm1(l-1,m) * costheta
+     $           - zlm0(l-1,m) * sintheta)
+     $           - c3 * zlm1(l-2,m)
+         end do
+      end do
+
+
+      if (rho .ne. 0.d0) then
+C     Azimuth angle phi is defined.
+         cosphi = xp / rho
+         sinphi = yp / rho
+C     First and second derivatives of theta.
+         thetax = costheta * cosphi / er
+         thetay = costheta * sinphi / er
+         thetaz = - sintheta / er
+C     First and second derivatives of phi, the angle in the xy-plane.
+         phix = - sinphi / rho
+         phiy = cosphi / rho
+C     Put together arrays of basis functions in the xy plane.
+C     The sqrt(2) factor is needed in going from the basis exp(+/-imphi)
+C     to the basis cos/sin(mphi).
+         cosmphi(0) = 1.d0
+         sinmphi(0) = 1.d0
+         cosmphi(1) = sqrt(2.d0) * cosphi
+         sinmphi(1) = sqrt(2.d0) * sinphi
+         do m=2,lmax
+            cosmphi(m) = cosmphi(m-1) * cosphi - sinmphi(m-1) * sinphi
+            sinmphi(m) = cosmphi(m-1) * sinphi + sinmphi(m-1) * cosphi
+         end do
+      else
+C     See above for a patch that avoids ever getting here.
+          call CCTK_WARN(0,'ylmder2 cannot handle axis')
+C     For x = y = 0 the following are not defined.
+!         cosphi = 7.d77
+!         sinphi = 7.d77
+!         thetax = 7.d77
+!         thetay = 7.d77
+!         phix = 7.d77
+!         phiy = 7.d77
+!         cosmphi = 7.d77
+!         sinmphi = 7.d77
+C     Only these are defined.
+         thetaz = 0.d0
+         cosmphi(0) = 1.d0
+         sinmphi(0) = 1.d0
+      end if
+
+C     Assemble the Y_lm from zlm0 and the basis of functions of phi.
+C     Assemble the Y_lm,i and Y_lm,ij in the corresponding manner.
+      do l=0,lmax
+         do m=0,l
+C     These are the values of indx corresponding to (l,m) and (l,-m).
+            indx1 = l**2 + 1 + l + m
+            indx2 = l**2 + 1 + l - m
+C     Ylm,x
+            ylmi(indx1,1) = thetax * zlm1(l,m) * cosmphi(m)
+     $           - dble(m) * phix * zlm0(l,m) * sinmphi(m)
+            ylmi(indx2,1) = thetax * zlm1(l,m) * sinmphi(m)
+     $           + dble(m) * phix * zlm0(l,m) * cosmphi(m)
+C     Ylm,y
+            ylmi(indx1,2) = thetay * zlm1(l,m) * cosmphi(m)
+     $           - dble(m) * phiy * zlm0(l,m) * sinmphi(m)
+            ylmi(indx2,2) = thetay * zlm1(l,m) * sinmphi(m)
+     $           + dble(m) * phiy * zlm0(l,m) * cosmphi(m)
+C     Ylm,z
+            ylmi(indx1,3) = thetaz * zlm1(l,m) * cosmphi(m)
+            ylmi(indx2,3) = thetaz * zlm1(l,m) * sinmphi(m)
+         end do
+      end do
+
+
+!     ********************************
+!     ***  First derivatives of r  ***
+!     ********************************
+
+      ni(1) = xp / er
+      ni(2) = yp / er
+      ni(3) = zp / er
+
+
+!     *************************************************************
+!     ***   compress c0, cc and cs into alm with single index   ***
+!     *************************************************************
+
+      do l=0, lmax
+         alm(l**2+l+1) = c0(l)
+         do m=1,lmax
+            alm(l**2+l+1+m) = cc(l,m)
+            alm(l**2+l+1-m) = cs(l,m)
+         end do
+      end do
+
+
+!     *******************************************************************
+!     ***   Assemble derivatives of f. Recall f = r - h(theta,phi):   ***
+!     *******************************************************************
+
+C     Derivatives of r...
+C     r,i = n_i and r,ij = (delta_ij - n_i n_j) / r = n_ij
+      do idir=1,3
+         fi(idir) = ni(idir)
+      end do
+C     ...and derivatives of -h.
+      do indx=1,nmax
+         do idir=1,3
+            fi(idir) = fi(idir) - alm(indx) * ylmi(indx,idir)
+         end do
+      end do
+
+
+!     *************************************************************
+!     ***   Assemble normal vector s on surfaces of constant f  ***
+!     ***   with indices down.  That is, normal with respect    ***
+!     ***   to the physical metric g_ij.                        ***
+!     *************************************************************
+
+      metnorm = 0.d0
+      do idir=1,3
+         do jdir=1,3
+            metnorm = metnorm + fi(idir) * fi(jdir)
+     $           * gupij(idir,jdir)
+         end do
+      end do
+      metnorm = sqrt(metnorm)
+      do idir=1,3
+         si(idir) = fi(idir) / metnorm
+      end do
+
+C     Now with indices up, raised by g^ij.
+      do idir=1,3
+         supi(idir) = 0.d0
+         do jdir=1,3
+            supi(idir) = supi(idir)
+     $           + gupij(idir,jdir) * si(jdir)
+         end do
+      end do
+
+!     *******************************************************
+!     ***   Assemble projection operator with indices up  ***
+!     ***            p^ij = g^ij - s^i s^j                ***
+!     *******************************************************
+
+      do idir=1,3
+         do jdir=1,3
+            pij(idir,jdir) = gupij(idir,jdir)
+     $           - supi(idir) * supi(jdir)
+         end do
+      end do
+
+
+!     *************************************************
+!     ***   Calculate weight sigma                  ***
+!     ***   2 * r^2 / (p^ij (delta_ij - n_i n_j))   ***
+!     *************************************************
+
+      sum = 0.d0
+      do idir=1,3
+         sum = sum + pij(idir,idir)
+         do jdir=1,3
+            sum = sum
+     $           - pij(idir,jdir) * ni(idir) * ni(jdir)
+         end do
+      end do
+      sigma = 2.d0 * er**2 / sum
+
+
+!     ***************
+!     ***   END   ***
+!     ***************
+
+      end subroutine AHFinder_calcsigma
+


Add missing GRHydro_Jacobian_state.c in EinsteinEvolve/GRHydro (einsteintoolkit/Cactus#7)

This PR adds the missing source file GRHydro_Jacobian_state.c to complete the EinsteinEvolve/GRHydro thorn implementation.

Implement the full functionality of GRHydro

Please implement the full functionality of `GRHydro` by finishing the code in `GRHydro_Jacobian_state.c`.

## Thorn Information:
- Name: GRHydro
- Target file: GRHydro_Jacobian_state.c

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_Jacobian_state.c b/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_Jacobian_state.c
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_Jacobian_state.c
@@ -0,0 +1,49 @@
+#include <assert.h>
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+
+
+
+/**
+   Checks states for Jacobians
+*/
+void
+GRHydro_check_Jacobian_state (CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS
+  DECLARE_CCTK_PARAMETERS
+
+  static CCTK_INT idxJacobian_state = -1, idxiJacobian_state = -1;
+
+  if (!CCTK_IsImplementationActive("Coordinates"))
+     return; /* Multipatch infrastructure not active */
+
+  if (idxJacobian_state == -1)
+  {
+     idxJacobian_state = CCTK_VarIndex("Coordinates::jacobian_state");
+     assert(idxJacobian_state >= 0);
+  }
+
+  if (idxiJacobian_state == -1)
+  {
+     idxiJacobian_state = CCTK_VarIndex("Coordinates::inverse_jacobian_state");
+     assert(idxiJacobian_state >= 0);
+  }
+
+  if (*(CCTK_INT *)CCTK_VarDataPtrI(cctkGH, 0, idxJacobian_state) == 0)
+  {
+     CCTK_WARN(0, "GRHydro requires storage for Jacobians. Please tell your Coordinates implementation to store the Jacobians!");
+  }
+
+  if (*(CCTK_INT *)CCTK_VarDataPtrI(cctkGH, 0, idxiJacobian_state) == 0)
+  {
+     CCTK_WARN(0, "GRHydro requires storage for inverse Jacobians. Please tell your Coordinates implementation to store the inverse Jacobians!");
+  }
+
+}
+
+
+

diff --git a/all_tests.txt b/all_tests.txt
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/all_tests.txt
@@ -0,0 +1,10 @@
+GRHydro_test_shock
+GRHydro_test_shock_mp5
+GRHydro_test_shock_ppm
+GRHydro_test_tov_ppm_ML
+GRHydro_test_tov_ppm_ML_disable_internal_excision
+GRHydro_test_tov_ppm_no_trp_ML
+test_one_hybrid
+tov_carpetevolutionmask
+tov_carpetevolutionmask2
+tov_slowsector


Add missing GRHydro_PPMReconstruct_drv_opt.F90 in EinsteinEvolve/GRHydro (einsteintoolkit/Cactus#8)

This PR adds the missing source file GRHydro_PPMReconstruct_drv_opt.F90 to complete the EinsteinEvolve/GRHydro thorn implementation.

Implement the full functionality of GRHydro

Please implement the full functionality of `GRHydro` by finishing the code in `GRHydro_PPMReconstruct_drv_opt.F90`.

## Thorn Information:
- Name: GRHydro
- Target file: GRHydro_PPMReconstruct_drv_opt.F90

## Interface Definition in interface.ccl:

## Schedule Definition in schedule.ccl:

## Parameters Definition in param.ccl:

## Configuration Definition in configuration.ccl:

## Documentation Context in readme.md and doc/documentation.tex

## Related Code Context in src folder

diff --git a/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_PPMReconstruct_drv_opt.F90 b/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_PPMReconstruct_drv_opt.F90
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/EinsteinEvolve/GRHydro/src/GRHydro_PPMReconstruct_drv_opt.F90
@@ -0,0 +1,209 @@
+ /*@@
+   @file      GRHydro_PPMReconstruct_drv.F90
+   @date      Tue Jul 19 13:22:03 EDT 2011
+   @author    Bruno C. Mundim, Joshua Faber, Christian D. Ott
+   @desc
+   Driver routine to perform the PPM reconstructions.
+   @enddesc
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+#include "cctk_Functions.h"
+
+#include "SpaceMask.h"
+
+#define velx(i,j,k) vup(i,j,k,1)
+#define vely(i,j,k) vup(i,j,k,2)
+#define velz(i,j,k) vup(i,j,k,3)
+#define sx(i,j,k) scon(i,j,k,1)
+#define sy(i,j,k) scon(i,j,k,2)
+#define sz(i,j,k) scon(i,j,k,3)
+
+
+ /*@@
+   @routine    GRHydro_PPMReconstruct_drv
+   @date       Tue Jul 19 13:24:34 EDT 2011
+   @author     Luca Baiotti, Ian Hawke, Bruno C. Mundim, Joshua Faber, Christian D. Ott
+   @desc
+   A driver routine to do PPM reconstructions.
+   @enddesc
+   @calls
+   @calledby
+   @history
+
+   @endhistory
+
+@@*/
+
+subroutine GRHydro_PPMReconstruct_drv(CCTK_ARGUMENTS)
+
+  implicit none
+
+  DECLARE_CCTK_ARGUMENTS
+  DECLARE_CCTK_PARAMETERS
+  DECLARE_CCTK_FUNCTIONS
+
+  integer :: nx, ny, nz, i, j, k
+
+  logical, dimension(:,:,:), allocatable :: trivial_rp
+
+  CCTK_INT :: type_bitsx, trivialx, not_trivialx, &
+       &type_bitsy, trivialy, not_trivialy, &
+       &type_bitsz, trivialz, not_trivialz
+
+  CCTK_INT :: ierr
+
+  ! save memory when MP is not used
+  CCTK_INT :: GRHydro_UseGeneralCoordinates
+  CCTK_REAL, DIMENSION(cctk_ash1,cctk_ash2,cctk_ash3) :: g11, g12, g13, g22, g23, g33
+  pointer (pg11,g11), (pg12,g12), (pg13,g13), (pg22,g22), (pg23,g23), (pg33,g33)
+  CCTK_REAL, DIMENSION(cctk_ash1,cctk_ash2,cctk_ash3) :: beta1, beta2, beta3
+  pointer (pbeta1,beta1), (pbeta2,beta2), (pbeta3,beta3)
+  CCTK_REAL, DIMENSION(cctk_ash1,cctk_ash2,cctk_ash3,3) :: vup
+  pointer (pvup,vup)
+
+  logical :: apply_enhanced_ppm
+
+  if (GRHydro_UseGeneralCoordinates(cctkGH).ne.0) then
+    pg11 = loc(gaa)
+    pg12 = loc(gab)
+    pg13 = loc(gac)
+    pg22 = loc(gbb)
+    pg23 = loc(gbc)
+    pg33 = loc(gcc)
+    pbeta1 = loc(betaa)
+    pbeta2 = loc(betab)
+    pbeta3 = loc(betac)
+    pvup = loc(lvel)
+  else
+    pg11 = loc(gxx)
+    pg12 = loc(gxy)
+    pg13 = loc(gxz)
+    pg22 = loc(gyy)
+    pg23 = loc(gyz)
+    pg33 = loc(gzz)
+    pbeta1 = loc(betax)
+    pbeta2 = loc(betay)
+    pbeta3 = loc(betaz)
+    pvup = loc(vel)
+  end if
+
+  allocate(trivial_rp(cctk_ash(1),cctk_ash(2),cctk_ash(3)),STAT=ierr)
+  if (ierr .ne. 0) then
+    call CCTK_ERROR("Allocation problems with trivial_rp")
+    STOP
+  end if
+
+  call SpaceMask_GetTypeBits(type_bitsx, "Hydro_RiemannProblemX")
+  call SpaceMask_GetStateBits(trivialx, "Hydro_RiemannProblemX", &
+       &"trivial")
+  call SpaceMask_GetStateBits(not_trivialx, "Hydro_RiemannProblemX", &
+       &"not_trivial")
+  call SpaceMask_GetTypeBits(type_bitsy, "Hydro_RiemannProblemY")
+  call SpaceMask_GetStateBits(trivialy, "Hydro_RiemannProblemY", &
+       &"trivial")
+  call SpaceMask_GetStateBits(not_trivialy, "Hydro_RiemannProblemY", &
+       &"not_trivial")
+  call SpaceMask_GetTypeBits(type_bitsz, "Hydro_RiemannProblemZ")
+  call SpaceMask_GetStateBits(trivialz, "Hydro_RiemannProblemZ", &
+       &"trivial")
+  call SpaceMask_GetStateBits(not_trivialz, "Hydro_RiemannProblemZ", &
+       &"not_trivial")
+
+  nx = cctk_lsh(1)
+  ny = cctk_lsh(2)
+  nz = cctk_lsh(3)
+
+  ! if use_enhanced_ppm, allow old PPM on one level
+  if (GRHydro_oppm_reflevel .eq. (-1) .or. &
+       GRHydro_reflevel .ne. GRHydro_oppm_reflevel) then
+     apply_enhanced_ppm = use_enhanced_ppm .ne. 0
+  else
+     apply_enhanced_ppm = .false.
+  end if
+
+
+
+!!$ PPM starts:
+    if (flux_direction == 1) then
+         !$OMP PARALLEL DO PRIVATE(i, j, k)
+         do k = GRHydro_stencil, nz - GRHydro_stencil + 1
+           do j = GRHydro_stencil, ny - GRHydro_stencil + 1
+
+           trivial_rp(:,j,k) = .false.
+           call PPMtyc(nx,CCTK_DELTA_SPACE(1),rho(:,j,k),velx(:,j,k),&
+                vely(:,j,k),velz(:,j,k),eps(:,j,k),temperature(:,j,k),Y_e(:,j,k),&
+                press(:,j,k),rhominus(:,j,k),&
+                velxminus(:,j,k),velyminus(:,j,k),velzminus(:,j,k),&
+                epsminus(:,j,k),tempminus(:,j,k), y_e_minus(:,j,k),&
+                rhoplus(:,j,k),&
+                velxplus(:,j,k),velyplus(:,j,k),velzplus(:,j,k),&
+                epsplus(:,j,k),tempplus(:,j,k),y_e_plus(:,j,k))
+             do i = 1, nx
+                if (trivial_rp(i,j,k)) then
+                  SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bitsx, trivialx)
+                else
+                  SpaceMask_SetStateBitsF90(space_mask, i, j, k, type_bitsx, not_trivialx)
+                end if
+             end do
+           end do
+         end do
+         !$OMP END PARALLEL DO
+      else if (flux_direction == 2) then
+        !$OMP PARALLEL DO PRIVATE(i, j, k)
+        do k = GRHydro_stencil, nz - GRHydro_stencil + 1
+          do j = GRHydro_stencil, nx - GRHydro_stencil + 1
+           trivial_rp(j,:,k) = .false.
+           call PPMtyc(ny,CCTK_DELTA_SPACE(2),rho(j,:,k),&
+                vely(j,:,k),velz(j,:,k),velx(j,:,k),&
+                eps(j,:,k),temperature(j,:,k),Y_e(j,:,k), &
+                press(j,:,k),rhominus(j,:,k),&
+                velyminus(j,:,k),velzminus(j,:,k),velxminus(j,:,k),&
+                epsminus(j,:,k),tempminus(j,:,k), y_e_minus(j,:,k),rhoplus(j,:,k),&
+                velyplus(j,:,k),velzplus(j,:,k),velxplus(j,:,k),&
+                epsplus(j,:,k),tempplus(j,:,k),y_e_plus(j,:,k))
+            do i = 1, ny
+              if (trivial_rp(j,i,k)) then
+                 SpaceMask_SetStateBitsF90(space_mask, j, i, k, type_bitsy, trivialy)
+              else
+                 SpaceMask_SetStateBitsF90(space_mask, j, i, k, type_bitsy, not_trivialy)
+              end if
+            end do
+          end do
+        end do
+        !$OMP END PARALLEL DO
+
+    else if (flux_direction == 3) then
+        !$OMP PARALLEL DO PRIVATE(i, j, k)
+        do k = GRHydro_stencil, ny - GRHydro_stencil + 1
+          do j = GRHydro_stencil, nx - GRHydro_stencil + 1
+           trivial_rp(j,k,:) = .false.
+           call PPMtyc(nz,CCTK_DELTA_SPACE(3),rho(j,k,:),&
+                velz(j,k,:),velx(j,k,:),vely(j,k,:),&
+                eps(j,k,:),temperature(j,k,:),Y_e(j,k,:), press(j,k,:),rhominus(j,k,:),&
+                velzminus(j,k,:),velxminus(j,k,:),velyminus(j,k,:),&
+                epsminus(j,k,:),tempminus(j,k,:),y_e_minus(j,k,:),rhoplus(j,k,:),&
+                velzplus(j,k,:),velxplus(j,k,:),velyplus(j,k,:),&
+                epsplus(j,k,:),tempplus(j,k,:),y_e_plus(j,k,:))
+            do i = 1, nz
+              if (trivial_rp(j,k,i)) then
+                SpaceMask_SetStateBitsF90(space_mask, j, k, i, type_bitsz, trivialz)
+              else
+                SpaceMask_SetStateBitsF90(space_mask, j, k, i, type_bitsz, not_trivialz)
+              end if
+            end do
+          end do
+        end do
+        !$OMP END PARALLEL DO
+    else
+      call CCTK_ERROR("Flux direction not x,y,z")
+      STOP
+    end if
+!!$ PPM ends.
+
+  deallocate(trivial_rp)
+
+end subroutine GRHydro_PPMReconstruct_drv
+