ModelStateReader Class

Class for reading model state file.

Definition

Namespace: DHI.Mike1D.ModelState
Assembly: DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class ModelStateReader
Inheritance
Object    ModelStateReader

Constructors

ModelStateReader(IDiagnostics) Create new Model State Reader
ModelStateReader(DateTime, IDiagnostics) Create new Model State Reader
ModelStateReader(StatestartInfo, IDiagnostics) Create new Model State Reader
ModelStateReader(StatestartInfo, DateTime, IDiagnostics) Create new Model State Reader

Properties

Diagnostics 
HasLineInfo Flag indicating if class can return line information
Info State start info for this reader.
LineNumber The current line number in the xml file, or -1 if not available
LinePosition The current line position in the xml file, or -1 if not available
Options Option objects for reader
ReadMode Read-mode of reader
SimStartTime Start time of simulation, used for writing times relative instead of absolute which allows for applying values at arbitrary times
TokenName Name of current token in state
TokenType Type of current token in state

Methods

AppendLineInfo Append line information to string. If no line information is available, the input string is returned directly.
Close Close reader and underlying stream.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Open(Stream) Open reader and read from stream
Open(String) Open reader and read from file
Read Read next token from state stream
Read(StateToken) Reads next element from the state stream and validates that the tokenType matches.

It throws an exception if the tokenType does not match

ReadBoolean Read boolean
ReadBooleans Read a list of integers
ReadDateTime Read a DateTime
ReadDateTimes Read a list of DateTimes
ReadDouble Read double
ReadDoubles Read a list of doubles
ReadEndObject Reads next element from the state stream and validates that it is and end object element.
ReadInt Read integer
ReadInts Read a list of integers
ReadRelativeTime Try to read a double or DateTime value
ReadRelativeTimes Try to read a list of double or DateTime values
ReadStartObject Reads the next element from the state stream and validates that the tokenName matches.

If file version and bridge version matches, if object is not found, an exception is thrown.

If file version is older than bridge version, and object is not found, false is returned.

ReadString Read string
ReadStrings Read a list of strings
ReadTimeSpan Read a TimeSpan
ReadTimeSpans Read a list of TimeSpans
Skip Skip current element, moves beyond the ObjectEnd of the current section.
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryRead First time called, this will read the next token. At subsequent calls, a new token will only be read if the previous call returned true
TryReadStartObject Reads the next element, but does only move by it if the tokenName matches.

Fields

Nodes Nodes stored in state, if state contains network
Reaches Reaches stored in state, if state contains network

Extension Methods

ReadBoolean Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadBoolean Read a parameter from state, and if there, apply it.
(Defined by ModelStateExtensions)
ReadBooleans Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadDateTime Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadDateTime Read a parameter from state, and if there, apply it.
(Defined by ModelStateExtensions)
ReadDateTimes Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadDouble Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadDouble Read a parameter from state, and if there, apply it.
(Defined by ModelStateExtensions)
ReadDoubles Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadInt Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadInt Read a parameter from state, and if there, apply it.
(Defined by ModelStateExtensions)
ReadNetworkState Read a network state, based on the indices of nodes and reaches specified, storing values in a NetworkDataT object.

A network states contains one array of node values, matching the nodesinput, and a number of arrays of reach values, matching the reaches input. For reaches, the array must contain values on all H grid points or all Q grid points.


(Defined by NetworkDataStateReader)
ReadRelativeTime For newer the version of state files the time associated with different items is relative to the state time. This allows for consistent results whether the StateTime is used as simulation start time or not. If the file is older the times are in DateTime format still.
(Defined by ModelStateExtensions)
ReadRelativeTimes For newer the version of state files the time buffers associated with different items are relative to the state time. This allows for consistent results whether the StateTime is used as simulation start time or not If the file is older the time buffers are in DateTime format still.
(Defined by ModelStateExtensions)
ReadString Read a parameter from state, return its value
(Defined by ModelStateExtensions)
ReadTimeSpans Read a parameter from state, return its value
(Defined by ModelStateExtensions)
TryReadDouble Read a parameter from state, and if there, apply it.
(Defined by ModelStateExtensions)
Warning Warning while reading state
(Defined by ModelStateExtensions)

See Also