From 9eb4b8768103929a7772e65382a517ea6ffa70fc Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Fri, 23 Nov 2018 17:54:13 +0100 Subject: [PATCH] Corrections Eric --- docCataWriter/bloc.rst | 6 +++++- docCataWriter/fact.rst | 5 +++++ docCataWriter/first_notions.rst | 1 + docCataWriter/python_rules.rst | 8 +++++--- docCataWriter/simp.rst | 22 ++++++++++++++++++---- docCataWriter/structure_rules.rst | 20 ++++++++++++++------ 6 files changed, 48 insertions(+), 14 deletions(-) diff --git a/docCataWriter/bloc.rst b/docCataWriter/bloc.rst index 18671f5f..a64624b7 100644 --- a/docCataWriter/bloc.rst +++ b/docCataWriter/bloc.rst @@ -15,6 +15,7 @@ General syntax Syntax is : :: + myConditionalGroup = BLOC( condition= " python statement", ... #included keywords or others fact/bloc ) @@ -23,6 +24,7 @@ Python statement is often <, >, == but this can be any expression returning Tru BLOC can be seen as an 'if' statement :: + print_frequency = SIMP(statut='f', typ='TXM', defaut='every', into=['every','periodically','sometimes']), frequency_every = BLOC ( condition= "print_frequency == 'every'", particule_to_be_printed = SIMP(statut='o',typ='TXM', ), @@ -45,7 +47,9 @@ Cardinality - BLOC appears depending on the evaluation of the conditional statement. it has no mandatory or optional status - BLOC cannot be repeat but included FACT or SIMP can - if keywords inside the BLOC have a status. this status is applied within the BLOC - :: + +:: + wind_speed = SIMP(statut='o', typ = 'R'), b_ask_wind_direction = BLOC ( condition= 'wind_speed > 0.5', wind_direction = SIMP(statut='o', typ='TXM'), diff --git a/docCataWriter/fact.rst b/docCataWriter/fact.rst index ffbbb4ae..08ff404b 100644 --- a/docCataWriter/fact.rst +++ b/docCataWriter/fact.rst @@ -15,6 +15,7 @@ General syntax Syntax is : :: + myGroup = FACT ( ... #included keywords or others fact/bloc ) @@ -22,13 +23,16 @@ Syntax is : "myGroup" is a python label. A group can not have the same name as its brothers. It contains simple elements or groups. There is no recursivity depth limit. :: + job_properties = FACT(statut='o', job_duration = SIMP(statut='o', typ='R', defaut=1000, val_min=0), stack_size = SIMP(statut='f', typ='R', defaut=1000, val_min=0), print_frequency = SIMP(statut='f', typ='TXM', defaut='every', into=['every','never','sometimes']), close_time = SIMP(statut='f', typ='R', defaut=1000, val_min=0), ), + Definition of FACT including others groups : + :: ThresholdExceedence = FACT ( @@ -45,6 +49,7 @@ Cardinality It is possible to constrain the number of instances (cardinality) of a FACT. The cardinality is specified using the min and max attributes. If min=max=1 (default), the FACT appears only once in a valid dataset. If max > 1, the group of parameters can appear more than once. min/max specifies the minimum/maximum number of repetitions. "**" means there is no upper limit for the maximal cardinality. :: + species_parameters = FACT(statut='o', max="**", species_name = SIMP(statut='o',typ='TXM'), species_mass = SIMP(statut='o',typ='R',defaut=1.0), diff --git a/docCataWriter/first_notions.rst b/docCataWriter/first_notions.rst index 22fae248..1a18cda2 100644 --- a/docCataWriter/first_notions.rst +++ b/docCataWriter/first_notions.rst @@ -9,6 +9,7 @@ Catalogs have a python syntax :ref:`python-label` The 'root node' is called 'JdC'. it has to be defined as : :: + JdC = JDC_CATA ( code = 'MyCodeName', ) diff --git a/docCataWriter/python_rules.rst b/docCataWriter/python_rules.rst index 8f58042b..fdc665ca 100644 --- a/docCataWriter/python_rules.rst +++ b/docCataWriter/python_rules.rst @@ -5,7 +5,7 @@ Rules for python syntax =============================== Variable names and identifiers are similar to those in many other languages : ----------------------------------------------------------------------------- +----------------------------------------------------------------------------- * They start with a letter (A_Z or a-z) or underscore "_"". * They are followed by letters, numbers or underscores. @@ -41,8 +41,10 @@ Catalogs are executable python files: * if needed, classes or functions should be defined. * arguments are separated with ',' -.. code:: python -time_step = SIMP(statut='o', typ='R',) +:: + + #code python : + time_step = SIMP(statut='o', typ='R',) This is a instantiation operation. it creates an object of type SIMP. the SIMP __init__() is called with two arguments statut and typ. You have to respect python syntax. diff --git a/docCataWriter/simp.rst b/docCataWriter/simp.rst index 43364ff6..f168d8b9 100644 --- a/docCataWriter/simp.rst +++ b/docCataWriter/simp.rst @@ -16,6 +16,7 @@ General syntax Source line code is : :: + myKeyword = SIMP (typ = 'F') | Attribute "typ" defines the keyword type (in this case, float) @@ -36,7 +37,9 @@ The attribute typ can take several values : * text(TXM), Examples : + :: + number_of_species = SIMP( typ='I' ), YoungModulus = SIMP( typ='R' ), electrostatics_is_on = SIMP( typ=bool, ), @@ -48,7 +51,9 @@ The attribute typ can take several values : - A tuple of N elements (Tuple(3)). * Class Tuple must first be defined in the catalog. - :: + + :: + import types class Tuple: def __init__(self,ntuple): @@ -63,13 +68,16 @@ The attribute typ can take several values : return "Tuple of %s elements" % self.ntuple * 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') @@ -96,11 +104,14 @@ The attribute typ can take several values : +-------------------------------------+--------------------------------------------------+ - | + | + - Or previously user defined type in the catalog (a mesh for example) A user-defined class inherits from the class ASSD + :: + class mesh (ASSD) : pass myMesh=SIMP(typ = 'mesh') @@ -113,6 +124,7 @@ 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. :: + scalar = SIMP(typ = 'R') list_of_scalars = SIMP(typ = 'R',max="**") list_of_3_to_5_scalars= SIMP(typ = 'R',max=5, min=3) @@ -143,7 +155,9 @@ 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) diff --git a/docCataWriter/structure_rules.rst b/docCataWriter/structure_rules.rst index 593c3a72..a7fd9fdb 100644 --- a/docCataWriter/structure_rules.rst +++ b/docCataWriter/structure_rules.rst @@ -18,6 +18,7 @@ General syntax Syntax is : :: + regles = (..list of rules), @@ -25,6 +26,7 @@ AU_MOINS_UN ----------- AU_MOINS_UN rule forces to create at least one concept in the list. More than one can be created. :: + Structure = FACT ( statut ='f', regles = (AU_MOINS_UN( 'Beam', 'Bar', 'Grid'),) Beam = FACT (...), @@ -40,7 +42,8 @@ If Structure is defined, one of the keyword 'Beam', 'Bar', 'Grid' is also defin UN_PARMI -------- UN_PARMI rule obliges the user to create one and only one concept of the list. -:: +:: + FOR_DPD = BLOC(condition = "code=='DPD'", regles=(UN_PARMI('Initialisation', 'Solver_Input'), ), @@ -57,7 +60,8 @@ The user must select Initialisation or (exclusive or) Solver_Input. EXCLUS ------ EXCLUS means that, if one of the keyword is created, the others won't be allowed. -:: +:: + JOB_DURATION = FACT(statut='o', regles=( EXCLUS('duration','number_of_time_step','end_at'), ), @@ -75,7 +79,8 @@ ENSEMBLE -------- The rule means that if one keyword is selected, the others have to be also. The keywords order is not meaningful. -:: +:: + GRILLE = FACT(statut='f', regles=( ENSEMBLE('ORIG_AXE','AXE'), ), @@ -91,7 +96,8 @@ PRESENT_PRESENT --------------- The rule means that if the FIRST keyword is selected, the others have to be also. The keywords order is meaningful. -:: +:: + FREQUENCE = FACT(statut='f', regles=( PRESENT_PRESENT('FREQ_MIN','FREQ_MAX','FREQ_PAS') ), @@ -109,7 +115,8 @@ PRESENT_ABSENT -------------- The rule means that if the FIRST keyword is selected, the others aren't allowed. The keywords order is meaningful. -:: +:: + GRID = FACT(statut='f', regles=( PRESENT_ABSENT('GroupOfNodes','GroupOfFaces','GroupOfEdges'), ), @@ -123,7 +130,8 @@ That means : All rules can be combinated, creating more complicated rules. -:: +:: + GRID = FACT(statut='f', regles=( PRESENT_ABSENT('GroupOfNodes','GroupOfFaces','GroupOfEdges'), ENSEMBLE('GroupOfFaces','GroupOfEdges'), -- 2.39.2