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 MatCopy;

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

    Module  MatCopy     (Version 1.0)

      Copyright (c) 1990-2006 by Olivier Roth, Andreas Fischlin and
      ETH Zurich.

    Purpose   Basic procedures for copying matrix parts
              or whole matrices to other matrices.

    Remarks   This module is part of the Mat-library, which forms
              part of the RAMSES package.


    Programming

      o Design
        Olivier Roth              23/04/1990

      o Implementation
        Olivier Roth              24/04/1990
        Andreas Fischlin          28/05/1993


    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:  03/07/2006  AF

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


  FROM SYSTEM IMPORT BYTE;
  FROM Matrices IMPORT Matrix, Cell, Selection;


  VAR
    selOneOne : Selection;      (* read only ! *)
    (* A predefined selection, which denotes the topmost and topleft cell
     * of a matrix, i.e. its first element. *)


  PROCEDURE AssignMatrix(VAR myMatrix: ARRAY OF BYTE; m,n: INTEGER;
                         VAR mat: Matrix);
  (*
    Assign the data structure myMatrix of type ARRAY [1..m,1..n] OF
    REAL, i.e. myMatrix is a  m by n  matrix with m rows and n
    columns, to the variable mat of opaque type Matrix. In case the
    matrix mat has not been declared yet, AssignMatrix will do it
    implicitely. myMatrix is VAR parameter only for speed-up
    reasons.
  *)

  PROCEDURE RetrieveMatrix(mat: Matrix;
                           VAR myMatrix: ARRAY OF BYTE; m,n: INTEGER);
  (*
    Retrieves from the variable mat of opaque type Matrix the data
    structure myMatrix of type ARRAY [1..m,1..n] OF REAL, i.e. myMatrix
    is a  m by n  matrix with m rows and n columns.
  *)


  PROCEDURE CopyMatrix( a: Matrix;  VAR b: Matrix );

  (* Copies the complete matrix a to matrix b. In case that matrix b
   * was not declared yet CopyMatrix implicitely declares the variable.
   * If the matrix b already existed its dimensions will be adjusted *)


  PROCEDURE SelWholeMat( m: Matrix; VAR sel: Selection );
  (* returns the complete matrix "m" selected *)


  PROCEDURE CopySelection( sourceMat: Matrix;  area: Selection;
                           destMat  : Matrix;  topLeft: Cell );

  PROCEDURE SwapSelections( mat1: Matrix;  area: Selection;
                            mat2: Matrix;  topLeft: Cell );


  PROCEDURE SwapRows( mat1: Matrix;  row1: INTEGER;
                      mat2: Matrix;  row2: INTEGER );

  PROCEDURE SwapCols( mat1: Matrix;  col1: INTEGER;
                      mat2: Matrix;  col2: INTEGER );


  PROCEDURE FillDown ( mat: Matrix;  area: Selection );
  PROCEDURE FillRight( mat: Matrix;  area: Selection );


END MatCopy.

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