pub struct ParallelAssembler {
pub ndofs: usize,
}Expand description
Assembles per-element stiffness contributions into a global CSR matrix.
§Thread safety
Elements are processed in parallel (Rayon). Each non-zero entry’s position
in the CSR values array is pre-determined from the sparsity pattern, so
scatter is lock-free at the element level. A per-row Mutex guards concurrent
writes to overlapping rows (e.g. when elements share nodes on different threads).
Fields§
§ndofs: usizeTotal number of global DOFs.
Implementations§
Source§impl ParallelAssembler
impl ParallelAssembler
Sourcepub fn new(ndofs: usize) -> Self
pub fn new(ndofs: usize) -> Self
Create an assembler for a problem with ndofs degrees of freedom.
Sourcepub fn assemble(&self, tasks: &[AssemblyTask]) -> CsrMatrix
pub fn assemble(&self, tasks: &[AssemblyTask]) -> CsrMatrix
Assemble all element stiffness matrices into a global CSR matrix.
The sparsity pattern is computed from the union of all element connectivity patterns. Values are accumulated atomically using per-row mutexes.
§Panics
Panics if any global_dof index exceeds ndofs.
Sourcepub fn assemble_rhs(
&self,
element_dofs: &[Vec<usize>],
element_forces: &[Vec<f64>],
) -> Vec<f64>
pub fn assemble_rhs( &self, element_dofs: &[Vec<usize>], element_forces: &[Vec<f64>], ) -> Vec<f64>
Assemble a load vector (right-hand side) from per-element force vectors.
element_forces[e] must have the same DOF count as element_dofs[e].
Sourcepub fn assemble_colored(
&self,
tasks: &[AssemblyTask],
element_dofs: &[Vec<usize>],
) -> CsrMatrix
pub fn assemble_colored( &self, tasks: &[AssemblyTask], element_dofs: &[Vec<usize>], ) -> CsrMatrix
Assemble using element graph coloring for better cache locality.
Computes a graph coloring of the elements (no two elements of the same color
share a DOF) and assembles each color group in parallel. The result is
identical to ParallelAssembler::assemble.
Trait Implementations§
Source§impl Debug for ParallelAssembler
impl Debug for ParallelAssembler
Source§impl Default for ParallelAssembler
impl Default for ParallelAssembler
Source§fn default() -> ParallelAssembler
fn default() -> ParallelAssembler
Auto Trait Implementations§
impl Freeze for ParallelAssembler
impl RefUnwindSafe for ParallelAssembler
impl Send for ParallelAssembler
impl Sync for ParallelAssembler
impl Unpin for ParallelAssembler
impl UnsafeUnpin for ParallelAssembler
impl UnwindSafe for ParallelAssembler
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.