diff options
author | lanfer <lanfer@57bc7290-fb3d-4efd-a9b1-28e84cce6043> | 1999-09-03 17:57:57 +0000 |
---|---|---|
committer | lanfer <lanfer@57bc7290-fb3d-4efd-a9b1-28e84cce6043> | 1999-09-03 17:57:57 +0000 |
commit | f2773b5206a6e0e980028995d33eb8bedc3a1f80 (patch) | |
tree | 8ffa279e7db6c22d7f15746b11c9b2bc75513935 | |
parent | 6a54afa9e7efa05ac1cd8ecd212cea4baa6d96ee (diff) |
The CactusElliptic arrangement
git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllBase/trunk@2 57bc7290-fb3d-4efd-a9b1-28e84cce6043
-rw-r--r-- | README | 20 | ||||
-rw-r--r-- | interface.ccl | 3 | ||||
-rw-r--r-- | param.ccl | 2 | ||||
-rw-r--r-- | schedule.ccl | 7 | ||||
-rw-r--r-- | src/EllBase.h | 20 | ||||
-rw-r--r-- | src/EllBase_Register.c | 53 | ||||
-rw-r--r-- | src/Ell_Interface.c | 64 | ||||
-rw-r--r-- | src/Ell_Register.c | 25 | ||||
-rw-r--r-- | src/Startup.c | 26 | ||||
-rw-r--r-- | src/make.code.defn | 9 |
10 files changed, 229 insertions, 0 deletions
@@ -0,0 +1,20 @@ +Cactus Code Thorn EllBase +Authors : ... +Managed by : ... <...@...........> +Version : ... +CVS info : $Header$ +-------------------------------------------------------------------------- + +1. Purpose of the thorn + +This thorn does ... + +2. Dependencies of the thorn + +This thorn additionally requires implementations and thorns ... + +3. Thorn distribution + +This thorn is available to ... + +4. Additional information diff --git a/interface.ccl b/interface.ccl new file mode 100644 index 0000000..6ebc6a1 --- /dev/null +++ b/interface.ccl @@ -0,0 +1,3 @@ +# Interface definition for thorn EllBase +# $Header$ +implements: ellbase diff --git a/param.ccl b/param.ccl new file mode 100644 index 0000000..e1aca1f --- /dev/null +++ b/param.ccl @@ -0,0 +1,2 @@ +# Parameter definitions for thorn EllBase +# $Header$ diff --git a/schedule.ccl b/schedule.ccl new file mode 100644 index 0000000..eb27b40 --- /dev/null +++ b/schedule.ccl @@ -0,0 +1,7 @@ +# Schedule definitions for thorn EllBase +# $Header$ + +schedule Ell_RegisterBaseEqTypes at STARTUP +{ + LANG:C +} "Register the SOR solvers" diff --git a/src/EllBase.h b/src/EllBase.h new file mode 100644 index 0000000..e01198c --- /dev/null +++ b/src/EllBase.h @@ -0,0 +1,20 @@ +#ifndef _LINEARELLIPTIC_H_ +#define _LINEARELLIPTIC_H_ + +#ifdef CCODE + + +/* Argumennt structure for the four different types of elliptic solvers + provided at this point. Difference is MetricI, MetricPsiI and StencilGFI, which + are arrays holding the grid function indices of the metric, metric+psi or + the 27 stencil grid functions, respectively */ + +#define LINELL_FLAT3D_ARGS cGH *GH, \ + CCTK_REAL tolerance, \ + int FieldIndex, \ + int MIndex, \ + int NIndex \ + +#endif + +#endif diff --git a/src/EllBase_Register.c b/src/EllBase_Register.c new file mode 100644 index 0000000..5bbeeed --- /dev/null +++ b/src/EllBase_Register.c @@ -0,0 +1,53 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "cctk.h" +#include "cctk_parameters.h" + +#include "StoreNamedData.h" +#include "cctk_FortranString.h" + + + +static pNamedData *EqTypeDB = NULL; +static pNamedData *EllSolverDB = NULL; + + +void Ell_RegisterEqType( void (*function),const char *eqname) { + int res; + char *message; + message = (char *)malloc( (128+strlen(name))*sizeof(char) ); + + res=StoreNamedData(&EquType, eqname, (void *)function); + + if (res==1) { + sprintf(message,"Memory failure while registering equation type %s\n",equname); + CCTK_WARN(0,message); + if (message) free(message); + } + else { + sprintf(message,"Equation type >%s< registered",name); + CCTK_INFO(message); + if (message) free(message); + } +} + + + +void Ell_RegisterSolver(void (*solver_func), + const char *sname, const char *eqname) { + int res; + char *message; + void (*function_C)(void *, const char *); + + message = (char *)malloc( (128+strlen(name))*sizeof(char) ); + + function_C = (void (*)) GetNamedData(EquTypeDB, eqname); + if (!function_C) CCTK_WARN(0,"Cannot get Equation Type"); + + function(sname,solver_func); + +} + + 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); +} + diff --git a/src/Ell_Register.c b/src/Ell_Register.c new file mode 100644 index 0000000..80d568e --- /dev/null +++ b/src/Ell_Register.c @@ -0,0 +1,25 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "cctk.h" +#include "cctk_parameters.h" + +#include "StoreNamedData.h" + +static pNamedData *EqNameDB; + +void Ell_RegisterEq(void *(function)(const char *, void*), const char *eqname) { + StoreNamedData(&EqNameDB, eqname, (void*)function); +} + + +void Ell_RegisterSolver(void (*function), const char *sname, const char *eqname) { + void (*fn)(void *, const char *); + + fn = (void(*)(void (*function), const char *sname))GetNamedData(EqNameDB, eqname); + if (!fn) CCTK_WARN(0,"Cannot get function in EqName"); + + fn(function,sname); +} diff --git a/src/Startup.c b/src/Startup.c new file mode 100644 index 0000000..71dce6b --- /dev/null +++ b/src/Startup.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "cctk.h" +#include "cctk_parameters.h" + +void Ell_RegisterBaseEqTypes(cGH *GH) { + void Ell_RegisterEq(void (*function),const char *); + void Ell_LinConfMetricRegistry(void (*function),const char *); + void Ell_LinMetricRegistry(void (*function),const char *); + + printf("Registering Ell_LinConfMetric...."); + Ell_RegisterEq(Ell_LinConfMetricRegistry,"Ell_LinConfMetric"); + printf("...done\n"); + + printf("Registering Ell_LinMetric...."); + Ell_RegisterEq(Ell_LinMetricRegistry,"Ell_LinMetric"); + printf("...done\n"); + +} + + + + + diff --git a/src/make.code.defn b/src/make.code.defn new file mode 100644 index 0000000..dec4f60 --- /dev/null +++ b/src/make.code.defn @@ -0,0 +1,9 @@ +# Main make.code.defn file for thorn EllBase +# $Header$ + +# Source files in this directory +SRCS = Ell_Interface.c Ell_Register.c Startup.c + +# Subdirectories containing source files +SUBDIRS = + |