#include <vector>
#include "util_math.h"
#include "node.h"
#include "kepler.h"
#include "dyn_kepler.h"
Go to the source code of this file.
Classes | |
class | dyn |
dyn: The simplest class of dynamical particles. More... | |
Defines | |
#define | BIN_INDENT 21 |
Typedefs | |
typedef dyn * | dynptr |
typedef vec(dyn::* | dyn_VMF_ptr )(void) const |
typedef void(dyn::* | dyn_MF_ptr )(const vec &) |
typedef bool | boolfn (dyn *) |
Compute arbitrary Lagrangian radii. | |
Functions | |
node * | new_dyn (hbpfp the_hbpfp, sbpfp the_sbpfp, bool use_stories) |
dyn * | mkdyn (int n, hbpfp the_hbpfp=new_hydrobase, sbpfp the_sbpfp=new_starbase) |
dyn * | get_col (istream &s=cin, npfp the_npfp=new_dyn, hbpfp the_hbpfp=new_hydrobase, sbpfp the_sbpfp=new_starbase, bool use_stories=true) |
Read col format data from a stream. | |
void | put_col (dyn *, ostream &s=cout) |
Write col format data to a stream. | |
dyn * | get_dyn (istream &s=cin, hbpfp the_hbpfp=new_hydrobase, sbpfp the_sbpfp=new_starbase, bool use_stories=true) |
Read a standard format dyn snapshot from a stream. | |
void | put_dyn (dyn *b, ostream &s=cout, bool print_xreal=true, int short_output=0) |
Write a standard format dyn snapshot to a stream. | |
dyn * | fget_dyn (FILE *fp=dyn::get_ifp()?:stdin) |
Fast read, switching between file and pipe input. | |
dyn * | common_ancestor (dyn *bi, dyn *bj) |
Return a pointer to the common ancestor of two nodes. | |
vec | something_relative_to_root (dyn *b, dyn_VMF_ptr mf) |
Compute a vector quantity relative to the root node. | |
void | dbg_message (char *, dyn *) |
void | makesphere (dyn *root, int n, real R=1, int u_flag=0) |
Create a uniform sphere of dyn particles. | |
real | pot_on_general_node (dyn *bj, dyn *bi, real eps2, bool cm) |
Compute the potential of a node in an N-body system. | |
void | calculate_energies (dyn *root, real eps2, real &epot, real &ekin, real &etot, bool cm=false) |
Calculate the potential, kinetic, and total energies of an N-body system. | |
void | print_recalculated_energies (dyn *, int mode=0, real eps2=0, real e_corr=0) |
Comute and print the energies. | |
void | initialize_print_energies (dyn *, real eps2=0) |
Initialize the energy diagnostics and print the energies. | |
void | compute_density (dyn *b, int k=12, bool use_mass=false, dyn **list=NULL, int n_list=0) |
Compute the densities associated with all nodes under b. | |
void | merge_low_level_nodes (dyn *b, real frac=1, int option=1) |
Combine two binary nodes into one. | |
vector< real > & | get_radial_densities (dyn *, vec, vector< real > &, bool(*)(dyn *)=0) |
vector< real > & | get_radial_numdensities (dyn *, vec, vector< real > &, bool(*)(dyn *)=0) |
int | get_radial_vdisp (dyn *b, vec cpos, vec cvel, int n_zones, real r[], real v2[]) |
Compute the velocity dispersion in radial bins. | |
int | get_density_profile (dyn *b, vec cpos, int n_zones, real r[], real rho[], bool(*select)(dyn *)=NULL) |
Compute the density in radial bins. | |
int | get_profile (dyn *b, vec cpos, int n_zones, real r[], real q[], real(*Q)(dyn *)) |
Compute the distribution of quantity q in radial bins. | |
void | compute_com (dyn *, vec &, vec &) |
Calculate the center of mass. | |
void | compute_mcom (dyn *, vec &, vec &, real f=0.9, int n_iter=2) |
Calculate the modified center of mass. | |
int | get_std_center (dyn *, vec &, vec &, bool verbose=false) |
Compute the "standard" center (density, modified, normal center of mass.). | |
void | compute_max_cod (dyn *, vec &, vec &) |
Compute the center defined by the particle with maximum density. | |
void | compute_mean_cod (dyn *, vec &, vec &) |
Compute the center, weighted by density. | |
void | compute_mass_radii (dyn *) |
Compute Lagrangian radii. | |
void | compute_mass_radii_percentiles (dyn *) |
Compute Lagrangian radii for 10-percentiles. | |
void | compute_mass_radii_quartiles (dyn *) |
Compute Lagrangian radii for quartiles. | |
void | set_lagr_cutoff_mass (dyn *b, real frac_low, real frac_high=1.0) |
Set limiting masses for Lagrangian radii. | |
void | reset_lagr_cutoff_mass (dyn *b, real frac_low, real frac_high=1.0) |
Set limiting masses for Lagrangian radii. | |
real | get_lagr_cutoff_mass () |
Return lower limiting mass for Lagrangian radii. | |
real | get_lagr_cutoff_mass_low () |
Return lower limiting mass for Lagrangian radii. | |
real | get_lagr_cutoff_mass_high () |
Return upper limiting mass for Lagrangian radii. | |
real | print_lagrangian_radii (dyn *b, int which_lagr=2, bool verbose=true, int which_star=0, bool print=true) |
Compute and print Lagrangian radii, write to root dyn story. | |
real | compute_lagrangian_radii (dyn *b, int which_lagr=2, bool verbose=true, int which_star=0) |
Compute, don't print. | |
bool | compute_general_mass_radii (dyn *, int, bool nonlin=false, boolfn *bf=NULL, bool verbose=true) |
void | search_for_binaries (dyn *b, real energy_cutoff=0, real kT=0, vec center=0, bool verbose=true, bool long_binary_output=true) |
Search for bound pairs and print their properties. | |
bool | parse_sys_stats_main (int argc, char *argv[], int &which_lagr, bool &binaries, bool &short_output, bool &B_flag, bool &calc_e, bool &n_sq, bool &out, bool &verbose, char *cvs_id, char *source) |
Parse the input for sys_stats and hsys_stats. | |
void | check_addstar (dyn *b) |
void | sys_stats (dyn *root, real energy_cutoff=1, bool verbose=true, bool binaries=true, bool long_binary_output=false, int which_lagr=2, bool print_time=false, bool compute_energy=false, bool allow_n_sq_ops=false, void(*compute_energies)(dyn *, real, real &, real &, real &, bool)=calculate_energies, void(*dstar_params)(dyn *)=NULL, bool(*print_dstar_stats)(dyn *, bool, vec, bool)=NULL) |
General statistics and diagnostics on an N-body system. | |
void | refine_cluster_mass (dyn *b, int verbose=0) |
Determine the self-consistent mass of a cluster in a tidal field. | |
void | refine_cluster_mass2 (dyn *b, int verbose=0) |
Determine the self-consistent mass of a cluster in a tidal field. | |
real | print_binary_params (kepler *k, real m1, real kT, real dist_from_cod, bool verbose=true, bool long_output=true, int init_indent=0, int indent=BIN_INDENT) |
Print the properties of a binary defined by a kepler. | |
real | get_total_energy (dyn *bi, dyn *bj) |
Return the total energy of the binary defined by two nodes. | |
real | get_semi_major_axis (dyn *bi, dyn *bj) |
Return the semi-major axis of the binary defined by two nodes. | |
real | get_period (dyn *bi, dyn *bj) |
Return the period of the binary defined by two nodes. | |
void | get_total_energy_and_period (dyn *bi, dyn *bj, real &E, real &P) |
Return the total energy and period of the binary defined by two nodes. | |
void | initialize_kepler_from_dyn_pair (kepler &k, dyn *bi, dyn *bj, bool minimal=false) |
Create a kepler structure from a pair of nodes. | |
void | print_binary_from_dyn_pair (dyn *bi, dyn *bj, real kT=0, vec center=vec(0, 0, 0), bool verbose=true, bool long_output=true) |
Print the properties of a binary defined by a pair of nodes. | |
real | print_structure_recursive (dyn *b, void(*dstar_params)(dyn *), int &n_unp, real &e_unp, real kT=0.0, vec center=vec(0, 0, 0), bool verbose=true, bool long_output=true, int indent=0) |
Recursively print the properties of binary node b. | |
void | compute_core_parameters (dyn *b, int k, bool allow_n_sq_ops, vec ¢er, real &rcore, int &ncore, real &mcore) |
Compute core radius, mass, etc. | |
void | plot_stars (dyn *bi, int n=5, int k=3) |
Pseudoplot a patch of an N-body system. | |
real | get_mass (dyn *b) |
Compute the total mass of a node. | |
void | scale_mass (dyn *b, real mscale) |
Scale the mass of a node (and descendents) to the specified value. | |
void | scale_pos (dyn *b, real rscale, vec com_pos=0.0) |
Scale the positions of a node and descendents by the specified value. | |
void | scale_vel (dyn *b, real vscale, vec com_vel=0.0) |
Scale the velocities of a node and descendents by the specified value. | |
real | get_top_level_kinetic_energy (dyn *b) |
Compute the total kinetic energy of all top-level nodes under b. | |
real | get_kinetic_energy (dyn *b) |
Compute the total kinetic energy of all leaves under b. | |
void | get_top_level_energies (dyn *b, real eps2, real &potential, real &kinetic) |
Compute the total energies of all top-level nodes under b. | |
void | scale_virial (dyn *b, real q, real potential, real &kinetic, vec com_vel=0.0) |
Scale velocities to produce the desired virial ratio. | |
real | scale_energy (dyn *b, real e, real &energy, vec com_pos=0.0, vec com_vel=0.0) |
Scale the total energy of a system to the desired value. | |
bool | parse_scale_main (int argc, char *argv[], real &eps, bool &c_flag, bool &e_flag, real &e, bool &m_flag, real &m, bool &q_flag, real &q, bool &r_flag, real &r, bool &debug, char *cvs_id, char *source) |
Parse the command line in scale and hscale. | |
void | scale (dyn *b, real eps, bool c_flag, bool e_flag, real e, bool m_flag, real m, bool q_flag, real q, bool r_flag, real r, bool debug=false, void(*top_level_energies)(dyn *, real, real &, real &)=get_top_level_energies) |
Scale masses, radii, and velocities according to various criteria. | |
void | get_external_acc (dyn *b, vec pos, vec vel, real &pot, vec &acc, vec &jerk, bool pot_only=false) |
Compute the acceleration and jerk due to an external field. | |
real | get_external_pot (dyn *b, void(*pot_func)(dyn *, real)=NULL) |
Compute the potential due to an external field. | |
real | vcirc (dyn *b, vec r) |
Compute the circular velocity in a (spherical) external potential. | |
real | get_tidal_pot (dyn *b) |
real | get_plummer_pot (dyn *b) |
real | get_power_law_pot (dyn *b) |
real | get_external_virial (dyn *b) |
void | print_external (unsigned int ext, bool shortbits=false) |
void | set_new_rhalf (bool s=true) |
Set half-mass radius used internally in dyn_external. | |
void | set_friction_beta (real b) |
Set dynamical friction scaling parameter. | |
void | set_friction_mass (real m) |
Set mass determining dynamical friction. | |
void | set_friction_vel (vec v) |
Set vel determining dynamical friction. | |
void | set_friction_acc (dyn *b, real r) |
Dynamical friction acceleration. | |
bool | get_physical_scales (dyn *b, real &mass, real &length, real &time) |
Determine physical scales associated with an N-body system. | |
void | add_plummer (dyn *b, real coeff, real scale, vec center=0.0, bool n_flag=false, bool verbose=false, bool fric_flag=false) |
Add parameters for an external Plummer field to an N-body system. | |
void | toggle_plummer_friction (dyn *b) |
Turn dynamical friction on/off. | |
void | add_power_law (dyn *b, real coeff, real exponent, real scale, vec center=0.0, bool n_flag=false, bool verbose=false, bool G_flag=false) |
Add parameters for an external power-law field to an N-body system. | |
real | get_initial_mass (dyn *b, bool verbose=false, bool mass_set=false, real input_mass=0) |
Read the initial mass from the root dyn story. | |
real | get_initial_virial_radius (dyn *b, bool verbose=false, bool r_virial_set=false, real input_r_virial=0) |
Read the initial virial radius from the root dyn story. | |
real | get_initial_jacobi_radius (dyn *b, real r_virial, bool verbose=false, bool r_jacobi_set=false, real input_r_jacobi=0) |
Read the initial jacobi radius from the root dyn story. | |
void | set_tidal_params (dyn *b, bool verbose, real initial_r_jacobi, real initial_mass, int &tidal_field_type) |
Read and set the tidal parameters from the root dyn story. | |
void | test_tidal_params (dyn *b, bool verbose, real initial_r_jacobi, real initial_r_virial, real initial_mass) |
Check the tidal parameters. | |
int | check_set_tidal (dyn *b, bool verbose=false) |
Check and set the tidal parameters. | |
void | check_set_plummer (dyn *b, bool verbose=false) |
void | check_set_power_law (dyn *b, bool verbose=false) |
void | check_set_external (dyn *b, bool verbose=false, int fric_int=-1) |
void | check_set_ignore_internal (dyn *b, bool verbose=false) |
int | bound_number (dyn *b) |
Number of bound stars. | |
real | bound_mass (dyn *b) |
Mass of bound stars. | |
vec | total_angular_momentum (dyn *b, vec x=0, vec v=0) |
Total angular momentum of the system. | |
real | total_energy (dyn *b) |
Total energy of the system. | |
real | core_radius (dyn *b) |
Cluster core radius. | |
real | core_mass (dyn *b) |
Cluster core mass. | |
int | core_number (dyn *b) |
Cluster core number. | |
real | virial_radius (dyn *b) |
Cluster virial radius. | |
real | tidal_radius (dyn *b) |
Cluster tidal radius. | |
real | core_density (dyn *b) |
Cluster core density. | |
real | mass (dyn *b) |
vec | pos (dyn *b, vec x=0) |
vec | vel (dyn *b, vec v=0) |
real | distance (dyn *b, vec x=0) |
|pos| | |
real | distance_sq (dyn *b, vec x=0) |
pos^2 | |
real | speed (dyn *b, vec v=0) |
|vel| | |
real | speed_sq (dyn *b, vec v=0) |
vel^2 | |
real | v_rad_sq (dyn *b, vec x=0, vec v=0) |
Squared radial velocity. | |
real | v_rad (dyn *b, vec x=0, vec v=0) |
Radial velocity. | |
real | v_trans_sq (dyn *b, vec x=0, vec v=0) |
Squared transverse velocity. | |
real | v_trans (dyn *b, vec x=0, vec v=0) |
Transverse velocity. | |
real | energy (dyn *b, vec v=0) |
Total energy. | |
vec | angular_momentum (dyn *b, vec x=0, vec v=0) |
Total angular momentum. |
Definition in file dyn.h.