Skip to main content

TimeDump

Struct TimeDump 

Source
pub struct TimeDump<S = MemorySink> { /* private fields */ }
Expand description

Time-domain field dump operator: samples a FieldSampler on a Schedule and passes each Snapshot to a DumpSink. See the module docs for when states are sampled.

The default sink is a MemorySink; read it back with Engine::operator(&handle).sink().

Implementations§

Source§

impl TimeDump<MemorySink>

Source

pub fn new(sampler: FieldSampler) -> Self

In-memory dump of every state (change with schedule).

Source

pub fn write_vtr(&self, dir: impl AsRef<Path>, basename: &str) -> Result<()>

Writes all recorded snapshots as <dir>/<basename>_<step>.vtr plus <dir>/<basename>.pvd (creating dir), like VtrSeries.

Source§

impl<S: DumpSink> TimeDump<S>

Source

pub fn with_sink(sampler: FieldSampler, sink: S) -> Self

Dump of every state into sink.

Source

pub fn schedule(self, schedule: Schedule) -> Self

Sets the schedule (default: every step).

Source

pub fn window(self, start: f64, stop: f64) -> Self

Records only states whose quantity time t (FieldSampler::time) satisfies start ≤ t ≤ stop [s]; stop ≤ 0 means no upper limit (the csx StartTime / StopTime convention). The schedule is evaluated only inside the window. Default: no window.

Source

pub fn sampler(&self) -> &FieldSampler

The sampler.

Source

pub fn sink(&self) -> &S

The sink.

Source

pub fn sink_mut(&mut self) -> &mut S

Mutable access to the sink (e.g. MemorySink::take).

Source

pub fn error(&self) -> Option<&Error>

The first sink error, after which the dump stopped.

Trait Implementations§

Source§

impl<S: Debug> Debug for TimeDump<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: DumpSink> Operator for TimeDump<S>

Source§

fn pre_h(&mut self, fields: &mut Fields<'_>, ctx: &StepContext<'_>)

Before the H update of step ctx.step.
Source§

fn post_e(&mut self, fields: &mut Fields<'_>, ctx: &StepContext<'_>)

After the E update (u is at ctx.e_time()).
Source§

fn post_h(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)

After the H update (i is at ctx.h_time()).
Source§

fn pre_e(&mut self, _fields: &mut Fields<'_>, _ctx: &StepContext<'_>)

Before the E update.
Source§

fn hooks(&self) -> Hooks

The serial hooks this operator implements (default Hooks::ALL). Queried once, at registration; undeclared hooks are never called. Declaring fewer hooks only saves time: an operator whose hooks are all empty may return Hooks::NONE.
Source§

fn slab_hooks( &mut self, _partition: &SlabPartition<'_>, ) -> Option<Arc<dyn SlabHooks>>

Slab-parallel work for the engine’s x-slab partition (default none). Called once, at registration; the returned object is run by the worker threads (see SlabHooks). The operator may keep a clone of the Arc to read results back.
Source§

fn energy(&self) -> f64

Energy [J] held in the operator’s own state at t = n·dt, the time of the E voltages after n completed steps (default 0). Read more

Auto Trait Implementations§

§

impl<S> Freeze for TimeDump<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for TimeDump<S>
where S: RefUnwindSafe,

§

impl<S> Send for TimeDump<S>
where S: Send,

§

impl<S> Sync for TimeDump<S>
where S: Sync,

§

impl<S> Unpin for TimeDump<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for TimeDump<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for TimeDump<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.