File species_parser.hxx#

Defines

SPECIES_PARSER_H#
class SpeciesParser#
#include <species_parser.hxx>

Class to parse species strings and extract charge information.

Public Functions

SpeciesParser(const std::string &species_str)#

Construct a new SpeciesParser object by extracting the element and charge from a species string.

Valid string requirements:

  • Element name must be 1 or 2 letters and is stored in lower case.

  • Any integer can precede the element name, but is discarded e.g. “2he” is parsed as “he”

  • A “+” or a “-”, optionally followed by an integer is interpreted as the charge. e.g. “he-1” (-1), “H” (0) or “ne+8” (+8)

  • Electrons are a special case and can be specified as “e” or “e-“.

Parameters:

species_str – The species string to parse

Throws:

BoutException – if the string cannot be parsed or contains invalid information

inline int get_charge() const#
inline std::string get_element() const#
inline std::string get_str() const#
std::string long_name() const#

Get an appropriate long name for the element in this species (e.g. “hydrogen” for “h”).

Returns:

std::string The long name of the species, or the element name if no long name is defined

SpeciesParser ionised()#

Construct a new object with the charge increased by 1.

Returns:

SpeciesParser Ionised species object

SpeciesParser recombined()#

Construct a new object with the charge reduced by 1.

Returns:

SpeciesParser Recombined species object

Private Functions

SpeciesParser(const std::string element, int charge)#

Private Members

std::string species_str#

Species string.

std::string element#

Atomic element of the species (or ‘e’ for electrons)

int charge#

Charge of the species.