aboutsummaryrefslogtreecommitdiff
path: root/src/gr/misc.cc
blob: 8a0ced45a602ee9fe7c4285a831ec8369bc92eae (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
// misc.cc -- misc support routines
// $Header$
//
// decode_geometry_method - decode the geometry_method parameter
#ifdef NOT_USED
// geomery_method_is_interp - does  enum geometry_method  specify interpolation?
#endif
// decode_geometry_method - decode the geometry_method parameter
//

#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>

#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"

#include "config.h"
#include "stdc.h"
#include "../jtutil/util.hh"
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"

#include "../patch/coords.hh"
#include "../patch/grid.hh"
#include "../patch/fd_grid.hh"
#include "../patch/patch.hh"
#include "../patch/patch_edge.hh"
#include "../patch/patch_interp.hh"
#include "../patch/ghost_zone.hh"
#include "../patch/patch_system.hh"

#include "../elliptic/Jacobian.hh"

#include "gfns.hh"
#include "gr.hh"

//******************************************************************************

//
// This function decodes the  geometry_method  parameter (string) into
// an internal enum for future use.
//
enum geometry_method
  decode_geometry_method(const char geometry_method_string[])
{
if	(STRING_EQUAL(geometry_method_string,
		      "globally interpolate from Cactus grid"))
   then return geometry__global_interp_from_Cactus_grid;
else if (STRING_EQUAL(geometry_method_string,
		      "locally interpolate from Cactus grid"))
   then return geometry__local_interp_from_Cactus_grid;
else if (STRING_EQUAL(geometry_method_string,
		      "Schwarzschild/EF"))
   then return geometry__Schwarzschild_EF;
else	CCTK_VWarn(-1, __LINE__, __FILE__, CCTK_THORNSTRING,
"decode_geometry_method(): unknown geometry_method_string=\"%s\"!",
		   geometry_method_string);			/*NOTREACHED*/
}

//******************************************************************************

#ifdef NOT_USED
//
// This function determines whether or not an  enum geometry_method
// value specifies an interpolation.
//
bool geometry_method_is_interp(enum geometry_method geometry_method)
{
switch	(geometry_method)
	{
case geometry__global_interp_from_Cactus_grid:
case geometry__local_interp_from_Cactus_grid:
	return true;
case geometry__Schwarzschild_EF:
	return false;
default:
	CCTK_VWarn(-1, __LINE__, __FILE__, CCTK_THORNSTRING,
"geometry_method_is_interp(): unknown geometry_method=(int)%d!",
		   geometry_method);				/*NOTREACHED*/
	}
}
#endif

//******************************************************************************

//
// This function decodes the  Jacobian_compute_method  parameter (string) into
// an internal enum for future use.
//
enum Jacobian_compute_method
  decode_Jacobian_compute_method(const char Jacobian_compute_method_string[])
{
if	(STRING_EQUAL(Jacobian_compute_method_string,
		      "numerical perturbation"))
   then return Jacobian__numerical_perturbation;
else if (STRING_EQUAL(Jacobian_compute_method_string,
		      "symbolic differentiation with finite diff d/dr"))
   then return Jacobian__symbolic_diff_with_FD_dr;
else if (STRING_EQUAL(Jacobian_compute_method_string,
		      "symbolic differentiation"))
   then return Jacobian__symbolic_diff;
else	CCTK_VWarn(-1, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
"   decode_Jacobian_compute_method():\n"
"        unknown Jacobian_compute_method_string=\"%s\"!",
		   Jacobian_compute_method_string);		/*NOTREACHED*/
}