ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE LgMatIO;

  (*******************************************************************

    Module  LgMatIO     (Version 1.0)

      Copyright (c) 1998-2006 by Dimitrios Gyalistras and ETH Zurich.

    Purpose   File input/output of double precision matrix objects  
              (large matrices, more than 4k x 4k elements). 

    Remarks   This module is part of the package LgMatrices.


    Programming

      o Design
        Dimitrios Gyalistras      23/07/1998

      o Implementation
        Dimitrios Gyalistras      23/07/1998


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  24/05/2002  AF

  *******************************************************************)


  FROM DMFiles IMPORT TextFile;
  IMPORT Errors;
  FROM LgMatrices IMPORT LMatrix;


  (**************************************)
  (*#####   General Declarations   #####*)
  (**************************************)

  CONST  (* result codes returned *)
    allOk   = Errors.allOk;
    notDone = Errors.onlyAnInsert;

  TYPE
    ProgressReportP  = PROCEDURE();

    AtReadDataPointP = PROCEDURE( INTEGER,           (* the row read *)
                                  INTEGER,           (* the colum read *)
                                  VAR LONGREAL,      (* the data point read *)
                                  VAR ARRAY OF CHAR  (* error text passed on by client *)
                                ): BOOLEAN;          (* if false, reading stops *)


  (*********************)
  (*#####   I/O   #####*)
  (*********************)

  PROCEDURE ReadMatrix( inFName        : ARRAY OF CHAR;
                        tryOpenFile    : BOOLEAN;
                        keepFileOpen   : BOOLEAN;
                        readTransposed : BOOLEAN;
                        VAR mat        : LMatrix;
                        VAR eof        : BOOLEAN;
                        VAR resCode    : INTEGER;
                        VAR errTxt     : ARRAY OF CHAR );


  PROCEDURE WriteMatrix( VAR outF     : TextFile;
                         mat          : LMatrix;
                         wrTransposed : BOOLEAN;
                         VAR resCode  : INTEGER;
                         VAR errTxt   : ARRAY OF CHAR );


  (***********************************)
  (*#####   Control of output   #####*)
  (***********************************)


  PROCEDURE SetOutputRows(     frstRow, lastRow: INTEGER );
  PROCEDURE GetOutputRows( VAR frstRow, lastRow: INTEGER );

  PROCEDURE SetOutputColumns(     frstCol, lastCol: INTEGER );
  PROCEDURE GetOutputColumns( VAR frstCol, lastCol: INTEGER );


  PROCEDURE SetMatrixOutputParams( noDataStr  : ARRAY OF CHAR;
                                   sciFormat  : BOOLEAN;    (* if TRUE use scientific format, e.g. -1.23E+04  *)
                                   nOutChars  : INTEGER;    (* number of characters per number *)
                                   nDecDigits : INTEGER );  (* number of decimal digits *)

  PROCEDURE GetMatrixOutputParams( VAR noDataStr  : ARRAY OF CHAR;
                                   VAR sciFormat  : BOOLEAN;
                                   VAR nOutChars  : INTEGER;
                                   VAR nDecDigits : INTEGER );


  TYPE
    OutputDataType = ( longReal, longInt );


  PROCEDURE SetColOutputDataType( colNr    : INTEGER;
                                  dataType : OutputDataType );

  PROCEDURE ColOutputDataType( colNr : INTEGER ): OutputDataType;


  (**********************************)
  (*#####   Run-time control   #####*)
  (**********************************)

  PROCEDURE InstallProgressReportP ( prp  : ProgressReportP );

  PROCEDURE InstallAtReadDataPointP( ardp : AtReadDataPointP );


END LgMatIO.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]