Elements and materials

Elements, substances, and material composition.

Note

MAT is experimental and unfinished; interfaces and behavior may change.

static constexpr std::array<std::string_view, 2> snt::mat::PT_HEADER

This file was generated using the following Python script devtools/build_periodic_table.py from data provided at the website of NIST Atomic Weights and Isotopic Compositions for All Elements

static constexpr std::array<Isotope, 354> snt::mat::PT_DATA
static constexpr size_t snt::mat::PT_NUM_DATA
class Element : public snt::mat::Part<int>, public snt::mat::Matter
#include <element.h>

An element is a pure substance that consists entirely of one type of atom

Public Functions

Element(const std::string &expr, int prop = 1, bool nat = true)

Element class constructor

Parameters:
  • expr – Element string representation

  • prop – Component proportion in a Composite

  • nat – Indicate if element is a natural isotope

std::string to_string()

String representation of an element instance

Returns:

String representation

void math_add(Element *other)

Addition of two elements

Parameters:

other – Pointer of another element

void math_multiply(Element *other)

Multiplication of two elements

Parameters:

other – Pointer of another element

Public Members

struct snt::mat::Element::ElementProperties elementProps

set of basic element properties

bool natural

true if element is naturally abundant

std::string element

element symbol

unsigned int isotope

isotope type

unsigned int ionisation

ionisation state

Public Static Functions

static Element from_string(const std::string &expr)

Get an instance of an Element from an expression

Parameters:

expr – String expression

Returns:

An instance of the Element class

struct ElementProperties
#include <element.h>

Set of element defining properties

Public Members

unsigned int protons

proton number Z

double neutrons

average number of neutrons in naturally abundant element N

unsigned int electrons

electron number e

struct Isotope
#include <periodic_table.h>

Public Members

std::string_view symbol
unsigned int protons
unsigned int isotope_number
double atomic_number
double natural_abundance
class Material : public snt::mat::Set<Substance, double>, public snt::mat::Matter
#include <material.h>

A material represented as a set of substances and their composition.

The set stores substance amounts as double values; the interpretation of those amounts (mass, fraction, or another quantity) follows the material construction and solver context.

class Matter
#include <matter.h>

Matter is anything that has mass and occupies space

Subclassed by snt::mat::Element, snt::mat::Material, snt::mat::Substance

Public Members

struct snt::mat::Matter::MatterProperties matterProps

set of basic matter properties

puq::Quantity mass_density

Mass density.

puq::Quantity number_density

Number density.

struct MatterProperties
#include <matter.h>

Set of matter defining properties

Public Members

puq::Quantity volume

Volume.

puq::Quantity mass

Mass.

template<typename PROPORTION>
class Part
#include <part.h>

A part is an individual substance or part that combines with others to form a larger whole

Template Parameters:

PROPORTION – proportion coefficient type (double or integer)

Public Functions

inline Part(PROPORTION prop, const std::string &expr = "")

Create a part

Parameters:
  • prop – Proportion of this part in a Composite

  • expr – String representation of a part

template<typename MEMBER, typename PROPORTION>
class Set
#include <set.h>

A set is a material or object made up of two or more distinct members that remain physically separate and identifiable within the final structure

Template Parameters:
  • MEMBER – Type of set members

  • PROPORTION – Proportion data type

Public Types

using PartMap = std::map<std::string, PROPORTION>

Map of parts and their proportions.

Public Functions

inline Set(const PartMap &comp, bool nat = true, const std::string &expr = "")

Set class constructor

Parameters:
  • comp – A map of parts with their proportions

  • nat – Indicate if substance atoms should use natural abundance

  • expr – Set string representation

Public Members

std::map<std::string, Part<PROPORTION>> parts

Map of parts.

std::string expression

String representation of a set.

bool natural

true if set is using natural abundances

class Substance : public snt::mat::Set<Element, int>, public snt::mat::Part<double>, public snt::mat::Matter
#include <substance.h>

A form of matter with uniform and definite composition and distinct physical and chemical properties.

Public Functions

Substance(double num)

Substance class constructor from a scalar number

Parameters:

num – Number

Substance(const ElementMap &comp, double prop = 1, bool nat = true)

Substance class constructor from a map of components and their proportions

Parameters:
  • comp – Map of components and their proportions

  • prop – Component proportion in a Composite

  • nat – Indicate if substance atoms should use natural abundance

Substance(const std::string &expr, double prop = 1, bool nat = true)

Substance class constructor from an expression

Parameters:
  • expr – Element string representation

  • prop – Component proportion in a Composite

  • nat – Indicate if substance atoms should use natural abundance

std::string to_string() const

Convert element to a string

Returns:

String representation of a substance