Moved out almost all BH-related stuff to a different compilation unit

This commit is contained in:
Yohai Meiron 2020-04-19 14:16:03 -04:00
parent 2a50f0fc9a
commit 19ce85da88
4 changed files with 331 additions and 358 deletions

59
black_holes.h Normal file
View file

@ -0,0 +1,59 @@
#include <algorithm>
#include "double3.h"
struct Bbh_gravity {
double pot1, pot2;
double3 a1, a2, adot1, adot2, a_pn1[7], a_pn2[7], adot_pn1[7], adot_pn2[7];
double spin1[3], spin2[3];
};
class Black_hole_physics {
public:
Black_hole_physics()
: count(0), c(0) {}
Black_hole_physics(const double m1, const double m2, const int myRank, const int rootRank)
: m1(m1), m2(m2), count(2), c(0), myRank(myRank), rootRank(rootRank) {}
void set_post_newtonian(const double c, const int pn_usage[7])
{
this->c = c;
std::copy(pn_usage, pn_usage+7, this->pn_usage);
}
void set_spins(const double spin1[3], const double spin2[3])
{
std::copy(spin1, spin1+3, this->bbh_grav.spin1);
std::copy(spin2, spin2+3, this->bbh_grav.spin2);
}
void set_xv(const double3& x1, const double3& x2, const double3& v1, const double3& v2)
{
this->x1 = x1;
this->x2 = x2;
this->v1 = v1;
this->v2 = v2;
}
void set_softening(const double eps_old, const double eps_new)
{
this->eps_old = eps_old;
this->eps_new = eps_new;
}
void adjust_softening(
double& pot1, double& pot2,
double3& acc1, double3& acc2,
double3& jrk1, double3& jrk2);
void adjust_post_newtonian(
const double dt_bh, // pn_usage should be const
double3& acc1, double3& acc2,
double3& jrk1, double3& jrk2);
void write_bh_data(double time_cur, double m[], double3 x[], double3 v[], double pot[], double3 a[], double3 adot[], double dt[]);
public: //TODO make private
double m1, m2;
int count;
int myRank, rootRank;
double eps_old, eps_new;
double3 x1, v1, x2, v2;
double c;
int pn_usage[7];
Bbh_gravity bbh_grav;
};
void write_bh_nb_data(int nb, int smbh_count, double time_cur, int N, double m[], double3 x[], double3 v[]);