Repository: einsteintoolkit/Cactus — pull request #3 (cpp)
Title: Add missing Boundary.c in CactusWave/WaveToyExtra

This PR adds the missing source file Boundary.c to complete the CactusWave/WaveToyExtra thorn implementation.

Resolved issues:
title: Implement the full functionality of WaveToyExtra
body: Please implement the full functionality of `WaveToyExtra` by finishing the code in `Boundary.c`.

## Thorn Information:
- Name: WaveToyExtra
- Target file: Boundary.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



Hints:

Fix patch:
diff --git a/arrangements/CactusWave/WaveToyExtra/src/Boundary.c b/arrangements/CactusWave/WaveToyExtra/src/Boundary.c
new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/arrangements/CactusWave/WaveToyExtra/src/Boundary.c
@@ -0,0 +1,106 @@
+/*@@
+   @file      Boundary.c
+   @date      Friday 18th July 2003
+   @author    Gabrielle Allen
+   @desc
+              Use any provided boundary condition with WaveToy
+   @enddesc
+   @version   $Id$
+ @@*/
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+#include "util_Table.h"
+
+static const char *rcsid = "$Header$";
+
+CCTK_FILEVERSION(CactusWave_WaveToyExtra_Boundary_c);
+
+/********************************************************************
+ *********************     Local Data Types   ***********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Routine Prototypes *********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Other Routine Prototypes *********************
+ ********************************************************************/
+
+void WaveToyExtra_Boundary(CCTK_ARGUMENTS);
+
+/********************************************************************
+ *********************     Local Data   *****************************
+ ********************************************************************/
+
+static int handle=-1;
+
+/********************************************************************
+ *********************     External Routines   **********************
+ ********************************************************************/
+
+ /*@@
+   @routine    WaveToyC_Boundary
+   @date       Friday 18th July 2003
+   @author     Gabrielle Allen
+   @desc 
+               Mark wavetoy variables for custom boundary condition
+   @enddesc 
+   @history 
+   @endhistory 
+@@*/
+
+void WaveToyExtra_Boundary(CCTK_ARGUMENTS)
+{
+  DECLARE_CCTK_ARGUMENTS;
+  DECLARE_CCTK_PARAMETERS;
+
+  CCTK_INT ierr=0;
+
+  if (CCTK_EQUALS(bound,"custom"))
+  {
+    if (!CCTK_EQUALS(custom_options,""))
+    {
+      if (handle == -1)
+      {
+        handle = Util_TableCreateFromString(custom_options);
+        if (handle < 0)
+        {
+          CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,
+                     "WaveToyC_Boundaries: Error creating table for "
+                     "boundary condition %s",custom_bound);
+        }
+      }
+    }
+    ierr = Boundary_SelectVarForBC(cctkGH, CCTK_ALL_FACES, 1, handle, 
+                                   "wavetoy::phi",custom_bound);  
+  }    
+
+  if (ierr < 0) 
+  {
+    CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,
+               "WaveToyC_Boundaries: Error selecting boundary "
+               "condition %s",bound);
+  }
+
+  return;
+}
+
+
+ /*@@
+   @routine    WaveToyC_Terminate
+   @date       Friday 18th July 2003
+   @author     Gabrielle Allen
+   @desc 
+               Tidy up wavetoy
+   @enddesc 
+   @history 
+   @endhistory 
+@@*/
+void WaveToyC_Terminate(CCTK_ARGUMENTS)
+{
+  Util_TableDestroy(handle);
+}

Test patch:
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_custom