SlowDown Algorithmic Regularization (SDAR)
Algorithmic Regularization with slowdown method for integrating few-body motions
|
Go to the documentation of this file.
36 template <
class Tptcl>
42 Float coshu = cosh(_ecca);
43 Float sinhu = sinh(_ecca);
45 pos_star.
x = -_bin.
semi*(_bin.
ecc - coshu);
46 pos_star.
y = -_bin.
semi*eccfac*sinhu;
49 Float fac = afac/(_bin.
ecc*coshu-1.0);
50 vel_star.
x = -fac*sinhu;
51 vel_star.
y = fac*eccfac*coshu;
55 Float cosu = cos(_ecca);
56 Float sinu = sin(_ecca);
58 pos_star.
x = _bin.
semi*(cosu - _bin.
ecc);
59 pos_star.
y = _bin.
semi*eccfac*sinu;
62 Float fac = afac/(1.0-_bin.
ecc*cosu);
63 vel_star.
x = -fac*sinu;
64 vel_star.
y = fac*eccfac*cosu;
74 Float m2_mt = _p2.mass / m_tot;
75 Float m1_mt = _p1.mass / m_tot;
76 _p1.pos[0] = -m2_mt * pos_red.
x;
77 _p1.pos[1] = -m2_mt * pos_red.
y;
78 _p1.pos[2] = -m2_mt * pos_red.
z;
80 _p2.pos[0] = m1_mt * pos_red.
x;
81 _p2.pos[1] = m1_mt * pos_red.
y;
82 _p2.pos[2] = m1_mt * pos_red.
z;
84 _p1.vel[0] = -m2_mt * vel_red.
x;
85 _p1.vel[1] = -m2_mt * vel_red.
y;
86 _p1.vel[2] = -m2_mt * vel_red.
z;
88 _p2.vel[0] = m1_mt * vel_red.
x;
89 _p2.vel[1] = m1_mt * vel_red.
y;
90 _p2.vel[2] = m1_mt * vel_red.
z;
100 template <
class Tptcl>
104 Float m_tot = _p1.mass + _p2.mass;
105 Float Gm_tot = _G*m_tot;
106 Vector3<Float> pos_red(_p2.pos[0] - _p1.pos[0], _p2.pos[1] - _p1.pos[1], _p2.pos[2] - _p1.pos[2]);
107 Vector3<Float> vel_red(_p2.vel[0] - _p1.vel[0], _p2.vel[1] - _p1.vel[1], _p2.vel[2] - _p1.vel[2]);
108 Float r_sq = pos_red * pos_red;
110 Float inv_dr = 1.0 / _bin.
r;
111 Float v_sq = vel_red * vel_red;
112 _bin.
semi = 1.0 / (2.0*inv_dr - v_sq / Gm_tot);
113 _bin.
am = pos_red ^ vel_red;
124 pos_bar.
x = pos_red.x*cosOMG + pos_red.y*sinOMG;
125 pos_bar.
y = (-pos_red.x*sinOMG + pos_red.y*cosOMG)*cosinc + pos_red.z*sininc;
127 vel_bar.
x = vel_red.x*cosOMG + vel_red.y*sinOMG;
128 vel_bar.
y = (-vel_red.x*sinOMG + vel_red.y*cosOMG)*cosinc + vel_red.z*sininc;
134 Float ecccosomg = h/Gm_tot*vel_bar.
y - pos_bar.
x*inv_dr;
135 Float eccsinomg = -h/Gm_tot*vel_bar.
x - pos_bar.
y*inv_dr;
136 _bin.
ecc = sqrt( ecccosomg*ecccosomg + eccsinomg*eccsinomg );
137 _bin.
rot_self = atan2(eccsinomg, ecccosomg);
139 Float phi = atan2(pos_bar.
y, pos_bar.
x);
145 _bin.
ecca = atan2(sin(true_anomaly)*sqrt(1.0 - _bin.
ecc*_bin.
ecc), _bin.
ecc+ cos(true_anomaly));
149 _bin.
t_peri = mean_anomaly / mean_motion;
152 _bin.
ecca = atanh(sin(true_anomaly)*sqrt(_bin.
ecc*_bin.
ecc-1)/(_bin.
ecc+ cos(true_anomaly)));
156 _bin.
t_peri = mean_anomaly / mean_motion;
167 return pow(_period*_period*_G*_mtot/(4*
PI*
PI),1.0/3.0);
177 Float mean_motion = sqrt(_G*_mtot/(fabs(_semi*_semi*_semi)));
178 return 2*
PI/mean_motion;
191 template <
class Tpi,
class Tpj>
193 Float m_tot = _p1.mass + _p2.mass;
194 Float Gm_tot = _G*m_tot;
195 Vector3<Float> pos_red(_p2.pos[0] - _p1.pos[0], _p2.pos[1] - _p1.pos[1], _p2.pos[2] - _p1.pos[2]);
196 Vector3<Float> vel_red(_p2.vel[0] - _p1.vel[0], _p2.vel[1] - _p1.vel[1], _p2.vel[2] - _p1.vel[2]);
197 Float r_sq = pos_red * pos_red;
199 Float v_sq = vel_red * vel_red;
200 _rv = pos_red * vel_red;
201 _semi = 1.0 / (2.0 / _r - v_sq / Gm_tot);
202 Float p = 1.0 - _r/_semi;
203 _ecc = sqrt(p*p + _rv*_rv/_semi/Gm_tot);
212 template <
class Tpi,
class Tpj>
228 return acos(cos_ecca);
232 return acosh(cosh_ecca);
243 if (_ecc<1.0)
return _ecca - _ecc*sin(_ecca);
244 else return _ecc*sinh(_ecca) - _ecca;
260 Float u0 = _mean_anomaly;
266 Float cu0 = sqrt(1.0 - su0*su0);
268 u1 = u0 - ((u0- _ecc*su0-_mean_anomaly)/(1.0 - _ecc*cu0));
270 if( fabs(u1-u0) < 1e-15 ){
return u1; }
273 std::cerr<<
"Error: kepler solver cannot converge to find correct eccentricity anomaly!\n";
289 Float mean_anomaly_new = freq * dt_tmp + mean_anomaly_old;
299 template <
class Tptcl>
310 template <
class Tptcl>
331 template <
class Tptcl>
359 void print(std::ostream& _os)
const{
360 _os<<
"semi: semi-major axis: "<<
semi<<std::endl
361 <<
"ecc: eccentricity: "<<
ecc<<std::endl
362 <<
"incline: inclination angle: "<<
incline<<std::endl
363 <<
"rot_horizon: rotational angle in horizon: "<<
rot_horizon<<std::endl
364 <<
"rot_self: rotational angle in orbital plane: "<<
rot_self<<std::endl
365 <<
"t_peri: phase to peri-center: "<<
t_peri<<std::endl
366 <<
"period: period: "<<
period<<std::endl
367 <<
"ecca: eccentricty anomaly: "<<
ecca<<std::endl
368 <<
"m1: mass 1: "<<
m1<<std::endl
369 <<
"m2: mass 2: "<<
m2<<std::endl
370 <<
"r: separation: "<<
r<<std::endl
371 <<
"L: Angular momentum: "<<
am.
x<<
" "<<
am.
y<<
" "<<
am.
z<<std::endl
372 <<
"stab: stability factor: "<<
stab<<std::endl;
381 _fout<<std::setw(_width)<<
"semi"
382 <<std::setw(_width)<<
"ecc"
383 <<std::setw(_width)<<
"incline"
384 <<std::setw(_width)<<
"rot_horizon"
385 <<std::setw(_width)<<
"rot_self"
386 <<std::setw(_width)<<
"t_peri"
387 <<std::setw(_width)<<
"period"
388 <<std::setw(_width)<<
"ecca"
389 <<std::setw(_width)<<
"m1"
390 <<std::setw(_width)<<
"m2"
391 <<std::setw(_width)<<
"r"
392 <<std::setw(_width)<<
"L.x"
393 <<std::setw(_width)<<
"L.y"
394 <<std::setw(_width)<<
"L.z"
395 <<std::setw(_width)<<
"stab";
404 _fout<<std::setw(_width)<<
semi
405 <<std::setw(_width)<<
ecc
409 <<std::setw(_width)<<
t_peri
410 <<std::setw(_width)<<
period
411 <<std::setw(_width)<<
ecca
412 <<std::setw(_width)<<
m1
413 <<std::setw(_width)<<
m2
414 <<std::setw(_width)<<
r
415 <<std::setw(_width)<<
am.
x
416 <<std::setw(_width)<<
am.
y
417 <<std::setw(_width)<<
am.
z
418 <<std::setw(_width)<<
stab;
426 fwrite(
this,
sizeof(*
this),1,_fp);
433 size_t rcount = fread(
this,
sizeof(*
this),1,_fin);
435 std::cerr<<
"Error: Data reading fails! requiring data number is 1, only obtain "<<rcount<<
".\n";
491 template <
class Tptcl,
class Tbinary>
494 typedef std::pair<Float, int> R2Index;
514 static bool pairLess(
const R2Index& a,
const R2Index & b) {
515 return a.first < b.first;
524 static void calcMinDisList(
int _ptcl_list[],
526 const int _n_members,
527 const Tptcl* _ptcl) {
528 for (
int i=0; i<_n_members-1; i++) {
529 int k = _ptcl_list[i];
532 for(
int j=i+1; j<_n_members; j++) {
533 const int kj =_ptcl_list[j];
535 _ptcl[k].pos[1] - _ptcl[kj].pos[1],
536 _ptcl[k].pos[2] - _ptcl[kj].pos[2]};
547 int jtmp = _ptcl_list[i+1];
548 _ptcl_list[i+1] = _ptcl_list[jc];
549 _ptcl_list[jc] = jtmp;
551 _r2_list[i].first = r2min;
552 _r2_list[i].second = i;
575 else _bin.stab = 0.0;
576 Float mout = _bin.mass;
578 for (
int k=0; k<2; k++) {
585 _bin.stab = std::max(_bin.stab,
Float(1000.0));
589 Float incline=acos(std::min(
Float(1.0), _bin.am*bin_in->am/sqrt((_bin.am*_bin.am)*(bin_in->am*bin_in->am))));
591 Float cosinc = cos(incline);
592 Float fac = 1.0 - 2.0*bin_in->ecc/3.0 * (1.0 - 0.5*bin_in->ecc*bin_in->ecc)
593 - 0.3*cosinc*(1.0 - 0.5*bin_in->ecc + 2.0*cosinc*(1.0 - 2.5*pow(bin_in->ecc,1.5) - cosinc));
595 Float min = bin_in->mass;
596 Float g = sqrt(std::max(bin_in->m1,bin_in->m2) /min)*(1.0 + mout/min);
598 Float qst = 1.52*pow(sqrt(_t_crit/_bin.period)/(1.0 - _bin.ecc),1.0/6.0)*pow(fac*g,1.0/3.0);
600 Float peri_out = _bin.semi * (_bin.ecc + 1.0);
601 Float q = peri_out/bin_in->semi;
603 bin_in->stab = std::max(bin_in->stab, qst/q);
604 _bin.stab = std::max(_bin.stab, qst/q);
624 for (
int i=0; i<2; i++) {
628 bini->branch = 2*_bin.
branch + i;
642 int left_edge = (
branch<<dlevel);
643 int right_edge = ((
branch+1)<<dlevel);
644 if (_bin.
branch>=left_edge&&_bin.
branch<right_edge)
return 2;
648 int left_edge = (_bin.
branch<<-dlevel);
649 int right_edge = ((_bin.
branch+1)<<-dlevel);
675 calcMinDisList(_ptcl_list, r2_list, _n, _ptcl);
677 if(_n>2) std::sort(r2_list, r2_list+_n-1, pairLess);
681 for(
auto &p : bin_host) p=NULL;
684 for(
int i=0; i<_n-1; i++) {
686 int k = r2_list[i].second;
688 int pindex[2]={-1,-1};
690 if(bin_host[k]==NULL) {
692 ASSERT(_ptcl_list[k]>=0);
694 p[0] = &_ptcl[_ptcl_list[k]];
695 pindex[0] = _ptcl_list[k];
696 bin_host[k] = &_bins[i];
703 while(bin_host[ki]==p[0]&&ki>=0) bin_host[ki--] = &_bins[i];
707 if(bin_host[k+1]==NULL) {
709 ASSERT(_ptcl_list[k+1]>0);
711 p[1] = &_ptcl[_ptcl_list[k+1]];
712 pindex[1] = _ptcl_list[k+1];
713 bin_host[k+1] = &_bins[i];
718 p[1] = bin_host[k+1];
720 while(bin_host[ki]==p[1]&&ki>=0) bin_host[ki++] = &_bins[i];
724 _bins[i].
setMembers(p[0], p[1], pindex[0], pindex[1]);
735 for(
int i=0; i<_n; i++) ASSERT(bin_host[i]==&_bins[_n-2]);
751 ASSERT(member[0]!=NULL);
752 ASSERT(member[1]!=NULL);
754 Float m1 = member[0]->mass;
755 Float m2 = member[1]->mass;
756 this->pos[0] = m1*member[0]->pos[0] + m2*member[1]->pos[0];
757 this->pos[1] = m1*member[0]->pos[1] + m2*member[1]->pos[1];
758 this->pos[2] = m1*member[0]->pos[2] + m2*member[1]->pos[2];
759 this->vel[0] = m1*member[0]->vel[0] + m2*member[1]->vel[0];
760 this->vel[1] = m1*member[0]->vel[1] + m2*member[1]->vel[1];
761 this->vel[2] = m1*member[0]->vel[2] + m2*member[1]->vel[2];
763 this->pos[0] /=this->mass;
764 this->pos[1] /=this->mass;
765 this->pos[2] /=this->mass;
766 this->vel[0] /=this->mass;
767 this->vel[1] /=this->mass;
768 this->vel[2] /=this->mass;
773 Tbinary::particleToSemiEccPeriod(*member[0], *member[1], _G);
778 Tbinary::calcOrbit(*member[0], *member[1], _G);
783 Tbinary::calcParticles(*member[0], *member[1], _G);
789 ASSERT(member[0]!=NULL);
790 ASSERT(member[1]!=NULL);
793 if (member_index[0]<0) n_members += ((
BinaryTreeLocal*)member[0])->getMemberN();
795 if (member_index[1]<0) n_members += ((
BinaryTreeLocal*)member[1])->getMemberN();
808 ASSERT(member[0]!=NULL);
809 ASSERT(member[1]!=NULL);
832 ASSERT(member[0]!=NULL);
833 ASSERT(member[1]!=NULL);
835 if (member_index[0]<0) ((
BinaryTreeLocal*)member[0])->processLeafIter(_dat, _f);
836 else _f(_dat, member[0]);
837 if (member_index[1]<0) ((
BinaryTreeLocal*)member[1])->processLeafIter(_dat, _f);
838 else _f(_dat, member[1]);
853 ASSERT(member[0]!=NULL);
854 ASSERT(member[1]!=NULL);
855 T dat_new = _f(_dat, *
this);
856 for (
int k=0; k<2; k++)
857 if (member_index[k]<0) dat_new = ((
BinaryTreeLocal*)member[k])->processRootIter(dat_new, _f);
869 template <
class Troot,
class Tleaf>
871 ASSERT(member[0]!=NULL);
872 ASSERT(member[1]!=NULL);
873 Troot dat_new = _f_root(_dat_root, *
this);
874 for (
int k=0; k<2; k++) {
875 if (member_index[k]<0) dat_new = ((
BinaryTreeLocal*)member[k])->processRootLeafIter(dat_new, _f_root, _dat_leaf, _f_leaf);
876 else _f_leaf(_dat_leaf, member[k]);
882 template <
class T,
class Tr>
893 template <
class T,
class Tr>
895 ASSERT(member[0]!=NULL);
896 ASSERT(member[1]!=NULL);
897 Tr res[2] = {_res1, _res2};
898 for (
int k=0; k<2; k++)
899 if (member_index[k]<0) res[k] = ((
BinaryTreeLocal*)member[k])->processTreeIter(_dat, _res1, _res2, _f);
900 return _f(_dat, res[0], res[1], *
this);
912 _bin_out[_i] = *
this;
913 for (
int k=0; k<2; k++) {
914 if (member_index[k]<0) {
917 _bin_out[_i].member[k] = &_bin_out[inow];
931 void setMembers(Tptcl* _p1, Tptcl* _p2,
const int _i1,
const int _i2) {
934 member_index[0] = _i1;
935 member_index[1] = _i2;
954 return member_index[i];
959 return (member_index[i]<0);
1009 Tptcl::printColumnTitle(_fout, _width);
1010 Tbinary::printColumnTitle(_fout, _width);
1019 Tptcl::printColumn(_fout, _width);
1020 Tbinary::printColumn(_fout, _width);
1027 Tptcl::writeAscii(_fout);
1028 Tbinary::writeAscii(_fout);
1035 Tptcl::readAscii(_fin);
1036 Tbinary::readAscii(_fin);
1041 Tbinary::printColumn(_fout, _width);
1042 for (
int k=0; k<2; k++) member[k]->
printColumn(_fout,_width);
1043 for (
int k=0; k<2; k++)
1044 if (member_index[k]<0) ((
BinaryTreeLocal*)member[k])->printBinaryTreeIter(_fout, _width);
1050 for (
int k=0; k<2; k++) {
1051 if (member_index[k]<0) ((
BinaryTreeLocal*)member[k])->printBinaryIter(_fout, _width);
void readBinary(FILE *_fin)
read class data to file with binary format
Definition: binary_tree.h:432
Definition: binary_tree.h:8
int calcMemberN()
calc total number of members
Definition: binary_tree.h:787
Float rot_horizon
Definition: binary_tree.h:17
int level
member pointer
Definition: binary_tree.h:510
void readAscii(std::istream &_fin)
read class data to file with ASCII format
Definition: binary_tree.h:1034
Float t_peri
Definition: binary_tree.h:19
Float stab
Definition: binary_tree.h:26
static Float semiToPeriod(const Float &_semi, const Float &_mtot, const Float &_G)
from semi-major axis calculate period;
Definition: binary_tree.h:176
int calcMemberNIter()
calc total number of members iteratively
Definition: binary_tree.h:806
Tr(*)(T &, const Tr &, const Tr &, BinaryTreeLocal &) ProcessFunctionTree
iteratively tree processing function template
Definition: binary_tree.h:883
BinaryTree()
Definition: binary_tree.h:558
Float period
Definition: binary_tree.h:20
int isSameBranch(const BinaryTreeLocal &_bin) const
check whether a given binarytree data is in the same branch
Definition: binary_tree.h:638
Float ecca
Definition: binary_tree.h:21
Float incline
Definition: binary_tree.h:16
static void solveKepler(Binary &_bin, const Float _dt)
solve kepler orbit after dt
Definition: binary_tree.h:284
BinaryTreeLocal * getRightMemberAsTree() const
get right member as tree
Definition: binary_tree.h:978
void calcParticlesEcca(Tptcl &_p1, Tptcl &_p2, const Float _ecca, const Float _G) const
calculate two components from kepler Orbit with input eccentricity anomaly
Definition: binary_tree.h:332
const Float NUMERIC_FLOAT_MAX
Definition: Float.h:29
Binary parameter class.
Definition: binary_tree.h:12
void printBinaryIter(std::ostream &_fout, const int _width=20)
print binary function
Definition: binary_tree.h:1048
void evolve(const Float _dt)
Solve kepler motion for dt.
Definition: binary_tree.h:354
void rotation(const T I, const T OMEGA, const T omega)
Definition: matrix.h:51
T processRootIter(T &_dat, ProcessFunctionRoot< T > _f)
Process root data and return result iteratively.
Definition: binary_tree.h:852
int branch
binary tree level, start from zero for root tree. Then each subtree increase level by one.
Definition: binary_tree.h:511
void calcOrbit(const Tptcl &_p1, const Tptcl &_p2, const Float _G)
calculate kepler Orbit from particles
Definition: binary_tree.h:300
Tptcl * getLeftMember() const
get left member
Definition: binary_tree.h:963
void writeAscii(std::ostream &_fout) const
write class data to file with ASCII format
Definition: binary_tree.h:1026
Float rot_self
Definition: binary_tree.h:18
int copyDataIter(BinaryTreeLocal _bin_out[], const int _i)
copy a binary tree to a binaryTree array iteratively
Definition: binary_tree.h:909
Float semi
Definition: binary_tree.h:14
void getherBinaryTreeIter(BinaryTreeLocal _bin[])
collect BinaryTree data iteratively and save to a BinaryTree array
Definition: binary_tree.h:744
static void printColumnTitle(std::ostream &_fout, const int _width=20)
print titles of class members using column style
Definition: binary_tree.h:1008
static void generateBinaryTree(BinaryTreeLocal _bins[], int _ptcl_list[], const int _n, Tptcl *_ptcl, const Float _G)
Generate kepler binary tree for a group of particles.
Definition: binary_tree.h:666
static void particleToSemiEcc(Float &_semi, Float &_ecc, Float &_r, Float &_rv, const Tpi &_p1, const Tpj &_p2, const Float _G)
position velocity to orbit semi-major axis and eccentricity
Definition: binary_tree.h:192
void rotateToOriginalFrame(Float *_vec)
rotate position vector from binary rest-frame to original frame based on three angles
Definition: binary_tree.h:340
void calcParticles(const Float _G)
calculate particles from orbit
Definition: binary_tree.h:782
int getMemberN() const
get total number of members
Definition: binary_tree.h:801
T y
Definition: matrix.h:10
Float calcEccAnomaly(const Float _r)
calculate eccentric anomaly from separation (0-pi)
Definition: binary_tree.h:225
void printColumn(std::ostream &_fout, const int _width=20)
print data of class members using column style
Definition: binary_tree.h:1018
void calcParticles(Tptcl &_p1, Tptcl &_p2, const Float &_G)
calculate two components from kepler Orbit
Definition: binary_tree.h:311
Float m2
Definition: binary_tree.h:23
double Float
Definition: Float.h:25
void printColumn(std::ostream &_fout, const int _width=20)
print data of class members using column style
Definition: binary_tree.h:403
static Float periodToSemi(const Float &_period, const Float &_mtot, const Float &_G)
from period calculate semi-major axis
Definition: binary_tree.h:166
void calcSemiEccPeriod(const Float &_G)
calculate Kepler orbit semi, ecc and period only
Definition: binary_tree.h:772
void calcOrbit(const Float _G)
calculate Kepler orbit from members
Definition: binary_tree.h:777
bool isMemberTree(const size_t i) const
Definition: binary_tree.h:957
Float m1
Definition: binary_tree.h:22
BinaryTreeLocal * getMemberAsTree(const size_t i) const
get member as tree
Definition: binary_tree.h:946
Troot processRootLeafIter(Troot &_dat_root, ProcessFunctionRoot< Troot > _f_root, Tleaf &_dat_leaf, ProcessFunctionLeaf< Tleaf > _f_leaf)
Process root and leaf data and return result iteratively.
Definition: binary_tree.h:870
static void printColumnTitle(std::ostream &_fout, const int _width=20)
print titles of class members using column style
Definition: binary_tree.h:380
Tr processTreeIter(T &_dat, const Tr &_res1, const Tr &_res2, ProcessFunctionTree< T, Tr > _f)
Process tree data with extra dat iteratively (from bottom to top)
Definition: binary_tree.h:894
void printBinaryTreeIter(std::ostream &_fout, const int _width=20)
print binary and member information
Definition: binary_tree.h:1040
Tptcl * getRightMember() const
get right member
Definition: binary_tree.h:973
int getMemberIndex(const size_t i) const
get member index
Definition: binary_tree.h:952
void print(std::ostream &_os) const
Definition: binary_tree.h:359
const Float PI
Definition: binary_tree.h:9
static Float calcMeanAnomaly(const Float _ecca, const Float _ecc)
calculate mean anomaly from eccentric anomaly (0-pi)
Definition: binary_tree.h:242
static void orbitToParticle(Tptcl &_p1, Tptcl &_p2, const Binary &_bin, const Float &_ecca, const Float _G)
Orbit to position and velocity.
Definition: binary_tree.h:37
void setMembers(Tptcl *_p1, Tptcl *_p2, const int _i1, const int _i2)
set members
Definition: binary_tree.h:931
T(*)(T &, BinaryTreeLocal &) ProcessFunctionRoot
iteratively root processing function template
Definition: binary_tree.h:843
void calcCenterOfMass()
calculate center-of-mass from members
Definition: binary_tree.h:749
void calcSemiFromPeriod(const Float &_G)
from period calculate semi-major axis
Definition: binary_tree.h:319
static void particleToOrbit(Binary &_bin, const Tptcl &_p1, const Tptcl &_p2, const Float _G)
position velocity to orbit
Definition: binary_tree.h:101
#define to_int(x)
Definition: Float.h:26
Binary tree cell.
Definition: binary_tree.h:492
Float r
Definition: binary_tree.h:24
static Float calcEccAnomaly(const Float _mean_anomaly, const Float _ecc)
calculate eccentric anomaly from mean anomaly
Definition: binary_tree.h:253
void processLeafIter(T &_dat, ProcessFunctionLeaf< T > _f)
Process (bottom) leaf data with extra dat iteratively (from left to right)
Definition: binary_tree.h:830
static Float & stableCheckIter(BinaryTreeLocal &_bin, const Float _t_crit)
Three-body stability function for hierarchical binary tree.
Definition: binary_tree.h:573
void particleToSemiEccPeriod(const Tpi &_p1, const Tpj &_p2, const Float _G)
calcualte semi, ecc and period
Definition: binary_tree.h:213
T z
Definition: matrix.h:10
void writeAscii(std::ostream &_fout) const
write class data to file with ASCII format
Definition: binary_tree.h:443
Vector3< Float > am
Definition: binary_tree.h:25
void readAscii(std::istream &_fin)
read class data to file with ASCII format
Definition: binary_tree.h:464
void writeBinary(FILE *_fp) const
write class data to file with binary format
Definition: binary_tree.h:425
Float ecc
Definition: binary_tree.h:15
void(*)(T &, Tparticle *&) ProcessFunctionLeaf
iteratively leaf processing function template
Definition: binary_tree.h:821
T x
Definition: matrix.h:10
Tptcl * getMember(const size_t i) const
get member
Definition: binary_tree.h:940
BinaryTreeLocal * getLeftMemberAsTree() const
get left member as tree
Definition: binary_tree.h:968
static void generateLevelBranch(BinaryTreeLocal &_bin, const bool _reset)
generate level and branch
Definition: binary_tree.h:616