diff options
Diffstat (limited to 'src/Ell_Interface.c')
-rw-r--r-- | src/Ell_Interface.c | 119 |
1 files changed, 95 insertions, 24 deletions
diff --git a/src/Ell_Interface.c b/src/Ell_Interface.c index 259f40b..838e3e6 100644 --- a/src/Ell_Interface.c +++ b/src/Ell_Interface.c @@ -1,3 +1,21 @@ + /*@@ + @header Ell_Interface.h + @date + @author Gerd Lanferman + @desc + Elliptic class routines for: + + * Registering the equation class wrapper (the function which is called for + a specific class of problems by passing all the necessay arguments PLUS + the name of the desired solver + + * Equation class wrapper, for each elliptic class + Derives the function to call from the passed registration name of the + solver "sname". + + @enddesc + @version $Header$ + @@*/ #include <stdio.h> #include <stdlib.h> @@ -18,26 +36,29 @@ static pNamedData *BrBrConfMetricSolverDB; static pNamedData *PolyConfMetricSolverDB; -/*########## Elliptic Equation class: LinEllConfMetric */ - +/* +###################################################### +###### Elliptic Equation class: LinEllConfMetric ##### +###################################################### +*/ -/* Registers the Equation class wrapper (the function which is called for a - specific class of problems by passing all the necessay arguments PLUS - the name of the desired solver */ +int Ell_LinConfMetricRegistry(int (*function), const char *sname) +{ + int retval; -void Ell_LinConfMetricRegistry(int (*function), const char *sname) { - StoreNamedData(&LinConfMetricSolverDB,sname,(int*)function); + if(!GetNamedData(LinConfMetricSolverDB,sname)) + { + StoreNamedData(&LinConfMetricSolverDB,sname,(int*)function); + retval = ELL_SUCCESS; + } + else + { + retval = ELL_SOLVEREXISTS; + } + + return retval; } -/* The Equation class wrapper, for the elliptic class LinConfMetric - (linar elliptic problem that requires the metric plus a - conformal factor). It derives the function to call from the - passed registration name of the solver "sname". - Specifically it takes: - grid hierarchy, integer array of the metric+conf.factor indeces, - field index, Mindex, Nindex, real array for absolute tolerances - and relative tolerances, the registration name of the solver */ - int Ell_LinConfMetricSolver(cGH *GH, int *MetricPsi, int FieldIndex, @@ -108,9 +129,21 @@ void FMODIFIER FORTRAN_NAME(Ell_LinConfMetricSolver) ################################################## */ -void Ell_LinMetricRegistry(void (*function), const char *sname) +int Ell_LinMetricRegistry(void (*function), const char *sname) { - StoreNamedData(&LinMetricSolverDB,sname,(void*)function); + int retval; + + if(!GetNamedData(LinMetricSolverDB,sname)) + { + StoreNamedData(&LinMetricSolverDB,sname,(void*)function); + retval = ELL_SUCCESS; + } + else + { + retval = ELL_SOLVEREXISTS; + } + + return retval; } int Ell_LinMetricSolver(cGH *GH, @@ -181,9 +214,22 @@ void FMODIFIER FORTRAN_NAME(Ell_LinMetricSolver) ################################################ */ -void Ell_LinFlatRegistry(void (*function), const char *sname) +int Ell_LinFlatRegistry(void (*function), const char *sname) { - StoreNamedData(&LinFlatSolverDB,sname,(void*)function); + int retval; + + if(!GetNamedData(LinFlatSolverDB,sname)) + { + StoreNamedData(&LinFlatSolverDB,sname,(void*)function); + retval = ELL_SUCCESS; + } + else + { + retval = ELL_SOLVEREXISTS; + } + + return retval; + } int Ell_LinFlatSolver(cGH *GH, @@ -250,9 +296,22 @@ void FMODIFIER FORTRAN_NAME(Ell_LinFlatSolver) (Brandt-Bruemann Data with conformal metric) */ -void Ell_BrBrConfMetricRegistry(void (*function), const char *sname) +int Ell_BrBrConfMetricRegistry(void (*function), const char *sname) { - StoreNamedData(&BrBrConfMetricSolverDB,sname, (void*)function); + int retval; + + if(!GetNamedData(BrBrConfMetricSolverDB,sname)) + { + StoreNamedData(&BrBrConfMetricSolverDB,sname, (void*)function); + retval = ELL_SUCCESS; + } + else + { + retval = ELL_SOLVEREXISTS; + } + + return retval; + } int Ell_BrBrConfMetricSolver(cGH *GH, @@ -325,9 +384,21 @@ void FMODIFIER FORTRAN_NAME(Ell_BrBrConfMetricSolver) #################################################### */ -void Ell_PolyConfMetricRegistry(void (*function), const char *sname) +int Ell_PolyConfMetricRegistry(void (*function), const char *sname) { - StoreNamedData(&PolyConfMetricSolverDB,sname, (void*)function); + int retval; + + if(!GetNamedData(PolyConfMetricSolverDB,sname)) + { + StoreNamedData(&PolyConfMetricSolverDB,sname, (void*)function); + retval = ELL_SUCCESS; + } + else + { + retval = ELL_SOLVEREXISTS; + } + + return retval; } int Ell_PolyConfMetricSolver(cGH *GH, |