Skip to main content

PhysicsError

Enum PhysicsError 

Source
pub enum PhysicsError {
Show 21 variants NumericalDivergence { message: String, }, InvalidInput { field: String, reason: String, }, OutOfBounds { index: usize, max: usize, }, ConvergenceFailed { iterations: usize, tolerance: f64, residual: f64, }, MeshError { message: String, }, MaterialError { message: String, }, CollisionError { message: String, }, IoError { message: String, }, FemElementError { element_id: usize, message: String, }, FemAssemblyError { message: String, }, FemBoundaryConditionError { node_id: usize, message: String, }, LbmLatticeError { message: String, }, LbmDistributionError { cell_id: usize, message: String, }, LbmStabilityError { parameter: String, value: f64, limit: f64, }, SphKernelError { message: String, }, SphNeighborError { particle_id: usize, message: String, }, SphDensityError { particle_id: usize, density: f64, }, MdForceFieldError { atom_types: (String, String), message: String, }, MdIntegrationError { step: usize, message: String, }, MdNeighborListError { message: String, }, WithContext { source: Box<PhysicsError>, context: String, },
}
Expand description

Unified error type for the physics engine.

Variants§

§

NumericalDivergence

Solver diverged.

Fields

§message: String

Description of the divergence.

§

InvalidInput

Invalid parameter.

Fields

§field: String

Name of the field that was invalid.

§reason: String

Reason it was invalid.

§

OutOfBounds

Index out of bounds.

Fields

§index: usize

The index that was accessed.

§max: usize

The exclusive upper bound.

§

ConvergenceFailed

Iterative solver failed to converge.

Fields

§iterations: usize

Number of iterations performed.

§tolerance: f64

Target tolerance.

§residual: f64

Final residual achieved.

§

MeshError

Mesh topology error.

Fields

§message: String

Description of the mesh error.

§

MaterialError

Invalid material state.

Fields

§message: String

Description of the material error.

§

CollisionError

Collision detection failure.

Fields

§message: String

Description of the collision error.

§

IoError

I/O error wrapper.

Fields

§message: String

Description of the I/O error.

§

FemElementError

FEM element error (degenerate element, negative Jacobian, etc.)

Fields

§element_id: usize

Element index.

§message: String

Description.

§

FemAssemblyError

FEM assembly error (stiffness matrix assembly failed).

Fields

§message: String

Description.

§

FemBoundaryConditionError

FEM boundary condition error.

Fields

§node_id: usize

Node or DOF index.

§message: String

Description.

§

LbmLatticeError

LBM lattice configuration error.

Fields

§message: String

Description.

§

LbmDistributionError

LBM distribution function error (negative density, non-physical state).

Fields

§cell_id: usize

Cell index.

§message: String

Description.

§

LbmStabilityError

LBM stability violation (CFL, Mach number exceeded).

Fields

§parameter: String

The violated parameter name.

§value: f64

The value that caused the violation.

§limit: f64

The allowed limit.

§

SphKernelError

SPH kernel error (radius too small, invalid kernel type).

Fields

§message: String

Description.

§

SphNeighborError

SPH neighbor search error.

Fields

§particle_id: usize

Particle index.

§message: String

Description.

§

SphDensityError

SPH density computation error (negative density, tensile instability).

Fields

§particle_id: usize

Particle index.

§density: f64

Computed density value.

§

MdForceFieldError

MD force field error (missing parameters, invalid potential).

Fields

§atom_types: (String, String)

Atom type pair.

§message: String

Description.

§

MdIntegrationError

MD integration error (energy drift, temperature blowup).

Fields

§step: usize

Time step at which the error occurred.

§message: String

Description.

§

MdNeighborListError

MD neighbor list error.

Fields

§message: String

Description.

§

WithContext

Error with additional context.

Fields

§source: Box<PhysicsError>

The original error.

§context: String

Additional context message.

Implementations§

Source§

impl PhysicsError

Source

pub fn with_context(self, context: impl Into<String>) -> Self

Wrap this error with additional context.

Source

pub fn root_cause(&self) -> &PhysicsError

Get the root cause error, unwrapping all context layers.

Source

pub fn context_chain(&self) -> Vec<&str>

Get the chain of context messages from outermost to innermost.

Source

pub fn domain(&self) -> &'static str

Returns the domain name for this error variant.

Source

pub fn recovery_suggestion(&self) -> &'static str

Returns a recovery suggestion for this error.

Source

pub fn severity(&self) -> ErrorSeverity

Returns the severity level of this error.

Trait Implementations§

Source§

impl Clone for PhysicsError

Source§

fn clone(&self) -> PhysicsError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PhysicsError

Source§

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

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

impl Display for PhysicsError

Source§

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

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

impl Error for PhysicsError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for PhysicsError

Source§

fn eq(&self, other: &PhysicsError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PhysicsError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,