[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 Variable Types

Angora simulation variables can be assigned C++-type scalar values, as well as more complex values of type group, array, and list. The latter types are defined by the libconfig library. Some of the text in this section is copied verbatim from the libconfig manual. The libconfig library, along with its documentation, is distributed under the GNU Lesser Public License.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.1 Integer Values

Integers can be represented in one of two ways: as a series of one or more decimal digits (‘0’ - ‘9’), with an optional leading sign character (‘+’ or ‘-’); or as a hexadecimal value consisting of the characters ‘0x’ followed by a series of one or more hexadecimal digits (‘0’ - ‘9’, ‘A’ - ‘F’, ‘a’ - ‘f’).

Examples:

 
n_sx = 3;
offset = -4;
address = 0xFFFF;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.2 Floating-Point Values

Floating point values consist of a series of one or more digits, one decimal point, an optional leading sign character (‘+’ or ‘-’), and an optional exponent. An exponent consists of the letter ‘E’ or ‘e’, an optional sign character, and a series of one or more digits.

Except in special circumstances, floating-point values in Angora are read and processed in ‘double’ precision, which corresponds to roughly 15 decimal digits.

Examples:

 
f = 1.0;
origin = -3e-6;
prefactor = 5E10;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.3 Boolean Values

Boolean values may have one of the following values: ‘true’, ‘false’, or any mixed-case variation thereof.

Examples:

 
include_first_value = true;
include_last_value = FaLsE;

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.4 String Values

String values consist of arbitrary text delimited by double quotes. Literal double quotes can be escaped by preceding them with a backslash: ‘\"’. The escape sequences ‘\\’, ‘\f’, ‘\n’, ‘\r’, and ‘\t’ are also recognized, and have the usual meaning.

In addition, the ‘\x’ escape sequence is supported; this sequence must be followed by exactly two hexadecimal digits, which represent an 8-bit ASCII value. For example, ‘\xFF’ represents the character with ASCII code 0xFF.

No other escape sequences are currently supported.

Adjacent strings are automatically concatenated, as in C/C++ source code. This is useful for formatting very long strings as sequences of shorter strings. For example, the following constructs are equivalent:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.5 Groups

A group has the form:

 
{
   name=value;
   other_name=other_value;
   …
}

Notice the curly brackets ‘{}’ around the variable assignments. Groups can contain any number of variable assignments (see Variable Assignment), but each variable must have a unique name within the group.

Example:

 
{
    shape_tag = "mysphere";
    center_coord_x = 5e-6;
    center_coord_y = 5e-6;
    center_coord_z = 5e-6;
    radius = 4e-6;
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.6 Arrays

An array has the form:

 
[ value, value, … ]

Notice the square brackets ‘[]’ delimiting the comma-separated values. An array may have zero or more elements, but the elements must all be scalar values of the same type.

Examples:

 
disabled_runs = [0,1,3];
output_variables = ["Ex","Ey"];

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.7 Lists

A list has the form:

 
( value, value, … )

Notice the parantheses ‘()’ delimiting the comma-separated values. A list may have zero or more elements, each of which can be a scalar value, an array, a group, or another list. The values in a list can be of different types; however, in Angora, the list type is exclusively used to contain a collection of group values. In Angora, the list type semantically represents a collection of objects, each with a collection of properties set within their respective group value. Here is an example:

 
Materials:
(
    {
        material_tag = "mat1";
        rel_permittivity = 2.0;
    },
    {
        material_tag = "mat2";
        rel_permittivity = 2.5;
    }
);

Here, the list structure named Materials contains two groups (each delimited by curly brackets ‘{}’) separated by a comma. This defines two materials with different sets of properties.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.8 Comments

Three types of comments are allowed within a configuration:

As expected, comment delimiters appearing within quoted strings are treated as literal text.

 
# Here's a comment
MyGroup:
(/* This is
    also a comment */
    {
        this_property = "myvalue";
        // Another comment
    }
);

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2.9 Include Directives

A configuration file may “include” the contents of another file using an include directive. This directive has the effect of inlining the contents of the named file at the point of inclusion.

An include directive must appear on its own line in the input. It has the form:

 
@include "filename"

Any backslashes or double quotes in the file name must be escaped as ‘\\’ and ‘\"’, respectively.

For example, consider the following two configuration files:

 
# file: limits.cfg
back_coord_x = -5e-6;
front_coord_x = 6e-6;
left_coord_y = -5e-6;
right_coord_y = 6e-6;
lower_coord_z = -3e-6;
upper_coord_z = 4e-6;
 
# file: mysim.cfg
RectangularBoxes:
(
    {
        shape_tag = "mybox";
        @include "limits.cfg"
    }
);

Include files may be nested to a maximum of 10 levels; exceeding this limit results in a runtime error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Ilker Rafet Capoglu on December 12, 2012 using texi2html 1.82.