SlowDown Algorithmic Regularization (SDAR)
Algorithmic Regularization with slowdown method for integrating few-body motions
|
#include <binary_tree.h>
Public Types | |
template<class T > | |
using | ProcessFunctionLeaf = void(*)(T &, Tptcl *&) |
iteratively leaf processing function template More... | |
template<class T > | |
using | ProcessFunctionRoot = T(*)(T &, BinaryTreeLocal &) |
iteratively root processing function template More... | |
template<class T , class Tr > | |
using | ProcessFunctionTree = Tr(*)(T &, const Tr &, const Tr &, BinaryTreeLocal &) |
iteratively tree processing function template More... | |
Public Member Functions | |
BinaryTree () | |
int | isSameBranch (const BinaryTreeLocal &_bin) const |
check whether a given binarytree data is in the same branch More... | |
void | getherBinaryTreeIter (BinaryTreeLocal _bin[]) |
collect BinaryTree data iteratively and save to a BinaryTree array More... | |
void | calcCenterOfMass () |
calculate center-of-mass from members More... | |
void | calcSemiEccPeriod (const Float &_G) |
calculate Kepler orbit semi, ecc and period only More... | |
void | calcOrbit (const Float _G) |
calculate Kepler orbit from members More... | |
void | calcParticles (const Float _G) |
calculate particles from orbit More... | |
int | calcMemberN () |
calc total number of members More... | |
int | getMemberN () const |
get total number of members More... | |
int | calcMemberNIter () |
calc total number of members iteratively More... | |
template<class T > | |
void | processLeafIter (T &_dat, ProcessFunctionLeaf< T > _f) |
Process (bottom) leaf data with extra dat iteratively (from left to right) More... | |
template<class T > | |
T | processRootIter (T &_dat, ProcessFunctionRoot< T > _f) |
Process root data and return result iteratively. More... | |
template<class Troot , class Tleaf > | |
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. More... | |
template<class T , class Tr > | |
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) More... | |
int | copyDataIter (BinaryTreeLocal _bin_out[], const int _i) |
copy a binary tree to a binaryTree array iteratively More... | |
void | setMembers (Tptcl *_p1, Tptcl *_p2, const int _i1, const int _i2) |
set members More... | |
Tptcl * | getMember (const size_t i) const |
get member More... | |
BinaryTreeLocal * | getMemberAsTree (const size_t i) const |
get member as tree More... | |
int | getMemberIndex (const size_t i) const |
get member index More... | |
bool | isMemberTree (const size_t i) const |
Tptcl * | getLeftMember () const |
get left member More... | |
BinaryTreeLocal * | getLeftMemberAsTree () const |
get left member as tree More... | |
Tptcl * | getRightMember () const |
get right member More... | |
BinaryTreeLocal * | getRightMemberAsTree () const |
get right member as tree More... | |
void | printColumn (std::ostream &_fout, const int _width=20) |
print data of class members using column style More... | |
void | writeAscii (std::ostream &_fout) const |
write class data to file with ASCII format More... | |
void | readAscii (std::istream &_fin) |
read class data to file with ASCII format More... | |
void | printBinaryTreeIter (std::ostream &_fout, const int _width=20) |
print binary and member information More... | |
void | printBinaryIter (std::ostream &_fout, const int _width=20) |
print binary function More... | |
Static Public Member Functions | |
static Float & | stableCheckIter (BinaryTreeLocal &_bin, const Float _t_crit) |
Three-body stability function for hierarchical binary tree. More... | |
static void | generateLevelBranch (BinaryTreeLocal &_bin, const bool _reset) |
generate level and branch More... | |
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. More... | |
static void | printColumnTitle (std::ostream &_fout, const int _width=20) |
print titles of class members using column style More... | |
Public Attributes | |
int | level |
More... | |
int | branch |
More... | |
Binary tree cell.
using COMM::BinaryTree< Tptcl, Tbinary >::ProcessFunctionLeaf = void (*) (T&, Tptcl* &) |
iteratively leaf processing function template
using COMM::BinaryTree< Tptcl, Tbinary >::ProcessFunctionRoot = T (*) (T&, BinaryTreeLocal& ) |
iteratively root processing function template
using COMM::BinaryTree< Tptcl, Tbinary >::ProcessFunctionTree = Tr (*) (T&, const Tr&, const Tr&, BinaryTreeLocal& ) |
iteratively tree processing function template
|
inline |
|
inline |
calculate center-of-mass from members
|
inline |
calc total number of members
|
inline |
calc total number of members iteratively
|
inline |
calculate Kepler orbit from members
|
inline |
calculate particles from orbit
|
inline |
calculate Kepler orbit semi, ecc and period only
|
inline |
copy a binary tree to a binaryTree array iteratively
[in] | _bin_out | BinaryTree array to store the data |
[in] | _i | index in _bin_out for copying the current tree cell |
|
inlinestatic |
Generate kepler binary tree for a group of particles.
|
inlinestatic |
generate level and branch
[in] | _bin | binary tree |
[in] | _reset | if true, set _bin as root tree (level=0, branch=0), otherwise use the stored values. |
|
inline |
collect BinaryTree data iteratively and save to a BinaryTree array
The member number should be correct
[out] | _bin | binarytree array to store the data (should be size of n_members-1), the root is put last (n_members-1) |
|
inline |
get left member
|
inline |
get left member as tree
|
inline |
get member
|
inline |
get member as tree
|
inline |
get member index
|
inline |
get total number of members
|
inline |
get right member
|
inline |
get right member as tree
|
inline |
|
inline |
check whether a given binarytree data is in the same branch
[in] | _bin | binary tree |
|
inline |
print binary function
|
inline |
print binary and member information
|
inline |
print data of class members using column style
print data of class members in one line for column style. Notice no newline is printed at the end
[out] | _fout | std::ostream output object |
[in] | _width | print width (defaulted 20) |
|
inlinestatic |
print titles of class members using column style
! copy operator = *! Copy the data and member address. If member address point to a particle (id>0), copy address; else if it is a binary tree, copy the address and also correct the address difference, this assume the whole BinaryTree is stored in a continuing array, thus correct address difference also make the new binary tree have consistent member address in new array.
print titles of class members in one line for column style
[out] | _fout | std::ostream output object |
[in] | _width | print width (defaulted 20) |
|
inline |
Process (bottom) leaf data with extra dat iteratively (from left to right)
[in] | _dat | data for processing loop from left to right |
[in] | _f | function to process leaf information |
|
inline |
Process root data and return result iteratively.
The process go from top root to leafs from left to right
[in] | _dat | data return from upper level processing function |
[in] | _f | function to process root information |
|
inline |
Process root and leaf data and return result iteratively.
The process go from top root to leafs from left to right
[in] | _dat_root | data return from upper root processing function |
[in] | _f_root | function to process root information |
[in] | _dat_leaf | data for processing loop from left to right |
[in] | _f_leaf | function to process leaf information |
|
inline |
Process tree data with extra dat iteratively (from bottom to top)
[in] | _dat | general data type for process using |
[in] | _res1 | return from branch 1 |
[in] | _res2 | return from branch 2 |
[in] | _f | function to process root information |
|
inline |
read class data to file with ASCII format
[in] | _fin | std::istream file for input |
|
inline |
set members
[in] | _p1 | particle 1 |
[in] | _p2 | particle 2 |
[in] | _i1 | particle 1 index (should be >=0 if it is not binary tree) |
[in] | _i2 | particle 2 index (should be >=0 if it is not binary tree) |
|
inlinestatic |
Three-body stability function for hierarchical binary tree.
|
inline |
write class data to file with ASCII format
[in] | _fout | std:osteram file for output |
int COMM::BinaryTree< Tptcl, Tbinary >::branch |
binary tree level, start from zero for root tree. Then each subtree increase level by one.
int COMM::BinaryTree< Tptcl, Tbinary >::level |
member pointer