102 #define INPUT_QUANTUM(ID) \ 103 if (s == #ID) return QuantumNumberType::ID 163 #define INPUT_QUANTUM(ID) \ 164 if (s == QuantumNumberType::ID) return #ID 214 throw std::runtime_error(
"Bad quantum number type");
224 typedef std::array<Rational, Index(QuantumNumberType::FINAL_ENTRY)>
245 RATIONAL_UNDEFINED}) {}
267 RATIONAL_UNDEFINED}) {}
275 return mqnumbers[qn];
284 return mqnumbers[
Index(qn)];
293 return mqnumbers[qn];
302 return mqnumbers[
Index(qn)];
345 return std::accumulate(
347 return r.isUndefined() ?
i : i + 1;
408 : mqtype(qt), mspecies(species), miso(
iso) {}
424 mqm({upper, lower}) {}
436 const std::vector<QuantumNumberType>& keys,
437 const std::vector<Rational>& upper,
438 const std::vector<Rational>& lower)
442 for(
size_t i=0;
i<keys.size();
i++) {
443 mqm[TRANSITION_UPPER_INDEX][keys[
i]] = upper[
i];
444 mqm[TRANSITION_LOWER_INDEX][keys[
i]] = lower[
i];
469 static constexpr
Index TRANSITION_UPPER_INDEX = 0;
472 static constexpr
Index TRANSITION_LOWER_INDEX = 1;
475 static constexpr
Index ENERGY_LEVEL_INDEX = 0;
515 void SetFromString(
String str);
526 constexpr QType
Type()
const {
return mqtype; }
529 void Type(QType x) { mqtype = x; }
533 constexpr
auto keys =
stdarrayify(
Index(TRANSITION), ENERGY_LEVEL, ALL, NONE);
534 return std::any_of(keys.cbegin(), keys.cend(), [x](
auto y){
return x == y;});
539 if (std::string(
"ENERGY_LEVEL") == str) {
541 }
else if (std::string(
"TRANSITION") == str) {
543 }
else if (std::string(
"ALL") == str) {
545 }
else if (std::string(
"NONE") == str) {
556 String SpeciesName()
const;
571 const std::array<QuantumNumbers, 2>&
QuantumMatch()
const {
return mqm; }
588 return mqm[TRANSITION_UPPER_INDEX];
593 return mqm[TRANSITION_LOWER_INDEX];
598 return mqm[TRANSITION_UPPER_INDEX][X];
603 return mqm[TRANSITION_LOWER_INDEX][X];
608 return mqm[TRANSITION_UPPER_INDEX][X];
613 return mqm[TRANSITION_LOWER_INDEX][X];
618 return mqm[ENERGY_LEVEL_INDEX];
623 return mqm[ENERGY_LEVEL_INDEX][X];
628 return mqm[TRANSITION_UPPER_INDEX];
633 return mqm[TRANSITION_LOWER_INDEX];
638 return mqm[ENERGY_LEVEL_INDEX];
681 bool any_quantumnumbers()
const;
690 std::array<QuantumNumbers, 2>
mqm;
720 throw std::runtime_error(
"Programmer error --- added type is missing");
782 void update_id(
QuantumIdentifier& qid,
const std::vector<std::array<String, 2> >& upper_list,
const std::vector<std::array<String, 2> >& lower_list);
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const ArrayOfNumeric &temp_range, const Index &coefftype)
Initialize isotopologue and move iterator to next one.
INDEX Index
The type to use for all integer numbers and indices.
void Set(String qn, Rational r)
Set quantum number at position.
#define RATIONAL_UNDEFINED
const QuantumNumbers & UpperQuantumNumbers() const noexcept
Return the upper quantum numbers by const reference.
constexpr Index Isotopologue() const
Return the Isotopologue by index.
bool Compare(const QuantumNumbers &qn) const
Compare Quantum Numbers Ignores any undefined numbers in the comparison.
constexpr Index Species() const
Return the Species by index.
bool IsValidQuantumNumberName(String name)
Check for valid quantum number name.
void Isotopologue(Index iso)
Set the Isotopologue.
void Type(QType x)
Set Type.
constexpr QuantumNumbers() noexcept
Initializer with undefined values.
constexpr QuantumIdentifier UpperQuantumId() const noexcept
Return a quantum identifer as if it wants to match to upper energy level.
constexpr Rational operator[](const QuantumNumberType qn) const noexcept
Access operator.
QuantumNumberType string2quantumnumbertype(const String &s)
constexpr Rational EnergyLevelQuantumNumber(QuantumNumberType X) const noexcept
Return a energy level quantum number by copy.
bool operator==(const QuantumIdentifier &a, const QuantumIdentifier &b)
Is everything the same between the identifiers.
static bool validIndexForType(Index x) noexcept
Checks if input is a valid Type.
void ThrowIfQuantumNumberNameInvalid(String name)
Check for valid quantum number name and throws if it is invalid.
Rational & LowerQuantumNumber(QuantumNumberType X) noexcept
Return a lower quantum number by copy.
Header file for interpolation.cc.
static constexpr Index TRANSITION_LOWER_INDEX
Lower level index.
#define INPUT_QUANTUM(ID)
QuantumNumberType
Enum for Quantum Numbers used for indexing.
String quantumnumbertype2string(QuantumNumberType s)
This file contains the definition of Array.
constexpr QuantumIdentifier(const QuantumIdentifier::QType &qt, const Index species, const Index iso) noexcept
Initialize with no quantum numbers defined but known species and matching type.
bool operator!=(const QuantumIdentifier &a, const QuantumIdentifier &b)
Is anything different between the identifiers.
constexpr QuantumIdentifier(const Index spec, const Index isot, const QuantumNumbers &upper, const QuantumNumbers &lower) noexcept
Initialize with transition identifier type.
QuantumIdentifier(const Index spec, const Index isot, const std::vector< QuantumNumberType > &keys, const std::vector< Rational > &upper, const std::vector< Rational > &lower)
Initialize with transition identifier type.
Index & Isotopologue()
Return the Isotopologue by index reference.
void update_id(QuantumIdentifier &qid, const std::vector< std::array< String, 2 > > &upper_list, const std::vector< std::array< String, 2 > > &lower_list)
Updates the quantum identifier based on a lists of strings.
std::array< QuantumNumbers, 2 > mqm
std::array< Rational, Index(QuantumNumberType::FINAL_ENTRY)> QuantumContainer
static constexpr Index TRANSITION_UPPER_INDEX
Upper level index.
Rational & operator[](const Index qn) noexcept
Access operator.
void Species(Index sp)
Set the Species.
static constexpr Index ENERGY_LEVEL_INDEX
Energy level index.
QuantumContainer mqnumbers
Implements rational numbers to work with other ARTS types.
void SetNone()
Set to NONE identifier.
QuantumNumbers & UpperQuantumNumbers()
Return the upper quantum numbers by reference.
constexpr Rational LowerQuantumNumber(QuantumNumberType X) const noexcept
Return a lower quantum number by copy.
Class to identify and match lines by their quantum numbers.
constexpr QuantumNumbers(Rational J, Rational N, Rational v) noexcept
constexpr Rational operator[](const Index qn) const noexcept
Access operator.
constexpr QuantumIdentifier LowerQuantumId() const noexcept
Return a quantum identifer as if it wants to match to lower energy level.
void Set(Index qn, Rational r)
Set quantum number at position.
constexpr Rational UpperQuantumNumber(QuantumNumberType X) const noexcept
Return a upper quantum number by copy.
Array< QuantumIdentifier > ArrayOfQuantumIdentifier
Array< QuantumNumbers > ArrayOfQuantumNumbers
std::ostream & operator<<(std::ostream &os, const QuantumNumbers &qn)
Output operator.
Container class for Quantum Numbers.
static QType string2Type(const String &str) noexcept
This can be used to make arrays out of anything.
std::istream & operator>>(std::istream &is, QuantumNumbers &qn)
Input operator.
constexpr QType Type() const
const QuantumNumbers & LowerQuantumNumbers() const noexcept
Return the lower quantum numbers by const reference.
void SetTransition()
Set key to transition type.
QuantumIdentifier(String x)
Construct a new Quantum Identifier object from text.
const QuantumContainer & GetNumbers() const
Get the numbers.
QuantumNumbers & EnergyLevelQuantumNumbers()
Return the energy level quantum numbers by reference.
void Compare(const Numeric &var1, const Numeric &var2, const Numeric &maxabsdiff, const String &error_message, const String &var1name, const String &var2name, const String &, const String &, const Verbosity &verbosity)
WORKSPACE METHOD: Compare.
QType
Ways to identify quantum numbers.
void Set(QuantumNumberType qn, Rational r)
Set quantum number at position.
Index & Species()
Return the Species by index reference.
Contains the rational class definition.
constexpr QuantumIdentifier() noexcept
Initialize with no matches.
const std::array< QuantumNumbers, 2 > & QuantumMatch() const
Return the quantum numbers array const reference.
Rational & operator[](const QuantumNumberType qn) noexcept
Access operator.
Index nNumbers() const
The number of defined quantum numbers.
constexpr QuantumIdentifier(const Index spec, const Index isot, const QuantumNumbers &qnr) noexcept
Initialize with energy level identifier type.
bool IsEnergyLevelType() const
Check if *this is a energy level type of identifier.
constexpr std::array< T, 1+sizeof...(Ts)> stdarrayify(const T &first, const Ts &... the_rest)
Make a std::array of a list of variables (must be 1-long at least)
Rational & UpperQuantumNumber(QuantumNumberType X) noexcept
Return a upper quantum number by copy.
const QuantumNumbers & EnergyLevelQuantumNumbers() const noexcept
Return the energy level quantum numbers by const reference.
void SetAll()
Set to All identifier.
std::array< QuantumNumbers, 2 > & QuantumMatch()
Return the quantum numbers array reference.
QuantumNumbers & LowerQuantumNumbers()
Return the lower quantum numbers by reference.
This file contains the definition of String, the ARTS string class.