drasil-code-0.1.9.0: A framework for code and document generation for scientific software - Code SubPackage
Safe HaskellNone
LanguageGHC2024

Language.Drasil.Code.Imperative.Modules

Synopsis

Documentation

genMain :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState (FS (r file)) Source #

Generates a controller module.

genMainProc :: (NativeVector r, ProcProg r vis stmt mthd prg file mod bod block) => GenState (FS (r file)) Source #

Generates a controller module.

genMainFunc :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState (Maybe (MS (r mthd))) Source #

Generates a main function, to act as the controller for an SCS program. The controller declares input and constant variables, then calls the functions for reading input values, calculating derived inputs, checking constraints, calculating outputs, and printing outputs. Returns Nothing if the user chose to generate a library.

genMainFuncProc :: (BlockSym r block stmt, BodySym r bod block, CommandLineArgs r, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, MultiStatement r stmt, ValueStatement r stmt, DeclStatement r stmt bod, FuncAppStatement r stmt, Argument r, List r, NativeVector r, Reference r, Set r, MethodSym r vis mthd bod, TypeElim r) => GenState (Maybe (MS (r mthd))) Source #

Generates a main function, to act as the controller for an SCS program. The controller declares input and constant variables, then calls the functions for reading input values, calculating derived inputs, checking constraints, calculating outputs, and printing outputs. Returns Nothing if the user chose to generate a library.

genInputClass :: OOProg r vis stmt mthd stvr attch prg file mod bod block => ClassType -> GenState (Maybe (CS (r Class))) Source #

Returns Nothing if no inputs or constants are mapped to InputParameters in the class definition map. If any inputs or constants are defined in InputParameters, this generates the InputParameters class containing the inputs and constants as state variables. If the InputParameters constructor is also exported, then the generated class also contains the input-related functions as private methods.

genInputDerived :: OOProg r vis stmt mthd stvr attch prg file mod bod block => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

Generates a function for calculating derived inputs.

genInputDerivedProc :: (BlockSym r block stmt, BodySym r bod block, NativeVector r, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, Argument r, Array r, List r, Reference r, Set r, MultiStatement r stmt, DeclStatement r stmt bod, AssignStatement r stmt, ControlStatement r stmt bod, StringStatement r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, MethodSym r vis mthd bod, TypeElim r, VariableElim r) => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

Generates a function for calculating derived inputs.

genInputMod :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState [FS (r file)] Source #

Generates a single module containing all input-related components.

genInputModProc :: (NativeVector r, ProcProg r vis stmt mthd prg file mod bod block) => GenState [FS (r file)] Source #

Generates a single module containing all input-related components.

genInputConstraints :: OOProg r vis stmt mthd stvr attch prg file mod bod block => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

Generates function that checks constraints on the input.

genInputConstraintsProc :: (BlockSym r block stmt, BodySym r bod block, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, Argument r, NativeVector r, Reference r, Set r, List r, EmptyStatement r stmt, MultiStatement r stmt, DeclStatement r stmt bod, PrintConsole r stmt, FileHandling r stmt, PrintFile r stmt, ControlStatement r stmt bod, MethodSym r vis mthd bod, TypeElim r, VariableElim r) => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

Generates function that checks constraints on the input.

genInputFormat :: OOProg r vis stmt mthd stvr attch prg file mod bod block => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

| Generates a function for reading inputs from a file.

genInputFormatProc :: (BlockSym r block stmt, BodySym r bod block, NativeVector r, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, MultiStatement r stmt, DeclStatement r stmt bod, ControlStatement r stmt bod, StringStatement r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, Argument r, List r, ListStatement r stmt, Reference r, Set r, MethodSym r vis mthd bod, TypeElim r, VariableElim r) => VisibilityTag -> GenState (Maybe (MS (r mthd))) Source #

| Generates a function for reading inputs from a file.

genConstMod :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState [FS (r file)] Source #

Generates a module containing the class where constants are stored.

checkConstClass :: GenState Bool Source #

Checks if a class is needed to store constants, i.e. if constants are mapped to the constants class in the class definition map.

genConstClass :: OOProg r vis stmt mthd stvr attch prg file mod bod block => ClassType -> GenState (Maybe (CS (r Class))) Source #

Generates a class to store constants, if constants are mapped to the Constants class in the class definition map, otherwise returns Nothing.

genCalcMod :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState (FS (r file)) Source #

Generates a module containing calculation functions.

genCalcModProc :: (NativeVector r, ProcProg r vis stmt mthd prg file mod bod block) => GenState (FS (r file)) Source #

Generates a module containing calculation functions.

genCalcFunc :: OOProg r vis stmt mthd stvr attch prg file mod bod block => CodeDefinition -> GenState (MS (r mthd)) Source #

Generates a calculation function corresponding to the CodeDefinition. For solving ODEs, the ExtLibState containing the information needed to generate code is found by looking it up in the external library map.

genCalcFuncProc :: (BlockSym r block stmt, BodySym r bod block, NativeVector r, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, Argument r, Array r, List r, ListStatement r stmt, Reference r, Set r, MultiStatement r stmt, ValueStatement r stmt, DeclStatement r stmt bod, AssignStatement r stmt, ControlStatement r stmt bod, StringStatement r stmt, FileHandling r stmt, PrintFile r stmt, ReadFile r stmt, MethodSym r vis mthd bod, TypeElim r, VariableElim r) => CodeDefinition -> GenState (MS (r mthd)) Source #

Generates a calculation function corresponding to the CodeDefinition. For solving ODEs, the ExtLibState containing the information needed to generate code is found by looking it up in the external library map.

genOutputMod :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState [FS (r file)] Source #

Generates a module containing the function for printing outputs.

genOutputModProc :: (NativeVector r, ProcProg r vis stmt mthd prg file mod bod block) => GenState [FS (r file)] Source #

Generates a module containing the function for printing outputs.

genOutputFormat :: OOProg r vis stmt mthd stvr attch prg file mod bod block => GenState (Maybe (MS (r mthd))) Source #

Generates a function for printing output values.

genOutputFormatProc :: (BlockSym r block stmt, BodySym r bod block, NativeVector r, MathConstant r, VariableValue r, BooleanExpression r, Comparison r, NumericExpression r, ValueExpression r, Argument r, List r, Reference r, Set r, MultiStatement r stmt, DeclStatement r stmt bod, ControlStatement r stmt bod, FileHandling r stmt, PrintFile r stmt, MethodSym r vis mthd bod, TypeElim r, VariableElim r) => GenState (Maybe (MS (r mthd))) Source #

Generates a function for printing output values.

genSampleInput :: Applicative r => GenState (Maybe (r FileLayout)) Source #

Generates a sample input file compatible with the generated program, if the user chose to.