aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallen <allen@fa3da13c-9f13-4301-a575-cf5b8c5e1907>2002-05-02 21:55:18 +0000
committerallen <allen@fa3da13c-9f13-4301-a575-cf5b8c5e1907>2002-05-02 21:55:18 +0000
commit03e793ed612baf1d5ddb15fe83db444947d3cbd0 (patch)
tree5b8437837a4ab6d397aca7b934d9dc5207da9cc4
parent1ee9574ba9795b340a64925c6f24d633ad574e48 (diff)
Added interface to SOR for LinMetric
git-svn-id: http://svn.cactuscode.org/arrangements/CactusElliptic/EllSOR/trunk@78 fa3da13c-9f13-4301-a575-cf5b8c5e1907
-rw-r--r--src/ConfMetric.c31
-rw-r--r--src/Startup.c117
-rw-r--r--src/Wrapper.c33
3 files changed, 152 insertions, 29 deletions
diff --git a/src/ConfMetric.c b/src/ConfMetric.c
index 1b714a7..360fb28 100644
--- a/src/ConfMetric.c
+++ b/src/ConfMetric.c
@@ -27,12 +27,37 @@ CCTK_FILEVERSION(CactusElliptic_EllSOR_ConfMetric_c)
#define SQR(a) ((a)*(a))
-static int firstcall = 1;
+/********************************************************************
+ ********************* Local Data Types ***********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Routine Prototypes *********************
+ ********************************************************************/
int SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,
int FieldIndex, int MIndex, int NIndex,
CCTK_REAL *AbsTol, CCTK_REAL *RelTol);
+/********************************************************************
+ ***************** Scheduled Routine Prototypes *********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Other Routine Prototypes *********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Data *****************************
+ ********************************************************************/
+
+static int firstcall = 1;
+
+/********************************************************************
+ ********************* External Routines **********************
+ ********************************************************************/
+
+
/*@@
@routine SORConfMetric3D
@date Tue Sep 26 11:28:08 2000
@@ -50,8 +75,8 @@ int SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,
@@*/
int SORConfMetric3D(cGH *GH, int *MetricPsiI, int conformal,
- int FieldIndex, int MIndex, int NIndex,
- CCTK_REAL *AbsTol, CCTK_REAL *RelTol)
+ int FieldIndex, int MIndex, int NIndex,
+ CCTK_REAL *AbsTol, CCTK_REAL *RelTol)
{
DECLARE_CCTK_PARAMETERS
diff --git a/src/Startup.c b/src/Startup.c
index 19a75bd..2e86a42 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -1,9 +1,19 @@
+ /*@@
+ @header Startup.c
+ @date
+ @author
+ @desc
+ Register known elliptic interfaces
+ @enddesc
+ @version $Header$
+ @@*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
+
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
@@ -14,14 +24,29 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusElliptic_EllSOR_Startup_c)
+/********************************************************************
+ ********************* Local Data Types ***********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Routine Prototypes *********************
+ ********************************************************************/
+
void EllSOR_Register(CCTK_ARGUMENTS);
void SORConfMetric(cGH *GH,
- int *MetricPsiI,
- int FieldI,
- int MI,
- int NI,
- CCTK_REAL *AbsTol,
- CCTK_REAL *RelTol);
+ int *MetricPsiI,
+ int FieldI,
+ int MI,
+ int NI,
+ CCTK_REAL *AbsTol,
+ CCTK_REAL *RelTol);
+void SORMetric(cGH *GH,
+ int *MetricI,
+ int FieldI,
+ int MI,
+ int NI,
+ CCTK_REAL *AbsTol,
+ CCTK_REAL *RelTol);
void SORFlat(cGH *GH,
int FieldI,
int MI,
@@ -29,10 +54,41 @@ void SORFlat(cGH *GH,
CCTK_REAL *AbsTol,
CCTK_REAL *RelTol);
-/* routine registers the SOR solver "SORConfMetric" under the name "sor"
- with the Elliptic Class "LinConfMetric".
-*/
+/********************************************************************
+ ***************** Scheduled Routine Prototypes *********************
+ ********************************************************************/
+
+void EllSOR_Register(CCTK_ARGUMENTS);
+
+/********************************************************************
+ ********************* Other Routine Prototypes *********************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* Local Data *****************************
+ ********************************************************************/
+
+/********************************************************************
+ ********************* External Routines **********************
+ ********************************************************************/
+
+/*@@
+ @routine EllSOR_Register
+ @date
+ @author
+ @desc
+ Scheduled routine to register the SOR solvers SORConfMetric and
+ SORFlatunder with the name "sor" for the Elliptic Classes
+ LinConfMetric and LinFlat
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+ @@*/
void EllSOR_Register(CCTK_ARGUMENTS)
{
@@ -41,43 +97,54 @@ void EllSOR_Register(CCTK_ARGUMENTS)
int err;
- /* Register the solver with the elliptic classes */
+ if (Ell_RegisterSolver(SORConfMetric,"sor","Ell_LinConfMetric")
+ != ELL_SUCCESS)
+ {
+ CCTK_WARN(0,
+ "EllSOR_Register: Failed to register sor for Ell_LinConfMetric");
+ }
- err = Ell_RegisterSolver(SORConfMetric,"sor","Ell_LinConfMetric");
- if (!err==ELL_SUCCESS)
+ if (Ell_RegisterSolver(SORMetric,"sor","Ell_LinMetric")
+ != ELL_SUCCESS)
{
- CCTK_WARN(0,"EllSOR_Register: Failed to register sor for Ell_LinConfMetric");
+ CCTK_WARN(0,
+ "EllSOR_Register: Failed to register sor for Ell_LinMetric");
}
- err = Ell_RegisterSolver(SORFlat,"sor","Ell_LinFlat");
- if (!err==ELL_SUCCESS)
+ if (Ell_RegisterSolver(SORFlat,"sor","Ell_LinFlat") != ELL_SUCCESS)
{
CCTK_WARN(0,"EllSOR_Register: Failed to register sor for Ell_LinFlat");
}
- /* These "keys" have to be same in other elliptic solver and in
+ /* These "keys" have to be same in other elliptic solvers and in
the routines that sets them ! */
- /* Register boundary SOR can handle */
+ /* Register boundaries which SOR can handle */
err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinFlat::Bnd::Robin");
+ if (err != ELL_SUCCESS)
+ {
+ CCTK_WARN(1,
+ "EllSOR_Register: Failed to create key EllLinFlat::Bnd::Robin");
+ }
err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinFlat::Bnd::Const");
+ if (err != ELL_SUCCESS)
+ {
+ CCTK_WARN(1,
+ "EllSOR_Register: Failed to create key EllLinFlat::Bnd::Const");
+ }
- /* Create a key to be associated with the maximum number of iterations
- allowed. */
+ /* Create a key for the maximum number of iterations allowed. */
err = Ell_CreateKey(CCTK_VARIABLE_INT, "Ell::SORmaxit");
if (err != ELL_SUCCESS)
{
- CCTK_WARN(0, "EllSOR_Register: "
- "Failed to create integer key Ell::SORmaxit");
+ CCTK_WARN(0, "EllSOR_Register: Failed to create key Ell::SORmaxit");
}
- /* Create a key to be associated with the type of acceleration to be
- used. */
+ /* Create a key for the type of acceleration to be used. */
err = Ell_CreateKey(CCTK_VARIABLE_STRING, "Ell::SORaccel");
if (err != ELL_SUCCESS)
{
- CCTK_WARN(0, "EllSOR_Register: "
- "Failed to create integer key Ell::SORaccel");
+ CCTK_WARN(0, "EllSOR_Register: Failed to create key Ell::SORaccel");
}
}
diff --git a/src/Wrapper.c b/src/Wrapper.c
index b3ca1c5..cbbca49 100644
--- a/src/Wrapper.c
+++ b/src/Wrapper.c
@@ -72,7 +72,7 @@ int SORFlat(cGH *GH,
@@*/
int SORConfMetric(cGH *GH,
- int *MetricPsiI,
+ int *MetricPsiI,
int FieldIndex,
int MIndex,
int NIndex,
@@ -102,6 +102,37 @@ int SORConfMetric(cGH *GH,
return retval;
}
+int SORMetric(cGH *GH,
+ int *MetricI,
+ int FieldIndex,
+ int MIndex,
+ int NIndex,
+ CCTK_REAL *AbsTol,
+ CCTK_REAL *RelTol)
+{
+ int retval = ELL_NOSOLVER;
+
+ switch (CCTK_GroupDimFromVarI(FieldIndex))
+ {
+ case 1:
+ CCTK_WARN(0,"SORMetric: No 1D SOR solver implemented");
+ break;
+ case 2:
+ CCTK_WARN(0,"SORMetric: No 2D SOR solver implemented");
+ break;
+ case 3:
+ retval = SORConfMetric3D(GH, MetricI, 0,
+ FieldIndex, MIndex, NIndex,
+ AbsTol, RelTol);
+ break;
+ default:
+ CCTK_WARN(1,"SORMetric: Solver only implemented for 3D");
+ break;
+ }
+
+ return retval;
+}
+
/*@@
@routine SORFlat
@date Tue Sep 26 11:31:42 2000