Sage-ST ä

Groupdata

Documentation

Global Declarations (Constants, Types, Variables)
CloseData DefineDataStream DefineGroup
DeleteAllGroups GetDataElement GetGroupDataError GetMaxNumberOfElementsInGroup
GetNumberOfDataStreamsInGroup GetNumberOfDefinedDataStreams GetNumberOfDefinedGroups GetStorageLimits
OpenData STROpenData SetStorageLimits SumGroupElements
SumGroupStream





  //*
  //  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.
  //*
  //

  uses
    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 = pointer;




  procedure CloseData
             (var   Data : DPData;
              const save : boolean); stdcall;

  exports CloseData name 'GroupData_CloseData';

  //*
  //  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 ModSys.FLOAT64;
              const Count      : cardinal;
              const Append     : boolean); stdcall;

  exports DefineDataStream name 'GroupData_DefineDataStream';

  //*
  //  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 ModSys.FLOAT64
  //      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); stdcall;

  exports DefineGroup name 'GroupData_DefineGroup';

  //*
  //  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); stdcall;

  exports DeleteAllGroups name 'GroupData_DeleteAllGroups';

  //*
  //  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
  //




  function GetGroupDataError
             (const Data : DPData) : cardinal; stdcall;

  exports GetGroupDataError name 'GroupData_GetGroupDataError';

  //*
  //  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.
  //




  function GetDataElement
             (const Data          : DPData;
              const GroupNumber   : cardinal;
              const streamNumber  : cardinal;
              const ElementNumber : cardinal) : ModSys.FLOAT64; stdcall;

  exports GetDataElement name 'GroupData_GetDataElement';

  //*
  //  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); stdcall;

  exports GetMaxNumberOfElementsInGroup name 'GroupData_GetMaxNumberOfElementsInGroup';

  //*
  //  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); stdcall;

  exports GetNumberOfDataStreamsInGroup name 'GroupData_GetNumberOfDataStreamsInGroup';

  //*
  //  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); stdcall;

  exports GetNumberOfDefinedDataStreams name 'GroupData_GetNumberOfDefinedDataStreams';

  //*
  //  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); stdcall;

  exports GetNumberOfDefinedGroups name 'GroupData_GetNumberOfDefinedGroups';

  //*
  //  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); stdcall;

  exports GetStorageLimits name 'GroupData_GetStorageLimits';

  //*
  //  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); overload; stdcall;

  exports OpenData (var   Data     : DPData;
                    const FileName : array of char;
                    const mode     : DEMode) name 'GroupData_OpenData';

  //*
  //  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 OpenData
             (var   Data     : DPData;
              const FileName : string;
              const mode     : DEMode); overload; stdcall;

  exports OpenData (var   Data     : DPData;
                    const FileName : string;
                    const mode     : DEMode) name 'GroupData_STROpenData';

  //*
  //  STROpenData - See documentation of OpenData.
  //




  procedure SetStorageLimits
             (const MaxNumberOfGroups          : cardinal;
              const maxNumberOfStreams         : cardinal;
              const maxNumberOfStreamsPerGroup : cardinal); stdcall;

  exports SetStorageLimits name 'GroupData_SetStorageLimits';

  //*
  //  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); stdcall;

  exports SumGroupElements name 'GroupData_SumGroupElements';

  //*
  //  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 : ModSys.FLOAT64
  //      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); stdcall;

  exports SumGroupStream name 'GroupData_SumGroupStream';

  //*
  //  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 : ModSys.FLOAT64
  //      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