Wiki

Clone wiki

lifev-release / tutorial / Write_a_ParameterList_datafile

Go back


Write a ParameterList datafile

The ParameterList class can parse an input datafile in xml format. An example of datafile written in such a format is reported below:

<ParameterList>
    <ParameterList name = "section_AA">
        <Parameter name = "parameter_one" type ="string" value="TEXT" />
        <Parameter name = "parameter_two" type="int" value="5" />
        <ParameterList name = "subsectionA" >
            <Parameter name = "parameterA" type="int" value="1" />
        </ParameterList>
        <ParameterList name = "subsectionB" >
            <Parameter name = "parameterB" type="bool" value="true" />
        </ParameterList>
    </ParameterList>

    <ParameterList name = "section_BB"> <!-- This is an example of how to insert comments-->
        <Parameter name = "another_parameter" type="double" value="1.2" />
    </ParameterList>
</ParameterList>

The input xml list begins with "<ParameterList>" and ends with "</ParameterList>" in the bottom of the file. We notice that when closing a section in the xml file we need to use the slash "/" operator. To open a section we write "<ParameterList name = "section_name">" and to close it we write "</ParameterList>". Within each section we can define as parameters intergers, doubles, booleans, strings, etc. For each parameter we need to specify the type and the value. We notice that, with respect to the GetPot format, we can not provide arrays as input.

It is highly recommended to indent the datafile to easily track where sections open and close.

Comments can be added to the text: a comment begins with "".

Here you can download the xml_example.xml file.

Updated