ARTS 2.5.9 (git: 825fa5f2)
Quantum::Number Namespace Reference

Classes

struct  CheckMatch
 Status of comparing two lists that are supposedly of some type. More...
 
struct  GlobalState
 A logical struct for global quantum numbers with species identifiers. More...
 
struct  HalfIntegerValue
 Holds half integer values, but only its denominator. More...
 
struct  IntegerValue
 Holds integer values. More...
 
struct  LevelMatch
 Struct that converts to bool automatically but allows checking both energy levels matching status. More...
 
struct  LevelTest
 
struct  LocalState
 A logical struct for local quantum numbers. More...
 
struct  StateMatch
 StateMatchType operates so that a check less than a level should be 'better', bar None. More...
 
struct  StringValue
 Holds string values but can only hold sizeof(Index) long values. More...
 
struct  TwoLevelValueHolder
 The values of two levels. More...
 
struct  Value
 A complete quantum number value with type information. More...
 
struct  ValueDescription
 A complete description of a value, its type and value. More...
 
union  ValueHolder
 A union of the three type of values we need to consider. More...
 
class  ValueList
 A list of many quantum numbers. Should always remain sorted. More...
 

Functions

std::ostream & operator<< (std::ostream &os, ValueDescription x)
 
std::ostream & operator<< (std::ostream &os, Value x)
 
std::istream & operator>> (std::istream &is, Value &x)
 
std::pair< std::string_view, Stringfix_legacy (std::string_view key, std::string_view val)
 Fix legacy catalog, where some values are rationals even though they shouldn't be. More...
 
constexpr std::pair< std::string_view, std::string_view > split_hitran_qn (std::string_view x)
 Returns some input "ASDASDS=asdAS" as ["ASDASDS", "asdAS"] for Hitran online data. More...
 
ValueList from_hitran (std::string_view upp, std::string_view low)
 
std::ostream & operator<< (std::ostream &os, const ValueList &vl)
 
std::istream & operator>> (std::istream &is, ValueList &vl)
 
std::ostream & operator<< (std::ostream &os, const GlobalState &gs)
 
std::istream & operator>> (std::istream &is, GlobalState &gs)
 
bool vamdcCheck (const ValueList &l, VAMDC type) ARTS_NOEXCEPT
 
std::ostream & operator<< (std::ostream &os, const LocalState &vl)
 
std::istream & operator>> (std::istream &is, LocalState &vl)
 
 ENUMCLASS (Type, char, alpha, config, ElecStateLabel, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, I, J, K, Ka, Kc, L, Lambda, N, Omega, S, Sigma, SpinComponentLabel, asSym, elecInv, elecRefl, elecSym, kronigParity, l, l1, l10, l11, l12, l2, l3, l4, l5, l6, l7, l8, l9, n, parity, r, rotSym, rovibSym, sym, tau, term, v, v1, v10, v11, v12, v2, v3, v4, v5, v6, v7, v8, v9, vibInv, vibRefl, vibSym) const expr ValueType common_value_type(Type type) noexcept
 Three tags, S: str, I: index, H: half-index. More...
 
constexpr ValueType common_value_type (ValueType a, ValueType b) noexcept
 Return a common type between a and b. More...
 
constexpr std::strong_ordering cmp (std::strong_ordering &&a, std::strong_ordering &&b)
 
constexpr ValueDescription value_holder (Rational r_)
 Takes a rational and determine which type of quantum number it is, returning this information or throwing a runtime error if there's an error. More...
 
constexpr Rational cast_qnrat (std::string_view s) noexcept
 Returns a rational if possible or RATIONAL_UNDEFINED otherwise. More...
 
constexpr ValueDescription value_holder (std::string_view s, Type t)
 Returns a value description for the quantum number. More...
 
constexpr Index count_items (std::string_view s) noexcept
 Count all space-separated items in s. More...
 
constexpr std::string_view rstrip (std::string_view x)
 Strips spaces at the end of x before returning it. More...
 
constexpr std::string_view lstrip (std::string_view x)
 Strips spaces at the beginning x before returning it. More...
 
constexpr std::string_view strip (std::string_view x)
 Strips spaces at the beginning and end of x before returning it. More...
 
template<std::size_t n = 1>
constexpr std::string_view items (std::string_view s, std::size_t i) noexcept
 Get a view of a number of space-separated items from the list. More...
 
constexpr CheckValue update (CheckValue val, CheckValue res) noexcept
 Updates old by what a new check says it should be. More...
 
constexpr CheckMatch update (CheckMatch val, CheckValue res) noexcept
 Updates old by what a new check says it should be. More...
 
constexpr CheckMatch update (CheckMatch val, CheckMatch res) noexcept
 Updates old by what a new check says it should be. More...
 
template<size_t N>
constexpr bool is_sorted (const std::array< Type, N > &types) noexcept
 Checks if an array of types is sorted. More...
 
 ENUMCLASS (VAMDC, char, asymcs, asymos, dcs, hunda, hundb, lpcs, lpos, ltcs, ltos, nltcs, nltos, sphcs, sphos, stcs) bool vamdcCheck(const ValueList &l
 VAMDC classes of quantum number cases. More...
 

Variables

VAMDC type ARTS_NOEXCEPT
 
constexpr std::array global_types
 A default state of global quantum numbers. More...
 
constexpr std::array local_types
 A default state of local quantum numbers. More...
 

Function Documentation

◆ cast_qnrat()

constexpr Rational Quantum::Number::cast_qnrat ( std::string_view  s)
constexprnoexcept

Returns a rational if possible or RATIONAL_UNDEFINED otherwise.

Spaces are not allowed and results in RATIONAL_UNDEFINED being returns

Also only accepts rationals that match how quantum numbers are defined, so half or full integers, in case a decimal string is given. Note also that only a single decimal value can be given

If the rational is not a full integer or a half-integer, returns RATIONAL_UNDEFINED

Parameters
sSome view of a string
Returns
constexpr Rational

Definition at line 494 of file quantum_numbers.h.

References d, Quantum::Number::ValueHolder::i, nonstd::isdigit(), RATIONAL_UNDEFINED, and Quantum::Number::ValueHolder::s.

Referenced by value_holder().

◆ cmp()

constexpr std::strong_ordering Quantum::Number::cmp ( std::strong_ordering &&  a,
std::strong_ordering &&  b 
)
constexpr

Definition at line 396 of file quantum_numbers.h.

References a, and b.

Referenced by Quantum::Number::TwoLevelValueHolder::order().

◆ common_value_type()

constexpr ValueType Quantum::Number::common_value_type ( ValueType  a,
ValueType  b 
)
constexprnoexcept

Return a common type between a and b.

If they are the same, returns the value If either is H and the other is I, returns H Otherwise returns FINAL as an error flag

Parameters
aA value type
bAnother value type
Returns
constexpr ValueType with FINAL as error flag

Definition at line 341 of file quantum_numbers.h.

References a, and b.

Referenced by Quantum::Number::Value::level_match(), Quantum::Number::Value::low(), Absorption::Lines::max(), Quantum::Number::Value::operator<=>(), Quantum::Number::Value::read(), Quantum::Number::Value::str_low(), Quantum::Number::Value::str_upp(), Quantum::Number::TwoLevelValueHolder::TwoLevelValueHolder(), Quantum::Number::Value::upp(), Quantum::Number::Value::Value(), value_holder(), and Quantum::Number::Value::write().

◆ count_items()

constexpr Index Quantum::Number::count_items ( std::string_view  s)
constexprnoexcept

Count all space-separated items in s.

Example: "X 1 3123 1/3 1,,,,,2 " returns 5

Parameters
sAny set of characters
Returns
constexpr Index The number of space-separated items in s

Definition at line 623 of file quantum_numbers.h.

References nonstd::isspace(), and Quantum::Number::ValueHolder::s.

Referenced by Quantum::Number::GlobalState::GlobalState(), Quantum::Number::Value::Value(), Quantum::Number::ValueList::ValueList(), and xml_read_from_stream().

◆ ENUMCLASS() [1/2]

Quantum::Number::ENUMCLASS ( Type  ,
char  ,
alpha  ,
config  ,
ElecStateLabel  ,
,
F1  ,
F10  ,
F11  ,
F12  ,
F2  ,
F3  ,
F4  ,
F5  ,
F6  ,
F7  ,
F8  ,
F9  ,
,
,
,
Ka  ,
Kc  ,
,
Lambda  ,
N  ,
Omega  ,
,
Sigma  ,
SpinComponentLabel  ,
asSym  ,
elecInv  ,
elecRefl  ,
elecSym  ,
kronigParity  ,
,
l1  ,
l10  ,
l11  ,
l12  ,
l2  ,
l3  ,
l4  ,
l5  ,
l6  ,
l7  ,
l8  ,
l9  ,
,
parity  ,
,
rotSym  ,
rovibSym  ,
sym  ,
tau  ,
term  ,
v  ,
v1  ,
v10  ,
v11  ,
v12  ,
v2  ,
v3  ,
v4  ,
v5  ,
v6  ,
v7  ,
v8  ,
v9  ,
vibInv  ,
vibRefl  ,
vibSym   
) const
noexcept

Three tags, S: str, I: index, H: half-index.

Different types of quantum numbers according to VAMDC with some unbounded counted up to 12 times Common value type of a given quantum number type

Guards against integer/half-integer comparisons failing for bad reasons and allows IO to not need some information

Keep new entries to a 1-to-1 key-to-key match, and sort them the same as Type for ease of reading

Parameters
typeA quantum number type
Returns
constexpr ValueType The common type

Definition at line 100 of file quantum_numbers.h.

◆ ENUMCLASS() [2/2]

Quantum::Number::ENUMCLASS ( VAMDC  ,
char  ,
asymcs  ,
asymos  ,
dcs  ,
hunda  ,
hundb  ,
lpcs  ,
lpos  ,
ltcs  ,
ltos  ,
nltcs  ,
nltos  ,
sphcs  ,
sphos  ,
stcs   
) const &

VAMDC classes of quantum number cases.

Checks if a ValueList can belong to a given VAMDC type by ensuring it cannot have some quantum numbers

Parameters
lA list of values
typeA type of VAMDC molecular model
Returns
true If it can belong to the VAMDC type
false If it cannot belong to the VAMDC type

◆ fix_legacy()

std::pair< std::string_view, String > Quantum::Number::fix_legacy ( std::string_view  key,
std::string_view  val 
)

Fix legacy catalog, where some values are rationals even though they shouldn't be.

Definition at line 60 of file quantum_numbers.cc.

References ARTS_USER_ERROR.

Referenced by Quantum::Number::ValueList::ValueList().

◆ from_hitran()

ValueList Quantum::Number::from_hitran ( std::string_view  upp,
std::string_view  low 
)

◆ is_sorted()

template<size_t N>
constexpr bool Quantum::Number::is_sorted ( const std::array< Type, N > &  types)
constexprnoexcept

Checks if an array of types is sorted.

Template Parameters
NNumber of types
Parameters
typesArray of types
Returns
true if it is sorted
false if it is not sorted

Definition at line 891 of file quantum_numbers.h.

References Quantum::Number::ValueHolder::i, and N.

◆ items()

template<std::size_t n = 1>
constexpr std::string_view Quantum::Number::items ( std::string_view  s,
std::size_t  i 
)
constexprnoexcept

Get a view of a number of space-separated items from the list.

Example: "X 1 3123 1/3 1,,,,,2 " with i=0, n=3 returns "X 1 3123" Example: "X 1 3123 1/3 1,,,,,2 " with i=2, n=3 returns "3123 1/3 1,,,,,2" Example: "X 1 3123 1/3 1,,,,,2 " with i=4, n=3 returns "1,,,,,2" Example: "X 1 3123 1/3 1,,,,,2 " with i=5, n=3 returns ""

Template Parameters
nNumber of items
Parameters
sAny set of characters
iThe first item from the original list in the list of n items
Returns
constexpr std::string_view

Definition at line 682 of file quantum_numbers.h.

References Quantum::Number::ValueHolder::i, nonstd::isspace(), and Quantum::Number::ValueHolder::s.

Referenced by Quantum::Number::GlobalState::GlobalState(), Quantum::Number::Value::Value(), Quantum::Number::ValueList::ValueList(), and xml_read_from_stream().

◆ lstrip()

constexpr std::string_view Quantum::Number::lstrip ( std::string_view  x)
constexpr

Strips spaces at the beginning x before returning it.

Parameters
xany string view
Returns
constexpr std::string_view stripped

Definition at line 655 of file quantum_numbers.h.

References nonstd::isspace().

Referenced by strip().

◆ operator<<() [1/5]

std::ostream & Quantum::Number::operator<< ( std::ostream &  os,
const GlobalState gs 
)

Definition at line 413 of file quantum_numbers.cc.

◆ operator<<() [2/5]

std::ostream & Quantum::Number::operator<< ( std::ostream &  os,
const LocalState vl 
)

Definition at line 982 of file quantum_numbers.cc.

◆ operator<<() [3/5]

std::ostream & Quantum::Number::operator<< ( std::ostream &  os,
const ValueList vl 
)

Definition at line 360 of file quantum_numbers.cc.

◆ operator<<() [4/5]

std::ostream & Quantum::Number::operator<< ( std::ostream &  os,
Value  x 
)

Definition at line 35 of file quantum_numbers.cc.

◆ operator<<() [5/5]

std::ostream & Quantum::Number::operator<< ( std::ostream &  os,
ValueDescription  x 
)

Definition at line 11 of file quantum_numbers.cc.

◆ operator>>() [1/4]

std::istream & Quantum::Number::operator>> ( std::istream &  is,
GlobalState gs 
)

Definition at line 417 of file quantum_numbers.cc.

◆ operator>>() [2/4]

std::istream & Quantum::Number::operator>> ( std::istream &  is,
LocalState vl 
)

Definition at line 986 of file quantum_numbers.cc.

◆ operator>>() [3/4]

std::istream & Quantum::Number::operator>> ( std::istream &  is,
Value x 
)

Definition at line 39 of file quantum_numbers.cc.

◆ operator>>() [4/4]

std::istream & Quantum::Number::operator>> ( std::istream &  is,
ValueList vl 
)

Definition at line 368 of file quantum_numbers.cc.

◆ rstrip()

constexpr std::string_view Quantum::Number::rstrip ( std::string_view  x)
constexpr

Strips spaces at the end of x before returning it.

Parameters
xany string view
Returns
constexpr std::string_view stripped

Definition at line 645 of file quantum_numbers.h.

References nonstd::isspace().

Referenced by strip().

◆ split_hitran_qn()

constexpr std::pair< std::string_view, std::string_view > Quantum::Number::split_hitran_qn ( std::string_view  x)
constexpr

Returns some input "ASDASDS=asdAS" as ["ASDASDS", "asdAS"] for Hitran online data.

Note that there is a special exception for F::XYZ values

Parameters
xA string
Returns
constexpr std::pair<std::string_view, std::string_view>

Definition at line 228 of file quantum_numbers.cc.

References strip().

Referenced by from_hitran().

◆ strip()

constexpr std::string_view Quantum::Number::strip ( std::string_view  x)
constexpr

Strips spaces at the beginning and end of x before returning it.

Parameters
xany string view
Returns
constexpr std::string_view stripped

Definition at line 665 of file quantum_numbers.h.

References lstrip(), and rstrip().

Referenced by from_hitran(), and split_hitran_qn().

◆ update() [1/3]

constexpr CheckMatch Quantum::Number::update ( CheckMatch  val,
CheckMatch  res 
)
constexprnoexcept

Updates old by what a new check says it should be.

Definition at line 879 of file quantum_numbers.h.

References update().

◆ update() [2/3]

constexpr CheckMatch Quantum::Number::update ( CheckMatch  val,
CheckValue  res 
)
constexprnoexcept

Updates old by what a new check says it should be.

Definition at line 874 of file quantum_numbers.h.

References update().

◆ update() [3/3]

constexpr CheckValue Quantum::Number::update ( CheckValue  val,
CheckValue  res 
)
constexprnoexcept

Updates old by what a new check says it should be.

Definition at line 864 of file quantum_numbers.h.

Referenced by Quantum::Number::ValueList::check_match(), and update().

◆ value_holder() [1/2]

constexpr ValueDescription Quantum::Number::value_holder ( Rational  r_)
constexpr

Takes a rational and determine which type of quantum number it is, returning this information or throwing a runtime error if there's an error.

Parameters
r_A rational
Returns
constexpr ValueDescription

Definition at line 460 of file quantum_numbers.h.

References Rational::denom, Quantum::Number::ValueHolder::h, Quantum::Number::ValueHolder::i, Rational::numer, quantum_number_error_value, reduce_by_gcd(), Quantum::Number::ValueDescription::val, Quantum::Number::IntegerValue::x, and Quantum::Number::HalfIntegerValue::x.

Referenced by Quantum::Number::Value::set(), Quantum::Number::Value::Value(), and value_holder().

◆ value_holder() [2/2]

constexpr ValueDescription Quantum::Number::value_holder ( std::string_view  s,
Type  t 
)
constexpr

Returns a value description for the quantum number.

Note that several branches can throw as the input is assumed to be from the user

Parameters
sSome view of a string
Returns
constexpr ValueDescription

Definition at line 587 of file quantum_numbers.h.

References cast_qnrat(), common_value_type(), Quantum::Number::ValueHolder::s, Quantum::Number::ValueDescription::val, and value_holder().

◆ vamdcCheck()

bool Quantum::Number::vamdcCheck ( const ValueList l,
VAMDC  type 
)

Definition at line 425 of file quantum_numbers.cc.

Referenced by SimpleG().

Variable Documentation

◆ ARTS_NOEXCEPT

VAMDC type Quantum::Number::ARTS_NOEXCEPT

Definition at line 1141 of file quantum_numbers.h.

◆ global_types

constexpr std::array Quantum::Number::global_types
constexpr

A default state of global quantum numbers.

Definition at line 1144 of file quantum_numbers.h.

◆ local_types

constexpr std::array Quantum::Number::local_types
constexpr
Initial value:
{Type::F,
Type::F1,
Type::F10,
Type::F11,
Type::F12,
Type::F2,
Type::F3,
Type::F4,
Type::F5,
Type::F6,
Type::F7,
Type::F8,
Type::F9,
Type::I,
Type::J,
Type::K,
Type::Ka,
Type::Kc,
Type::N}

A default state of local quantum numbers.

Definition at line 1197 of file quantum_numbers.h.