Initial commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
//! Error types for FEM head modeling.
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// FEM head modeling error types
|
||||
#[derive(Debug, Error)]
|
||||
pub enum FemError {
|
||||
/// Invalid mesh configuration
|
||||
#[error("Invalid mesh: {0}")]
|
||||
InvalidMesh(String),
|
||||
|
||||
/// Mesh generation failure
|
||||
#[error("Mesh generation failed: {0}")]
|
||||
MeshGenerationError(String),
|
||||
|
||||
/// Invalid conductivity configuration
|
||||
#[error("Invalid conductivity: {0}")]
|
||||
InvalidConductivity(String),
|
||||
|
||||
/// Matrix assembly error
|
||||
#[error("Assembly error: {0}")]
|
||||
AssemblyError(String),
|
||||
|
||||
/// Solver failure
|
||||
#[error("Solver error: {0}")]
|
||||
SolverError(String),
|
||||
|
||||
/// Solver did not converge
|
||||
#[error("Solver did not converge: {0}")]
|
||||
ConvergenceError(String),
|
||||
|
||||
/// Invalid geometry
|
||||
#[error("Invalid geometry: {0}")]
|
||||
GeometryError(String),
|
||||
|
||||
/// Lead field computation error
|
||||
#[error("Lead field error: {0}")]
|
||||
LeadFieldError(String),
|
||||
|
||||
/// Dimension mismatch
|
||||
#[error("Dimension mismatch: {0}")]
|
||||
DimensionMismatch(String),
|
||||
|
||||
/// I/O error
|
||||
#[error("I/O error: {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
|
||||
/// FEA library error
|
||||
#[error("FEA error: {0}")]
|
||||
FeaError(String),
|
||||
}
|
||||
|
||||
/// Result type for FEM operations
|
||||
pub type FemResult<T> = Result<T, FemError>;
|
||||
|
||||
impl From<rtx_fea::FeaError> for FemError {
|
||||
fn from(e: rtx_fea::FeaError) -> Self {
|
||||
FemError::FeaError(e.to_string())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user