PartMC  2.6.1
Functions/Subroutines
numeric_diff.F90 File Reference

The numeric_diff program. More...

Go to the source code of this file.

Functions/Subroutines

program numeric_diff
 Compare two files containing numerical arrays and check whether they are the same as each other, to within the specified tolerance. More...
 
subroutine print_help ()
 
subroutine print_errors (abs_err, rel_err)
 

Detailed Description

The numeric_diff program.

Definition in file numeric_diff.F90.

Function/Subroutine Documentation

◆ numeric_diff()

program numeric_diff

Compare two files containing numerical arrays and check whether they are the same as each other, to within the specified tolerance.

If the arrays in the two files are of different sizes then they are automatically different. Otherwise they are the same if

\[ | A_1 - A_2 |_2 < \verb+abs_tol+ \]

and

\[ \frac{| A_1 - A_2 |_2}{| A_1 |_2 + | A_2 |_2} < \verb+rel_tol+ \]

and are otherwise different. Setting abs_tol or rel_tol to zero skips the corresponding test.

If the files are the same then "<tt>files match within the given tolerances</tt>" is printed on stdout, otherwise "<tt>files differ</tt>" is printed, followed by the absolute and relative differences, as above, or a message describing the difference. The files will be reported as different if they have a different pattern of end-of-lines and end-of-files, or if they have whitespace in different places (amount of whitespace is irrelevant).

The exit status of the program is:

  • 0 if the files are the same
  • 1 if the files are different
  • 3 if an error occurred

Definition at line 33 of file numeric_diff.F90.

◆ print_errors()

subroutine numeric_diff::print_errors ( real(kind=dp), dimension(:,:)  abs_err,
real(kind=dp), dimension(:,:)  rel_err 
)
Parameters
abs_errAbsolute errors.
rel_errRelative errors.

Definition at line 293 of file numeric_diff.F90.

◆ print_help()

subroutine numeric_diff::print_help

Definition at line 262 of file numeric_diff.F90.