44 if (!
mqnumbers[qnri].isUndefined() && !qnumbers2[qnri].isUndefined() &&
56 if (mspecies not_eq other.
mspecies)
return false;
57 if (miso not_eq other.
miso)
return false;
68 "One of your inputs is bad. You are using function comparing energy levels to the upper state of lines, but the types mismatch");
72 if (other.
mqm[TRANSITION_UPPER_INDEX][qnri].isUndefined()) {
73 if (not mqm[ENERGY_LEVEL_INDEX][qnri].isUndefined())
return false;
75 if (other.
mqm[TRANSITION_UPPER_INDEX][qnri] not_eq
76 mqm[ENERGY_LEVEL_INDEX][qnri])
87 if (mspecies not_eq other.
mspecies)
return false;
88 if (miso not_eq other.
miso)
return false;
99 "One of your inputs is bad. You are using function comparing energy levels to the lower state of lines, but the types mismatch");
103 if (other.
mqm[TRANSITION_LOWER_INDEX][qnri].isUndefined()) {
104 if (not mqm[ENERGY_LEVEL_INDEX][qnri].isUndefined())
return false;
106 if (other.
mqm[TRANSITION_LOWER_INDEX][qnri] not_eq
107 mqm[ENERGY_LEVEL_INDEX][qnri])
118 if (mspecies not_eq other.
mspecies)
return false;
119 if (miso not_eq other.
miso)
return false;
126 }
else if (mqtype not_eq other.
mqtype)
127 throw std::runtime_error(
128 "Can never compare different types of identifiers with QID.In(QID), one of your inputs is of wrong QuantumIdentifier type");
130 auto& other_low = other.
mqm[TRANSITION_LOWER_INDEX];
131 auto& other_upp = other.
mqm[TRANSITION_UPPER_INDEX];
132 auto& this_low = mqm[TRANSITION_LOWER_INDEX];
133 auto& this_upp = mqm[TRANSITION_UPPER_INDEX];
136 if (other_low[
i].isUndefined()) {
137 }
else if (this_low[
i].isUndefined())
139 else if (this_low[
i] not_eq other_low[
i])
142 if (other_upp[i].isUndefined()) {
143 }
else if (this_upp[i].isUndefined())
145 else if (this_upp[i] not_eq other_upp[i])
149 auto& other_qn = other.
mqm[ENERGY_LEVEL_INDEX];
150 auto& this_qn = mqm[ENERGY_LEVEL_INDEX];
153 if (other_qn[
i].isUndefined()) {
154 }
else if (this_qn[
i].isUndefined())
156 else if (this_qn[
i] not_eq other_qn[
i])
171 os <<
"Invalid quantum number: " << name;
172 throw std::runtime_error(os.
str());
190 if (qn[
i].isDefined()) {
232 mqm[TRANSITION_UPPER_INDEX] = upper;
233 mqm[TRANSITION_LOWER_INDEX] = lower;
238 mqm[ENERGY_LEVEL_INDEX] =
q;
248 static map<String, SpecIsoMap> ArtsMap;
251 static bool hinit =
false;
261 ArtsMap[buf] = indicies;
274 const map<String, SpecIsoMap>::const_iterator
i = ArtsMap.find(token);
275 if (i == ArtsMap.end()) {
277 os <<
"ARTS Tag: " << token <<
" is unknown.";
278 throw runtime_error(os.
str());
291 os <<
"Expected 'UP', but got: " << token;
292 throw std::runtime_error(os.str());
302 if (token ==
"LO")
break;
307 os <<
"Premature end of data, expected 'LO'.";
308 throw std::runtime_error(os.str());
317 }
else if (token ==
"EN") {
328 }
else if (token ==
"ALL") {
330 }
else if (token ==
"NONE") {
334 os <<
"Error parsing QuantumIdentifier. Expected TR or EN, but got: " 337 throw std::runtime_error(os.str());
344 assert(upper.
nelem() == 5);
345 assert(lower.
nelem() == 5);
346 assert(iso.
nelem() == 3);
350 os <<
"CO2-" << iso <<
" TR " 352 <<
"v1 " << upper[0] <<
" v2 " << upper[1] <<
" l2 " << upper[2] <<
" v3 " 353 << upper[3] <<
" r " << upper[4] <<
" " 355 <<
"v1 " << lower[0] <<
" v2 " << lower[1] <<
" l2 " << lower[2] <<
" v3 " 356 << lower[3] <<
" r " << lower[4];
358 SetFromString(os.str());
369 os << spr.
Name() <<
"-";
397 for (
const auto& qns : mqm)
do {
398 if (not qns[qni].isUndefined())
return true;
435 void update_id(
QuantumIdentifier& qid,
const std::vector<std::array<String, 2> >& upper_list,
const std::vector<std::array<String, 2> >& lower_list)
437 for (
auto& keyval: upper_list) {
441 os <<
"The key \"" << keyval[0] <<
"\" is an invalid input as a quantum number key";
442 std::cout <<
"WARNING: " << os.str() <<
'\n';
449 os <<
"The key \"" << keyval[0] <<
"\" and value \"" << keyval[1] <<
"\" are invalid input as a quantum number key and value pair";
450 std::cout <<
"WARNING: " << os.str() <<
'\n';
455 for (
auto& keyval: lower_list) {
459 os <<
"The key \"" << keyval[0] <<
"\" is an invalid input as a quantum number key";
460 std::cout <<
"WARNING: " << os.str() <<
'\n';
467 os <<
"The key \"" << keyval[0] <<
"\" and value \"" << keyval[1] <<
"\" are invalid input as a quantum number key and value pair";
468 std::cout <<
"WARNING: " << os.str() <<
'\n';
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.
#define RATIONAL_UNDEFINED
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.
bool Compare(const QuantumNumbers &qn) const
Compare Quantum Numbers Ignores any undefined numbers in the comparison.
bool any_quantumnumbers() const
Check if there are any quantum numbers defined.
Index nelem() const
Number of elements.
void Isotopologue(Index iso)
Set the Isotopologue.
QuantumIdentifier::QType Index LowerQuantumNumbers Species
bool InLower(const QuantumIdentifier &other) const
Return if this is in other's lower energy state.
std::istream & operator>>(std::istream &is, QuantumNumbers &qn)
Input operator.
QuantumNumberType string2quantumnumbertype(const String &s)
bool InUpper(const QuantumIdentifier &other) const
Return if this is in other's upper energy state.
void SetEnergyLevel(const QuantumNumbers &q)
Set tp energy level identifier.
static constexpr Index TRANSITION_LOWER_INDEX
Lower level index.
void SetFromString(String str)
Set from a String object.
basic_istringstream< char, string_char_traits< char >, alloc > istringstream
QuantumNumberType
Enum for Quantum Numbers used for indexing.
const Array< SpeciesRecord > species_data
Species Data.
String quantumnumbertype2string(QuantumNumberType s)
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
String SpeciesName() const
Return the Species by name.
const Array< IsotopologueRecord > & Isotopologue() const
void ThrowIfQuantumNumberNameInvalid(String name)
Check for valid quantum number name and throws if it is invalid.
std::array< QuantumNumbers, 2 > mqm
std::array< Rational, Index(QuantumNumberType::FINAL_ENTRY)> QuantumContainer
_CS_string_type str() const
static constexpr Index TRANSITION_UPPER_INDEX
Upper level index.
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.
Contains the lookup data for one species.
void SetFromStringForCO2Band(String upper, String lower, String iso)
Set CO2 transition from String objects.
QuantumIdentifier::QType Isotopologue
Rational interpret_stringdata(const QuantumNumberType key, const String &val)
std::ostream & operator<<(std::ostream &os, const QuantumNumbers &qn)
Output operator.
constexpr Rational LowerQuantumNumber(QuantumNumberType X) const noexcept
Return a lower quantum number by copy.
Class to identify and match lines by their quantum numbers.
Index nelem() const
Number of elements.
const String & Name() const
Declarations required for the calculation of absorption coefficients.
Header file for special_interp.cc.
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.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
Container class for Quantum Numbers.
constexpr QType Type() const
void SetTransition()
Set key to transition type.
const QuantumContainer & GetNumbers() const
Get the numbers.
bool IsValidQuantumNumberName(String name)
Check for valid quantum number name.
const std::array< QuantumNumbers, 2 > & QuantumMatch() const
Return the quantum numbers array const reference.
bool In(const QuantumIdentifier &other) const
Return if this is in other.