drasil-code-0.1.9.0: A framework for code and document generation for scientific software - Code SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.Code.Imperative.Modules

Synopsis

Documentation

genMain :: OOProg r => GenState (SFile r) Source #

Generates a controller module.

genMainProc :: ProcProg r => GenState (SFile r) Source #

Generates a controller module.

genMainFunc :: OOProg r => GenState (Maybe (SMethod r)) 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 :: SharedProg r => GenState (Maybe (SMethod r)) 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 => ClassType -> GenState (Maybe (SClass r)) 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 => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

Generates a function for calculating derived inputs.

genInputDerivedProc :: SharedProg r => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

Generates a function for calculating derived inputs.

genInputMod :: OOProg r => GenState [SFile r] Source #

Generates a single module containing all input-related components.

genInputModProc :: ProcProg r => GenState [SFile r] Source #

Generates a single module containing all input-related components.

genInputConstraints :: OOProg r => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

Generates function that checks constraints on the input.

genInputConstraintsProc :: SharedProg r => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

Generates function that checks constraints on the input.

genInputFormat :: OOProg r => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

| Generates a function for reading inputs from a file.

genInputFormatProc :: SharedProg r => VisibilityTag -> GenState (Maybe (SMethod r)) Source #

| Generates a function for reading inputs from a file.

genConstMod :: OOProg r => GenState [SFile r] 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 => ClassType -> GenState (Maybe (SClass r)) 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 => GenState (SFile r) Source #

Generates a module containing calculation functions.

genCalcModProc :: ProcProg r => GenState (SFile r) Source #

Generates a module containing calculation functions.

genCalcFunc :: OOProg r => CodeDefinition -> GenState (SMethod r) 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 :: SharedProg r => CodeDefinition -> GenState (SMethod r) 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 => GenState [SFile r] Source #

Generates a module containing the function for printing outputs.

genOutputModProc :: ProcProg r => GenState [SFile r] Source #

Generates a module containing the function for printing outputs.

genOutputFormat :: OOProg r => GenState (Maybe (SMethod r)) Source #

Generates a function for printing output values.

genOutputFormatProc :: SharedProg r => GenState (Maybe (SMethod r)) Source #

Generates a function for printing output values.

genSampleInput :: AuxiliarySym r => GenState (Maybe (r (Auxiliary r))) Source #

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