McStas logo McStas - A neutron ray-trace simulation package ILL; PSI; ESS Niels Bohr Institute DTU Physics

McStas

About McStas
 Conditions of use
 Authors/Contacts
 Project funding

Download
 Components

Mailing list

Search web/mailinglist

Documentation
 Wiki (GitHub)
 McStas manual
 Publications

Links

Report bugs (GitHub)

Code-repository (GitHub)


McStas: Unittest_INHERIT_OVERRIDE

[ Identification | Description | Examples | Input parameters | Links ]

The Unittest_INHERIT_OVERRIDE Instrument

DEFINE COMPONENT X INHERIT Y: written sections (even empty) replace Y's

Identification

  • Site: Tests_grammar
  • Author: Peter Willendrup
  • Origin: DTU
  • Date: Oct 7th, 2026

Description

Unit test for whole-component inheritance, see
docs/GRAMMAR/ADR-records/ADR_20261007_GRAMMAR_FIXES.md
(same rule as mccode-antlr, mccode-dev/mccode-antlr#321).

Local components: Unittest_IO_parent absorbs particles with x>0. Its
children, DEFINE COMPONENT ... INHERIT Unittest_IO_parent:
- Unittest_IO_cancel writes an empty TRACE %{ %}: replaces the parent's
TRACE, absorbs nothing. Before, an empty block counted as "not written"
and the parent's TRACE was used.
- Unittest_IO_keep writes no sections: inherits the parent's TRACE.
- Unittest_IO_extend writes TRACE INHERIT Unittest_IO_parent EXTEND %{..%}:
the parent's TRACE followed by more code (absorbs x>0 and y>0). It also
uses INHERIT within USERVARS.
- Unittest_IO_noinit writes an empty INITIALIZE EXTEND %{ %}: keeps the
parent's DECLARE and TRACE but not its INITIALIZE (io_val stays 0, so
its TRACE halves the weight). "Inherit everything but one section".

One unit of intensity is emitted uniformly from a 1x1 m square:
AfterCancel_I = 1, AfterKeep_I = 0.5, AfterExtend_I = 0.25,
AfterNoInit_I = 0.125.

Examples

(Test cases in bold)
  • Test: Detector: AfterCancel_I=1
  • Test: Detector: AfterKeep_I=0.5
  • Test: Detector: AfterExtend_I=0.25
  • Test: Detector: AfterNoInit_I=0.125

Input parameters

Parameters in boldface are required; the others are optional.
NameUnitDescriptionDefault
Pp01Dummy input parameter used internally0

Links

  • Source code for Unittest_INHERIT_OVERRIDE.instr.
  • docs/GRAMMAR/ADR-records/ADR_20261007_GRAMMAR_FIXES.md

[ Identification | Description | Examples | Input parameters | Links ]

Generated for mcstas 3.10.0


Last Modified: Friday, 23-Oct-2026 18:32:10 CEST
Search website mailinglist archive GitHub repos