![]() |
|
![]() |
(**
MODULE GroupData.
Allows usage of large amounts of data by writing streams of data
to a file, and combining the streams into groups so that the
elements may be retrieved or summed in streams and across groups.
**)
IMPORT ModSys;
CONST
ERROROK = 0;
ERRORNOMEMORY = 1;
ERRORCACHENOTOPEN = 2;
ERRORDATANOTDEFINED = 3;
ERRORDATAISREADONLY = 4;
ERRORDATAFILENOTFOUND = 5;
ERRORMAXNUMBEROFSTREAMSEXCEEDED = 6;
ERRORMAXNUMBEROFGROUPSEXCEEDED = 7;
ERRORMAXNUMBEROFSTREAMSPERGROUPEXCEEDED = 8;
ERRORINVALIDDATAFILE = 9;
ERRORCACHEDISKERROR = 10;
ERRORNOSTREAMSDEFINED = 11;
ERRORINVALIDGROUPNUMBER = 12;
ERRORINVALIDELEMENTNUMBER = 13;
TYPE
DEMode = (readWrite, (* allow reading and writing *)
readOnly, (* allow reading only *)
writeOnly); (* delete existing file *)
DPData;
PROCEDURE CloseData
(VAR Data : DPData;
CONST save : BOOLEAN);
(**
CloseData - closes the data file.
Closes the file associated with the handle 'data'.
CALLING SEQUENCE -
CloseData (data, save);
ENTRY -
data : DPData
A handle to the data file.
save : BOOLEAN
FALSE if the data file is to be deleted after closing.
*)
PROCEDURE DefineDataStream
(CONST Data : DPData;
CONST dataStream : ARRAY OF LONGREAL;
CONST Count : CARDINAL;
CONST Append : BOOLEAN);
(**
DefineDataStream - add another data stream to the data file 'data'.
Adds the values in dataStream to the data file
CALLING SEQUENCE -
DefineDataStream (data, dataStream, count, append);
ENTRY -
data : DPData
A handle to the data file
dataStream : ARRAY OF LONGREAL
An array of numbers to be added to the file
count : CARDINAL
The number of elements in 'dataStream'
append : BOOLEAN
TRUE if 'dataStream' is to added to the last defined stream.
FALSE if 'dataStream' is to be created as a new stream,
EXIT -
groupDataError : CARDINAL
Non-zero if an error occurred.
Use "GetGroupDataError" to retrieve the error status
*)
PROCEDURE DefineGroup
(CONST Data : DPData;
CONST groupList : ARRAY OF CARDINAL;
CONST Count : CARDINAL;
VAR groupHandle : CARDINAL);
(**
DefineGroup - define a group of data streams.
Defines a group, a collection of any previously declared data streams.
CALLING SEQUENCE -
DefineGroup (data, groupList, count, groupHandle);
ENTRY -
data : DPData
A handle to the data file
groupList : ARRAY OF CARDINAL
An array of the stream indexes to be included in the
group. The first defined stream has an index of 1
count : CARDINAL
The number of indexes in groupList
EXIT -
groupHandle : CARDINAL
A number specifying the group number assigned to the
specified group. This should return a 1 on the first
defined group.
groupDataError : CARDINAL
Non-zero if an error occurred.
Use "GetGroupDataError" to retrieve the error status
*)
PROCEDURE DeleteAllGroups
(CONST Data : DPData);
(**
DeleteGroup - define a group of data streams.
Removes all previously defined data streams.
CALLING SEQUENCE -
DefineGroup (data);
ENTRY -
data : DPData
A handle to the data file
EXIT -
groupDataError : CARDINAL
Non-zero if an error occurred.
Use "GetGroupDataError" to retrieve the error status
*)
PROCEDURE GetGroupDataError
(CONST Data : DPData) : CARDINAL;
(**
GetGroupDataError - Get the error status and set it to GroupData.ERROROK.
This procedure gets and returns the current error status of GroupData.
In addition it sets the GroupData's error status to GroupData.ERROROK.
CALLING SEQUENCE -
error := GetGroupDataError (data);
ENTRY -
data : DPData
A handle to the data file
EXIT -
error : CARDINAL
The current error status of SGK.
The GroupData's error status is set to GroupData.ERROROK.
*)
PROCEDURE GetDataElement
(CONST Data : DPData;
CONST GroupNumber : CARDINAL;
CONST streamNumber : CARDINAL;
CONST ElementNumber : CARDINAL) : ModSys.FLOAT64;
(**
GetDataElement - get a data element from a data file.
Allows access to the defined streams in a data file via the group number,
the stream index in that group, and the element index in that stream.
Streams must have already been defined, and assigned to the group being
accessed.
CALLING SEQUENCE -
dataElement := GetDataElement (data,
groupNumber,
streamNumber,
elementNumber);
ENTRY -
data : DPData
A handle to a data file
groupNumber : CARDINAL
The index of the group
streamNumber : CARDINAL
The index of the stream in the group
elementNumber : CARDINAL
The index of the element in the stream
EXIT -
dataElement : ModSys.FLOAT64
The specified element
*)
PROCEDURE GetMaxNumberOfElementsInGroup
(CONST Data : DPData;
CONST GroupNumber : CARDINAL;
VAR maxNumberOfElements : CARDINAL);
(**
GetMaxNumberOfElementsInGroup - get the number of elements in the group.
Get the number of elements in the largest stream of a group.
CALLING SEQUENCE -
GetMaxNumberOfElementsInGroup (data, groupNumber, maxNumberOfElements);
ENTRY -
data : DPData
A handle to the data file
groupNumber : CARDINAL
The number assigned to the group in defineGroup
EXIT -
maxNumberOfElements : CARDINAL
The number of elements in the largest stream in a group
*)
PROCEDURE GetNumberOfDataStreamsInGroup
(CONST Data : DPData;
CONST GroupNumber : CARDINAL;
VAR numberOfDataStreams : CARDINAL);
(**
GetNumberOfDataStreamsInGroup - get the number of data streams in a group.
CALLING SEQUENCE -
GetNumberOfDataStreamsInGroup (data, groupNumber, numberOfDataStreams);
ENTRY -
data : DPData
A handle to the data file
groupNumber : CARDINAL
The number assigned to the group in defineGroup
EXIT -
numberOfDataStreams : CARDINAL
The number of data streams in the group
*)
PROCEDURE GetNumberOfDefinedDataStreams
(CONST Data : DPData;
VAR numberOfDataStreams : CARDINAL);
(**
GetNumberOfDefinedDataStreams - get the number of defined data streams.
CALLING SEQUENCE -
GetNumberOfDefinedDataStreams (data, numberOfDataStreams);
ENTRY -
data : DPData
A handle to the data file
EXIT -
numberOfDataStreams : CARDINAL
The number of streams in the data file
*)
PROCEDURE GetNumberOfDefinedGroups
(CONST Data : DPData;
VAR numberOfGroups : CARDINAL);
(**
GetNumberOfDefinedGroups - get the number of defined groups.
CALLING SEQUENCE -
GetNumberOfDefinedGroups (data, numberOfGroups);
ENTRY -
data : DPData
A handle to the data file
EXIT -
numberOfGroups : CARDINAL
The number of groups in the data file
*)
PROCEDURE GetStorageLimits
(VAR MaxNumberOfGroups : CARDINAL;
VAR maxNumberOfStreams : CARDINAL;
VAR maxNumberOfStreamsPerGroup : CARDINAL);
(**
GetStorageLimits - get the capacities of the groupData storage.
CALLING SEQUENCE -
GetStorageLimits (maxNumberOfGroups,
maxNumberOfStreams,
maxNumberOfStreamsPerGroup);
EXIT -
maxNumberOfGroups : CARDINAL
The maximum allowable groups
maxNumberOfStreams : CARDINAL
The maximum allowable streams
maxNumberOfStreamsPerGroup : CARDINAL
The maximum allowable streams per group
*)
PROCEDURE OpenData
(VAR Data : DPData;
CONST FileName : ARRAY OF CHAR;
CONST mode : DEMode);
(**
OpenData - Opens the data file 'fileName' for use with the GroupData routines.
Opens the data file under the mode 'mode' which can be either 'readWrite' or
'readOnly'. This command must be executed beforee any other routine in this
package can be used.
CALLING SEQUENCE -
OpenData (data, fileName, mode);
ENTRY -
fileName : ARRAY OF CHAR
A valid dos filename naming the desired file. The file will
be created if mode = readWrite. An error will be returned
if mode=readOnly and fileName does not exist. An error
will be returned if fileName does exist but is not in the
proper format.
mode : DEMode
The mode (readWrite or readOnly) in which the file to be opened.
EXIT -
data : DPData
A handle to the data file.
groupDataError : CARDINAL
Non-zero if an error occurred.
Use "GetGroupDataError" to retrieve the error status
*)
PROCEDURE SetStorageLimits
(CONST MaxNumberOfGroups : CARDINAL;
CONST maxNumberOfStreams : CARDINAL;
CONST maxNumberOfStreamsPerGroup : CARDINAL);
(**
SetStorageLimits - set the capacities of the groupData storage.
CALLING SEQUENCE -
SetStorageLimits (maxNumberOfGroups,
maxNumberOfStreams,
maxNumberOfStreamsPerGroup);
ENTRY -
maxNumberOfGroups : CARDINAL
The number of groups to be allowed
maxNumberOfStreams : CARDINAL
The number of streams to be allowed
maxNumberOfStreamsPerGroup : CARDINAL
The number of streams per group to be allowed
*)
PROCEDURE SumGroupElements
(CONST Data : DPData;
CONST GroupNumber : CARDINAL;
CONST startIndex : CARDINAL;
CONST endIndex : CARDINAL;
VAR Sum : ModSys.FLOAT64);
(**
SumGroupElements - sum the elements across streams in a group.
Adds all numbers in all streams in group 'groupNumber' with element indexes
between 'startIndex' and 'endIndex'
CALLING SEQUENCE -
SumGroupElements (data,
groupNumber,
startIndex,
endIndex,
sum);
ENTRY -
data : DPData
A handle to the data file
groupNumber : CARDINAL
The group number to be used
startIndex : CARDINAL
The starting index of the elements to be added
endIndex : CARDINAL
The ending index of the elements to be added
EXIT -
sum : LONGREAL
The sum of the elements
*)
PROCEDURE SumGroupStream
(CONST Data : DPData;
CONST GroupNumber : CARDINAL;
CONST streamNumber : CARDINAL;
CONST startIndex : CARDINAL;
CONST endIndex : CARDINAL;
VAR Sum : ModSys.FLOAT64);
(**
SumGroupStream - sums elements in one stream.
CALLING SEQUENCE -
SumGroupStream (data,
groupNumber,
streamNumber,
startIndex,
endIndex,
sum);
ENTRY -
data : DPData
A handle to the data file
groupNumber : CARDINAL
The group number containing the stream to be summed
streamNumber : CARDINAL
The stream number containing the elements to be summed
startIndex : CARDINAL
The starting index of the elements to be summed
endIndex : CARDINAL
The ending index of the elements to be summed
EXIT -
sum : LONGREAL
The sum of the elements
*)
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance