Model: edge seeds — a count or size per edge, bias and constraint

A seed names a design edge and asks for a number of divisions or a target
length, optionally graded geometrically toward the start, the end or both
ends, kept exactly, as a minimum or as a free goal. Seeds are saved with the
model; Seed::spacing gives the node positions meshers and the viewport share.

Part of #230.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 20:58:17 -04:00
1 parent 94c98e0c0b
commit f8e0be970e
2 files changed
+320 -1

No files matched your search

+13 -1
View File
@@ -44,6 +44,7 @@ pub mod materials;
mod mesh;
pub mod nodal;
pub mod sections;
pub mod seeds;
pub mod sets;
pub mod steps;
pub mod tie;
@@ -68,6 +69,7 @@ pub use mesh::{
tet4_jacobian,
};
pub use sections::{BeamProfile, Extent, Formulation, Integration, Section, SectionKind};
pub use seeds::{Bias, BiasToward, Divisions, Seed, SeedConstraint};
pub use sets::Set;
pub use steps::{
ArcConstraint, ArcLength, BulkViscosity, DisplacementLimit, ExplicitDynamic, Hourglass, HourglassKind, Imperfection, InitialVelocity,
@@ -148,6 +150,9 @@ pub struct Model {
/// In the order they cut.
#[serde(skip_serializing_if = "Vec::is_empty")]
partitions: Vec<Partition>,
/// Edge seeds, sorted by edge.
#[serde(skip_serializing_if = "Vec::is_empty")]
seeds: Vec<Seed>,
}
/// A [`Model`] as stored, before it is checked.
@@ -192,6 +197,8 @@ struct ModelData {
datums: BTreeMap<String, Datum>,
#[serde(default)]
partitions: Vec<Partition>,
#[serde(default)]
seeds: Vec<Seed>,
}
impl TryFrom<ModelData> for Model {
@@ -269,6 +276,9 @@ impl TryFrom<ModelData> for Model {
for p in d.partitions {
m.add_partition(p)?;
}
for s in d.seeds {
m.set_seed(s)?;
}
Ok(m)
}
}
@@ -376,11 +386,12 @@ impl Model {
steps: self.steps.clone(),
datums: self.datums.clone(),
partitions: self.partitions.clone(),
seeds: self.seeds.clone(),
}
}
/// Counts of each kind of definition, for summaries.
pub fn definition_counts(&self) -> [(&'static str, usize); 15] {
pub fn definition_counts(&self) -> [(&'static str, usize); 16] {
[
("sets", self.sets.len()),
("materials", self.materials.len()),
@@ -397,6 +408,7 @@ impl Model {
("steps", self.steps.len()),
("datums", self.datums.len()),
("partitions", self.partitions.len()),
("seeds", self.seeds.len()),
]
}
}