Skip to main content

HybridRepr

Struct HybridRepr 

Source
pub struct HybridRepr {
    pub sheet: SheetTracker,
    pub grid: UniformGrid6D,
    pub domain: Domain,
    pub stream_threshold: u32,
    pub mask: Vec<bool>,
}
Expand description

Hybrid representation combining SheetTracker and UniformGrid6D.

Single-stream regions (stream_count ≤ threshold) are tracked by the Lagrangian sheet (exact characteristics, zero diffusion). Multi-stream regions are handled by the Eulerian 6D grid (captures velocity dispersion).

The mask vector marks each spatial cell: true = grid mode, false = sheet mode.

Fields§

§sheet: SheetTracker

Lagrangian sheet tracker for single-stream regions.

§grid: UniformGrid6D

Eulerian 6D grid for multi-stream regions.

§domain: Domain

Simulation domain (spatial and velocity extents, boundary conditions).

§stream_threshold: u32

Stream count above which a cell transitions from sheet to grid mode.

§mask: Vec<bool>

Per spatial cell: true = grid mode (multi-stream), false = sheet mode.

Implementations§

Source§

impl HybridRepr

Source

pub fn new(domain: Domain) -> Self

Create a new hybrid representation with all cells initially in sheet mode.

Source

pub fn update_interface(&mut self)

Transfer particles from SheetTracker to grid where stream_count > stream_threshold.

For each spatial cell where the stream count exceeds the threshold and is not yet in grid mode: deposit the sheet particles into the 6D grid via CIC and mark the cell as grid mode.

Trait Implementations§

Source§

impl PhaseSpaceRepr for HybridRepr

Source§

fn compute_density(&self) -> DensityField

Compute density by selecting grid or sheet density per cell via the mask.

Source§

fn advect_x(&mut self, displacement: &DisplacementField, dt: f64)

Spatial drift: advance both sheet and grid, then update the interface mask.

Source§

fn advect_v(&mut self, acceleration: &AccelerationField, dt: f64)

Velocity kick: advance both sheet and grid, then update the interface mask.

Source§

fn moment(&self, position: &[f64; 3], order: usize) -> Tensor

Velocity moment dispatched to grid or sheet depending on the cell mask.

Source§

fn total_mass(&self) -> f64

Total mass summed over grid-mode and sheet-mode cells according to the mask.

Source§

fn casimir_c2(&self) -> f64

Casimir C2 invariant. Returns infinity if any cells are still in sheet mode (the sheet’s delta-function f makes C2 diverge).

Source§

fn entropy(&self) -> f64

Entropy. Sheet cells contribute zero; grid cells contribute normally.

Source§

fn stream_count(&self) -> StreamCountField

Stream count derived from the sheet tracker regardless of the cell mask.

Source§

fn velocity_distribution(&self, position: &[f64; 3]) -> Vec<f64>

Local velocity distribution dispatched to grid or sheet by cell mask.

Source§

fn total_kinetic_energy(&self) -> Option<f64>

Total kinetic energy. Uses the grid in all-grid mode, otherwise the sheet.

Source§

fn as_any(&self) -> &dyn Any

Downcast to &dyn Any for runtime type queries.

Source§

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

Downcast to &mut dyn Any for runtime type queries.

Source§

fn to_snapshot(&self, time: f64) -> Option<PhaseSpaceSnapshot>

Extract a full 6D snapshot of the current state. Read more
Source§

fn load_snapshot( &mut self, snap: PhaseSpaceSnapshot, ) -> Result<(), CausticError>

Replace the current state with data from a dense 6D snapshot. Read more
Source§

fn can_materialize(&self) -> bool

Whether full 6D materialization fits in available memory. Default: true. Compressed representations (HT, TT) should override to check shape vs a memory threshold.
Source§

fn memory_bytes(&self) -> usize

Approximate memory usage of this representation in bytes. Default returns 0; implementations should override for accurate tracking.
Source§

fn set_progress(&mut self, _progress: Arc<StepProgress>)

Attach shared progress state for intra-phase cell-level reporting. Implementations can use this to report progress via StepProgress::set_intra_progress.

Auto Trait Implementations§

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

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

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,