Skip to content

Commit e75b172

Browse files
committed
callbacks docs update
1 parent 11e115a commit e75b172

12 files changed

Lines changed: 38 additions & 23 deletions

.doctrees/architecture.doctree

-146 Bytes
Binary file not shown.

.doctrees/environment.pickle

-42 Bytes
Binary file not shown.

.doctrees/extending.doctree

-12 Bytes
Binary file not shown.

.doctrees/simulation_loop.doctree

1.75 KB
Binary file not shown.

_sources/architecture.md.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
STARK's public API is straightforward.
44
Users work through a single entry point, `Simulation`, which exposes all physics subsystems.
5-
Internally, `core::Stark` orchestrates time stepping and uses SymX's Newton solves.
5+
Internally, `Stark` orchestrates time stepping and uses SymX's Newton solves.
66

77
## Component Map
88

@@ -34,7 +34,7 @@ flowchart TD
3434
Constructing it with a `Settings` object is all that is needed to start a simulation:
3535

3636
```cpp
37-
stark::core::Settings settings;
37+
stark::Settings settings;
3838
settings.output.directory = "./output";
3939
settings.simulation.max_time_step_size = 0.01;
4040

@@ -123,9 +123,9 @@ See [Presets](presets.md) for the full list.
123123

124124
---
125125

126-
## `core::Stark`: The Solver Engine
126+
## `Stark` class
127127

128-
`core::Stark` is the engine that drives the simulation.
128+
`Stark` is the engine that drives the simulation.
129129

130130
Its key components are:
131131

@@ -134,7 +134,7 @@ Its key components are:
134134
- **`EventDrivenScript`** — fires lambdas at specified simulation times or on solver events.
135135
- **`Settings`** — output paths, time step size, Newton tolerances, contact parameters, and more.
136136

137-
Under normal use you do not interact with `core::Stark` directly.
137+
Under normal use you do not interact with `Stark` directly.
138138
When writing a custom energy model that extends STARK, you access it through `simulation.get_stark()`.
139139
See [Extending STARK](extending.md) for a worked example.
140140

_sources/extending.md.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This is incorporated to the rest of the physical effects and piped into the opti
3232
The following is the energy definition
3333

3434
```cpp
35-
stark::core::Stark& stark_core = simulation.get_stark();
35+
stark::Stark& stark_core = simulation.get_stark();
3636
stark::PointDynamics* dyn = simulation.deformables->point_sets.get();
3737

3838
stark_core.global_potential->add_potential("EnergyMagneticAttraction", magnetic_vertices,

_sources/simulation_loop.md.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ The simplified inner loop is:
9393
check initial state validity
9494

9595
for each Newton iteration:
96+
run before_step callbacks
9697
run before_energy_evaluation callbacks
9798
evaluate energy, gradient, and local Hessians
9899
compute residual
@@ -114,6 +115,7 @@ for each Newton iteration:
114115
backtrack until Armijo sufficient decrease holds
115116

116117
run optional user convergence callbacks
118+
run after_step callbacks
117119

118120
check converged-state validity
119121
```
@@ -197,6 +199,7 @@ Check the [original SymX docs](https://symx.physics-simulation.org/newtons_metho
197199

198200
| Callback | When it runs | Purpose |
199201
|---|---|---|
202+
| `before_step` | at the very start of each Newton iteration | logging, resetting per-iteration state |
200203
| `before_energy_evaluation` | before each energy or gradient/Hessian evaluation | update collision sets, derived fields, or time-dependent data |
201204
| `is_initial_state_valid` | before Newton starts | reject invalid starting states |
202205
| `max_allowed_step` | before line-search backtracking | impose step limits, commonly from CCD |
@@ -205,6 +208,7 @@ Check the [original SymX docs](https://symx.physics-simulation.org/newtons_metho
205208
| `on_armijo_fail` | after too many Armijo backtracks | diagnostics or model adjustment |
206209
| `is_converged` | after a line-search update | add custom convergence criteria |
207210
| `is_converged_state_valid` | after Newton reports success | verify final constraints/contact tolerances |
211+
| `after_step` | at the end of each Newton iteration | per-iteration diagnostics, adaptive parameter updates |
208212

209213
Boolean validity callbacks are combined with logical `AND`. All registered checks must pass.
210214
`max_allowed_step` callbacks are combined by taking the smallest returned step fraction.

architecture.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
<h1>Architecture<a class="headerlink" href="#architecture" title="Link to this heading"></a></h1>
262262
<p>STARK’s public API is straightforward.
263263
Users work through a single entry point, <code class="docutils literal notranslate"><span class="pre">Simulation</span></code>, which exposes all physics subsystems.
264-
Internally, <code class="docutils literal notranslate"><span class="pre">core::Stark</span></code> orchestrates time stepping and uses SymX’s Newton solves.</p>
264+
Internally, <code class="docutils literal notranslate"><span class="pre">Stark</span></code> orchestrates time stepping and uses SymX’s Newton solves.</p>
265265
<section id="component-map">
266266
<h2>Component Map<a class="headerlink" href="#component-map" title="Link to this heading"></a></h2>
267267
<pre class="mermaid">
@@ -288,7 +288,7 @@ <h2>Component Map<a class="headerlink" href="#component-map" title="Link to this
288288
<h2><code class="docutils literal notranslate"><span class="pre">Simulation</span></code><a class="headerlink" href="#simulation" title="Link to this heading"></a></h2>
289289
<p><code class="docutils literal notranslate"><span class="pre">Simulation</span></code> is the single public entry point.
290290
Constructing it with a <code class="docutils literal notranslate"><span class="pre">Settings</span></code> object is all that is needed to start a simulation:</p>
291-
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="nc">stark</span><span class="o">::</span><span class="nc">core</span><span class="o">::</span><span class="nc">Settings</span><span class="w"> </span><span class="n">settings</span><span class="p">;</span>
291+
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="nc">stark</span><span class="o">::</span><span class="nc">Settings</span><span class="w"> </span><span class="n">settings</span><span class="p">;</span>
292292
<span class="n">settings</span><span class="p">.</span><span class="n">output</span><span class="p">.</span><span class="n">directory</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;./output&quot;</span><span class="p">;</span>
293293
<span class="n">settings</span><span class="p">.</span><span class="n">simulation</span><span class="p">.</span><span class="n">max_time_step_size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mf">0.01</span><span class="p">;</span>
294294

@@ -409,17 +409,17 @@ <h3><code class="docutils literal notranslate"><span class="pre">presets</span><
409409
</section>
410410
</section>
411411
<hr class="docutils" />
412-
<section id="core-stark-the-solver-engine">
413-
<h2><code class="docutils literal notranslate"><span class="pre">core::Stark</span></code>: The Solver Engine<a class="headerlink" href="#core-stark-the-solver-engine" title="Link to this heading"></a></h2>
414-
<p><code class="docutils literal notranslate"><span class="pre">core::Stark</span></code> is the engine that drives the simulation.</p>
412+
<section id="stark-class">
413+
<h2><code class="docutils literal notranslate"><span class="pre">Stark</span></code> class<a class="headerlink" href="#stark-class" title="Link to this heading"></a></h2>
414+
<p><code class="docutils literal notranslate"><span class="pre">Stark</span></code> is the engine that drives the simulation.</p>
415415
<p>Its key components are:</p>
416416
<ul class="simple">
417417
<li><p><strong><code class="docutils literal notranslate"><span class="pre">GlobalPotential</span></code></strong> — the SymX energy registry. Energy models call <code class="docutils literal notranslate"><span class="pre">global_potential-&gt;add_potential(...)</span></code> during construction to register their symbolic expression and the state variables it acts on.</p></li>
418418
<li><p><strong><code class="docutils literal notranslate"><span class="pre">Callbacks</span></code></strong> — hook points for injecting logic at fixed moments in the loop: <code class="docutils literal notranslate"><span class="pre">before_time_step</span></code>, <code class="docutils literal notranslate"><span class="pre">on_time_step_accepted</span></code>, <code class="docutils literal notranslate"><span class="pre">after_time_step</span></code>, and <code class="docutils literal notranslate"><span class="pre">write_frame</span></code>.</p></li>
419419
<li><p><strong><code class="docutils literal notranslate"><span class="pre">EventDrivenScript</span></code></strong> — fires lambdas at specified simulation times or on solver events.</p></li>
420420
<li><p><strong><code class="docutils literal notranslate"><span class="pre">Settings</span></code></strong> — output paths, time step size, Newton tolerances, contact parameters, and more.</p></li>
421421
</ul>
422-
<p>Under normal use you do not interact with <code class="docutils literal notranslate"><span class="pre">core::Stark</span></code> directly.
422+
<p>Under normal use you do not interact with <code class="docutils literal notranslate"><span class="pre">Stark</span></code> directly.
423423
When writing a custom energy model that extends STARK, you access it through <code class="docutils literal notranslate"><span class="pre">simulation.get_stark()</span></code>.
424424
See <a class="reference internal" href="extending.html"><span class="std std-doc">Extending STARK</span></a> for a worked example.</p>
425425
</section>
@@ -490,7 +490,7 @@ <h2><code class="docutils literal notranslate"><span class="pre">core::Stark</sp
490490
<li><a class="reference internal" href="#presets"><code class="docutils literal notranslate"><span class="pre">presets</span></code></a></li>
491491
</ul>
492492
</li>
493-
<li><a class="reference internal" href="#core-stark-the-solver-engine"><code class="docutils literal notranslate"><span class="pre">core::Stark</span></code>: The Solver Engine</a></li>
493+
<li><a class="reference internal" href="#stark-class"><code class="docutils literal notranslate"><span class="pre">Stark</span></code> class</a></li>
494494
</ul>
495495
</li>
496496
</ul>

build/_deps/nanobind-src

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2a61ad2494d09fecb2e13322c1383342c299900d

extending.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <h2>Example: implicit magnetic attraction<a class="headerlink" href="#example-im
283283
<p>The force produced by this energy is attractive, and because the term is registered as a SymX potential, STARK also receives the corresponding Hessian contribution automatically.
284284
This is incorporated to the rest of the physical effects and piped into the optimization pipeline.</p>
285285
<p>The following is the energy definition</p>
286-
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="nc">stark</span><span class="o">::</span><span class="nc">core</span><span class="o">::</span><span class="nc">Stark</span><span class="o">&amp;</span><span class="w"> </span><span class="n">stark_core</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">simulation</span><span class="p">.</span><span class="nf">get_stark</span><span class="p">();</span>
286+
<div class="highlight-cpp notranslate"><div class="highlight"><pre><span></span><span class="nc">stark</span><span class="o">::</span><span class="nc">Stark</span><span class="o">&amp;</span><span class="w"> </span><span class="n">stark_core</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">simulation</span><span class="p">.</span><span class="nf">get_stark</span><span class="p">();</span>
287287
<span class="nc">stark</span><span class="o">::</span><span class="nc">PointDynamics</span><span class="o">*</span><span class="w"> </span><span class="n">dyn</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">simulation</span><span class="p">.</span><span class="n">deformables</span><span class="o">-&gt;</span><span class="n">point_sets</span><span class="p">.</span><span class="nf">get</span><span class="p">();</span>
288288

289289
<span class="n">stark_core</span><span class="p">.</span><span class="n">global_potential</span><span class="o">-&gt;</span><span class="nf">add_potential</span><span class="p">(</span><span class="s">&quot;EnergyMagneticAttraction&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">magnetic_vertices</span><span class="p">,</span>

0 commit comments

Comments
 (0)