Refactor flex stiffness storage to support variable sizes.

This change introduces `nflexstiffness` and `flex_stiffnessadr` to allow flex stiffness matrices to have sizes other than the fixed 21 per element. Higher-order flexes can now store larger stiffness matrices based on their number of nodes. The `flex_stiffnessadr` array provides the starting index for each flex's stiffness data within the `flex_stiffness` array.

PiperOrigin-RevId: 899632263
Change-Id: Ie49182c46c3777acf0c6b492345edfcf62fb5e44
This commit is contained in:
Alessio Quaglino
2026-04-14 09:38:17 -07:00
committed by Copybara-Service
parent 08bb6e66f1
commit 5724158593
14 changed files with 100 additions and 48 deletions
+14 -1
View File
@@ -972,6 +972,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([
type=ValueType(name='mjtSize'),
doc='number of element vertex ids in all flexes',
),
StructFieldDecl(
name='nflexstiffness',
type=ValueType(name='mjtSize'),
doc='number of stiffness parameters in all flexes',
),
StructFieldDecl(
name='nflexelemedge',
type=ValueType(name='mjtSize'),
@@ -2735,6 +2740,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='first element vertex id address',
array_extent=('nflex',),
),
StructFieldDecl(
name='flex_stiffnessadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='stiffness matrix address',
array_extent=('nflex',),
),
StructFieldDecl(
name='flex_elemedgeadr',
type=PointerType(
@@ -2965,7 +2978,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
inner_type=ValueType(name='mjtNum'),
),
doc='finite element stiffness matrix',
array_extent=('nflexelem', 21),
array_extent=('nflexstiffness',),
),
StructFieldDecl(
name='flex_bending',