Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | reportingInterval | |||
integer, | intent(in) | :: | recordIndex | |||
integer, | intent(in) | :: | CumlativeSimulationDays | |||
integer, | intent(in), | optional | :: | Month | ||
integer, | intent(in), | optional | :: | DayOfMonth | ||
integer, | intent(in), | optional | :: | Hour | ||
real(kind=r64), | intent(in), | optional | :: | EndMinute | ||
real(kind=r64), | intent(in), | optional | :: | StartMinute | ||
integer, | intent(in), | optional | :: | DST | ||
character(len=*), | intent(in), | optional | :: | DayType |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
FUNCTION CreateSQLiteTimeIndexRecord(reportingInterval, recordIndex, CumlativeSimulationDays, &
Month, DayOfMonth, Hour, EndMinute, StartMinute, DST, DayType) RESULT (iOut)
! FUNCTION INFORMATION:
! AUTHOR Greg Stark
! DATE WRITTEN July 2008
! MODIFIED September 2010, Kyle Benne
! Modified FUNCTION syntax to use RESULT keyword
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function creates a time index and writes the time data to the SQL database
! METHODOLOGY EMPLOYED:
! Standard SQL92 queries and commands via the Fortran SQLite3 API
! REFERENCES:
! na
! USE STATEMENTS
USE ISO_C_FUNCTION_BINDING
USE DataPrecisionGlobals, ONLY: r64
USE DataEnvironment, ONLY: CurEnvirNum
USE DataGlobals, ONLY: WarmupFlag
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: reportingInterval
! See Module Parameter Definitons for LocalReportEach, LocalReportTimeStep, LocalReportHourly, etc.
INTEGER, INTENT(IN) :: recordIndex
INTEGER, INTENT(IN) :: CumlativeSimulationDays
INTEGER, INTENT(IN), OPTIONAL :: Month
INTEGER, INTENT(IN), OPTIONAL :: DayOfMonth
INTEGER, INTENT(IN), OPTIONAL :: Hour
REAL(r64), INTENT(IN), OPTIONAL :: EndMinute
REAL(r64), INTENT(IN), OPTIONAL :: StartMinute
INTEGER, INTENT(IN), OPTIONAL :: DST
CHARACTER(len=*), INTENT(IN), OPTIONAL :: DayType
INTEGER :: iOut
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=MaxMessageSize) :: mesaageBuffer
INTEGER, PARAMETER, DIMENSION(12) :: LastDayOfMonth = (/31,28,31,30,31,30,31,31,30,31,30,31/)
INTEGER :: IntEndEMinute = 60
INTEGER :: IntStartMinute = 0
INTEGER :: UpdatedHour
INTEGER :: IntervalInMinutes
INTEGER :: errcode
INTRINSIC NINT
SELECT CASE (reportingInterval)
CASE(LocalReportEach, LocalReportTimeStep)
SQLdbTimeIndex = SQLdbTimeIndex + 1
UpdatedHour = Hour
IntEndEMinute = NINT(EndMinute)
IntStartMinute = NINT(StartMinute)
CALL AdjustReportingHourAndMinutes(UpdatedHour, IntEndEMinute)
IntervalInMinutes = NINT(EndMinute) - IntStartMinute
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 1, SQLdbTimeIndex)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 2, Month)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 3, DayOfMonth)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 4, UpdatedHour)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 5, IntEndEMinute)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 6, DST)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 7, IntervalInMinutes)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 8, reportingInterval)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 9, CumlativeSimulationDays)
errcode = SQLiteBindTextMacro (TimeIndexInsertStmt, 10, dayType)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 11, CurEnvirNum)
IF ( WarmupFlag ) THEN
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 12, 1)
ELSE
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 12, 0)
ENDIF
errcode = SQLiteStepCommand (TimeIndexInsertStmt)
errcode = SQLiteResetCommand (TimeIndexInsertStmt)
iOut = SQLdbTimeIndex
CASE(LocalReportHourly)
SQLdbTimeIndex = SQLdbTimeIndex + 1
IntervalInMinutes = 60
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 1, SQLdbTimeIndex)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 2, Month)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 3, DayOfMonth)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 4, Hour)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 5, 0)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 6, DST)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 7, IntervalInMinutes)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 8, reportingInterval)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 9, CumlativeSimulationDays)
errcode = SQLiteBindTextMacro (TimeIndexInsertStmt, 10, dayType)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 11, CurEnvirNum)
errcode = SQLiteStepCommand (TimeIndexInsertStmt)
errcode = SQLiteResetCommand (TimeIndexInsertStmt)
iOut = SQLdbTimeIndex
CASE(LocalReportDaily)
SQLdbTimeIndex = SQLdbTimeIndex + 1
IntervalInMinutes = 60*24
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 1, SQLdbTimeIndex)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 2, Month)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 3, DayOfMonth)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 4, 24)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 5, 0)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 6, DST)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 7, IntervalInMinutes)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 8, reportingInterval)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 9, CumlativeSimulationDays)
errcode = SQLiteBindTextMacro (TimeIndexInsertStmt, 10, dayType)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 11, CurEnvirNum)
errcode = SQLiteStepCommand (TimeIndexInsertStmt)
errcode = SQLiteResetCommand (TimeIndexInsertStmt)
iOut = SQLdbTimeIndex
CASE(LocalReportMonthly)
SQLdbTimeIndex = SQLdbTimeIndex + 1
IntervalInMinutes = 60*24*LastDayOfMonth(Month)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 1, SQLdbTimeIndex)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 2, Month)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 3, LastDayOfMonth(Month))
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 4, 24)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 5, 0)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 6)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 7, IntervalInMinutes)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 8, reportingInterval)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 9, CumlativeSimulationDays)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 10)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 11, CurEnvirNum)
errcode = SQLiteStepCommand (TimeIndexInsertStmt)
errcode = SQLiteResetCommand (TimeIndexInsertStmt)
iOut = SQLdbTimeIndex
CASE(LocalReportSim)
SQLdbTimeIndex = SQLdbTimeIndex + 1
IntervalInMinutes = 60*24*CumlativeSimulationDays
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 1, SQLdbTimeIndex)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 2)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 3)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 4)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 5)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 6)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 7, IntervalInMinutes)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 8, reportingInterval)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 9, CumlativeSimulationDays)
errcode = SQLiteBindNULL (TimeIndexInsertStmt, 10)
errcode = SQLiteBindInteger (TimeIndexInsertStmt, 11, CurEnvirNum)
errcode = SQLiteStepCommand (TimeIndexInsertStmt)
errcode = SQLiteResetCommand (TimeIndexInsertStmt)
iOut = SQLdbTimeIndex
CASE DEFAULT
Write(mesaageBuffer,'(A,I5)') 'Illegal reportingInterval passed to CreateSQLiteTimeIndexRecord: ', reportingInterval
CALL SQLiteWriteMessageMacro (mesaageBuffer)
iOut = -1 ! this is an error condition
END SELECT
END FUNCTION CreateSQLiteTimeIndexRecord