Deform the assembly
This seems like a good starting point, even though the code is messy and the deformation routine has some numerical quirks. Note that the translation direction is mixed up: the keys are for x, but the velocity field is for z.
This commit is contained in:
parent
7aa69bdfcd
commit
58e7587131
3 changed files with 111 additions and 7 deletions
|
|
@ -87,6 +87,7 @@ impl PartialMatrix {
|
|||
|
||||
// --- configuration subspaces ---
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConfigSubspace(Vec<DMatrix<f64>>);
|
||||
|
||||
impl ConfigSubspace {
|
||||
|
|
@ -99,7 +100,7 @@ impl ConfigSubspace {
|
|||
// of the kernel if its eigenvalue is smaller than the constant `THRESHOLD`
|
||||
fn symmetric_kernel(a: DMatrix<f64>, assembly_dim: usize) -> ConfigSubspace {
|
||||
const ELEMENT_DIM: usize = 5;
|
||||
const THRESHOLD: f64 = 1.0e-9;
|
||||
const THRESHOLD: f64 = 1.0e-4;
|
||||
let eig = SymmetricEigen::new(a);
|
||||
let eig_vecs = eig.eigenvectors.column_iter();
|
||||
let eig_pairs = eig.eigenvalues.iter().zip(eig_vecs);
|
||||
|
|
@ -110,15 +111,23 @@ impl ConfigSubspace {
|
|||
)
|
||||
)
|
||||
);
|
||||
console::log_1(&JsValue::from(
|
||||
format!("Hessian eigenvalues: {}", eig.eigenvalues)
|
||||
)); /* DEBUG */
|
||||
ConfigSubspace(basis.collect())
|
||||
}
|
||||
|
||||
pub fn dim(&self) -> usize {
|
||||
let ConfigSubspace(basis) = self;
|
||||
basis.len()
|
||||
}
|
||||
|
||||
// find the projection onto this subspace of the motion where the element
|
||||
// with the given column index has velocity `v`
|
||||
/* TO DO */
|
||||
// for the zero subspace, this method's behavior doesn't match its name: it
|
||||
// panics rather than returning zero
|
||||
fn proj(&self, v: &DVectorView<f64>, column_index: usize) -> DMatrix<f64> {
|
||||
pub fn proj(&self, v: &DVectorView<f64>, column_index: usize) -> DMatrix<f64> {
|
||||
let ConfigSubspace(basis) = self;
|
||||
basis.into_iter().map(
|
||||
|b| b.column(column_index).dot(&v) * b
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue