5. Define simple keyword attributes#
The general syntax for declaring a simple keyword is:
MOT_CLE = SIMP (status=..., typ=..., into =(...,), default=...
min=..., max=..., val_min=..., val_max=..., validators=...
),
Among the attributes attached to a keyword, only status and type are mandatory for any simple keyword:
The status
Defining the status by the status attribute is mandatory.
Recognized statuses are only: |
|
“o” |
Mandatory: in this case the keyword must appear in the call body of the user’s order (unless this keyword is under an optional factor keyword in which case the simple keyword is mandatory as soon as the factor keyword appears). |
“f” |
Optional: otherwise. |
“c |
Hidden: the keyword is neither written in the message file, nor visible in asterStudy. Avoid this use. In general, it is used to transmit a parameter that may depend on other keywords and that would be complicated to deduce in Fortran. |
“d” |
Default: Means that the keyword will be present by default. Only relevant for factor keywords. |
The type
Type declaration using the type attribute is mandatory.
Recognized types are: |
|
type = “I” |
For integers |
type = “R” |
For the real ones |
type = “C” |
for complexes |
typ = type_de_concept (no ratings!) |
For the concepts |
type = “TXM” |
For the texts |
type = “L” |
For the logics |
type = unitType () |
for logical units |
Concept notes
Expected concept type is a type of concept created by an order other than the current order. It is among the list of concepts imported into the concept declaration catalog ( code_aster/Cata/DataStructure.py )
Note for logic units
For logical units (type unitType () ), it is necessary to declare an additional attribute inout which is “in” if the file is read or “out” if the file is read or “out” if it is written by the command.
The type of concept expected is not necessarily unique. It may be a list, which means that either type will be produced. This list reads as follows:
MATR_ASSE = SIMP (...
typ= (matr_asse_depl_r, matr_asse_depl_c,...),
...
)
The documentary syntax for this example is:
♦ MATR_ASSE = m/[matr_asse_depl_r]
/[matr_asse_depl_c]
Default value for a keyword
It is possible to assign a default value to a keyword that does not receive a « concept » argument. The declaration is made using the default argument
Examples:
PRECISION = SIMP (status='f', typ='R', default=1.e-3),
FICHIER = SIMP (status='f', typ=' TXM ', default=" RESULTAT "),
List of eligible values:
For the supervisor to check the validity of the content of certain keywords, it is possible to declare the values of the expected arguments. This statement is made by the argument into
Examples:
INFO = SIMP (status='f', typ='I', default= 1, into =( 1.2)),
The INFO keyword is optional, its value by default is 1, and the only accepted values are 1 and 2. The documentary syntax is:
♦ INFO:/1 [DEFAUT]
/2
Number of expected values:
The min and max arguments allow you to control the length of the list of expected arguments behind the simple keyword. By default, if nothing is specified in the catalog, one and only one value is expected behind a simple keyword (max = 1). Attention, declaring min = 1 does not contribute anything and is certainly not the same as making the keyword mandatory. If a potentially unlimited number of elements are expected, the syntax is max=”**”.
Examples:
MAILLE = SIMP (status='f', typ=ma, max='**'),
The user can enter as many mesh names as he wants here.
CENTRE = SIMP (status='f', typ='R', default =( 0.,0.,0. ),
min=3, max=3),
Here we expect a vector (list of exactly three real numbers).
Allowable value range
For integers and real numbers, you can specify the minimum and/or maximum values allowed:
NU = SIMP (status='o', typ='R',
val_min=-1e+0, val_max=0.5e+0),
In this example, NU should belong to the interval [:ref:` -1 , 0.5 < -1 , 0.5 >`]. The values given by both arguments are included in the range.
More complicated criteria
Besides the value ranges and the cardinal of the list, we can impose more complicated criteria on the value provided by the user, these are the validators, defined in Core/N_ VALIDATOR .py.
New ones can be programmed, according to needs. The main validators are:
pairVal () |
the integers provided must be even |
noRepeat () |
checking for the absence of duplicates in a list |
Compulsory (list) |
check that all list items have been provided |
longStr (low, high) |
checking the length of a character string |
ordList (order) |
checking if a list is increasing or decreasing |
andVal (val1, val2, … ) |
condition AND logic between the validators in the list |
Orval (val1, val2, … ) |
logical OR condition between the validators in the list |