You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MOOSE storage-layout precondition not enforced in generated .C #10
MooseMaterialTarget::emit_compute_qp_body wraps MOOSE's _<name>[_qp].dataPointer() in tmech::adaptor assuming RankTwoTensor is 9 contiguous row-major doubles and RankFourTensor is 81. The assumption is mentioned only in a class-level comment. The actual adaptor sites have no static_assert, no is_standard_layout_v check, and no runtime check.
If a future MOOSE release changes the storage of RankTwoTensorTempl<Real> (padding, column-major, std::array wrapper), this codegen silently produces wrong stresses with no compile- or run-time signal.
Emit a static_assert in the generated .C so the consuming MOOSE compiler verifies the invariant at MOOSE build time:
// In MooseMaterialTarget::emit_source, near the includes (or just inside the// anonymous namespace):"static_assert(sizeof(RankTwoTensor) == 9 * sizeof(Real),\n""\"numsim-codegen: RankTwoTensor must be 9 contiguous Reals.\");\n""static_assert(sizeof(RankFourTensor) == 81 * sizeof(Real),\n""\"numsim-codegen: RankFourTensor must be 81 contiguous Reals.\");\n"
Pair with the mock-MOOSE runtime parity test in the linked follow-up issue.
Activity
MOOSE target: reject dim != 3 tensors; emit storage-layout static_ass…