pub struct PyFemMesh {
pub nodes: Vec<PyFemNode>,
pub elements: Vec<PyFemElement>,
pub materials: Vec<PyFemMaterial>,
pub dirichlet_bcs: Vec<PyFemDirichletBC>,
pub nodal_forces: Vec<PyFemNodalForce>,
}Expand description
A 2-D FEM mesh with nodes, elements, materials, and boundary conditions.
Fields§
§nodes: Vec<PyFemNode>All nodes in the mesh.
elements: Vec<PyFemElement>All triangular elements in the mesh.
materials: Vec<PyFemMaterial>Material library.
dirichlet_bcs: Vec<PyFemDirichletBC>Dirichlet (fixed) boundary conditions.
nodal_forces: Vec<PyFemNodalForce>Nodal force loads.
Implementations§
Source§impl PyFemMesh
impl PyFemMesh
Sourcepub fn add_material(&mut self, mat: PyFemMaterial) -> usize
pub fn add_material(&mut self, mat: PyFemMaterial) -> usize
Add a material. Returns material index.
Sourcepub fn add_element(&mut self, n0: usize, n1: usize, n2: usize) -> usize
pub fn add_element(&mut self, n0: usize, n1: usize, n2: usize) -> usize
Add a CST element connecting nodes n0, n1, n2. Returns element index.
Sourcepub fn add_element_with_material(
&mut self,
n0: usize,
n1: usize,
n2: usize,
material_id: usize,
thickness: f64,
) -> usize
pub fn add_element_with_material( &mut self, n0: usize, n1: usize, n2: usize, material_id: usize, thickness: f64, ) -> usize
Add a CST element with explicit material and thickness. Returns element index.
Sourcepub fn add_dirichlet_bc(&mut self, bc: PyFemDirichletBC)
pub fn add_dirichlet_bc(&mut self, bc: PyFemDirichletBC)
Add a Dirichlet 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 at node.
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Number of elements.
Sourcepub fn element_area(&self, e: usize) -> f64
pub fn element_area(&self, e: usize) -> f64
Compute the signed area of triangular element e.
Sourcepub fn build_rectangle(
&mut self,
ox: f64,
oy: f64,
lx: f64,
ly: f64,
nx: usize,
ny: usize,
material_id: usize,
thickness: f64,
) -> usize
pub fn build_rectangle( &mut self, ox: f64, oy: f64, lx: f64, ly: f64, nx: usize, ny: usize, material_id: usize, thickness: f64, ) -> usize
Build a simple structured rectangular mesh of triangles.
Creates a nx × ny grid of quads, each quad split into 2 triangles.
Bottom-left corner at (ox, oy), domain size (lx, ly).
Returns the number of nodes added.
Source§impl PyFemMesh
impl PyFemMesh
Sourcepub fn bounding_box(&self) -> Option<[f64; 4]>
pub fn bounding_box(&self) -> Option<[f64; 4]>
Return the bounding box of all nodes as [xmin, ymin, xmax, ymax].
Sourcepub fn total_area(&self) -> f64
pub fn total_area(&self) -> f64
Return the total area of all elements (sum of |area_i|).
Sourcepub fn element_centroid(&self, e: usize) -> Option<[f64; 2]>
pub fn element_centroid(&self, e: usize) -> Option<[f64; 2]>
Return the centroid of element e as [cx, cy].
Sourcepub fn closest_node(&self, px: f64, py: f64) -> Option<usize>
pub fn closest_node(&self, px: f64, py: f64) -> Option<usize>
Find the node closest to position (px, py).
Sourcepub fn left_boundary_nodes(&self, tol: f64) -> Vec<usize>
pub fn left_boundary_nodes(&self, tol: f64) -> Vec<usize>
Return nodes on the left boundary (x <= xmin + tol).
Sourcepub fn right_boundary_nodes(&self, tol: f64) -> Vec<usize>
pub fn right_boundary_nodes(&self, tol: f64) -> Vec<usize>
Return nodes on the right boundary (x >= xmax - tol).
Sourcepub fn pin_left_boundary(&mut self, tol: f64)
pub fn pin_left_boundary(&mut self, tol: f64)
Pin all nodes on the left boundary.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PyFemMesh
impl<'de> Deserialize<'de> for PyFemMesh
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PyFemMesh
impl RefUnwindSafe for PyFemMesh
impl Send for PyFemMesh
impl Sync for PyFemMesh
impl Unpin for PyFemMesh
impl UnsafeUnpin for PyFemMesh
impl UnwindSafe for PyFemMesh
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.