Variable

Trait Variable 

Source
pub trait Variable:
    DynClone
    + Send
    + Sync
    + Debug
    + Display
    + Serialize
    + Deserialize {
    // Required method
    fn value(&self, event: &EventData) -> f64;

    // Provided methods
    fn bind(&mut self, _metadata: &DatasetMetadata) -> LadduResult<()> { ... }
    fn value_on_local(&self, dataset: &Dataset) -> LadduResult<Vec<f64>> { ... }
    fn value_on(&self, dataset: &Dataset) -> LadduResult<Vec<f64>> { ... }
    fn eq(&self, val: f64) -> VariableExpression
       where Self: Sized + 'static { ... }
    fn lt(&self, val: f64) -> VariableExpression
       where Self: Sized + 'static { ... }
    fn gt(&self, val: f64) -> VariableExpression
       where Self: Sized + 'static { ... }
    fn ge(&self, val: f64) -> VariableExpression
       where Self: Sized + 'static { ... }
    fn le(&self, val: f64) -> VariableExpression
       where Self: Sized + 'static { ... }
}
Expand description

Standard methods for extracting some value out of an EventData.

Required Methods§

Source

fn value(&self, event: &EventData) -> f64

This method takes an EventData and extracts a single value (like the mass of a particle).

Provided Methods§

Source

fn bind(&mut self, _metadata: &DatasetMetadata) -> LadduResult<()>

Bind the variable to dataset metadata so that any referenced names can be resolved to concrete indices. Implementations that do not require metadata may keep the default no-op.

Source

fn value_on_local(&self, dataset: &Dataset) -> LadduResult<Vec<f64>>

This method distributes the Variable::value method over each EventData in a Dataset (non-MPI version).

§Notes

This method is not intended to be called in analyses but rather in writing methods that have mpi-feature-gated versions. Most users should just call Variable::value_on instead.

Source

fn value_on(&self, dataset: &Dataset) -> LadduResult<Vec<f64>>

This method distributes the Variable::value method over each EventData in a Dataset.

Source

fn eq(&self, val: f64) -> VariableExpression
where Self: Sized + 'static,

Create an VariableExpression that evaluates to self == val

Source

fn lt(&self, val: f64) -> VariableExpression
where Self: Sized + 'static,

Create an VariableExpression that evaluates to self < val

Source

fn gt(&self, val: f64) -> VariableExpression
where Self: Sized + 'static,

Create an VariableExpression that evaluates to self > val

Source

fn ge(&self, val: f64) -> VariableExpression
where Self: Sized + 'static,

Create an VariableExpression that evaluates to self >= val

Source

fn le(&self, val: f64) -> VariableExpression
where Self: Sized + 'static,

Create an VariableExpression that evaluates to self <= val

Trait Implementations§

Source§

impl<'typetag> Serialize for dyn Variable + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Variable + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Variable + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn Variable + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Implementors§