Peano
TwoPunctures.h
Go to the documentation of this file.
1 /* TwoPunctures: File "TwoPunctures.h"*/
2 #pragma once
3 
7 
8 #include <stdio.h>
9 
10 namespace TP {
11 
12 
21 #define TP_RESTRICT __restrict__
22 
23 /* Give MPI information about rank */
24 inline int TP_MyProc() {
25  return 0;
26 }
27 
28 /* end of quick adaptions */
29 
30 typedef struct DERIVS {
31  double *d0, *d1, *d2, *d3, *d11, *d12, *d13, *d22, *d23, *d33;
33 
35 
36 /*
37 Files of "TwoPunctures":
38  TwoPunctures.c
39  FuncAndJacobian.c
40  CoordTransf.c
41  Equations.c
42  Newton.c
43  utilities.c (see utilities.h)
44 **************************
45 */
46 
47 class TwoPunctures : public Parameters {
48 public:
49 
50  // Work variables are defined in this class.
51  // Parameters go to the class TwoPunctures::Parameters.
52 
53  // shared variables between TP Setup and TP Interpolation
55  int nvar, n1, n2, n3;
59  double * _d0contig __attribute__ ((aligned (32)));
60  double * _d0contig_low __attribute__ ((aligned (32)));
61  bool runned;
62 
63  /* Consructor */
64 
66  nvar = 0; n1 = 0; n2 = 0; n3 = 0;
67  runned = false;
68  }
69 
70  /* Routines in "TwoPunctures.c"*/
72  double TestSolution (double A, double B, double X, double R, double phi);
73  void TestVector_w (double *par, int nvar, int n1, int n2, int n3, double *w);
74  void Run ();
75  void Interpolate (const double* const pos, double *Q, bool low_res=false);
76 
77  /* Routines in "FuncAndJacobian.c"*/
78  int Index (int ivar, int i, int j, int k, int nvar, int n1, int n2, int n3);
79  void allocate_derivs (derivs * v, int n);
80  void free_derivs (derivs * v, int n);
81  void Derivatives_AB3 (int nvar, int n1, int n2, int n3, derivs v);
82  void F_of_v (int nvar, int n1, int n2, int n3, derivs v,
83  double *F, derivs u);
84  void J_times_dv (int nvar, int n1, int n2, int n3, derivs dv,
85  double *Jdv, derivs u);
86  void JFD_times_dv (int i, int j, int k, int nvar, int n1,
87  int n2, int n3, derivs dv, derivs u, double *values);
88  void SetMatrix_JFD (int nvar, int n1, int n2, int n3,
89  derivs u, int *ncols, int **cols, double **Matrix);
90  double PunctEvalAtArbitPosition (double *v, int ivar, double A, double B, double phi,
91  int nvar, int n1, int n2, int n3);
92  void calculate_derivs (int i, int j, int k, int ivar, int nvar, int n1,
93  int n2, int n3, derivs v, derivs vv);
94  double interpol (double a, double b, double c, derivs v);
95  double PunctTaylorExpandAtArbitPosition (int ivar, int nvar, int n1,
96  int n2, int n3, derivs v, double x,
97  double y, double z);
98  double PunctIntPolAtArbitPosition (int ivar, int nvar, int n1,
99  int n2, int n3, derivs v, double x,
100  double y, double z);
101  void SpecCoef (int n1, int n2, int n3, int ivar, double *v, double *cf);
102  double PunctEvalAtArbitPositionFast (double *v, int ivar, double A, double B, double phi,
103  int nvar, int n1, int n2, int n3);
104  double PunctEvalAtArbitPositionFaster (double A, double B, double phi);
105  double PunctEvalAtArbitPositionFasterLowRes (double A, double B, double phi);
106  double PunctIntPolAtArbitPositionFast (derivs v, double x, double y, double z, bool low_res=false);
107 
108  /* Routines in "CoordTransf.c"*/
109  void AB_To_XR (int nvar, double A, double B, double *X,
110  double *R, derivs U);
111  void C_To_c (int nvar, double X, double R, double *x,
112  double *r, derivs U);
113  void rx3_To_xyz (int nvar, double x, double r, double phi, double *y,
114  double *z, derivs U);
115 
116  /* Routines in "Equations.c"*/
117  double BY_KKofxyz (double x, double y, double z);
118  void BY_Aijofxyz (double x, double y, double z, double Aij[3][3]);
119  void NonLinEquations (double rho_adm,
120  double A, double B, double X, double R,
121  double x, double r, double phi,
122  double y, double z, derivs U, double *values);
123  void LinEquations (double A, double B, double X, double R,
124  double x, double r, double phi,
125  double y, double z, derivs dU, derivs U, double *values);
126 
127  /* Routines in "Newton.c"*/
128  void TestRelax (int nvar, int n1, int n2, int n3, derivs v, double *dv);
129  void Newton (int nvar, int n1, int n2, int n3, derivs v,
130  double tol, int itmax);
131 
132  /* Former static routines in "Newton.c"*/
133  int
134  bicgstab (int const nvar, int const n1, int const n2, int const n3,
135  derivs v, derivs dv,
136  int const output, int const itmax, double const tol,
137  double * TP_RESTRICT const normres);
138  double
139  norm_inf (double const * TP_RESTRICT const F,
140  int const ntotal);
141  void
142  relax (double * TP_RESTRICT const dv,
143  int const nvar, int const n1, int const n2, int const n3,
144  double const * TP_RESTRICT const rhs,
145  int const * TP_RESTRICT const ncols,
146  int const * TP_RESTRICT const * TP_RESTRICT const cols,
147  double const * TP_RESTRICT const * TP_RESTRICT const JFD);
148  void
149  resid (double * TP_RESTRICT const res,
150  int const ntotal,
151  double const * TP_RESTRICT const dv,
152  double const * TP_RESTRICT const rhs,
153  int const * TP_RESTRICT const ncols,
154  int const * TP_RESTRICT const * TP_RESTRICT const cols,
155  double const * TP_RESTRICT const * TP_RESTRICT const JFD);
156  void
157  LineRelax_al (double * TP_RESTRICT const dv,
158  int const j, int const k, int const nvar,
159  int const n1, int const n2, int const n3,
160  double const * TP_RESTRICT const rhs,
161  int const * TP_RESTRICT const ncols,
162  int const * TP_RESTRICT const * TP_RESTRICT const cols,
163  double const * TP_RESTRICT const * TP_RESTRICT const JFD);
164  void
165  LineRelax_be (double * TP_RESTRICT const dv,
166  int const i, int const k, int const nvar,
167  int const n1, int const n2, int const n3,
168  double const * TP_RESTRICT const rhs,
169  int const * TP_RESTRICT const ncols,
170  int const * TP_RESTRICT const * TP_RESTRICT const cols,
171  double const * TP_RESTRICT const * TP_RESTRICT const JFD);
172 
173 
174 }; // class TwoPunctures
175 
176 } // namespace TP
177 
void free_derivs(derivs *v, int n)
GRID_SETUP_METHOD gsm
Definition: TwoPunctures.h:54
void Derivatives_AB3(int nvar, int n1, int n2, int n3, derivs v)
void JFD_times_dv(int i, int j, int k, int nvar, int n1, int n2, int n3, derivs dv, derivs u, double *values)
bool runned
an internal check
Definition: TwoPunctures.h:61
double BY_KKofxyz(double x, double y, double z)
Definition: Equations.cpp:25
double *_d0contig_low __attribute__((aligned(32)))
int bicgstab(int const nvar, int const n1, int const n2, int const n3, derivs v, derivs dv, int const output, int const itmax, double const tol, double *TP_RESTRICT const normres)
Definition: Newton.cpp:277
void SpecCoef(int n1, int n2, int n3, int ivar, double *v, double *cf)
void NonLinEquations(double rho_adm, double A, double B, double X, double R, double x, double r, double phi, double y, double z, derivs U, double *values)
Definition: Equations.cpp:153
void Interpolate(const double *const pos, double *Q, bool low_res=false)
Interpolation function for an external caller.
double PunctEvalAtArbitPositionFasterLowRes(double A, double B, double phi)
void F_of_v(int nvar, int n1, int n2, int n3, derivs v, double *F, derivs u)
double PunctEvalAtArbitPositionFast(double *v, int ivar, double A, double B, double phi, int nvar, int n1, int n2, int n3)
Fast Spectral Interpolation Routine Stuff.
void Newton(int nvar, int n1, int n2, int n3, derivs v, double tol, int itmax)
Definition: Newton.cpp:452
void relax(double *TP_RESTRICT const dv, int const nvar, int const n1, int const n2, int const n3, double const *TP_RESTRICT const rhs, int const *TP_RESTRICT const ncols, int const *TP_RESTRICT const *TP_RESTRICT const cols, double const *TP_RESTRICT const *TP_RESTRICT const JFD)
Definition: Newton.cpp:176
void AB_To_XR(int nvar, double A, double B, double *X, double *R, derivs U)
Definition: CoordTransf.cpp:18
void rx3_To_xyz(int nvar, double x, double r, double phi, double *y, double *z, derivs U)
void LineRelax_be(double *TP_RESTRICT const dv, int const i, int const k, int const nvar, int const n1, int const n2, int const n3, double const *TP_RESTRICT const rhs, int const *TP_RESTRICT const ncols, int const *TP_RESTRICT const *TP_RESTRICT const cols, double const *TP_RESTRICT const *TP_RESTRICT const JFD)
Definition: Newton.cpp:117
void set_initial_guess(derivs v)
void calculate_derivs(int i, int j, int k, int ivar, int nvar, int n1, int n2, int n3, derivs v, derivs vv)
void resid(double *TP_RESTRICT const res, int const ntotal, double const *TP_RESTRICT const dv, double const *TP_RESTRICT const rhs, int const *TP_RESTRICT const ncols, int const *TP_RESTRICT const *TP_RESTRICT const cols, double const *TP_RESTRICT const *TP_RESTRICT const JFD)
Definition: Newton.cpp:38
void BY_Aijofxyz(double x, double y, double z, double Aij[3][3])
Definition: Equations.cpp:83
double PunctTaylorExpandAtArbitPosition(int ivar, int nvar, int n1, int n2, int n3, derivs v, double x, double y, double z)
void LineRelax_al(double *TP_RESTRICT const dv, int const j, int const k, int const nvar, int const n1, int const n2, int const n3, double const *TP_RESTRICT const rhs, int const *TP_RESTRICT const ncols, int const *TP_RESTRICT const *TP_RESTRICT const cols, double const *TP_RESTRICT const *TP_RESTRICT const JFD)
Definition: Newton.cpp:57
double PunctEvalAtArbitPositionFaster(double A, double B, double phi)
double TestSolution(double A, double B, double X, double R, double phi)
void J_times_dv(int nvar, int n1, int n2, int n3, derivs dv, double *Jdv, derivs u)
double PunctIntPolAtArbitPosition(int ivar, int nvar, int n1, int n2, int n3, derivs v, double x, double y, double z)
void SetMatrix_JFD(int nvar, int n1, int n2, int n3, derivs u, int *ncols, int **cols, double **Matrix)
double *_d0contig __attribute__((aligned(32)))
double interpol(double a, double b, double c, derivs v)
void allocate_derivs(derivs *v, int n)
double norm_inf(double const *TP_RESTRICT const F, int const ntotal)
Definition: Newton.cpp:22
void LinEquations(double A, double B, double X, double R, double x, double r, double phi, double y, double z, derivs dU, derivs U, double *values)
Definition: Equations.cpp:181
double PunctEvalAtArbitPosition(double *v, int ivar, double A, double B, double phi, int nvar, int n1, int n2, int n3)
int Index(int ivar, int i, int j, int k, int nvar, int n1, int n2, int n3)
double PunctIntPolAtArbitPositionFast(derivs v, double x, double y, double z, bool low_res=false)
void TestRelax(int nvar, int n1, int n2, int n3, derivs v, double *dv)
Definition: Newton.cpp:225
void C_To_c(int nvar, double X, double R, double *x, double *r, derivs U)
Definition: CoordTransf.cpp:53
void TestVector_w(double *par, int nvar, int n1, int n2, int n3, double *w)
tuple w
Definition: ModeCalc.py:195
This file contains aliases for making access to the long state vector Q as used eg.
Definition: CoordTransf.cpp:13
struct TP::DERIVS derivs
GRID_SETUP_METHOD
Definition: TwoPunctures.h:34
@ GSM_Taylor_expansion
Definition: TwoPunctures.h:34
@ GSM_evaluation
Definition: TwoPunctures.h:34
int TP_MyProc()
Definition: TwoPunctures.h:24
j
Definition: euler.py:95
b
Definition: swe.py:82
double * d12
Definition: TwoPunctures.h:31
double * d23
Definition: TwoPunctures.h:31
double * d1
Definition: TwoPunctures.h:31
double * d11
Definition: TwoPunctures.h:31
double * d3
Definition: TwoPunctures.h:31
double * d33
Definition: TwoPunctures.h:31
double * d13
Definition: TwoPunctures.h:31
double * d0
Definition: TwoPunctures.h:31
double * d22
Definition: TwoPunctures.h:31
double * d2
Definition: TwoPunctures.h:31