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

Language.Drasil.CodeSpec

Description

Defines the CodeSpec structure and related functions.

Synopsis

Documentation

type Input = CodeVarChunk Source #

Program input.

type Output = CodeVarChunk Source #

Program output.

type Const = CodeDefinition Source #

Constants in the problem.

type Derived = CodeDefinition Source #

Derived inputs.

type Def = CodeDefinition Source #

Mathematical definition.

type ConstantMap = Map UID CodeDefinition Source #

Maps constants to their respective CodeDefinition.

data OldCodeSpec Source #

Old Code specifications. Holds information needed to generate code.

Constructors

OldCodeSpec 

Fields

class HasOldCodeSpec c where Source #

Minimal complete definition

oldCodeSpec

Methods

oldCodeSpec :: Lens' c OldCodeSpec Source #

authorsO :: Lens' c People Source #

cMapO :: Lens' c ConstraintCEMap Source #

configFilesO :: Lens' c [FilePath] Source #

constMapO :: Lens' c ConstantMap Source #

constantsO :: Lens' c [Const] Source #

derivedInputsO :: Lens' c [Derived] Source #

execOrderO :: Lens' c [Def] Source #

extInputsO :: Lens' c [Input] Source #

inputsO :: Lens' c [Input] Source #

modsO :: Lens' c [Mod] Source #

outputsO :: Lens' c [Output] Source #

pNameO :: Lens' c Name Source #

sysinfodbO :: Lens' c ChunkDB Source #

Instances

Instances details
HasOldCodeSpec CodeSpec Source # 
Instance details

Defined in Language.Drasil.CodeSpec

HasOldCodeSpec OldCodeSpec Source # 
Instance details

Defined in Language.Drasil.CodeSpec

data CodeSpec Source #

New Code Specification. Holds system information and a reference to OldCodeSpec.

Constructors

CS 

assocToMap :: HasUID a => [a] -> Map UID a Source #

Converts a list of chunks that have UIDs to a Map from UID to the associated chunk.

getODE :: [ExtLib] -> Maybe ODE Source #

Get ODE from ExtLib

mapODE :: Maybe ODE -> [CodeDefinition] Source #

Maps ODE to their respective CodeDefinition.

codeSpec :: SystemInformation -> Choices -> [Mod] -> CodeSpec Source #

Creates a CodeSpec using the provided SystemInformation, Choices, and Mods. The CodeSpec consists of the system information and a corresponding OldCodeSpec.

oldcodeSpec :: SystemInformation -> Choices -> [Mod] -> OldCodeSpec Source #

Generates an OldCodeSpec from SystemInformation, Choices, and a list of Mods. This function extracts various components (e.g., inputs, outputs, constraints, etc.) from SystemInformation to populate the OldCodeSpec structure.

asVC :: Func -> QuantityDict Source #

Convert a Func to an implementation-stage QuantityDict representing the function.

funcUID :: Func -> UID Source #

Get a UID of a chunk corresponding to a Func.

getDerivedInputs :: [DataDefinition] -> [Input] -> [Const] -> ChunkDB -> [SimpleQDef] Source #

Determines the derived inputs, which can be immediately calculated from the knowns (inputs and constants). If there are DDs, the derived inputs will come from those. If there are none, then the QDefinitions are used instead.

type Known = CodeVarChunk Source #

Known values.

type Need = CodeVarChunk Source #

Calculated values.

getExecOrder :: [Def] -> [Known] -> [Need] -> ChunkDB -> [Def] Source #

Orders a list of definitions such that they form a path between Known values and values that Need to be calculated.

getConstraints :: HasUID c => ConstraintCEMap -> [c] -> [ConstraintCE] Source #

Get a list of Constraints for a list of CodeChunks.

constraintvars :: ConstraintCE -> ChunkDB -> [CodeChunk] Source #

Get a list of CodeChunks from a constraint.