[][src]Struct bigbang::GravTree

pub struct GravTree<T: AsEntity + Clone> {
    pub root: Node<T>,
    // some fields omitted
}

The main struct you will interact with. This is a k-d tree containing all of your gravitational entities.

Fields

root: Node<T>

A GravTree consists of a root [[Node]]. A [[Node]] is a recursive binary tree data structure. Tragically must be public for now for testing reasons. Perhaps could be replaced by various getter methods later.

Methods

impl<T: AsEntity + Clone + Send + Sync> GravTree<T>[src]

pub fn new(pts: &mut Vec<T>, time_step: f64) -> GravTree<T> where
    T: AsEntity
[src]

pub fn as_vec(&self) -> Vec<T>[src]

Traverses the tree and returns a vector of all entities in the tree.

pub fn get_number_of_entities(&self) -> usize[src]

Gets the total number of entities contained by this tree.

pub fn time_step(&self) -> GravTree<T>[src]

This function creates a vector of all entities from the tree and applies gravity to them. Returns a new GravTree.

pub fn from_data_file(
    file_string: String,
    time_step: f64
) -> Result<GravTree<Entity>, &'static str>
[src]

Reads a data file generated by this program. To see the format of this file, go to [[write_data_file]]. Takes in a file path and a time_step value. These are not encoded in the data files to allow for SwiftViz to read the files without issue. There is currently no way to offload theta, max_pts, and time_step into the data file. Returns a new GravTree with the data from the file on success, or an error message if the data format is incorrect. Panics if the file path provided is incorrect.

pub fn write_data_file(self, file_path: String)[src]

Writes a utf8 file with one entity per line, space separated values of the format: x y z vx vy vz mass radius. Must have a newline after the final entity. This is compatible with SwiftVis visualizations.

Auto Trait Implementations

impl<T> Send for GravTree<T> where
    T: Send

impl<T> Unpin for GravTree<T> where
    T: Unpin

impl<T> Sync for GravTree<T> where
    T: Sync

impl<T> UnwindSafe for GravTree<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for GravTree<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,