Skip to main content

ThermalModifier

Struct ThermalModifier 

Source
pub struct ThermalModifier {
    pub config: ThermalConfig,
    pub temperature: ScalarField3D,
    pub melt_accumulator: ScalarField3D,
    pub heat_sources: Vec<HeatSource>,
    pub enabled: bool,
}
Expand description

Thermal simulation that modifies SDF based on temperature

Supports melting (surface recession + gravity droop), thermal expansion, and freeze growth.

Fields§

§config: ThermalConfig

Configuration

§temperature: ScalarField3D

Temperature field

§melt_accumulator: ScalarField3D

Accumulated melt deformation (positive = material removed)

§heat_sources: Vec<HeatSource>

Active heat sources

§enabled: bool

Whether modifier is enabled

Implementations§

Source§

impl ThermalModifier

Source

pub fn new( config: ThermalConfig, resolution: usize, min: (f32, f32, f32), max: (f32, f32, f32), ) -> Self

Create a new thermal modifier

Source

pub fn add_heat_point( &mut self, x: f32, y: f32, z: f32, power: f32, radius: f32, )

Add a point heat source

Source

pub fn apply_heat_at( &mut self, x: f32, y: f32, z: f32, amount: f32, radius: f32, )

Apply heat at a position (e.g., from friction, laser, etc.)

Source

pub fn temperature_at(&self, x: f32, y: f32, z: f32) -> f32

Get temperature at a point

Source§

impl ThermalModifier

Source

pub const PARTICIPANT_KIND: ParticipantKind

Snapshot tag of this type as a world participant: "THRM", the four ASCII bytes read big endian. Never changes.

Trait Implementations§

Source§

impl CoupledScalar for ThermalModifier

The temperature field is shared through a deterministic Fix128 channel.

ThermalModifier and crate::phase_change::PhaseChangeModifier each own a temperature field and nothing relates them — PhysicsModifier::update receives only dt, so neither can read the other’s. Going through CoupledField gives the pair one agreed field; see crate::coupled_field::reconcile_mean.

This does not change what update does: coupling happens only when the caller reconciles, so an existing chain behaves exactly as before.

Source§

fn coupled_name(&self) -> &'static str

Name of the quantity shared, for diagnostics ("temperature", …).
Source§

fn coupled_channel(&self) -> Result<CoupledField, CoupledFieldError>

A zero-filled channel on this subsystem’s grid. Read more
Source§

fn publish(&self, out: &mut CoupledField) -> Result<(), CoupledFieldError>

Write this subsystem’s field into out. Read more
Source§

fn adopt(&mut self, src: &CoupledField) -> Result<(), CoupledFieldError>

Replace this subsystem’s field with the channel’s contents. Read more
Source§

fn check_adopt(&self, src: &CoupledField) -> Result<(), CoupledFieldError>

Report, without changing anything, whether Self::adopt would accept src. Read more
Source§

impl Participant for ThermalModifier

One update(h) per world substep (h converted with Fix128::to_f32); see the module documentation of crate::sim_modifier for the payload and what is not coupled yet.

Observations: channel 0 the highest cell temperature (absent for a grid without cells), channel 1 the total melt (sum of the melt cells).

Source§

fn kind(&self) -> ParticipantKind

Snapshot tag of this participant type.
Source§

fn substep( &mut self, _ctx: &mut SubstepCtx<'_>, h: Fix128, ) -> Result<(), ParticipantFault>

Advance by one world substep of width h (ctx.h()). Read bodies from ctx, stage forces on them through ctx. Read more
Source§

fn observe(&self, out: &mut ObservationSink)

Report observable values. The world reports them as Observed::Undecided while a fault is recorded.
Source§

fn write_state(&self, out: &mut Vec<u8>)

Append the whole state to out.
Source§

fn check_state(&self, bytes: &[u8]) -> Result<(), StateError>

Check that bytes is a payload Self::read_state can apply. Must not change self. Read more
Source§

fn read_state(&mut self, bytes: &[u8])

Replace the state with bytes. Only called with a payload Self::check_state accepted.
Source§

fn step_rule(&self) -> StepRule

How this participant’s time step relates to the world substep.
Source§

fn ports(&self) -> &[Port]

The ports this participant reads and writes, empty by default. The world reads them once, at registration, to fix the execution order (execution_order); they must not change while the participant is registered.
Source§

impl PhysicsModifier for ThermalModifier

Source§

fn modify_distance(&self, x: f32, y: f32, z: f32, original_dist: f32) -> f32

Modify the SDF distance at a world-space point. Read more
Source§

fn update(&mut self, dt: f32)

Advance the simulation state by dt seconds.
Source§

fn name(&self) -> &'static str

Name of this modifier (for debugging)
Source§

fn is_active(&self) -> bool

Whether this modifier has any active effect

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

Source§

type Output = T

Should always be Self
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.