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.

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.

chooseInModule :: OOProg r => InputModule -> GenState [SFile r] Source #

Generates either a single module containing all input-related components, or separate modules for each input-related component, depending on the user's modularity choice.

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 => ScopeTag -> GenState (Maybe (SMethod r)) Source #

Generates a function for calculating derived inputs.

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

Generates function that checks constraints on the input.

genInputFormat :: OOProg r => ScopeTag -> 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.

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.

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.

genOutputMod :: OOProg 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.

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

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