Automatic generation produced by ISE Eiffel
deferred class EG_PARTICLE_SIMULATION_BH [G -> NUMERIC] General cluster: physics description: "This is the Barnes and Hut implementation for the n_body_force_solver of a particle system. The runtime is O (n log n) where n is the number of particles. The method was first proposed in: %"A Hierarchical O(n log n) force calculation algorithm%", J. Barnes and P. Hut, Nature, v. 324 (1986) To calculate the force on a_particle an EG_QUAD_TREE (node) is traversed where force is either traverse (node): 1. if node is a leaf force := n_body_force (a_particle, node.particle) 2. size of node region / distance between a_particle and center of mass of node < theta force := n_body_force (a_particle, node.center_of_mass_particle) 3. none of the above for all children c of node force := force + traverse (c) The larger theta the better the runtime but also the higher the error since center_of_mass_particle is only an approximation of all the particle in the children of node. " Ancestors EG_PARTICLE_SIMULATION* [G -> NUMERIC] EV_MODEL_DOUBLE_MATH Queries arc_cosine (v: REAL_64): REAL_64 arc_sine (v: REAL_64): REAL_64 arc_tangent (v: REAL_64): REAL_64 between (n, a, b: REAL_64): BOOLEAN ceiling (v: REAL_64): REAL_64 cosine (v: REAL_64): REAL_64 dabs (v: REAL_64): REAL_64 delta_x (angle, length: REAL_64): REAL_64 delta_y (angle, length: REAL_64): REAL_64 distance (x1, y1, x2, y2: REAL_64): REAL_64 distance_from_line (x, y, x1, y1, x2, y2: REAL_64): REAL_64 Euler: REAL_64 exp (x: REAL_64): REAL_64 floor (v: REAL_64): REAL_64 force (a_particle: [like particle_type] EG_PARTICLE): G last_theta_average: REAL_64 line_angle (x1, y1, x2, y2: REAL_64): REAL_64 log (v: REAL_64): REAL_64 log10 (v: REAL_64): REAL_64 log_2 (v: REAL_64): REAL_64 modulo (a, b: REAL_64): REAL_64 particles: LIST [[like particle_type] EG_PARTICLE] Pi: REAL_64 Pi_2: REAL_64 Pi_4: REAL_64 point_on_ellipse (x, y, xc, yc, r1, r2: REAL_64): BOOLEAN point_on_ellipse_boundary (x, y, xc, yc, r1, r2, width: REAL_64): BOOLEAN point_on_line (x, y, x1, y1, x2, y2, width: REAL_64): BOOLEAN point_on_polygon (x, y: REAL_64; points: SPECIAL [EV_COORDINATE]): BOOLEAN point_on_rectangle (x, y, x1, y1, x2, y2: REAL_64): BOOLEAN point_on_rotated_ellipse (x, y, xc, yc, r1, r2, angle: REAL_64): BOOLEAN point_on_rotated_ellipse_boundary (x, y, xc, yc, r1, r2, angle, width: REAL_64): BOOLEAN point_on_segment (x, y, x1, y1, x2, y2, width: REAL_64): BOOLEAN quad_tree: detachable EG_QUAD_TREE sine (v: REAL_64): REAL_64 sqrt (v: REAL_64): REAL_64 Sqrt2: REAL_64 tangent (v: REAL_64): REAL_64 theta: REAL_64 Commands set_particles (a_particles: [like particles] LIST [[like particle_type] EG_PARTICLE]) set_theta (a_theta: [like theta] REAL_64) Constraints quad tree exists -- Generated by Eiffel Studio --
For more details: eiffel.org