NuMFor 9f2ab49 (2024-04-08)
Numerical (Modern) Fortran. Library for Simple Numerical computing
save_array Interface Reference

save_array Stores an 1D or 2D array to file or stdout More...

Public Member Functions

subroutine save_array1d (x, ncols, fname, fmt, header, unit)
 
subroutine save_array2d (x, fname, fmt, header, unit)
 

Detailed Description

save_array Stores an 1D or 2D array to file or stdout

Examples:

real(dp), dimension(20), allocatable :: x,y
real(dp), dimension(20,2) :: z
character(len=:), allocatable :: filename
filename = "output.dat"
x = linspace(0, 10, 20)
y = -x**2/10
save_array(x) ! One array in one column to stdout
save_array(x, 1, filename) ! One array in one column to file
save_array([x,y], 2, filename) ! Two arrays in two columns to file
save_array([x,y], 2, fmt='g12.5', fout=filename) ! Two arrays in two columns to file with format
save_array(z) ! A 2D array in two columns to stdout
save_array(z, fmt='g12.5', fout=filename) ! a 2d array in two columns to file with format

Member Function/Subroutine Documentation

◆ save_array1d()

subroutine save_array1d ( real(dp), dimension(:), intent(in) x,
integer, intent(in), optional ncols,
character(len=*), intent(in), optional fname,
character(len=*), intent(in), optional fmt,
character(len=*), intent(in), optional header,
integer, intent(in), optional unit )
Parameters
[in]xArray to store
[in]ncolsNumber of columns to write. Default 1
[in]fnameFilename. Default: stdout
[in]fmtString with format. Default 'g0.5' for each data
[in]headerIf present, text to write before data.
[in]unitIf the file is already open, the unit at which it is associated.

References basic::print_msg().

Here is the call graph for this function:

◆ save_array2d()

subroutine save_array2d ( real(dp), dimension(:, :), intent(in) x,
character(len=*), intent(in), optional fname,
character(len=*), intent(in), optional fmt,
character(len=*), intent(in), optional header,
integer, intent(in), optional unit )
Parameters
[in]xArray to store
[in]fnameFilename. Default: stdout
[in]fmtString with format. Default 'g0.5' for each data
[in]headerIf present, text to write before data.
[in]unitIf the file is already open, the unit at which it is associated.

References basic::print_msg().

Here is the call graph for this function:

The documentation for this interface was generated from the following file: