Skip to content

MOOSE target: reject dim != 3 tensors; emit layout static_asserts (#7, #10) - #154

Open
petlenz wants to merge 2 commits into
mainfrom
fix-7-10-moose-dim-layout
Open

MOOSE target: reject dim != 3 tensors; emit layout static_asserts (#7, #10)#154
petlenz wants to merge 2 commits into
mainfrom
fix-7-10-moose-dim-layout

Conversation

@petlenz

@petlenz petlenz commented Aug 2, 2026

Copy link
Copy Markdown
Member

Closes #7. Closes #10.

#7 — dim guard: MOOSE's RankTwoTensor/RankFourTensor are always 3D (LIBMESH_DIM = 3); a dim-2 recipe previously emitted tmech::adaptor reads with dim-2 strides over 3x3 storage — a silent quadrature-point miscompute, not a compile error. emit() now rejects any dim != 3 tensor input/output with a message that names the symbol and points at the dim-3 embedding convention for plane-strain/axisymmetric models.

#10 — layout static_asserts: the contiguous-row-major-Real storage assumption behind the adaptor boundary was prose in a header comment. The generated .C now carries static_assert(sizeof(RankTwoTensor) == 9 * sizeof(Real)) and the rank-4 sibling, so a MOOSE-internal layout change becomes a compile error in the consumer's build instead of silently wrong stress.

Tests: MooseTarget.RejectsNonThreeDimensionalTensors, MooseTarget.SourceEmitsLayoutStaticAsserts. Full Debug (-Werror) ctest green (known local sibling-drift failure aside, see #140).

Note for the in-flight MOOSE-stub compile gate (#132): the stub's tensor types must satisfy the sizeof asserts (plain Real[9]/Real[81] storage does).

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.

MOOSE storage-layout precondition not enforced in generated .C MOOSE adaptor ignores tensor dim — silent miscompute when dim != 3

1 participant