FEMM/crates/femm-doc-mag/src/lib.rs

98 lines
2.2 KiB
Rust

//! magnetostatic pre-processor document model: geometry, properties, parser, writer.
pub mod geom;
pub mod geom_math;
pub mod props;
pub mod parser;
pub mod writer;
pub mod edit;
pub mod poly;
pub mod mesh;
pub mod ans;
use num_complex::Complex64;
pub use geom::{ArcSegment, BlockLabel, Node, Segment};
pub use props::{BoundaryProp, CircuitProp, MaterialProp, PointProp};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProblemType {
Planar,
Axisymmetric,
}
impl Default for ProblemType {
fn default() -> Self { ProblemType::Planar }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Coords {
#[default]
Cartesian,
Polar,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LengthUnit {
Inches = 0,
Millimeters = 1,
Centimeters = 2,
Meters = 3,
Mils = 4,
Microns = 5,
}
impl Default for LengthUnit {
fn default() -> Self { LengthUnit::Inches }
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum PrevType {
#[default]
None = 0,
Incremental = 1,
Frozen = 2,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ACSolver {
#[default]
SuccessiveApprox = 0,
Newton = 1,
}
/// magnetostatic .fem document: geometry, property tables, problem attributes.
#[derive(Debug, Clone, Default)]
pub struct FemmDoc {
pub format: f64,
pub frequency: f64,
pub precision: f64,
pub min_angle: f64,
pub smart_mesh: bool,
pub depth: f64,
pub length_units: LengthUnit,
pub ac_solver: ACSolver,
pub problem_type: ProblemType,
pub coords: Coords,
pub comment: String,
pub prev_soln: String,
pub prev_type: PrevType,
pub ext_ro: f64,
pub ext_ri: f64,
pub ext_zo: f64,
pub nodes: Vec<Node>,
pub segments: Vec<Segment>,
pub arcs: Vec<ArcSegment>,
pub block_labels: Vec<BlockLabel>,
pub materials: Vec<MaterialProp>,
pub boundaries: Vec<BoundaryProp>,
pub points: Vec<PointProp>,
pub circuits: Vec<CircuitProp>,
}
/// f64 complex number alias matching the C++ CComplex memory layout.
pub type Complex = Complex64;