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

Module with data type and subroutines for writing FEDEM result files. More...

Data Types

type  rdbtype
 Data type for a binary result database file. More...
 
interface  writerdb
 Writes a result quantity to the specified results database file. More...
 

Functions/Subroutines

subroutine, public checkstepsize (rdb, nByteStep, ierr)
 Checks that the estimated number of bytes per time is correct. More...
 
subroutine, public nullifyrdb (rdb)
 Initializes a rdbmodule::rdbtype object. More...
 
subroutine, public openheaderfiles (prog, ierr, comment, mFile, mName)
 Opens the temporary header files and write the meta data section. More...
 
subroutine, public openrdbfile (rdb, ierr, fileName, fileTag)
 Opens a binary results database file. More...
 
subroutine copyheadertobinaryfile (ifile, nBytes)
 Copies contents of the temporary header files to the binary file. More...
 
subroutine, public writevardef (rdb, iVar, iFile, cId, cDim, cType, cComp1, cComp2, nBits)
 Writes a variable definition. More...
 
subroutine, public writeitgdef (rdb, itemGroup, iFile, cId)
 Writes the beginning of an item group definition. More...
 
subroutine, public writetimestepheader (rdb)
 Writes time step definition to the temporary header files. More...
 
subroutine, public writetimestepdb (rdb, iStep, time, ierr, openTmp)
 Writes current time step to the specified results database file. More...
 
subroutine writeboolvardb (rdb, var, ierr)
 Writes a bolean variable to the specified results database file. More...
 
subroutine writeintvardb (rdb, var, ierr)
 Writes an integer variable to the specified results database file. More...
 
subroutine writeintarraydb (rdb, array, ierr)
 Writes an integer array to the specified results database file. More...
 
subroutine writefloatarray1db (rdb, array, ierr, writeAsDouble)
 Writes a 1D float array to the specified results database file. More...
 
subroutine writefloatarray2db (rdb, array, ierr)
 Writes a 2D float array to the specified results database file. More...
 
subroutine writedoublevardb (rdb, var, ierr, writeAsDouble)
 Writes a double variable to the specified results database file. More...
 
subroutine writedoublearray1db (rdb, array, ierr, writeAsDouble)
 Writes a 1D double array to the specified results database file. More...
 
subroutine writedoublearray2db (rdb, array, ierr, writeAsDouble)
 Writes a 2D double array to the specified results database file. More...
 
subroutine, public flushrdbfile (rdb, ierr)
 Flushes the specified results database file to disk. More...
 
subroutine, public closerdbfile (rdb, ierr, retainIfEmpty, haveData)
 Closes the specified results database file. More...
 

Variables

integer, save, private incr = -1
 File increment number. More...
 
integer, save, public ivard = 65
 Temporary variable description file. More...
 
integer, save, public iitem = 66
 Temporary item group description file. More...
 
integer, save, public idatd = 67
 Temporary data description file. More...
 
real(sp), dimension(:), allocatable, save work
 For double-to-single casting. More...
 

Detailed Description

Module with data type and subroutines for writing FEDEM result files.

Function/Subroutine Documentation

◆ checkstepsize()

subroutine, public rdbmodule::checkstepsize ( type(rdbtype), intent(in)  rdb,
integer, intent(in)  nByteStep,
integer, intent(out)  ierr 
)

Checks that the estimated number of bytes per time is correct.

Parameters
[in]rdbThe result database file to consider
[in]nByteStepEstimated number of bytes per time step for this file
[out]ierrError flag

An error message is issued if the actual amount written per step does not match the estimated time step size.

Author
Knut Morten Okstad
Date
22 Mar 2001
Here is the caller graph for this function:

◆ closerdbfile()

subroutine, public rdbmodule::closerdbfile ( type(rdbtype), intent(inout)  rdb,
integer, intent(inout)  ierr,
logical, intent(in), optional  retainIfEmpty,
logical, intent(out), optional  haveData 
)

Closes the specified results database file.

Parameters
rdbThe result database file to close
ierrError flag
[in]retainIfEmptyIf present and .true., don't delete empty file
[out]haveDataIf present, set to .true. unless the file is empty

The file is deleted if it is empty when closed (i.e., no binary data has been written to it) unless retainIfEmpty is .true.

Author
Knut Morten Okstad
Date
20 Nov 2000
Here is the caller graph for this function:

◆ copyheadertobinaryfile()

subroutine rdbmodule::copyheadertobinaryfile ( integer, intent(in)  ifile,
integer, intent(inout)  nBytes 
)

Copies contents of the temporary header files to the binary file.

Parameters
[in]ifileFile handle (0-based index) for the binary file
nBytesNumber of bytes written to the file, negative on error
Author
Knut Morten Okstad
Date
27 Nov 2000
Here is the caller graph for this function:

◆ flushrdbfile()

subroutine, public rdbmodule::flushrdbfile ( type(rdbtype), intent(inout)  rdb,
integer, intent(inout)  ierr 
)

Flushes the specified results database file to disk.

Parameters
rdbThe result database file to flush
ierrError flag
Author
Knut Morten Okstad
Date
10 Jan 2003
Here is the caller graph for this function:

◆ nullifyrdb()

subroutine, public rdbmodule::nullifyrdb ( type(rdbtype), intent(out)  rdb)

Initializes a rdbmodule::rdbtype object.

Parameters
[out]rdbThe result database file to consider
Author
Knut Morten Okstad
Date
22 Mar 2001
Here is the caller graph for this function:

◆ openheaderfiles()

subroutine, public rdbmodule::openheaderfiles ( character(len=*), intent(in)  prog,
integer, intent(out)  ierr,
character(len=*), intent(in), optional  comment,
character(len=*), intent(in), optional  mFile,
character(len=*), intent(in), optional  mName 
)

Opens the temporary header files and write the meta data section.

Parameters
[in]progName of the program module that writes the file to open
[out]ierrError flag
[in]commentAdditional description to write in the meta data section
[in]mFileName of the model file to which the written file belong
[in]mNameName of the model to which the written file belong
Author
Knut Morten Okstad
Date
20 Nov 2000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openrdbfile()

subroutine, public rdbmodule::openrdbfile ( type(rdbtype), intent(inout)  rdb,
integer, intent(out)  ierr,
character*(*), intent(in), optional  fileName,
character*(*), intent(in), optional  fileTag 
)

Opens a binary results database file.

Parameters
[in]rdbThe result database file to open
[out]ierrError flag
[in]fileNameAbsolute path to the result database file
[in]fileTagTag to write in the first line identifying the file type
Author
Knut Morten Okstad
Date
27 Nov 2000
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeboolvardb()

subroutine rdbmodule::writeboolvardb ( type(rdbtype), intent(inout)  rdb,
logical, intent(in)  var,
integer, intent(inout)  ierr 
)

Writes a bolean variable to the specified results database file.

Parameters
rdbThe result database file to write to
[in]varThe variable value to write
ierrError flag
Author
Knut Morten Okstad
Date
16 Jun 2003

◆ writedoublearray1db()

subroutine rdbmodule::writedoublearray1db ( type(rdbtype), intent(inout)  rdb,
real(dp), dimension(:), intent(in)  array,
integer, intent(inout)  ierr,
logical, intent(in), optional  writeAsDouble 
)

Writes a 1D double array to the specified results database file.

Parameters
rdbThe result database file to write to
[in]arrayThe array to write
ierrError flag
[in]writeAsDoubleIf present and .true., write as 64-bit reals, otherwise cast to 32-bit reals
Author
Knut Morten Okstad
Date
6 Dec 2000

◆ writedoublearray2db()

subroutine rdbmodule::writedoublearray2db ( type(rdbtype), intent(inout)  rdb,
real(dp), dimension(:,:), intent(in)  array,
integer, intent(inout)  ierr,
logical, intent(in), optional  writeAsDouble 
)

Writes a 2D double array to the specified results database file.

Parameters
rdbThe result database file to write to
[in]arrayThe array to write
[in]writeAsDoubleIf present and .true., write as 64-bit reals, otherwise cast to 32-bit reals
ierrError flag
Author
Knut Morten Okstad
Date
6 Dec 2000

◆ writedoublevardb()

subroutine rdbmodule::writedoublevardb ( type(rdbtype), intent(inout)  rdb,
real(dp), intent(in)  var,
integer, intent(inout)  ierr,
logical, intent(in), optional  writeAsDouble 
)

Writes a double variable to the specified results database file.

Parameters
rdbThe result database file to write to
[in]varThe variable value to write
ierrError flag
[in]writeAsDoubleIf present and .true., write as 64-bit real, otherwise cast to 32-bit real
Author
Knut Morten Okstad
Date
6 Dec 2000

◆ writefloatarray1db()

subroutine rdbmodule::writefloatarray1db ( type(rdbtype), intent(inout)  rdb,
real(sp), dimension(:), intent(in)  array,
integer, intent(inout)  ierr,
logical, intent(in), optional  writeAsDouble 
)

Writes a 1D float array to the specified results database file.

Parameters
rdbThe result database file to write to
[in]arrayThe array to write
ierrError flag
[in]writeAsDoubleCurrently unused (gives warning)
Author
Knut Morten Okstad
Date
10 Jan 2003

◆ writefloatarray2db()

subroutine rdbmodule::writefloatarray2db ( type(rdbtype), intent(inout)  rdb,
real(sp), dimension(:,:), intent(in)  array,
integer, intent(inout)  ierr 
)

Writes a 2D float array to the specified results database file.

Parameters
rdbThe result database file to write to
[in]arrayThe array to write
ierrError flag
Author
Knut Morten Okstad
Date
10 Feb 2017

◆ writeintarraydb()

subroutine rdbmodule::writeintarraydb ( type(rdbtype), intent(inout)  rdb,
integer, dimension(:), intent(in)  array,
integer, intent(inout)  ierr 
)

Writes an integer array to the specified results database file.

Parameters
rdbThe result database file to write to
[in]arrayThe array to write
ierrError flag
Author
Knut Morten Okstad
Date
25 Oct 2008

◆ writeintvardb()

subroutine rdbmodule::writeintvardb ( type(rdbtype), intent(inout)  rdb,
integer, intent(in)  var,
integer, intent(inout)  ierr 
)
private

Writes an integer variable to the specified results database file.

Parameters
rdbThe result database file to write to
[in]varThe variable value to write
ierrError flag
Author
Knut Morten Okstad
Date
6 Dec 2000

◆ writeitgdef()

subroutine, public rdbmodule::writeitgdef ( type(rdbtype), intent(inout)  rdb,
integer, intent(inout)  itemGroup,
integer, intent(out)  iFile,
character(len=*), intent(in)  cId 
)

Writes the beginning of an item group definition.

Parameters
rdbThe result database file to write to
itemGroupItem group identifier (1-based index)
[out]iFileFile unit number for the item group definition, if zero, this item group definition has already been written
[in]cIdItem group description

This subroutine writes the beginning of an item group definition to the item group definition section of the results file header, and a reference to it in the data section.

Author
Knut Morten Okstad
Date
30 Apr 2002
Here is the caller graph for this function:

◆ writetimestepdb()

subroutine, public rdbmodule::writetimestepdb ( type(rdbtype), intent(inout)  rdb,
integer(i8), intent(in)  iStep,
real(dp), intent(in)  time,
integer, intent(out)  ierr,
logical, intent(in), optional  openTmp 
)

Writes current time step to the specified results database file.

Parameters
rdbThe result database file to write to
[in]iStepTime step number
[in]timeCurrent time
[out]ierrError flag
[in]openTmpIf present and .true., a temporary binary file is opened if the binary results database file is not opened yet
Author
Knut Morten Okstad
Date
20 Nov 2000
Here is the caller graph for this function:

◆ writetimestepheader()

subroutine, public rdbmodule::writetimestepheader ( type(rdbtype), intent(inout)  rdb)

Writes time step definition to the temporary header files.

Parameters
rdbThe result database file to write to
Author
Knut Morten Okstad
Date
10 Jan 2003
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writevardef()

subroutine, public rdbmodule::writevardef ( type(rdbtype), intent(inout)  rdb,
integer, intent(inout)  iVar,
integer, intent(in)  iFile,
character(len=*), intent(in)  cId,
character(len=*), intent(in), optional  cDim,
character(len=*), intent(in), optional  cType,
character(len=*), intent(in), optional  cComp1,
character(len=*), intent(in), optional  cComp2,
integer, intent(in), optional  nBits 
)

Writes a variable definition.

Parameters
rdbThe result database file to write to
iVarVariable identifier (1-based index)
[in]iFileFile unit number to write a reference to the variable to
[in]cIdVariable description
[in]cDimDimension of the variable
[in]cTypeType of the variable
[in]cComp1Description of first dimension components
[in]cComp2Description of second dimension components
[in]nBitsNumber of bits in each variable component (32 or 64)

This subroutine writes a variable definition to the variable definition section of the results file header, and optionally a reference to it in the item group- or data definition section.

Author
Knut Morten Okstad
Date
30 Apr 2002
Here is the caller graph for this function:

Variable Documentation

◆ idatd

integer, save, public rdbmodule::idatd = 67

Temporary data description file.

◆ iitem

integer, save, public rdbmodule::iitem = 66

Temporary item group description file.

◆ incr

integer, save, private rdbmodule::incr = -1
private

File increment number.

◆ ivard

integer, save, public rdbmodule::ivard = 65

Temporary variable description file.

◆ work

real(sp), dimension(:), allocatable, save rdbmodule::work
private

For double-to-single casting.