Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 14 variants General(String), ParameterOutOfRange { param: &'static str, value: f64, min: f64, max: f64, }, MissingProperty(&'static str), NumericalDivergence { solver: &'static str, iterations: usize, residual: f64, }, Singularity { context: &'static str, detail: String, }, InadmissibleState(String), UnphysicalEosPressure { eos: &'static str, pressure: f64, density: f64, }, PhaseTransformConvergence { model: &'static str, detail: String, }, TableOutOfRange { table: &'static str, variable: &'static str, value: f64, lo: f64, hi: f64, }, FatigueModel { model: &'static str, detail: String, }, FractureMechanics(String), DimensionMismatch { expected: String, actual: String, }, Io { path: String, message: String, }, Parse { context: String, message: String, },
}
Expand description

Main error type for the materials module.

Variants§

§

General(String)

Generic error message.

§

ParameterOutOfRange

A required material parameter is out of its physical range.

param is the parameter name, value is what was supplied, min / max are the valid bounds (use ±f64::INFINITY for open ends).

Fields

§param: &'static str

Parameter name.

§value: f64

Supplied value.

§min: f64

Minimum allowed value.

§max: f64

Maximum allowed value.

§

MissingProperty(&'static str)

A required material property was not set.

§

NumericalDivergence

Numerical divergence during an iterative algorithm.

Typically triggered when an implicit solver does not converge.

Fields

§solver: &'static str

Name of the solver or algorithm that diverged.

§iterations: usize

Number of iterations performed.

§residual: f64

Final residual or error norm.

§

Singularity

Singularity encountered (e.g. zero determinant, zero density).

Fields

§context: &'static str

Where the singularity occurred.

§detail: String

Human-readable detail.

§

InadmissibleState(String)

The requested deformation state is physically inadmissible (e.g. negative volume, compressive stretch beyond locking).

§

UnphysicalEosPressure

An equation of state returned an unphysical pressure.

Fields

§eos: &'static str

Equation of state identifier.

§pressure: f64

Computed pressure (Pa).

§density: f64

Density at which the EOS was evaluated (kg/m³).

§

PhaseTransformConvergence

Phase-transformation model failed to converge.

Fields

§model: &'static str

Model identifier (e.g. “JMAK”, “martensitic”).

§detail: String

Additional diagnostic information.

§

TableOutOfRange

Table look-up out of bounds (e.g. tabulated EOS, TTT diagram).

Fields

§table: &'static str

Table identifier.

§variable: &'static str

Variable name being looked up.

§value: f64

Queried value.

§lo: f64

Lower bound of table.

§hi: f64

Upper bound of table.

§

FatigueModel

Fatigue model error (e.g. invalid cycle count, negative stress amplitude).

Fields

§model: &'static str

Model name.

§detail: String

Description.

§

FractureMechanics(String)

Fracture mechanics error (e.g. stress intensity factor not finite).

§

DimensionMismatch

Incompatible units or dimension mismatch.

Fields

§expected: String

Expected dimension string.

§actual: String

Actual dimension string.

§

Io

I/O error when loading material data from a file.

Fields

§path: String

File path.

§message: String

Error message.

§

Parse

Parse error when decoding material data.

Fields

§context: String

Parsing context.

§message: String

Error message.

Implementations§

Source§

impl Error

Source

pub fn below_minimum(param: &'static str, value: f64, min: f64) -> Self

Create a Error::ParameterOutOfRange for a lower-bound violation.

Source

pub fn above_maximum(param: &'static str, value: f64, max: f64) -> Self

Create a Error::ParameterOutOfRange for an upper-bound violation.

Source

pub fn diverged(solver: &'static str, iterations: usize, residual: f64) -> Self

Create a Error::NumericalDivergence with a simple description.

Source

pub fn singular(context: &'static str, detail: impl Into<String>) -> Self

Create a Error::Singularity error.

Source

pub fn inadmissible(detail: impl Into<String>) -> Self

Create an Error::InadmissibleState error.

Source

pub fn table_out_of_range( table: &'static str, variable: &'static str, value: f64, lo: f64, hi: f64, ) -> Self

Create a Error::TableOutOfRange error.

Source

pub fn fatigue(model: &'static str, detail: impl Into<String>) -> Self

Create a Error::FatigueModel error.

Source

pub fn unphysical_pressure( eos: &'static str, pressure: f64, density: f64, ) -> Self

Source

pub fn is_numerical(&self) -> bool

Returns true if this is a numerical issue (divergence or singularity).

Source

pub fn is_parameter_error(&self) -> bool

Returns true if this is a parameter validation error.

Source

pub fn is_eos_error(&self) -> bool

Returns true if this is an EOS-specific error.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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