Calcify

A crate for 3-D and 4-D vector and matrix algebra, conceived for use in physics simulations. Builds out from a basic ThreeVec struct including most commonly used operations built in. Includes physics constants, 3 and 4-D vectors and matrices and many associated operations, collections, histograms, and output trees, which are serialized in json or MessagePack.

ICalcify

Python command line utility and module for analyzing Tree files.

Check it out here!

Usage

```rust use std::error;

extern crate calcify;

use calcify::Tree; use calcify::FeedTree; use calcify::Collection; use calcify::Bin; use calcify::Point; use calcify::io::ToFile;

mod dummyexperimentlib;

use dummyexperimentlib::Projectile; use dummyexperimentlib::Lab;

fn main() -> Result<(),Box> { let mut ftree = FeedTree::::new("DummyStates","Object"); let mut ttree = Tree::new("DummyData");

ftree.add_field("Desc","A FeedTree of states for a simulation that does not exist.")?;
ttree.add_field("Desc","A Tree data branches for a simulation that does not exist.")?;

let mut dummy_lab = Lab::new();

let init_state: Collection<Projectile> = Collection::from(dummy_lab.state.clone());
let init_hist: Collection<Bin> = init_state.map(|x| {x.r().r()}).hist(500);
let init_spread: Collection<Point> = Collection::plot(&init_state.map(|x| {*x.r().x0()}).vec,
                                                      &init_state.map(|x| {*x.r().x1()}).vec)
                                                      .cut(|p| p.r() <= 1.0);

ftree.add_feed("init_state", init_state)?;
ttree.add_branch("init_hist", init_hist, "Bin")?;
ttree.add_branch("init_spread", init_spread, "Point")?;

dummy_lab.run(1000);

let fin_state: Collection<Projectile> = Collection::from(dummy_lab.state.clone());
let fin_hist: Collection<Bin> = fin_state.map(|x| {x.r().r()}).hist(500);
let fin_spread: Collection<Point> = Collection::plot(&fin_state.map(|x| {*x.r().x0()}).vec,
                                                     &fin_state.map(|x| {*x.r().x1()}).vec)
                                                     .cut(|p| p.r() <= 1.0);

ftree.add_feed("fin_state", fin_state)?;
ttree.add_branch("fin_hist", fin_hist, "Bin")?;
ttree.add_branch("fin_spread", fin_spread, "Point")?;

ftree.write_msg("dummy_states.msg")?;
ttree.write_msg("dummy_data.msg")?;
Ok(())

} ```

Example

cargo run --example universe_in_a_box --release

Notes about File IO

Trees

| Write | Read | | ----------- | ----------- | | Supports all subtypes | Internal types only, and not Object|

FeedTrees

| Write| Read | | -----| -----| | Supports all subtypes| Supports all subtypes|

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.