aboutsummaryrefslogtreecommitdiff
path: root/src/Ell_Interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ell_Interface.c')
-rw-r--r--src/Ell_Interface.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/Ell_Interface.c b/src/Ell_Interface.c
new file mode 100644
index 0000000..1ddca73
--- /dev/null
+++ b/src/Ell_Interface.c
@@ -0,0 +1,64 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "cctk.h"
+#include "cctk_parameters.h"
+
+#include "cctk_FortranString.h"
+#include "StoreNamedData.h"
+
+static pNamedData *LinConfMetricSolverDB;
+static pNamedData *LinMetricSolverDB;
+
+void Ell_LinConfMetricRegistry(void (*function), const char *sname) {
+ StoreNamedData(&LinConfMetricSolverDB,sname,(void*)function);
+}
+
+void Ell_LinConfMetricSolver(cGH *GH, int *MetricPsi, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol, const char *sname) {
+
+ void (*fn)(cGH *GH,int *MetricPsi, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol);
+
+ fn = (void(*))GetNamedData(LinConfMetricSolverDB,sname);
+ if (!fn) CCTK_WARN(0,"Cannot find solver! ");
+
+ fn(GH, MetricPsi, FieldIndex, MIndex, NIndex, AbsTol, RelTol);
+}
+
+void FMODIFIER FORTRAN_NAME(Ell_LinConfMetricSolver)
+ (cGH *GH, int *MetricPsi, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol, ONE_FORTSTRING_ARG) {
+ ONE_FORTSTRING_CREATE(sname);
+ Ell_LinConfMetricSolver(GH, MetricPsi, FieldIndex, MIndex, NIndex, AbsTol, RelTol, sname);
+ free(sname);
+}
+
+
+
+void Ell_LinMetricRegistry(void (*function), const char *sname) {
+ StoreNamedData(&LinMetricSolverDB,sname,(void*)function);
+}
+
+void Ell_LinMetricSolver(cGH *GH, int *Metric, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol, const char *sname) {
+
+ void (*fn)(cGH *GH,int *Metric, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol);
+
+ fn = (void(*))GetNamedData(LinMetricSolverDB,sname);
+ if (!fn) CCTK_WARN(0,"Cannot find solver! ");
+
+ fn(GH, Metric, FieldIndex, MIndex, NIndex, AbsTol, RelTol);
+}
+
+void FMODIFIER FORTRAN_NAME(Ell_LinMetricSolver)
+ (cGH *GH, int *Metric, int *FieldIndex,
+ int *MIndex, int *NIndex, int *AbsTol, int *RelTol, ONE_FORTSTRING_ARG) {
+ ONE_FORTSTRING_CREATE(sname);
+ Ell_LinMetricSolver(GH, Metric, FieldIndex, MIndex, NIndex, AbsTol, RelTol, sname);
+ free(sname);
+}
+