Skip to content

MOOSE backend: add runtime parity test against mock RankTwoTensor #12

Description

@petlenz

Summary

tests/MooseTargetTest.cpp is purely textual ("does this string appear in the emitted source?"). The compile-check driver only exercises StandaloneCxxTarget. There is no test that:

  1. Constructs a MOOSE-like buffer.
  2. Runs the generated MOOSE-target compute function through it.
  3. Verifies the arithmetic.

Result: the entire cluster of bugs in issues #6 (arg-order), #7 (dim drift), #9 (layout) are undetectable in CI.

Fix

Add tests/moose_mock/ containing a minimal stand-in:

  • struct RankTwoTensor { double _coords[3][3]; double const* dataPointer() const { return &_coords[0][0]; } /* + non-const */ };
  • struct RankFourTensor { double _data[81]; /* + dataPointer() */ };
  • struct MaterialProperty<T> { std::vector<T> _vals; T const& operator[](size_t qp) const { return _vals[qp]; } /* + non-const */ };
  • Just enough surface for _qp, MaterialProperty<T>::operator[], dataPointer().

Then:

  1. Build a ConstitutiveModel (e.g. linear elasticity).
  2. Generate the MOOSE .h + .C via MooseMaterialTarget.
  3. Compile and link them against the mock headers.
  4. Drive a few QP evaluations and assert the computed stresses match an analytic reference.

This catches arg-order, dim, and layout regressions in one test.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions