/*******************************************************************************
*
* McStas, neutron ray-tracing package
*         Copyright (C) 1997-2024, All rights reserved
*         Risoe National Laboratory, Roskilde, Denmark
*         Institut Laue Langevin, Grenoble, France
*
* Instrument: test_File
*
* %Identification
* Written by: Greg Tucker
* Date: 2024
* Origin: ESS
* %INSTRUMENT_SITE: Tests_other
*
* Demonstrates how to use the File.comp component for storing instrument 
* input-files as METADATA blocks
*
* %Description
* Demonstrates how to use the File.comp component for storing instrument 
* input-files as METADATA blocks
*
* %Link
* From https://github.com/g5t/mccode-file
*
* %End
*******************************************************************************/
DEFINE INSTRUMENT test_File()
TRACE
COMPONENT Origin = Progress_bar() AT (0, 0, 0) ABSOLUTE
METADATA "mimetype/text" origin_info %{
# Generated file
Here is some data to go into a file.
%}

COMPONENT source = Source_gen(
    lambda0=0.18, dlambda=0.01, focus_aw=0.0001, focus_ah=0.0001, radius=0.0001
) AT (0, 0, 0) RELATIVE Origin

COMPONENT first_file = File(filename="first.txt", metadatakey="stored", keep=1) AT (0, 0, 0) ABSOLUTE
METADATA txt stored %{
Store text to write in first.txt
%}

COMPONENT second_file = File(filename="second.txt", metadatakey="Origin:origin_info", keep=1)
AT (0, 0, 0) ABSOLUTE

END

