PartMC 2.1.0
Modules | Functions/Subroutines | Variables
util.F90 File Reference

The pmc_util module. More...

Modules

module  pmc_util
 

Common utility subroutines.


Functions/Subroutines

subroutine pmc_util::warn_msg (code, warning_msg)
 Prints a warning message.
subroutine pmc_util::warn_assert_msg (code, condition_ok, warning_msg)
 Prints a warning message if condition_ok is false.
subroutine pmc_util::assert_msg (code, condition_ok, error_msg)
 Errors unless condition_ok is true.
subroutine pmc_util::assert (code, condition_ok)
 Errors unless condition_ok is true.
subroutine pmc_util::die (code)
 Error immediately.
subroutine pmc_util::die_msg (code, error_msg)
 Error immediately.
integer pmc_util::get_unit ()
 Returns an available unit number. This should be freed by free_unit().
subroutine pmc_util::free_unit (unit)
 Frees a unit number returned by get_unit().
logical pmc_util::almost_equal (d1, d2)
 Convert volume (m^3) to radius (m).
logical pmc_util::almost_equal_abs (d1, d2, abs_tol)
 Tests whether two real numbers are almost equal using an absolute and relative tolerance.
subroutine pmc_util::check_event (time, timestep, interval, last_time, do_event)
 Computes whether an event is scheduled to take place.
subroutine pmc_util::linspace (min_x, max_x, x)
 Makes a linearly spaced array from min to max.
subroutine pmc_util::logspace (min_x, max_x, x)
 Makes a logarithmically spaced array of length n from min to max.
integer pmc_util::linspace_find (min_x, max_x, n, x)
 Find the position of a real number in a 1D linear array.
integer pmc_util::logspace_find (min_x, max_x, n, x)
 Find the position of a real number in a 1D logarithmic array.
integer pmc_util::find_1d (n, x_vals, x)
 Find the position of a real number in an arbitrary 1D array.
real(kind=dp) pmc_util::interp_1d (x_vals, y_vals, x)
 1D linear interpolation.
real(kind=dp) pmc_util::interp_linear_disc (x_1, x_n, n, i)
 Linear interpolation over discrete indices.
integer pmc_util::string_to_integer (string)
 Convert a string to an integer.
real(kind=dp) pmc_util::string_to_real (string)
 Convert a string to a real.
logical pmc_util::string_to_logical (string)
 Convert a string to a logical.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::integer_to_string (val)
 Convert an integer to a string format.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::real_to_string (val)
 Convert a real to a string format.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::logical_to_string (val)
 Convert a logical to a string format.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::complex_to_string (val)
 Convert a complex to a string format.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::integer_to_string_max_len (val, max_len)
 Convert an integer to a string format of maximum length.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::real_to_string_max_len (val, max_len)
 Convert a real to a string format of maximum length.
character(len=PMC_UTIL_CONVERT_STRING_LEN) pmc_util::time_to_string_max_len (time, max_len)
 Convert a time to a string format of maximum length.
subroutine pmc_util::vec_cts_to_disc (n, vec_cts, n_samp, vec_disc)
 Convert a real-valued vector into an integer-valued vector.
subroutine pmc_util::average_integer (int_vec, int_avg)
 Computes the average of an array of integer numbers.
subroutine pmc_util::average_real (real_vec, real_avg)
 Computes the average of an array of real numbers.
subroutine pmc_util::get_basename (filename, basename)
 Strip the extension to find the basename.
subroutine pmc_util::iso8601_date_and_time (date_time)
 Current date and time in ISO 8601 format.
real(kind=dp) pmc_util::deg2rad (deg)
 Convert degrees to radians.
real(kind=dp) pmc_util::rad2deg (rad)
 Convert radians to degrees.

Variables

integer, parameter pmc_util::max_units = 200
 Maximum number of IO units usable simultaneously.
integer, parameter pmc_util::unit_offset = 10
 Minimum unit number to allocate.
logical, dimension(max_units), save pmc_util::unit_used = .false.
 Table of unit numbers storing allocation status.
integer, parameter pmc_util::PMC_UTIL_CONVERT_STRING_LEN = 100
 Length of string for converting numbers.
integer, parameter pmc_util::PMC_MAX_FILENAME_LEN = 300
 Maximum length of filenames.

Detailed Description

The pmc_util module.