aboutsummaryrefslogtreecommitdiff
path: root/src/sor_wrapper.c
blob: 0bd976c8bf9d28046fff5b368a88739417048b7d (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
 /*@@
   @file      jacobi_wrapper.c
   @date      Tue Aug 24 12:50:07 1999
   @author    Gerd Lanfermann
   @desc 
   The C wrapper, which calles the core Fortran routine, which 
   performs the actual solve.
   We cannot derive the pointers to the GF data from the indeces in 
   Fortran. So we do this here in C and then pass the everything 
   over to the Fortran routine.

   This wrapper is registers with the Elliptic solver registry 
   (not the Fortran file) , as coded up in ./CactusElliptic/EllBase
   @enddesc 
 @@*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cctk.h"
#include "cctk_Parameters.h"
#include "cctk_FortranString.h"

void sor_confmetric_3d(cGH *GH, int *MetricPsiI, int conformal,
		       int FieldIndex, int MIndex, int NIndex,
		       CCTK_REAL *AbsTol, CCTK_REAL *RelTol);

/*@@
   @routine    sor_confmetric
   @date       Tue Sep 26 11:31:42 2000
   @author     Gerd Lanfermann
   @desc 
     elliptic solver wrapper which provides a interface to the 
     different n-dimensional SOR solvers for the conformal metric, 
     of which only 3D is coded currently.

     This wrapper is registered and if it is being called with 
     a n-dim. grid function, it goes of and picks the correct solver.

     We pass in the arguments that are neccessary for this class of elliptic eq. 
     this solver is intended to solve. See ./CactusElliptic/EllBase/src/ for the
     classes of elliptic eq. 
   @enddesc 
   @calls      
   @calledby   
   @history 
 
   @endhistory 

@@*/

void sor_confmetric(cGH *GH, 
		    int *MetricPsiI, 
		    int FieldIndex, 
		    int MIndex, 
		    int NIndex, 
		    CCTK_REAL *AbsTol,
		    CCTK_REAL *RelTol) 
{
  
  switch (CCTK_GroupDimFromVarI(FieldIndex))
  {
    case 1:  
      CCTK_WARN(0,"No 1D SOR solver implemented");
      break;
    case 2:
      CCTK_WARN(0,"No 2D SOR solver implemented");
      break;
    case 3:
      sor_confmetric_3d(GH, MetricPsiI, 1, FieldIndex, MIndex, NIndex,
			AbsTol, RelTol);
      break;
    default:
      CCTK_WARN(1,"Requested SOR solver for dimension equal "
		  "zero or gt. three not implemented!");
      break;
  }
}
 
/*@@
   @routine    sor_flat
   @date       Tue Sep 26 11:31:42 2000
   @author     Gerd Lanfermann
   @desc 
     elliptic solver wrapper which provides a interface to the 
     different n-dimensional SOR solvers (flat case), 
     of which only 3D is coded currently.

     This wrapper is registered and if it is being called with 
     a n-dim. grid function, it goes of and picks the correct solver.

     We pass in the arguments that are neccessary for this class of elliptic eq. 
     this solver is intended to solve. See ./CactusElliptic/EllBase/src/ for the
     classes of elliptic eq. 
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

void sor_flat(cGH *GH, 
	     int FieldIndex, 
	     int MIndex, 
	     int NIndex, 
	     CCTK_REAL *AbsTol, 
	     CCTK_REAL *RelTol) 
{
  switch (CCTK_GroupDimFromVarI(FieldIndex))
  {
    case 1:  
      CCTK_WARN(1,"No 1D SOR solver implemented");
      break;
    case 2:
      CCTK_WARN(1,"No 2D SOR solver implemented");
      break;
    case 3:
      printf(" wrapper: %d %d %d \n",FieldIndex, MIndex, NIndex);
      sor_flat_3d(GH, FieldIndex, MIndex, NIndex, AbsTol, RelTol);
      break;
  default:
      CCTK_WARN(1,"Requested SOR solver for dimension equal" 
		  "zero or gt. three not implemented!");
      break;
  }

}