pub struct PyFemBinding { /* private fields */ }Expand description
PyO3-style binding handle for a 2-D FEM solver.
Wraps PyFemSolver and PyFemMesh and exposes helpers suitable for
future #[pymethods] annotation.
Implementations§
Source§impl PyFemBinding
impl PyFemBinding
Sourcepub fn add_node(&mut self, x: f64, y: f64) -> usize
pub fn add_node(&mut self, x: f64, y: f64) -> usize
Add a 2-D node at position (x, y). Returns the new node index.
Sourcepub fn add_tri_element(&mut self, n0: usize, n1: usize, n2: usize) -> usize
pub fn add_tri_element(&mut self, n0: usize, n1: usize, n2: usize) -> usize
Add a CST triangular element given three node indices.
Returns the new element index.
Sourcepub fn add_tri_element_with_material(
&mut self,
n0: usize,
n1: usize,
n2: usize,
material_id: usize,
thickness: f64,
) -> usize
pub fn add_tri_element_with_material( &mut self, n0: usize, n1: usize, n2: usize, material_id: usize, thickness: f64, ) -> usize
Add a CST triangular element with explicit material and thickness.
Sourcepub fn add_material(&mut self, material: PyFemMaterial) -> usize
pub fn add_material(&mut self, material: PyFemMaterial) -> usize
Add a material to the mesh library. Returns the material index.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Return the number of nodes.
Sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Return the number of elements.
Sourcepub fn add_dirichlet_bc(&mut self, bc: PyFemDirichletBC)
pub fn add_dirichlet_bc(&mut self, bc: PyFemDirichletBC)
Apply a Dirichlet (fixed DOF) boundary condition.
Sourcepub fn apply_nodal_force(&mut self, node: usize, fx: f64, fy: f64)
pub fn apply_nodal_force(&mut self, node: usize, fx: f64, fy: f64)
Apply a nodal force [fx, fy] at node.
Sourcepub fn solve(&mut self) -> bool
pub fn solve(&mut self) -> bool
Solve the linear-elastic static problem.
Returns true on success. Query results via get_displacement_flat.
Sourcepub fn get_displacement_flat(&self) -> Vec<f64>
pub fn get_displacement_flat(&self) -> Vec<f64>
Return nodal displacements as a flat [ux0,uy0, ux1,uy1, …]
array, or an empty Vec if no solve has been run.
Sourcepub fn get_stress_flat(&self) -> Vec<f64>
pub fn get_stress_flat(&self) -> Vec<f64>
Return element von-Mises stresses as a flat array.
Sourcepub fn max_von_mises_stress(&self) -> f64
pub fn max_von_mises_stress(&self) -> f64
Return the maximum von-Mises stress, or 0.0 if no result exists.
Sourcepub fn last_solve_converged(&self) -> bool
pub fn last_solve_converged(&self) -> bool
Return whether the last solve converged.
Trait Implementations§
Source§impl Clone for PyFemBinding
impl Clone for PyFemBinding
Source§fn clone(&self) -> PyFemBinding
fn clone(&self) -> PyFemBinding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PyFemBinding
impl Debug for PyFemBinding
Auto Trait Implementations§
impl Freeze for PyFemBinding
impl RefUnwindSafe for PyFemBinding
impl Send for PyFemBinding
impl Sync for PyFemBinding
impl Unpin for PyFemBinding
impl UnsafeUnpin for PyFemBinding
impl UnwindSafe for PyFemBinding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.