CYCLUS
Static Public Member Functions | List of all members
cyclus::Env Class Reference

Detailed Description

An environment utility to help locate files and find environment settings.

The environment for a given simulation can be accessed via the simulation's Context.

Definition at line 23 of file env.h.

#include <env.h>

Static Public Member Functions

static const bool allow_milps ()
 
static const std::vector< std::string > cyclus_path ()
 
static const std::string EnvDelimiter ()
 
static std::string FindModule (std::string path)
 
static std::string FindModule (std::string path, std::string lib)
 
static const std::string GetBuildPath ()
 
static std::string GetEnv (std::string var)
 
static const std::string GetInstallPath ()
 
static const std::string nuc_data ()
 
static std::string PathBase (std::string path)
 
static const std::string PathDelimiter ()
 
static const std::string rng_schema (bool flat=false)
 
static const void SetNucDataPath ()
 
static const void SetNucDataPath (std::string p)
 
static void SplitPath (const std::string &s, char delim, std::vector< std::string > &elems)
 
static std::vector< std::string > SplitPath (const std::string &s, char delim)
 

Member Function Documentation

◆ allow_milps()

const bool cyclus::Env::allow_milps ( )
static
Returns
whether or not Cyclus should allow Mixed-Integer Linear Programs The default depends on a compile time option DEFAULT_ALLOW_MILPS, but may be specified at run time with the ALLOW_MILPS environment variable

Definition at line 161 of file env.cc.

◆ cyclus_path()

const std::vector< std::string > cyclus::Env::cyclus_path ( )
static
Returns
the current value of the module environment variable CYCLUS_PATH

Definition at line 152 of file env.cc.

◆ EnvDelimiter()

const std::string cyclus::Env::EnvDelimiter ( )
static
Returns
the correct environment variable delimiter based on the file system

Definition at line 79 of file env.cc.

◆ FindModule() [1/2]

std::string cyclus::Env::FindModule ( std::string  path)
static

Returns the full path to a module by searching through default install and CYCLUS_PATH directories.

You may optionally pass in the lib name itself without any frills. In this case, Python modules will also be searched.

Definition at line 176 of file env.cc.

◆ FindModule() [2/2]

std::string cyclus::Env::FindModule ( std::string  path,
std::string  lib 
)
static

Definition at line 180 of file env.cc.

◆ GetBuildPath()

const std::string cyclus::Env::GetBuildPath ( )
static

The relative path to the root build directory (containing bin, lib, etc.)

Returns
the absolute path to the build directory

Definition at line 59 of file env.cc.

◆ GetEnv()

std::string cyclus::Env::GetEnv ( std::string  var)
static

Method to check the existence of and return an environment variable.

Parameters
varis the variable to check and return

Definition at line 71 of file env.cc.

◆ GetInstallPath()

const std::string cyclus::Env::GetInstallPath ( )
static

The relative path to the root install directory (containing bin, lib, etc.) This first checks the path of the cyclus executable itself and then tries the install directory given at run time.

Returns
the absolute path to the install directory

Definition at line 34 of file env.cc.

◆ nuc_data()

const std::string cyclus::Env::nuc_data ( )
static
Returns
the current value of the data environment variable CYCLUS_NUC_DATA

Definition at line 95 of file env.cc.

◆ PathBase()

std::string cyclus::Env::PathBase ( std::string  path)
static

the path basis

Returns
path with the last item removed

Definition at line 25 of file env.cc.

◆ PathDelimiter()

const std::string cyclus::Env::PathDelimiter ( )
static
Returns
the correct path delimiter based on the file system

Definition at line 87 of file env.cc.

◆ rng_schema()

const std::string cyclus::Env::rng_schema ( bool  flat = false)
static

Returns the current rng schema.

Uses CYCLUS_RNG_SCHEMA env var if set; otherwise uses the default install location. If using the default location, set flat=true for the default flat schema.

Definition at line 117 of file env.cc.

◆ SetNucDataPath() [1/2]

static const void cyclus::Env::SetNucDataPath ( )
inlinestatic

Initializes the path to the cyclus_nuc_data.h5 file.

By default, it is assumed to be located in the path given by GetInstallPath()/share; however, paths in environment variable CYCLUS_NUC_DATA are checked first.

Definition at line 98 of file env.h.

◆ SetNucDataPath() [2/2]

static const void cyclus::Env::SetNucDataPath ( std::string  p)
inlinestatic

Initializes the path to the nuclear data library to p.

Definition at line 103 of file env.h.

◆ SplitPath() [1/2]

static void cyclus::Env::SplitPath ( const std::string &  s,
char  delim,
std::vector< std::string > &  elems 
)
inlinestatic

splits a string of paths by a delimeter

Parameters
sstring of paths
delimthe delimeter character
elemsthe vector of split strings

Definition at line 30 of file env.h.

◆ SplitPath() [2/2]

static std::vector<std::string> cyclus::Env::SplitPath ( const std::string &  s,
char  delim 
)
inlinestatic

splits a string of paths by a delimeter

Parameters
sstring of paths
delimthe delimeter character
Returns
the vector of split strings

Definition at line 45 of file env.h.


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