Click or drag to resize
IDfsuFile Interface
Interface for accessing data in a dfsu file.

Namespace: DHI.Generic.MikeZero.DFS.dfsu
Assembly: DHI.Generic.MikeZero.DFS (in DHI.Generic.MikeZero.DFS.dll) Version: 16.0.0.0 (11.1.1.1111)
Syntax
public interface IDfsuFile : IDfsFileIO, 
	IDisposable

The IDfsuFile type exposes the following members.

Properties
  NameDescription
Public propertyApplicationTitle
Title of application creating the file
Public propertyApplicationVersion
Version number of appliation creating the file.
Public propertyCode
Boundary code of node. 0 means not a boundary node.
Public propertyDeleteValueFloat
Delete (undefined/missing) value
Public propertyDfsuFileType
Type of dfsu file.
Public propertyElementIds
Id for each element. Usually starts from 1 and increases, but needs not to.
Public propertyElementTable
The ElementTable defines for each element which nodes that defines the element.

The numbers in the ElementTable are node numbers, not indices! Each value in the table are between 1 and number-of-nodes.

Public propertyElementType
Type of element.
Public propertyFileTitle
Title of file
Public propertyItemInfo
List of dynamic item info.
Public propertyNodeIds
Id for each node. Usually starts from 1 and increases, but needs not to.
Public propertyNumberOfElements
Number of elements in the mesh.
Public propertyNumberOfLayers
For files with a vertical dimension, returns the maximum number of layers.
Public propertyNumberOfNodes
Number of nodes in the mesh.
Public propertyNumberOfSigmaLayers
For files with a vertical dimension, returns the number of sigma layers.
Public propertyNumberOfTimeSteps
Number of time steps in the file
Public propertyProjection
Geographical projection.
Public propertyStartDateTime
Start date time of the file
Public propertyTimeStepInSeconds
Time step in seconds.
Public propertyX
X coordinates of nodes. Depending on the projection string, node coordinates are in meters or degrees.
Public propertyY
Y coordinates of nodes. Depending on the projection string, node coordinates are in meters or degrees.
Public propertyZ
Z coordinates of nodes. Unit is specified in ZUnit.
Public propertyZUnit
Unit of the z coordinate. The unit must be a length unit (convertable to meters).
Top
Methods
  NameDescription
Public methodClose
Close the file and release all ressources associated with it. The header information is still valid (for reading) even though the file has been closed.
(Inherited from IDfsFileIO.)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodFindItem
Positions the file pointer at the location in the file where the specified dynamic item at the specified time step starts.
(Inherited from IDfsFileIO.)
Public methodFindTimeStep
Positions the file pointer at the location in the file where the specified time step starts.
(Inherited from IDfsFileIO.)
Public methodFlush
Flush cached data to the file. This will especially update the header information, such that if another process is reading the file while it is being read, the new header information can be retrieved.
(Inherited from IDfsFileIO.)
Public methodFlushTimeStep
Flush cached data to the file. This will update the time part of the header information, but not other parts of the header.

Compared to the Flush method; the Flush will update statistics of all items (if enabled) and all modifications to the header data. This method will only update the time part. The Flush method can be an expensive operations especially for files with many dynamic items. This method is independent of the file at hand.

(Inherited from IDfsFileIO.)
Public methodReadItemTimeStep(Int32, Int32)
Reads the dynamic item-timestep as specified from the file. It throws an exception if itemNumber or timestepIndex is out of range.
(Inherited from IDfsFileIO.)
Public methodReadItemTimeStep(IDfsItemData, Int32)
Read the specified item and time step. With this you can reuse the data buffer in IDfsItemData, Data. The data is updated in place.

If the data from one timestep is to be saved for later, the user is responsible to copy the data before using this method again.

(Inherited from IDfsFileIO.)
Public methodReadItemTimeStepNext

Reads the next dynamic item-timestep. First time called it returns the first timestep of the first item. It cycles through each timestep, and each item in the timestep. For a file with 3 items, it returns (itemnumber, timestepIndex) in the following order: (1,0), (2,0), (3,0), (1,1), (2,1), (3,1), (1,2), etc.

If one of the ReadItemTimeStep is called with for example (1,4) the next call to this method will continue from there and return (2,4).

If one of the methods reading/writing static item data is called, the iterator is reset, and the next call to this method again returns the first item-timestep.

This is the most efficient way to iterate through all the items and timesteps in a file, since it iterates exactly as the data is stored on the disk.

(Inherited from IDfsFileIO.)
Public methodReset
Resets the file pointer to point on the first dynamic item time step in the file.

Can also be used if it is required to restart reading the static items.

(Inherited from IDfsFileIO.)
Public methodWriteItemTimeStep
Writes data to the specified item and timestep in the file.

If the item-timestep exists already, data is updated. If it does not exist, the item number and timestep index must match exactly the next item-timestep after the last one in the file.

The size of the data must match the data size of the item that is to be written.

The time value is only relevant for files with non-equidistant time axis. For files with an equidistant time axis, the time value is ignored, and a zero can be used.

(Inherited from IDfsFileIO.)
Public methodWriteItemTimeStepNext

Writes the next dynamic item-timestep.

If the file pointer points to the end of the file, this will append a new item-timestep to the file. If the file pointer points to an existing item-timestep, the data of that item-timestep is updated.

Remember that the file pointer position depends on the mode that the file was opened: In edit mode the file pointer points at the first item-timestep. In append mode the file pointer points initially at the end of file.

It iterates over the item-timesteps as the ReadItemTimeStepNext, see there for more details.

This is the most efficient way to iterate through and update/append the items and timesteps in a file, since it iterates exactly as the data is stored on the disk.

The size of the data must match the data size of the item that is to be written.

The time value is only relevant for files with non-equidistant time axis. For files with an equidistant time axis, the time value is ignored, and a zero can be used.

(Inherited from IDfsFileIO.)
Top
Extension Methods
  NameDescription
Public Extension MethodCalculateElementCenterCoordinates
For each element, calculates the element center coordinate as the average of all node coordinates of the nodes in each element.
(Defined by DfsuUtil.)
Public Extension MethodFindTopLayerElements
Find element indices (zero-based) of the elements being the upper-most element in its column.

Each column is identified by matching node id numbers. For 3D elements the last half of the node numbers of the bottom element must match the first half of the node numbers in the top element. For 2D vertical elements the order of the node numbers in the bottom element (last half number of nodes) are reversed compared to those in the top element (first half number of nodes).

(Defined by DfsuUtil.)
Public Extension MethodGetDateTimes
Return an array of DateTimes which are the times for each timestep
(Defined by DfsuUtil.)
Top
See Also