Skip to content

perf(capi): read a whole line at once, with section curvature and the EI = 0 azimuth range - #97

Merged
SMI-Lab-Inha merged 4 commits into
devfrom
fix/ei0-signed-azimuth
Nov 7, 2026
Merged

SMI-Lab-Inha merged 4 commits into
devfrom
fix/ei0-signed-azimuth

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

Summary

Three connected changes to reading line values in-process.

  • Section curvature: CD_C_LINE_SECTION_CURVATURE and Line.section_curvature() return CurvX and CurvY at every node of a finite-EI line in one evaluation. A channel per node evaluated the whole line each time.
  • Whole-line reads: CableDyn_GetLineValues evaluates position, velocity, acceleration, tension, curvature, bend moment, declination and azimuth in one pass, without a text token per node. The per-node rules moved into helpers that the channel evaluator and this path share, so they cannot drift.
  • EI = 0 azimuth: a line whose deck chord heads within 45 degrees of +X reported its azimuth in [0, 360) instead of (-180, 180] outside the standalone EI = 0 route, on the C API and Python, the standalone mixed and multibody routes, and OpenFAST. commit_model_copy dropped azimuth_signed. Those values read 360 degrees lower now; nothing else changes.

Timings

Per call, 301 nodes, a 4 ms step:

Read Before After
Positions 0.60 ms 0.005 ms
Tension, curvature, bend moment 0.24 ms 0.06 ms
Declination, azimuth 0.27 ms 0.007 ms
EI = 0 tension (was O(n²)) 8.6 ms 0.039 ms

Checks

  • line_values_match_channels: 16,380 values against CableDyn_EvalChannel and 23,768 against the mesh-node channels, bit for bit, across headings, recoveries, a stiffener, torsion, mixed, point, refined, body and rod decks.
  • Old library against new on 80 decks: 549,850 values byte-identical before the azimuth fix. With it, on 120 decks, 479 azimuth values moved by exactly -360 degrees and nothing else moved.
  • Mutation check: six deliberate faults in the new path, all caught.
  • Heading sweep of the azimuth on EI = 0 and mixed decks through line values, channels, the driver's .out and .static.out.
  • CTest on the default kernel and with OPENBLAS_CORETYPE=Prescott; pytest passes; no new compiler warnings.

The CHANGELOG entry lands with the release batch.

CurvX and CurvY were reachable in-process only as one channel per node,
each of which evaluates the whole line. CD_C_LINE_SECTION_CURVATURE and
Line.section_curvature() return both at every node of a finite-EI line
in one evaluation, and match the channels bit for bit.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
CableDyn_GetLineValues built a text token per node and value and parsed
it back, and each EI = 0 or geometric token also rebuilt the whole line,
so a read cost O(n) tokens and O(n^2) work.

CD_Eval_Aggregate_Line_Values now evaluates position, velocity,
acceleration, tension, curvature, bend moment, declination and azimuth
for a whole line, on finite-EI cables and EI = 0 lines, on the aggregate
and point routes. It shares the per-node rules with the channel
evaluator (cable_recovered_value, system_node_tension, line_geom_from_r,
cable_global_component, cable_global_azimuth), so every value is the
channel's bit for bit. A failed or non-finite value still goes through
its channel, which gives the same status and message as before. The line
is looked up without building the inventory, and the one scratch array
lives on the handle.

test_line_values compares every quantity with the channels, value by
value, on the point and aggregate routes and at every node of a refined
mesh. test_c_api_threads now reads the lines of every handle at each
step.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…copy

CD_Copy_Model set the azimuth range on its working copy, but
commit_model_copy did not move it to the destination. Every EI = 0 line
held by a system is such a copy, so it fell back to [0, 360) whatever its
deck chord: a line heading just below +X read 350.5 deg where the
standalone EI = 0 route reads -9.5 deg, in the channels and line values
of the C API and Python on the point and aggregate routes, on the
standalone mixed and multibody routes, and in the aggregate's channels,
static profile and initialisation summary, which OpenFAST reports.

The move is one line. Only the L<L>N<J>Azi value of an EI = 0 line whose
chord heads within 45 deg of +X changes, by -360 deg where it read above
180 deg; no force or state depends on it.

test_model checks the copy. test_line_values and test_objects sweep
headings on both sides of +X, on EI = 0 and mixed decks and on a body,
against the documented range on every route.

Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T14:53:27.208991Z 655f21d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35720329 | 📁 Comparing 655f21d against latest (3d04008)

  🔍 Preview build  

16 files changed · ± 16 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 655f21df01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit a15a95d into dev Nov 7, 2026
21 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the fix/ei0-signed-azimuth branch November 7, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant