forked from 1b-agent/fieldcraft-upstream
solver: order by planes or graph dissection, whichever fills less (#212)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
fd26967517
commit
b8e51b5dd9
2 files changed
+5
-5
No files matched your search
@@ -15,7 +15,7 @@ use crate::cholesky::{Factor, FactorError, UpperColumns};
|
|||||||
use crate::constraints::{Budget, Reduction, coupling_rows, symmetry_rows};
|
use crate::constraints::{Budget, Reduction, coupling_rows, symmetry_rows};
|
||||||
use crate::eigen::{Operator, Wanted, lanczos};
|
use crate::eigen::{Operator, Wanted, lanczos};
|
||||||
use crate::ldlt::{Kind, Symmetric};
|
use crate::ldlt::{Kind, Symmetric};
|
||||||
use crate::ordering::nested_dissection;
|
use crate::ordering::fill_reducing_order;
|
||||||
use crate::sparse::{Csr, NodeGraph, add_block, add_diagonal, add_scalar};
|
use crate::sparse::{Csr, NodeGraph, add_block, add_diagonal, add_scalar};
|
||||||
use crate::system::{
|
use crate::system::{
|
||||||
Mesh, Structural, StructuralKernel, add_thermal_loads, inelastic_warnings, loads, prescribed, structural_body_forces, temperature_loads,
|
Mesh, Structural, StructuralKernel, add_thermal_loads, inelastic_warnings, loads, prescribed, structural_body_forces, temperature_loads,
|
||||||
@@ -311,10 +311,10 @@ pub(crate) fn pattern(mesh: &Mesh) -> (NodeGraph, Vec<usize>) {
|
|||||||
// The order covers the mesh nodes; reference point equations follow them.
|
// The order covers the mesh nodes; reference point equations follow them.
|
||||||
let n = mesh.labels.len();
|
let n = mesh.labels.len();
|
||||||
let order = if graph.adjacency.len() == n {
|
let order = if graph.adjacency.len() == n {
|
||||||
nested_dissection(&mesh.xyz, &graph.adjacency)
|
fill_reducing_order(&mesh.xyz, &graph.adjacency)
|
||||||
} else {
|
} else {
|
||||||
let mesh_part: Vec<Vec<usize>> = graph.adjacency.iter().take(n).map(|row| row.iter().copied().filter(|b| *b < n).collect()).collect();
|
let mesh_part: Vec<Vec<usize>> = graph.adjacency.iter().take(n).map(|row| row.iter().copied().filter(|b| *b < n).collect()).collect();
|
||||||
nested_dissection(&mesh.xyz, &mesh_part)
|
fill_reducing_order(&mesh.xyz, &mesh_part)
|
||||||
};
|
};
|
||||||
(graph, order)
|
(graph, order)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ use fieldcraft_model::{ElementKind, Load, Model, Procedure, Resolved, SectionKin
|
|||||||
use crate::cholesky::{Factor, FactorError, UpperColumns};
|
use crate::cholesky::{Factor, FactorError, UpperColumns};
|
||||||
use crate::constraints::{Budget, Reduction, Row};
|
use crate::constraints::{Budget, Reduction, Row};
|
||||||
use crate::contact::thickness;
|
use crate::contact::thickness;
|
||||||
use crate::ordering::nested_dissection;
|
use crate::ordering::fill_reducing_order;
|
||||||
use crate::sparse::{Csr, NodeGraph, add_block};
|
use crate::sparse::{Csr, NodeGraph, add_block};
|
||||||
use crate::system::hold;
|
use crate::system::hold;
|
||||||
use crate::tie::{TieFace, TieNodes, rows_of};
|
use crate::tie::{TieFace, TieNodes, rows_of};
|
||||||
@@ -398,7 +398,7 @@ fn run(model: &Model, resolved: &Resolved, step: &Step, limits: &Limits) -> Resu
|
|||||||
let mut warnings = Vec::new();
|
let mut warnings = Vec::new();
|
||||||
let rows = tie_rows(model, resolved, &mesh, &mut warnings)?;
|
let rows = tie_rows(model, resolved, &mesh, &mut warnings)?;
|
||||||
let fixed = prescribed(model, resolved, &mesh, step)?;
|
let fixed = prescribed(model, resolved, &mesh, step)?;
|
||||||
let order = nested_dissection(&mesh.xyz, &graph.adjacency);
|
let order = fill_reducing_order(&mesh.xyz, &graph.adjacency);
|
||||||
let budget = Budget { max_bytes: limits.max_factor_entries.saturating_mul(8), pattern_entries: graph.entries(&mesh.layout), matrices: 1 };
|
let budget = Budget { max_bytes: limits.max_factor_entries.saturating_mul(8), pattern_entries: graph.entries(&mesh.layout), matrices: 1 };
|
||||||
let eqs = Reduction::new(&mesh.layout, std::iter::empty(), &order, &rows, |_| Ok(fixed), budget)?;
|
let eqs = Reduction::new(&mesh.layout, std::iter::empty(), &order, &rows, |_| Ok(fixed), budget)?;
|
||||||
if eqs.neq() == 0 {
|
if eqs.neq() == 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user