From 0198d0e256bc34db3bde97b4a0ab8e1d99049e0a Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Wed, 20 Nov 2019 15:38:03 +0100 Subject: [PATCH] Ajout de la documentation sur le mapping xsd --- docCataWriter/conf.py | 6 +- docCataWriter/index.rst | 5 +- docCataWriter/oper_and_proc.rst | 29 +++++--- docCataWriter/simp.rst | 114 ++++++++++++++++-------------- docCataWriter/structure_rules.rst | 1 + 5 files changed, 88 insertions(+), 67 deletions(-) diff --git a/docCataWriter/conf.py b/docCataWriter/conf.py index 1989792c..e7fb10ac 100644 --- a/docCataWriter/conf.py +++ b/docCataWriter/conf.py @@ -25,7 +25,8 @@ import sys, os # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [] +extensions = ['sphinx.ext.todo'] +#extensions = [] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -245,3 +246,6 @@ texinfo_documents = [ # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' + +#TODO extension option : +todo_include_todos=True diff --git a/docCataWriter/index.rst b/docCataWriter/index.rst index 71da5032..0788a2c8 100644 --- a/docCataWriter/index.rst +++ b/docCataWriter/index.rst @@ -23,7 +23,4 @@ Contents: oper_and_proc.rst structure_rules.rst python_rules - - - - + xsd_mapping diff --git a/docCataWriter/oper_and_proc.rst b/docCataWriter/oper_and_proc.rst index 05cf2c63..3376e8b2 100644 --- a/docCataWriter/oper_and_proc.rst +++ b/docCataWriter/oper_and_proc.rst @@ -1,3 +1,5 @@ +.. _Defining-steps-in-a-catalog: + Defining steps in a catalog =========================== @@ -5,13 +7,13 @@ Root node _________ 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', ) @@ -24,16 +26,19 @@ General syntax ~~~~~~~~~~~~~~ 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. :: @@ -50,11 +55,17 @@ To describe a PROC, attribute 'nom' is mandatory and has to be the lvalue. Note ), ); +.. _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. :: diff --git a/docCataWriter/simp.rst b/docCataWriter/simp.rst index 234b0254..56319e52 100644 --- a/docCataWriter/simp.rst +++ b/docCataWriter/simp.rst @@ -21,32 +21,34 @@ Source line code is : | 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)). @@ -70,41 +72,44 @@ The attribute typ can take several values : * 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) @@ -123,15 +128,17 @@ Cardinality ~~~~~~~~~~~ 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. @@ -156,14 +163,15 @@ Other useful attributes 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 - + diff --git a/docCataWriter/structure_rules.rst b/docCataWriter/structure_rules.rst index 716dec4e..404a9df0 100644 --- a/docCataWriter/structure_rules.rst +++ b/docCataWriter/structure_rules.rst @@ -130,6 +130,7 @@ That means : All rules can be combinated, creating more complicated rules. + :: GRID = FACT(statut='f', -- 2.39.2