FEDEM Solver  R8.0
Source code of the dynamics solver
Data Types | Functions/Subroutines | Variables
diskmatrixmodule Module Reference

Module for general rectangular matrices with disk storage,. More...

Data Types

type  diskmatrixtype
 Data type representing a rectangular matrix with disk storage. More...
 

Functions/Subroutines

integer function dmgetswapsize (n1, n2, autoRamSizeRatio)
 Returns requested size of one swap section from command-line option. More...
 
subroutine dmnullify (this)
 Initializes a disk matrix object. More...
 
subroutine dmwrite (this, lpu, name)
 Writes out the content of a disk matrix. More...
 
subroutine dmopen (this, fileName, fileChkSum, nRows, nCols, status, err, nColSwap, swapSize, wantTag)
 Opens a disk matrix file for Read/Write or ReadOnly operations. More...
 
subroutine dmsetreadonly (this, err, isReadOnly)
 Toggles between Read/Write and ReadOnly. More...
 
integer(i8) function dmsize (this, iDim)
 Returns the size of the given disk matrix. More...
 
subroutine dmclose (this, err)
 Closes the disk matrix file and releases the associated swap array. More...
 
subroutine, private dmgetaddress (this, rInd, cInd, section, index, err)
 Gets swap section number and local array index for matrix element. More...
 
subroutine, private dmswap (this, newSection, err)
 Writes current section to disk and reads a new one into core. More...
 
subroutine, private dmsingledoublecast (this, ielSwap, nelSwap, toSingle)
 Casts the in-core matrix elements to/from single precision. More...
 
subroutine dmsetvalue (this, value, rInd, cInd, err)
 Assigns a value to a matrix element. More...
 
real(dp) function dmgetvalue (this, rInd, cInd, err)
 Returns the value of a matrix element. More...
 
real(dp) function, dimension(:,:), pointer dmgetswapsecptr (this, cInd, err)
 Returns a pointer to a matrix containing a swap section. More...
 
real(dp) function, dimension(:), pointer dmgetcolptr (this, cInd, err)
 Returns a pointer to column cInd of the given disk matrix. More...
 
subroutine dmgetcol (this, cInd, col, err)
 Gets a column of the given disk matrix. More...
 
subroutine dmgetrow (this, rInd, row, err)
 Gets a row of the given disk matrix. More...
 
subroutine dmmattimesvec (this, xVec, yVec, err, doInitialize)
 Multiplies a disk matrix with a given vector. More...
 
subroutine dmmattranstimesvec (this, xVec, yVec, err)
 Multiplies the transpose of a disk matrix with a given vector. More...
 
subroutine dmfindabsmaxrowvalues (this, maxRowVal, err)
 Finds the absolute maximum value for each row in a disk matrix. More...
 

Variables

integer, parameter dmold_p = 0
 ReadOnly matrix. More...
 
integer, parameter dmnsp_p = 1
 Write matrix in single precision. More...
 
integer, parameter dmndp_p = 2
 Write matrix in double precision. More...
 

Detailed Description

Module for general rectangular matrices with disk storage,.

This module contains a data type and associated utility routines for representing a general rectangular matrix stored on a disk file. The matrix is stored column-wise on disk and it is therefore adviced to access the matrix in a column-wise fashion to obtain optimal speed.

Note
All data members of diskmatrixmodule::diskmatrixtype are private and can therefore be accessed only through the subroutines/functions contained in this module.

Function/Subroutine Documentation

◆ dmclose()

subroutine diskmatrixmodule::dmclose ( type(diskmatrixtype), intent(inout)  this,
integer, intent(out)  err 
)

Closes the disk matrix file and releases the associated swap array.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to close
[out]errError indicator
Author
Knut Morten Okstad
Date
1 Dec 2000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmfindabsmaxrowvalues()

subroutine diskmatrixmodule::dmfindabsmaxrowvalues ( type(diskmatrixtype), intent(inout)  this,
real(dp), dimension(:), intent(out)  maxRowVal,
integer, intent(out)  err 
)

Finds the absolute maximum value for each row in a disk matrix.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to address
[out]maxRowValAbsolute maximum row values
[out]errError indicator
Author
Bjorn Haugen
Date
25 Mar 2003
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmgetaddress()

subroutine, private diskmatrixmodule::dmgetaddress ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  rInd,
integer, intent(in)  cInd,
integer, intent(out)  section,
integer, intent(out)  index,
integer, intent(out)  err 
)
private

Gets swap section number and local array index for matrix element.

Parameters
[in]thisThe diskmatrixmodule::diskmatrixtype object to address
[in]rIndRow index of matrix element to get address of
[in]cIndColumn index of matrix element to get address of
[out]sectionIndex of swap section containing the matrix element
[out]indexArray index within that swap section for matrix element
[out]errError indicator
Author
Bjorn Haugen
Date
10 Feb 1999
Here is the caller graph for this function:

◆ dmgetcol()

subroutine diskmatrixmodule::dmgetcol ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  cInd,
real(dp), dimension(:), intent(out)  col,
integer, intent(out)  err 
)

Gets a column of the given disk matrix.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to return for
[in]cIndColumn index to return for
[out]colContent of the matrix column
[out]errError indicator
Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:

◆ dmgetcolptr()

real(dp) function, dimension(:), pointer diskmatrixmodule::dmgetcolptr ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  cInd,
integer, intent(out)  err 
)

Returns a pointer to column cInd of the given disk matrix.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to return for
[in]cIndColumn index to return pointer for
[out]errError indicator
Note
This function circumvents all protection and should be used with extreme caution and only for ReadOnly purposes when speed is essential. Calls to other dm... routines can also change the contents of the memory being pointed to.
Author
Bjorn Haugen and Karl Erik Thoresen
Date
5 May 1999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmgetrow()

subroutine diskmatrixmodule::dmgetrow ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  rInd,
real(dp), dimension(:), intent(out)  row,
integer, intent(out)  err 
)

Gets a row of the given disk matrix.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to return for
[in]rIndRow index to return for
[out]rowContent of the matrix row
[out]errError indicator
Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:

◆ dmgetswapsecptr()

real(dp) function, dimension(:,:), pointer diskmatrixmodule::dmgetswapsecptr ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  cInd,
integer, intent(out)  err 
)

Returns a pointer to a matrix containing a swap section.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to return for
[in]cIndColumn index for start of swap section to return for
[out]errError indicator

The pointer to the entire swap section starting at column cInd of the given disk matrix. The function can be used for speedy random access of the matrix elements.

Author
Knut Morten Okstad
Date
13 Sep 2004
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmgetswapsize()

integer function diskmatrixmodule::dmgetswapsize ( integer, intent(in), optional  n1,
integer, intent(in), optional  n2,
real(sp), intent(in), optional  autoRamSizeRatio 
)

Returns requested size of one swap section from command-line option.

Parameters
[in]n1Optional number of matrix rows (for note message only)
[in]n2Optional number of matrix columns (for note message only)
[in]autoRamSizeRatioIf present and .true., compute max swap size based on currently available physical memory
Author
Knut Morten Okstad
Date
31 Jan 2002
Here is the caller graph for this function:

◆ dmgetvalue()

real(dp) function diskmatrixmodule::dmgetvalue ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  rInd,
integer, intent(in)  cInd,
integer, intent(out)  err 
)

Returns the value of a matrix element.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to return for
[in]rIndRow index of matrix element to return
[in]cIndColumn index of matrix element to return
[out]errError indicator
Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:

◆ dmmattimesvec()

subroutine diskmatrixmodule::dmmattimesvec ( type(diskmatrixtype), intent(inout)  this,
real(dp), dimension(:), intent(in)  xVec,
real(dp), dimension(:), intent(inout)  yVec,
integer, intent(out)  err,
logical, intent(in), optional  doInitialize 
)

Multiplies a disk matrix with a given vector.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object (A) to multiply
[in]xVecThe vector (x) to multiply matrix A with
yVecThe resulting vector (y)
[out]errError indicator
[in]doInitializeIf not present or .true., the existing content of yVec is discarded

One of of the following operations are performed y = A*x y = y + A*x depending on the value of doInitialize.

Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmmattranstimesvec()

subroutine diskmatrixmodule::dmmattranstimesvec ( type(diskmatrixtype), intent(inout)  this,
real(dp), dimension(:), intent(in)  xVec,
real(dp), dimension(:), intent(out)  yVec,
integer, intent(out)  err 
)

Multiplies the transpose of a disk matrix with a given vector.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object (A) to multiply
[in]xVecThe vector (x) to multiply matrix A with
yVecThe resulting vector (y)
[out]errError indicator

The following operation is performed y = A^t*x

Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:

◆ dmnullify()

subroutine diskmatrixmodule::dmnullify ( type(diskmatrixtype), intent(out)  this)

Initializes a disk matrix object.

Parameters
[out]thisThe diskmatrixmodule::diskmatrixtype object to be initialized
Author
Knut Morten Okstad
Date
14 Feb 2002
Here is the caller graph for this function:

◆ dmopen()

subroutine diskmatrixmodule::dmopen ( type(diskmatrixtype), intent(out)  this,
character(len=*), intent(in)  fileName,
integer, intent(inout)  fileChkSum,
integer, intent(in)  nRows,
integer, intent(in)  nCols,
integer, intent(in)  status,
integer, intent(out)  err,
integer, intent(in), optional  nColSwap,
integer, intent(in), optional  swapSize,
character(len=*), intent(in), optional  wantTag 
)

Opens a disk matrix file for Read/Write or ReadOnly operations.

Parameters
[out]thisThe diskmatrixmodule::diskmatrixtype object to open
[in]fileNameName of file to read/write matrix content from/to
fileChkSumCheck-sum value of the FE part associated with this
[in]nRowsNumber of matrix rows
[in]nColsNumber of matrix columns
[in]statusFile opening mode, either diskmatrixmodule::dmold_p, diskmatrixmodule::dmnsp_p or diskmatrixmodule::dmndp_p
[out]errError indicator
[in]nColSwapOptional number of matrix columns per swap section
[in]swapSizeOptional size of swap section in double precision words
[in]wantTagExpected file tag for ReadOnly matrices
Author
Knut Morten Okstad
Date
1 Jun 2001
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmsetreadonly()

subroutine diskmatrixmodule::dmsetreadonly ( type(diskmatrixtype), intent(inout)  this,
integer, intent(out)  err,
logical, intent(in), optional  isReadOnly 
)

Toggles between Read/Write and ReadOnly.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to toggle for
[out]errError indicator
[in]isReadOnlyIf present and .false., switch to ReadWrite, otherwise toggle to ReadOnly

If switching to ReadOnly, the present in-core section is first written to file.

Author
Knut Morten Okstad
Date
1 Dec 2000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmsetvalue()

subroutine diskmatrixmodule::dmsetvalue ( type(diskmatrixtype), intent(inout)  this,
real(dp), intent(in)  value,
integer, intent(in)  rInd,
integer, intent(in)  cInd,
integer, intent(out)  err 
)

Assigns a value to a matrix element.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to assign
[in]valueThe value to be assigned
[in]rIndRow index of matrix element to assign
[in]cIndColumn index of matrix element to assign
[out]errError indicator
Author
Bjorn Haugen
Date
10 Feb 1999
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmsingledoublecast()

subroutine, private diskmatrixmodule::dmsingledoublecast ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  ielSwap,
integer, intent(in)  nelSwap,
logical, intent(in)  toSingle 
)
private

Casts the in-core matrix elements to/from single precision.

Parameters
thisThe diskmatrixmodule::diskmatrixtype object to cast for
[in]ielSwapIndex to first element in swap section
[in]nelSwapNumber of elements in swap section to cast for
[in]toSingleIf .true., cast from double to single precision, otherwise from single to double precision

It is assumed that the single-precision buffer array diskmatrixmodule::diskmatrixtype::vals is not larger than one column.

Author
Knut Morten Okstad
Date
19 May 2005
Here is the caller graph for this function:

◆ dmsize()

integer(i8) function diskmatrixmodule::dmsize ( type(diskmatrixtype), intent(in)  this,
integer, intent(in), optional  iDim 
)

Returns the size of the given disk matrix.

Parameters
[in]thisThe diskmatrixmodule::diskmatrixtype object to get size of
[in]iDimWhich size parameter to return:
  • if not present, return the total size (nrows×ncols)
  • 1: number of matrix rows (nrows)
  • 2: number of matrix columns (ncols)
  • for any other value: return the number of columns in swap array
Author
Bjorn Haugen
Date
29 Jan 1999
Here is the caller graph for this function:

◆ dmswap()

subroutine, private diskmatrixmodule::dmswap ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  newSection,
integer, intent(out)  err 
)
private

Writes current section to disk and reads a new one into core.

Parameters
[in]thisThe diskmatrixmodule::diskmatrixtype object to swap for
[in]newSectionIndex of the swap section to read into core
[out]errError indicator
Author
Knut Morten Okstad
Date
1 Dec 2000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dmwrite()

subroutine diskmatrixmodule::dmwrite ( type(diskmatrixtype), intent(inout)  this,
integer, intent(in)  lpu,
character(len=*), intent(in)  name 
)

Writes out the content of a disk matrix.

Parameters
[in]thisThe diskmatrixmodule::diskmatrixtype object to write out
[in]lpuFile unit number to write to
[in]nameMatrix identifier
Author
Knut Morten Okstad
Date
18 Mar 2003
Here is the caller graph for this function:

Variable Documentation

◆ dmndp_p

integer, parameter diskmatrixmodule::dmndp_p = 2

Write matrix in double precision.

◆ dmnsp_p

integer, parameter diskmatrixmodule::dmnsp_p = 1

Write matrix in single precision.

◆ dmold_p

integer, parameter diskmatrixmodule::dmold_p = 0

ReadOnly matrix.