+.. _Defining-steps-in-a-catalog:
+
Defining steps in a catalog
===========================
_________
The 'root node' is called 'JdC'.
-| It has to be declared at the very begininng in the catalog file such as :
+It has to be declared at the very begininng in the catalog file such as :
::
from Accas import *
- jdc = JDC_CATA (
+ JdC = JDC_CATA (
code = 'MyCodeName',
)
~~~~~~~~~~~~~~
A step can be :
* PROC : a simple procedure
- * OPER : a command returning a concept
+ * OPER : a command returning a concept/user type
+
+A PROC definition agregate hierarchical data in order to express a coherent part of your modelisation.
+A PROC may also be seen as a PROCedure call with more or less complex parameters.
::
- MonPROC = PROC (nom = MonOPER, ..
+ MonPROC = PROC (nom = 'MonPROC', ..
);
- MonOPER = OPER (nom = MonPROC, sd_prod= myUserClass,
+ MonOPER = OPER (nom = 'MonOPER', sd_prod= myUserClass,
);
-To describe a PROC, attribute 'nom' is mandatory and has to be the lvalue. Note that the name has to begin with a upper character. after that, inside elements are added.
+To describe a PROC, the 'nom' attribute is mandatory and has to be the stringfied lvalue. Note that the variable name must begin with an upper character. Once a PROC or an OPER is defined you can add elements inside.
::
),
);
+.. _Defining-a-concept-type-user:
+
+Defining a concept type / user type
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A OPER definition agregate hierarchical data in order to express a coherent part of your modelisation.
+Despite an PROC it produce a new data that you can reuse in further defintion.
+A OPER may also be seen as a fuction call with more or less complex parameters which return a new
-Defining a user concept type
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To describe an OPER , you have first to describe a user-defined type of concept.
-Declarations appears at the beginning of the catalogs. User classes inherits from ASSD. Most of the time, pass statement is all you need.
+Declarations appears at the beginning of the catalogs. User classes inherits from ASSD. Most of the time the pass statement is all you need to write.
::
| Attribute "typ" defines the keyword type (in this case, float)
| "myKeyword" is the keyword name. it is a python label. A keyword can not have the same name as its brothers.
-| Attribute typ is mandatory. Other SIMP attributes (see below) have default value and are optional.
+| Attribute *typ* is mandatory. Other SIMP attributes (see below) have default value and are optional.
Typ
~~~
-The attribute typ can take several values :
+The attribute *typ* can take several values :
- - A "simple "type :
+ - A simple type :
* boolean (bool)
- * integer (I),
- * float (R)
- * complex(C)
- * text(TXM),
+ * integer (I)
+ * float (R)
+ * complex (C)
+ * text (TXM)
Examples :
::
-
+
number_of_species = SIMP( typ='I' ),
YoungModulus = SIMP( typ='R' ),
electrostatics_is_on = SIMP( typ=bool, ),
-
- Valid values for number_of_species : 1, -6, 128
- Valid values for YoungModulus : 1, 110.3, -6., 14.5×10−3
- Valid values for electrostatics_is_on : True, False , 0, 1
+
+
+ * Valid values for number_of_species : 1, -6, 128
+ * Valid values for YoungModulus : 1, 110.3, -6., 14.5×10−3
+ * Valid values for electrostatics_is_on : True, False , 0, 1
+ |
- A tuple of N elements (Tuple(3)).
* Then, inside each tuple, each model element has a specified type.
::
-
+
pair_identification = SIMP(statut ='o', typ=Tuple(2), validators=VerifTypeTuple(('TXM','TXM' )),),
simulation_box_sizes = SIMP(statut ='o', typ=Tuple(3), validators=VerifTypeTuple(('R' ,'R', 'R')),),
length = SIMP(statut ='o', typ=Tuple(2), validators=VerifTypeTuple(('R' ,'TXM' )),),
- means that pair_identification is a tuple of two strings, simulation_box_sizes a tuple of three floats and lenght a tuple which first parameter is a float and second a string.
- ::
-
- Valid values for pair_identification : ('A', 'A'), ('A','B')
- Valid values for simulation_box_sizes : (1,1.,0), (2.,-2.5, 10+3)
- Valid values for length : (1,'m'), (2., 'cm') but also (-500, 'Fahr') or (32, 'fareneit')
- Note that a tuple element is not seen as a list but as ONE element. (it is possible to define list of tuple)
+ means that pair_identification is a tuple of two strings, simulation_box_sizes a tuple of three floats and lenght a tuple which first parameter is a float and second a string.
+
+ * Valid values for pair_identification : ('A', 'A'), ('A','B')
+ * Valid values for simulation_box_sizes : (1,1.,0), (2.,-2.5, 10+3)
+ * Valid values for length : (1,'m'), (2., 'cm') but also (-500, 'Fahr') or (32, 'fareneit')
+
+ .. note:: A tuple element is not seen as a list but as ONE element. (it is possible to define list of tuple)
- A directory or a file (existing or not)
- +-------------------------------------+--------------------------------------------------+
- | parameter is : | catalog's description is : |
- +=====================================+==================================================+
- |an existing file | typ='Fichier' |
- +-------------------------------------+--------------------------------------------------+
- |a directory | typ='Repertoire' |
- +-------------------------------------+--------------------------------------------------+
- |an existing file with specific suffix| typ='Fichier','JDC Files (*.comm);;All Files (*) |
- +-------------------------------------+--------------------------------------------------+
- |a non-allready existing file | typ=('Fichier',"",'Sauvegarde'), |
- +-------------------------------------+--------------------------------------------------+
- |a file (existing or not) | typ='FichierNoAbs' |
- +-------------------------------------+--------------------------------------------------+
- |a file or a directory | typ='FichierOuRepertoire' |
- +-------------------------------------+--------------------------------------------------+
-
-
- |
+ +-------------------------------------+-----------------------------------------------------+
+ | parameter is : | catalog's description is : |
+ +=====================================+=====================================================+
+ |an existing file | typ='Fichier' |
+ +-------------------------------------+-----------------------------------------------------+
+ |a directory | typ='Repertoire' |
+ +-------------------------------------+-----------------------------------------------------+
+ |an existing file with specific suffix| typ=('Fichier','JDC Files (*.comm);;All Files (*)') |
+ +-------------------------------------+-----------------------------------------------------+
+ |a non-allready existing file | typ=('Fichier',"",'Sauvegarde'), |
+ +-------------------------------------+-----------------------------------------------------+
+ |a file (existing or not) | typ='FichierNoAbs' |
+ +-------------------------------------+-----------------------------------------------------+
+ |a file or a directory | typ='FichierOuRepertoire' |
+ +-------------------------------------+-----------------------------------------------------+
+
+ .. note:: To filter filenames, you have to set the *typ* attribute with a python tuple :
+
+ * The first element is a fixed string value : *'Fichier'* , *'Repertoire'* , *'FichierNoAbs'* , *'FichierOuRepertoire'*
+ * The second element is a Qt filter string as defined by QT. This string is used only by the graphical interface. The filter is inactive for *typ* *'Repertoire'* .
+ * The third element is only used with the value *'Sauvegarde'* in the triple *('Fichier',"",'Sauvegarde')* to activate the non-alreay existing file usecase
- Or previously user defined type in the catalog (a mesh for example)
~~~~~~~~~~~
It is possible to constrain the number of instances (cardinality) of a keyword. The cardinality is specified using the min and max attributes.
If min=max=1 (default), the keyword has a single value. if max > 1, parameter is a list. min/max specify the minimum/maximum number of occurences in the list. 'max= "**"' sets no upper limit for the maximal cardinality.
-::
-
+
+.. code-block:: python
+
scalar = SIMP(typ = 'R')
list_of_scalars = SIMP(typ = 'R',max="**")
list_of_3_to_5_scalars= SIMP(typ = 'R',max=5, min=3)
-
- Valid values for scalar : 1., 2.,
- Valid values for list_of_scalars : (1.,1.,0), (2.,5., 7.,8,.,... 999.), (1.,)
- Valid values for list_of_3_to_5_scalars : (1.,1.,1), (1.,1.,1.,1.),(1.,1.,1.)
+
+
+* Valid values for scalar : 1., 2.,
+* Valid values for list_of_scalars : (1.,1.,0), (2.,5., 7.,8,.,... 999.), (1.,)
+* Valid values for list_of_3_to_5_scalars : (1.,1.,1), (1.,1.,1.,1.),(1.,1.,1.)
Note that a list can be mandatory or optional.
And some examples :
- ::
-
- print_frequency = SIMP(statut='f', typ='TXM', defaut='every', into=['every','never','10 steps'])
- close_time = SIMP(statut='f', typ='R' , defaut=1000, val_min=0),
- number_of_steps = SIMP(statut='f', typ='I' , defaut=100 , val_min=0, val_max=1000)
+.. code-block:: python
+
+ print_frequency = SIMP(statut='f', typ='TXM', defaut='every', into=['every','never','10 steps'])
+ close_time = SIMP(statut='f', typ='R' , defaut=1000, val_min=0)
+ number_of_steps = SIMP(statut='f', typ='I' , defaut=100 , val_min=0, val_max=1000)
+
- Valid values for print_frequency : 'every','never','10 steps' and no others
- Valid values for close_time : positive float (not nul)
- Valid values for number_of_steps : integer between 1 and 999
+* Valid values for print_frequency : 'every','never','10 steps' and no others
+* Valid values for close_time : positive float (not nul)
+* Valid values for number_of_steps : integer between 1 and 999
-
+