The Open FUSION Toolkit 1.0.0-8905cc5
Modeling tools for plasma and fusion research and engineering
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
OFT_env Class Reference

Detailed Description

OpenFUSIONToolkit runtime environment class.

Public Member Functions

 __del__ (self)
 Destroy environment and cleanup known temporary files.
 
 __init__ (self, debug_level=0, nthreads=2, unique_tempfiles='global', abort_callback=True)
 Initialize OFT runtime object.
 
 float_is_disabled (self, val)
 Check if float is set to a value indicated its usage is "disabled".
 
 get_c_errorbuff (self)
 Get properly-sized error string buffer for calls to OFT compiled API.
 
 path2c (self, path)
 Convert general strings to C-compatible objects calls to OFT compiled API.
 
 set_debug_level (self, debug_level)
 Set debug verbosity level.
 
 set_num_threads (self, nthreads)
 Set the number of OpenMP threads to use.
 
 string2c (self, string)
 Convert general strings to C-compatible objects calls to OFT compiled API.
 
 unique_tmpfile (self, filename)
 Get unique temporary filename.
 
 update_oft_in (self)
 Update input file with current settings (see oft_in_groups)
 

Public Attributes

 debug_level
 Debug level.
 
 float_disable_flag
 Value for marking a float quantity as disabled.
 
 ncpus
 Number of physical CPUs (if multiple types are present only "performance" are counted)
 
 nthreads
 Number of threads for execution.
 
 oft_error_slen
 Error string size.
 
 oft_ifile
 Input filename for execution environment.
 
 oft_in_groups
 Main input file groups.
 
 oft_path_slen
 Path string size.
 
 oft_slen
 General string size.
 
 os
 OS type.
 
 pid
 ID of Python interpreter process.
 
 tempdir
 Directory for temporary files.
 

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  debug_level = 0,
  nthreads = 2,
  unique_tempfiles = 'global',
  abort_callback = True 
)

Initialize OFT runtime object.

Parameters
debug_levelLevel of debug printing (0-3)
nthreadsNumber of threads for execution
unique_tempfilesMethod for temporary file creation ('global': Create unique folder in global temporary space, 'local_dir': Create unique folder in current working directory, 'local_file': Use current working directory and append unique identifier to filenames, 'none': Use non-unique names in local directory; can lead to conflict with multiple instances)
abort_callbackUse callback for "graceful" abort

◆ __del__()

__del__ (   self)

Destroy environment and cleanup known temporary files.

Member Function Documentation

◆ float_is_disabled()

float_is_disabled (   self,
  val 
)

Check if float is set to a value indicated its usage is "disabled".

Parameters
valFloat value to check
Returns
Value is within 10% of self.float_disable_flag

◆ get_c_errorbuff()

get_c_errorbuff (   self)

Get properly-sized error string buffer for calls to OFT compiled API.

◆ path2c()

path2c (   self,
  path 
)

Convert general strings to C-compatible objects calls to OFT compiled API.

Parameters
pathPython path string
Returns
c_char_p object containing path string value

◆ set_debug_level()

set_debug_level (   self,
  debug_level 
)

Set debug verbosity level.

Parameters
debug_levelNew value for debug level (must be in range [0,3])

◆ set_num_threads()

set_num_threads (   self,
  nthreads 
)

Set the number of OpenMP threads to use.

Parameters
nthreadsNumber of threads to use for subsequent OpenMP parallel regions

◆ string2c()

string2c (   self,
  string 
)

Convert general strings to C-compatible objects calls to OFT compiled API.

Parameters
stringPython string
Returns
c_char_p object containing string value

◆ unique_tmpfile()

unique_tmpfile (   self,
  filename 
)

Get unique temporary filename.

Parameters
filenameBase non-unique filename
Returns
Unique filepath in suitable temporary location

◆ update_oft_in()

update_oft_in (   self)

Update input file with current settings (see oft_in_groups)

Member Data Documentation

◆ debug_level

debug_level

Debug level.

◆ float_disable_flag

float_disable_flag

Value for marking a float quantity as disabled.

◆ ncpus

ncpus

Number of physical CPUs (if multiple types are present only "performance" are counted)

◆ nthreads

nthreads

Number of threads for execution.

◆ oft_error_slen

oft_error_slen

Error string size.

◆ oft_ifile

oft_ifile

Input filename for execution environment.

◆ oft_in_groups

oft_in_groups

Main input file groups.

◆ oft_path_slen

oft_path_slen

Path string size.

◆ oft_slen

oft_slen

General string size.

◆ os

os

OS type.

◆ pid

pid

ID of Python interpreter process.

◆ tempdir

tempdir

Directory for temporary files.


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