Skip to main content

Quantity

Trait Quantity 

Source
pub trait Quantity:
    Any
    + Send
    + Sync {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn name(&self) -> &str;
    fn structure_name(&self) -> &str;
    fn kind(&self) -> QuantityKind;
    fn is_enabled(&self) -> bool;
    fn set_enabled(&mut self, enabled: bool);
    fn build_ui(&mut self, ui: &dyn Any);
    fn refresh(&mut self);
    fn data_size(&self) -> usize;

    // Provided method
    fn clear_gpu_resources(&mut self) { ... }
}
Expand description

Data associated with a structure that can be visualized.

Quantities are attached to structures and represent data like:

  • Scalar fields (temperature, pressure, etc.)
  • Vector fields (velocity, normals, etc.)
  • Colors
  • UV parameterizations

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Returns a reference to self as Any for downcasting.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Returns a mutable reference to self as Any for downcasting.

Source

fn name(&self) -> &str

Returns the name of this quantity.

Source

fn structure_name(&self) -> &str

Returns the name of the parent structure.

Source

fn kind(&self) -> QuantityKind

Returns the kind of this quantity.

Source

fn is_enabled(&self) -> bool

Returns whether this quantity is currently enabled/visible.

Source

fn set_enabled(&mut self, enabled: bool)

Sets the enabled state of this quantity.

Source

fn build_ui(&mut self, ui: &dyn Any)

Builds the ImGui UI controls for this quantity.

Source

fn refresh(&mut self)

Refreshes GPU resources after data changes.

Source

fn data_size(&self) -> usize

Returns the number of data elements.

Provided Methods§

Source

fn clear_gpu_resources(&mut self)

Clears GPU render resources so they can be re-initialized with a new device.

Implementors§