A finite element method module.
```rust
extern crate finiteelementmethod;
use finiteelementmethod::{FEM, DOFParameter, ElementForceComponent};
const RELTOL: f32 = 1e-4; const ABSTOL: f32 = 1e-12;
let mut model = FEM::create(RELTOL, ABSTOL, 10);
model.addnode(1, 0.0, 0.0, 0.0)?; model.addnode(2, 0.0, 30.0, 0.0)?;
model.add_truss(1, 1, 2, 1e6, 2.0, None)?;
model.add_displacement(1, DOFParameter::X, 0.0)?;
model.addconcentratedload(2, DOFParameter::Y, 100.0)?;
let separatedstiffnessmatrix = model.separatestiffnessmatrix()?; let ravector = model.composeravector(separatedstiffnessmatrix.getkaaindexes())?; let ubvector = model.composeubvector(separatedstiffnessmatrix.getkbbindexes())?;
let uavector = model.finduavector( &separatedstiffnessmatrix, &ravector, &ubvector, )?; let rrvector = model.findrrvector( &separatedstiffnessmatrix, &uavector, &ub_vector, )?;
model.composeglobalanalysisresult( separatedstiffnessmatrix.getkaaindexes(), separatedstiffnessmatrix.getkbbindexes(), &uavector, &rr_vector, )?;
let mut globalanalysisresult = model.extractglobalanalysisresult()?; globalanalysisresult.sortby( |(n1, dof1, , _), (n2, dof2, _, _)| (n1, dof1).partialcmp(&(n2, dof2)).unwrap() ); let globalanalysisresult_expected = vec![ (1, DOFParameter::X, 0.0, -100.0), (1, DOFParameter::Y, 0.0, 0.0), (1, DOFParameter::Z, 0.0, 0.0), (1, DOFParameter::ThX, 0.0, 0.0), (1, DOFParameter::ThY, 0.0, 0.0), (1, DOFParameter::ThZ, 0.0, 0.0), (2, DOFParameter::X, 0.0014999999, 100.0), (2, DOFParameter::Y, 0.0, 0.0), (2, DOFParameter::Z, 0.0, 0.0), (2, DOFParameter::ThX, 0.0, 0.0), (2, DOFParameter::ThY, 0.0, 0.0), (2, DOFParameter::ThZ, 0.0, 0.0), ];
let elementsanalysisresult = model.extractelementsanalysisresult()?; let elementsanalysisresultexpected = vec![ (1, vec![(ElementForceComponent::ForceR, 100.0)]), ];
asserteq!(globalanalysisresult, globalanalysisresultexpected); asserteq!(elementsanalysisresult, elementsanalysisresultexpected); ```