The Open FUSION Toolkit 1.0.0-8905cc5
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines | Variables
oft_base Module Reference

Detailed Description

Base environment functions and aliases for Open FUSION Toolkit.

Authors
Chris Hansen
Date
June 2010

Data Types

interface  oft_abort_callback
 Prototype for abort callback to override usual abort process. More...
 
type  oft_env_type
 Dummy shadow type for Fox XML node. More...
 
interface  oft_mpi_max
 Perform a MAX reduction over all processors. More...
 
interface  oft_mpi_sum
 Perform a SUM/AND reduction over all processors. More...
 
interface  oft_random_number
 Need docs. More...
 
interface  oft_set_signal_handlers
 Interface for setting UNIX signal handlers in "oft_local.c". More...
 

Functions/Subroutines

pure subroutine find_orient_listn (oflag, list, n)
 Apply an orientation transform to a n-value array.
 
real(r8) function linterp (x, y, n, xx, extrap)
 Perform linear 1-D interpolation of function F(x)
 
subroutine linterp_facs (x, n, xx, inds, facs, extrap)
 Compute coefficients for linear 1-D interpolation of function F(x)
 
subroutine oft_abort (error_str, sname, fname)
 Graceful abort for Open FUSION Toolkit.
 
pure logical function oft_debug_print (level)
 Output control for debug messages.
 
subroutine oft_decrease_indent
 Decrease length of global indent string by 2.
 
subroutine oft_finalize ()
 Finalize Open FUSION Toolkit environment.
 
subroutine oft_increase_indent
 Increase length of global indent string by 2.
 
subroutine oft_init (nthreads)
 Initializes Open FUSION Toolkit run environment.
 
logical function oft_mpi_and (a)
 logical scalar implementation of global AND (SUM) reduction
 
subroutine oft_mpi_barrier (ierr)
 Wrapper for MPI_BARRIER with MPI_COMM_WORLD to enable communication profiling.
 
logical function oft_mpi_check_reqs (n, req)
 Helper to check all requests from completion.
 
integer(i4) function, private oft_mpi_maxi (a)
 integer(i4) scalar implementation of global MAX reduction
 
integer(i8) function, dimension(n) oft_mpi_maxi8a (a, n)
 integer(i8) array implementation of element-wise global MAX reduction
 
integer(i4) function, dimension(n), private oft_mpi_maxia (a, n)
 integer(i4) array implementation of element-wise global MAX reduction
 
real(i8) function, private oft_mpi_maxr (a)
 real(r8) scalar implementation of global MAX reduction
 
real(r8) function, dimension(n), private oft_mpi_maxra (a, n)
 real(r8) array implementation of element-wise global MAX reduction
 
complex(r8) function, private oft_mpi_sumc (a)
 complex(c8) scalar implementation of global SUM reduction
 
complex(c8) function, dimension(n), private oft_mpi_sumca (a, n)
 complex(c8) array implementation of element-wise global SUM reduction
 
integer(i4) function, private oft_mpi_sumi4 (a)
 integer(i4) scalar implementation of global SUM reduction
 
integer(i4) function, dimension(n), private oft_mpi_sumi4a (a, n)
 integer(i4) array implementation of element-wise global SUM reduction
 
integer(i8) function, private oft_mpi_sumi8 (a)
 integer(i8) scalar implementation of global SUM reduction
 
integer(i8) function, dimension(n), private oft_mpi_sumi8a (a, n)
 integer(i8) array implementation of element-wise global SUM reduction
 
real(r8) function, private oft_mpi_sumr (a)
 real(r8) scalar implementation of global SUM reduction
 
real(r8) function, dimension(n), private oft_mpi_sumra (a, n)
 real(r8) array implementation of element-wise global SUM reduction
 
subroutine oft_mpi_waitall (n, req, ierr)
 Wrapper for MPI_WAITALL to enable communication profiling.
 
subroutine oft_mpi_waitany (n, req, j, ierr)
 Wrapper for MPI_WAITANY to enable communication profiling.
 
pure logical function oft_pm_print ()
 Output control for performance messages.
 
subroutine oft_prof_print
 Print some basic profiling information.
 
subroutine oft_prof_reset
 Reset all profiling counters.
 
subroutine oft_profile_start ()
 Activate profiling.
 
subroutine oft_random_number_c8 (array, n)
 Complex implementation of toolkit random_number function.
 
subroutine, private oft_random_number_r8 (array, n)
 Real implementation of toolkit random_number function.
 
subroutine oft_stack_print ()
 Print the current contents of the stack.
 
subroutine oft_stack_reset
 Reset the stack.
 
pure subroutine oft_thread_slice (tid, nthreads, length, i1, i2)
 Get thread ownership range for even spacing.
 
subroutine oft_warn (error_str)
 Graceful warning printing for Open FUSION Toolkit.
 
pure subroutine orient_list2 (oflag, list)
 Apply an orientation transform to a 2 value array.
 
pure subroutine orient_listn (oflag, list, n)
 Apply an orientation transform to a n-value array.
 
pure subroutine orient_listn_inv (oflag, list, n)
 Apply an orientation transform to a n-value array.
 

Variables

integer(i8), dimension(4) comm_times = 0
 Times for blocking communications.
 
procedure(oft_abort_callback), pointer oft_abort_cb
 Abort callback for graceful abort in Python interface.
 
type(oft_env_typeoft_env
 Global container for environment information.
 
character(len=:), allocatable oft_indent
 Indentation string for status messages.
 
integer(i4oft_mpi_c4 =MPI_COMPLEX8
 MPI_COMPLEX8 alias.
 
integer(i4oft_mpi_c8 =MPI_COMPLEX16
 MPI_COMPLEX16 alias.
 
integer(i4oft_mpi_char =MPI_CHARACTER
 MPI_CHAR alias.
 
integer(i4oft_mpi_i4 =MPI_INTEGER4
 MPI_INT4 alias.
 
integer(i4oft_mpi_i8 =MPI_INTEGER8
 MPI_INT8 alias.
 
integer(i4oft_mpi_logical =MPI_LOGICAL
 MPI_LOGICAL alias.
 
integer(i4oft_mpi_r4 =MPI_REAL8
 MPI_REAL4 alias.
 
integer(i4oft_mpi_r8 =MPI_REAL8
 MPI_REAL8 alias.
 
logical, private oft_prof_enabled = .FALSE.
 Enable profiling?
 
logical oft_stack_disabled = .FALSE.
 Disable debug/profiling stack.
 
integer(i4), dimension(24), parameter oft_test_seed = [430470439, -303393496, -476850581, -964913795, 995391627, 84909391, -586395292, -2070086573, -1010035798, 1012650827, 325297911, 701378007, 392909068, 379156631, 484729024, -292308758, -1669043581, 142231192, 708877466, -1255634259, 593274827, -561530186, -934579426, 900810854]
 
integer(i4oft_tid = 0
 ID of current thread.
 
real(r8), private start_time
 Time that run began.
 
logical use_petsc = .FALSE.
 Use PETSc as linear algebra backend.
 

Function/Subroutine Documentation

◆ find_orient_listn()

pure subroutine find_orient_listn ( integer(i4), intent(out)  oflag,
integer(i4), dimension(n), intent(in)  list,
integer(i4), intent(in)  n 
)

Apply an orientation transform to a n-value array.

Parameters
[out]oflagOrientation flag
[in]listArray for orientation [n]
[in]nLength of array

◆ linterp()

real(r8) function linterp ( real(r8), dimension(n), intent(in)  x,
real(r8), dimension(n), intent(in)  y,
integer(i4), intent(in)  n,
real(r8), intent(in)  xx,
integer(i4), intent(in), optional  extrap 
)

Perform linear 1-D interpolation of function F(x)

Warning
This function requires x be sorted lowest to highest.
Note
This function performs an interval search each time it is called.
Returns
\( F(xx) \) (-1.E99 if outside domain and extrap=0 or invalid value for extrap)
Parameters
[in]xParamaterizing array \( x_i \) [n]
[in]yFunction values \( F(x_i) \) [n]
[in]xxLocation to perform interpolation
[in]nLength of function parameterization
[in]extrapExtrapolation mode (0: none, 1: constant, 2: linear)

◆ linterp_facs()

subroutine linterp_facs ( real(r8), dimension(n), intent(in)  x,
integer(i4), intent(in)  n,
real(r8), intent(in)  xx,
integer(i4), dimension(2), intent(out)  inds,
real(r8), dimension(2), intent(out)  facs,
integer(i4), intent(in), optional  extrap 
)

Compute coefficients for linear 1-D interpolation of function F(x)

Warning
This function requires x be sorted lowest to highest.
Note
This function performs an interval search each time it is called.
Parameters
[in]xParamaterizing array \( x_i \) [n]
[in]xxLocation to perform interpolation
[in]nLength of function parameterization
[out]indsIndices of points bounding subinterval (-1 -> error)
[out]facsInterpolation factors for point in inds(2)
[in]extrapExtrapolation mode (0: none, 1: constant, 2: linear)

◆ oft_abort()

subroutine oft_abort ( character(len=*), intent(in)  error_str,
character(len=*), intent(in)  sname,
character(len=*), intent(in)  fname 
)

Graceful abort for Open FUSION Toolkit.

Also calls MPI_ABORT/STOP

Parameters
[in]error_strError string
[in]snameSource subroutine name
[in]fnameSource file name

◆ oft_debug_print()

pure logical function oft_debug_print ( integer(i4), intent(in)  level)

Output control for debug messages.

Returns
(oft_env%debug>=level).AND.oft_env%head_proc
Parameters
[in]levelThreshold debugging level

◆ oft_decrease_indent()

subroutine oft_decrease_indent

Decrease length of global indent string by 2.

◆ oft_finalize()

subroutine oft_finalize

Finalize Open FUSION Toolkit environment.

Also calls PetscFinalize/MPI_FINALIZE

◆ oft_increase_indent()

subroutine oft_increase_indent

Increase length of global indent string by 2.

◆ oft_init()

subroutine oft_init ( integer(i4), intent(in), optional  nthreads)

Initializes Open FUSION Toolkit run environment.

Also calls MPI_INIT

Parameters
[in]nthreadsNumber for threads to use (negative for default)

◆ oft_mpi_and()

logical function oft_mpi_and ( logical, intent(in)  a)

logical scalar implementation of global AND (SUM) reduction

Returns
\( ALL(a) \) over all processors
Parameters
[in]aLocal value for AND

◆ oft_mpi_barrier()

subroutine oft_mpi_barrier ( integer(i4), intent(out)  ierr)

Wrapper for MPI_BARRIER with MPI_COMM_WORLD to enable communication profiling.

Parameters
[out]ierrError flag

◆ oft_mpi_check_reqs()

logical function oft_mpi_check_reqs ( integer(i4), intent(in)  n,
integer(i4), dimension(n), intent(inout)  req 
)

Helper to check all requests from completion.

Parameters
[in]nNumber of requests
[in,out]reqArray of requests

◆ oft_mpi_maxi()

integer(i4) function, private oft_mpi_maxi ( integer(i4), intent(in)  a)
private

integer(i4) scalar implementation of global MAX reduction

Returns
\( max(a) \) over all processors
Parameters
[in]aLocal value for MAX

◆ oft_mpi_maxi8a()

integer(i8) function, dimension(n) oft_mpi_maxi8a ( integer(i8), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)

integer(i8) array implementation of element-wise global MAX reduction

Returns
\( max(a) \) over all processors
Parameters
[in]aLocal values for MAX [n]
[in]nLength of array for reduction

◆ oft_mpi_maxia()

integer(i4) function, dimension(n), private oft_mpi_maxia ( integer(i4), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

integer(i4) array implementation of element-wise global MAX reduction

Returns
\( max(a) \) over all processors
Parameters
[in]aLocal values for MAX [n]
[in]nLength of array for reduction

◆ oft_mpi_maxr()

real(i8) function, private oft_mpi_maxr ( real(i8), intent(in)  a)
private

real(r8) scalar implementation of global MAX reduction

Returns
\( max(a) \) over all processors
Parameters
[in]aLocal value for MAX

◆ oft_mpi_maxra()

real(r8) function, dimension(n), private oft_mpi_maxra ( real(r8), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

real(r8) array implementation of element-wise global MAX reduction

Returns
\( max(a) \) over all processors
Parameters
[in]aLocal values for MAX [n]
[in]nLength of array for reduction

◆ oft_mpi_sumc()

complex(r8) function, private oft_mpi_sumc ( complex(r8), intent(in)  a)
private

complex(c8) scalar implementation of global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal value for SUM

◆ oft_mpi_sumca()

complex(c8) function, dimension(n), private oft_mpi_sumca ( complex(c8), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

complex(c8) array implementation of element-wise global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal values for SUM [n]
[in]nLength of array for reduction

◆ oft_mpi_sumi4()

integer(i4) function, private oft_mpi_sumi4 ( integer(i4), intent(in)  a)
private

integer(i4) scalar implementation of global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal value for SUM

◆ oft_mpi_sumi4a()

integer(i4) function, dimension(n), private oft_mpi_sumi4a ( integer(i4), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

integer(i4) array implementation of element-wise global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal values for SUM [n]
[in]nLength of array for reduction

◆ oft_mpi_sumi8()

integer(i8) function, private oft_mpi_sumi8 ( integer(i8), intent(in)  a)
private

integer(i8) scalar implementation of global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal value for SUM

◆ oft_mpi_sumi8a()

integer(i8) function, dimension(n), private oft_mpi_sumi8a ( integer(i8), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

integer(i8) array implementation of element-wise global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal values for SUM [n]
[in]nLength of array for reduction

◆ oft_mpi_sumr()

real(r8) function, private oft_mpi_sumr ( real(r8), intent(in)  a)
private

real(r8) scalar implementation of global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal value for SUM

◆ oft_mpi_sumra()

real(r8) function, dimension(n), private oft_mpi_sumra ( real(r8), dimension(n), intent(in)  a,
integer(i4), intent(in)  n 
)
private

real(r8) array implementation of element-wise global SUM reduction

Returns
\( sum(a) \) over all processors
Parameters
[in]aLocal values for SUM [n]
[in]nLength of array for reduction

◆ oft_mpi_waitall()

subroutine oft_mpi_waitall ( integer(i4), intent(in)  n,
integer(i4), dimension(n), intent(inout)  req,
integer(i4), intent(out)  ierr 
)

Wrapper for MPI_WAITALL to enable communication profiling.

Parameters
[in]nNumber of requests
[in,out]reqArray of requests
[out]ierrError flag

◆ oft_mpi_waitany()

subroutine oft_mpi_waitany ( integer(i4), intent(in)  n,
integer(i4), dimension(n), intent(inout)  req,
integer(i4), intent(out)  j,
integer(i4), intent(out)  ierr 
)

Wrapper for MPI_WAITANY to enable communication profiling.

Parameters
[in]nNumber of requests
[in,out]reqArray of requests
[out]jNext completed request
[out]ierrError flag

◆ oft_pm_print()

pure logical function oft_pm_print

Output control for performance messages.

Returns
oft_env%pm.AND.oft_env%head_proc

◆ oft_prof_print()

subroutine oft_prof_print

Print some basic profiling information.

◆ oft_prof_reset()

subroutine oft_prof_reset

Reset all profiling counters.

◆ oft_profile_start()

subroutine oft_profile_start

Activate profiling.

◆ oft_random_number_c8()

subroutine oft_random_number_c8 ( complex(c8), dimension(n), intent(out)  array,
integer(i4), intent(in)  n 
)

Complex implementation of toolkit random_number function.

Parameters
[out]arrayArray to set with random values [n]
[in]nLength of array

◆ oft_random_number_r8()

subroutine, private oft_random_number_r8 ( real(r8), dimension(n), intent(out)  array,
integer(i4), intent(in)  n 
)
private

Real implementation of toolkit random_number function.

Parameters
[out]arrayArray to set with random values [n]
[in]nLength of array

◆ oft_stack_print()

subroutine oft_stack_print

Print the current contents of the stack.

◆ oft_stack_reset()

subroutine oft_stack_reset

Reset the stack.

Warning
This should only be done for the main run program, otherwise the stack may become corrupted.

◆ oft_thread_slice()

pure subroutine oft_thread_slice ( integer(i4), intent(in)  tid,
integer(i4), intent(in)  nthreads,
integer(i4), intent(in)  length,
integer(i4), intent(out)  i1,
integer(i4), intent(out)  i2 
)

Get thread ownership range for even spacing.

Parameters
[in]tidThread index (0-indexed)
[in]nthreadsTotal number of threads
[in]lengthLength of range to partition
[out]i1Start of ownership range (1-indexed)
[out]i2End of ownership range (1-indexed)

◆ oft_warn()

subroutine oft_warn ( character(len=*)  error_str)

Graceful warning printing for Open FUSION Toolkit.

◆ orient_list2()

pure subroutine orient_list2 ( integer(i4), intent(in)  oflag,
integer(i4), dimension(2), intent(inout)  list 
)

Apply an orientation transform to a 2 value array.

list([1,2]) = list([1,2]) if oflag>0 list([1,2]) = list([2,1]) if oflag<0

Parameters
[in]oflagOrientation flag
[in,out]listArray for orientation [2]

◆ orient_listn()

pure subroutine orient_listn ( integer(i4), intent(in)  oflag,
integer(i4), dimension(n), intent(inout)  list,
integer(i4), intent(in)  n 
)

Apply an orientation transform to a n-value array.

Parameters
[in]oflagOrientation flag
[in,out]listArray for orientation [n]
[in]nLength of array

◆ orient_listn_inv()

pure subroutine orient_listn_inv ( integer(i4), intent(in)  oflag,
integer(i4), dimension(n), intent(inout)  list,
integer(i4), intent(in)  n 
)

Apply an orientation transform to a n-value array.

Parameters
[in]oflagOrientation flag
[in,out]listArray for orientation [n]
[in]nLength of array

Variable Documentation

◆ comm_times

integer(i8), dimension(4) comm_times = 0

Times for blocking communications.

◆ oft_abort_cb

procedure(oft_abort_callback), pointer oft_abort_cb

Abort callback for graceful abort in Python interface.

◆ oft_env

type(oft_env_type) oft_env

Global container for environment information.

◆ oft_indent

character(len=:), allocatable oft_indent

Indentation string for status messages.

◆ oft_mpi_c4

integer(i4) oft_mpi_c4 =MPI_COMPLEX8

MPI_COMPLEX8 alias.

◆ oft_mpi_c8

integer(i4) oft_mpi_c8 =MPI_COMPLEX16

MPI_COMPLEX16 alias.

◆ oft_mpi_char

integer(i4) oft_mpi_char =MPI_CHARACTER

MPI_CHAR alias.

◆ oft_mpi_i4

integer(i4) oft_mpi_i4 =MPI_INTEGER4

MPI_INT4 alias.

◆ oft_mpi_i8

integer(i4) oft_mpi_i8 =MPI_INTEGER8

MPI_INT8 alias.

◆ oft_mpi_logical

integer(i4) oft_mpi_logical =MPI_LOGICAL

MPI_LOGICAL alias.

◆ oft_mpi_r4

integer(i4) oft_mpi_r4 =MPI_REAL8

MPI_REAL4 alias.

◆ oft_mpi_r8

integer(i4) oft_mpi_r8 =MPI_REAL8

MPI_REAL8 alias.

◆ oft_prof_enabled

logical, private oft_prof_enabled = .FALSE.
private

Enable profiling?

◆ oft_stack_disabled

logical oft_stack_disabled = .FALSE.

Disable debug/profiling stack.

◆ oft_test_seed

integer(i4), dimension(24), parameter oft_test_seed = [430470439, -303393496, -476850581, -964913795, 995391627, 84909391, -586395292, -2070086573, -1010035798, 1012650827, 325297911, 701378007, 392909068, 379156631, 484729024, -292308758, -1669043581, 142231192, 708877466, -1255634259, 593274827, -561530186, -934579426, 900810854]

◆ oft_tid

integer(i4) oft_tid = 0

ID of current thread.

◆ start_time

real(r8), private start_time
private

Time that run began.

◆ use_petsc

logical use_petsc = .FALSE.

Use PETSc as linear algebra backend.