FEDEM Solver
R8.0
Source code of the dynamics solver
|
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... | |
Module with data type and subroutines for writing FEDEM result files.
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.
[in] | rdb | The result database file to consider |
[in] | nByteStep | Estimated number of bytes per time step for this file |
[out] | ierr | Error flag |
An error message is issued if the actual amount written per step does not match the estimated time step size.
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.
rdb | The result database file to close | |
ierr | Error flag | |
[in] | retainIfEmpty | If present and .true., don't delete empty file |
[out] | haveData | If 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.
subroutine rdbmodule::copyheadertobinaryfile | ( | integer, intent(in) | ifile, |
integer, intent(inout) | nBytes | ||
) |
Copies contents of the temporary header files to the binary file.
[in] | ifile | File handle (0-based index) for the binary file |
nBytes | Number of bytes written to the file, negative on error |
subroutine, public rdbmodule::flushrdbfile | ( | type(rdbtype), intent(inout) | rdb, |
integer, intent(inout) | ierr | ||
) |
Flushes the specified results database file to disk.
rdb | The result database file to flush |
ierr | Error flag |
subroutine, public rdbmodule::nullifyrdb | ( | type(rdbtype), intent(out) | rdb | ) |
Initializes a rdbmodule::rdbtype object.
[out] | rdb | The result database file to consider |
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.
[in] | prog | Name of the program module that writes the file to open |
[out] | ierr | Error flag |
[in] | comment | Additional description to write in the meta data section |
[in] | mFile | Name of the model file to which the written file belong |
[in] | mName | Name of the model to which the written file belong |
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.
[in] | rdb | The result database file to open |
[out] | ierr | Error flag |
[in] | fileName | Absolute path to the result database file |
[in] | fileTag | Tag to write in the first line identifying the file type |
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.
rdb | The result database file to write to | |
[in] | var | The variable value to write |
ierr | Error flag |
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.
rdb | The result database file to write to | |
[in] | array | The array to write |
ierr | Error flag | |
[in] | writeAsDouble | If present and .true., write as 64-bit reals, otherwise cast to 32-bit reals |
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.
rdb | The result database file to write to | |
[in] | array | The array to write |
[in] | writeAsDouble | If present and .true., write as 64-bit reals, otherwise cast to 32-bit reals |
ierr | Error flag |
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.
rdb | The result database file to write to | |
[in] | var | The variable value to write |
ierr | Error flag | |
[in] | writeAsDouble | If present and .true., write as 64-bit real, otherwise cast to 32-bit real |
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.
rdb | The result database file to write to | |
[in] | array | The array to write |
ierr | Error flag | |
[in] | writeAsDouble | Currently unused (gives warning) |
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.
rdb | The result database file to write to | |
[in] | array | The array to write |
ierr | Error flag |
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.
rdb | The result database file to write to | |
[in] | array | The array to write |
ierr | Error flag |
|
private |
Writes an integer variable to the specified results database file.
rdb | The result database file to write to | |
[in] | var | The variable value to write |
ierr | Error flag |
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.
rdb | The result database file to write to | |
itemGroup | Item group identifier (1-based index) | |
[out] | iFile | File unit number for the item group definition, if zero, this item group definition has already been written |
[in] | cId | Item 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.
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.
rdb | The result database file to write to | |
[in] | iStep | Time step number |
[in] | time | Current time |
[out] | ierr | Error flag |
[in] | openTmp | If present and .true., a temporary binary file is opened if the binary results database file is not opened yet |
subroutine, public rdbmodule::writetimestepheader | ( | type(rdbtype), intent(inout) | rdb | ) |
Writes time step definition to the temporary header files.
rdb | The result database file to write to |
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.
rdb | The result database file to write to | |
iVar | Variable identifier (1-based index) | |
[in] | iFile | File unit number to write a reference to the variable to |
[in] | cId | Variable description |
[in] | cDim | Dimension of the variable |
[in] | cType | Type of the variable |
[in] | cComp1 | Description of first dimension components |
[in] | cComp2 | Description of second dimension components |
[in] | nBits | Number 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.
integer, save, public rdbmodule::idatd = 67 |
Temporary data description file.
integer, save, public rdbmodule::iitem = 66 |
Temporary item group description file.
|
private |
File increment number.
integer, save, public rdbmodule::ivard = 65 |
Temporary variable description file.
|
private |
For double-to-single casting.