aboutsummaryrefslogtreecommitdiff
path: root/src/Startup.c
blob: 2cf60eac02460d06c082120478da15806d1fbaaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
 /*@@
   @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"

#include "CactusElliptic/EllBase/src/EllBase.h"
#include "CactusElliptic/EllBase/src/Ell_DBstructure.h"

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);
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, 
             int NI, 
             CCTK_REAL *AbsTol, 
             CCTK_REAL *RelTol);


/********************************************************************
 ***************** 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) 
{

  DECLARE_CCTK_ARGUMENTS 
  DECLARE_CCTK_PARAMETERS 

  int err;

  if (Ell_RegisterSolver(SORConfMetric,"sor","Ell_LinConfMetric")
        != ELL_SUCCESS)
  {
    CCTK_WARN(0,
              "EllSOR_Register: Failed to register sor for Ell_LinConfMetric");
  }

  if (Ell_RegisterSolver(SORMetric,"sor","Ell_LinMetric")
        != ELL_SUCCESS)
  {
    CCTK_WARN(0,
              "EllSOR_Register: Failed to register sor for Ell_LinMetric");
  }

  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 solvers and in 
     the routines that sets them ! */

  /* Register boundaries which SOR can handle */
  err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinFlat::Bnd::Robin");
  if (err == ELLCREATE_FAILED)
  {
    CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,
               "EllSOR_Register: Failed to create key EllLinFlat::Bnd::Robin (Error %d)",err);
  }
  err = Ell_CreateKey(CCTK_VARIABLE_STRING,"EllLinFlat::Bnd::Const");
  if (err == ELLCREATE_FAILED)
  {
    CCTK_WARN(1,
              "EllSOR_Register: Failed to create key EllLinFlat::Bnd::Const");
  }

  /* Create a key for the maximum number of iterations allowed. */
  err = Ell_CreateKey(CCTK_VARIABLE_INT, "Ell::SORmaxit");
  if (err == ELLCREATE_FAILED)
  {
    CCTK_WARN(0, "EllSOR_Register: Failed to create key Ell::SORmaxit");
  } 

  /* Create a key for the type of acceleration to be used. */
  err = Ell_CreateKey(CCTK_VARIABLE_STRING, "Ell::SORaccel");
  if (err == ELLCREATE_FAILED)
  {
    CCTK_WARN(0, "EllSOR_Register: Failed to create key Ell::SORaccel");
  } 

}