astrofrog / fortranlib

Collection of personal scientific routines in Fortran :book:
BSD 2-Clause "Simplified" License
298 stars 73 forks source link

This is a collection of Fortran routines I have written over the years for use in more complex codes. The different files are as independent as possible from each other, but in some cases dependencies are unavoidable.

A lot of routines are written so as to work with both single and double type precision. These are in the templates/ directory, and are coded using generic types. The files in templates are not valid Fortran, and will not compile. Running the parse.py script automatically generates the full source code from these templates, and places the results in src.

base_types.f90 (no dependencies) Defines numeric types

lib_algebra.f90 (no dependencies) Defines the following routines:

lib_array.f90 (no dependencies) Defines the following routines:

lib_cfitsio.f90 (requires the cfitsio library to be installed) Defines wrapper routines for the cfitsio library

lib_conf.f90 (no dependencies) Defines routines to make it easy to read Apache-style configuration files

lib_constants.f90 (no dependencies) Defines some physical constants in SI and CGS units

lib_hdf5.f90 (requires the HDF5 library to be installed) Defines wrapper routines for the HDF5 library

libio.f90 (requires the posix*.f90 modules - see below) Defines various I/O operations (file deletion with confirmation, etc.)

lib_messages.f90 Defines warning/error routines

lib_random.f90 Defines routines to sample random numbers:

posix_default.f90 and posix_nag.f90 Define various low-level routines, such as checking for file/directory existence, and a routine to sleep a program for an amount of time defined in microseconds. If using the NAG f95 compiler, use posix_nag.f90, otherwise use posix_default.f90

type_angle3d.f90 (requires lib_random.f90) Defines a derived type for 3D angles, and associated routines

type_pdf.f90 (requires lib_array.f90 and lib_random.f90) Defines derived types for discrete and continuous PDFs, and associated routines (including for sampling the PDFs).

type_stokes.f90 Defines a derived type for Stokes vectors, and associated routines

type_vector3d.f90 (requires lib_random.f90 and type_angle3d.f90) Defines a derived type for 3D vectors, and associated routines