ARTS  2.4.0(git:4fb77825)
lineshapemodel.h File Reference

Contains the line shape namespace. More...

#include <numeric>
#include <algorithm>
#include "abs_species_tags.h"
#include "constants.h"
#include "file.h"
#include "jacobian.h"

Go to the source code of this file.

Classes

struct  LineShape::ModelParameters
 Coefficients and temperature model for SingleSpeciesModel. More...
 
class  LineShape::SingleSpeciesModel
 Compute the line shape parameters for a single broadening species. More...
 
struct  LineShape::Output
 Main output of Model. More...
 
class  LineShape::Model
 Main line shape model class. More...
 

Namespaces

 LineShape
 Computations of line shape derived parameters.
 
 LineShape::LegacyLineFunctionData
 Legacy dealing with reading old LineFunctionData.
 
 LineShape::LegacyLineMixingData
 Legacy dealing with reading old LineMixingData.
 
 LineShape::LegacyPressureBroadeningData
 Legacy dealing with reading old PressureBroadeningData.
 

Macros

#define VARIABLE2STRINGDEF(X)
 
#define STRING2VARIABLEDEF(X)    if (type == #X) return Variable::X
 
#define x0   X[Index(var)].X0
 
#define x1   X[Index(var)].X1
 
#define x2   X[Index(var)].X2
 
#define x3   X[Index(var)].X3
 
#define ACCESS_INTERNAL(VARPOS)
 
#define MODELPARAMCASESETTER(X)
 
#define MODELPARAMCASEGETTER(X)   case Variable::X: out = X(); break;
 
#define LSPC(XVAR, PVAR)
 
#define LSPCV(XVAR, PVAR)
 
#define LSPCT(XVAR, PVAR)
 
#define LSPDC(XVAR, DERIV, PVAR)
 
#define RETURNINTERNALDERIVATIVE(TYPE)
 

Typedefs

typedef LineShape::Model LineShapeModel
 
typedef LineShape::SingleSpeciesModel LineShapeSingleSpeciesModel
 

Enumerations

enum  LineShape::TemperatureModel : Index {
  LineShape::TemperatureModel::None, LineShape::TemperatureModel::T0, LineShape::TemperatureModel::T1, LineShape::TemperatureModel::T2,
  LineShape::TemperatureModel::T3, LineShape::TemperatureModel::T4, LineShape::TemperatureModel::T5, LineShape::TemperatureModel::LM_AER,
  LineShape::TemperatureModel::DPL
}
 Temperature models. More...
 
enum  LineShape::Variable {
  LineShape::Variable::G0 = 0, LineShape::Variable::D0 = 1, LineShape::Variable::G2 = 2, LineShape::Variable::D2 = 3,
  LineShape::Variable::FVC = 4, LineShape::Variable::ETA = 5, LineShape::Variable::Y = 6, LineShape::Variable::G = 7,
  LineShape::Variable::DV = 8
}
 List of possible shape variables. More...
 
enum  LineShape::Type : Index {
  LineShape::Type::DP, LineShape::Type::LP, LineShape::Type::VP, LineShape::Type::SDVP,
  LineShape::Type::HTP
}
 Type of line shape to compute. More...
 
enum  LineShape::LegacyLineMixingData::TypeLM {
  LineShape::LegacyLineMixingData::TypeLM::LM_NONE, LineShape::LegacyLineMixingData::TypeLM::LM_LBLRTM, LineShape::LegacyLineMixingData::TypeLM::LM_LBLRTM_O2NonResonant, LineShape::LegacyLineMixingData::TypeLM::LM_1STORDER,
  LineShape::LegacyLineMixingData::TypeLM::LM_2NDORDER, LineShape::LegacyLineMixingData::TypeLM::LM_BYBAND
}
 Line mixing types that used to exist. More...
 
enum  LineShape::LegacyPressureBroadeningData::TypePB { LineShape::LegacyPressureBroadeningData::TypePB::PB_NONE, LineShape::LegacyPressureBroadeningData::TypePB::PB_AIR_BROADENING, LineShape::LegacyPressureBroadeningData::TypePB::PB_AIR_AND_WATER_BROADENING, LineShape::LegacyPressureBroadeningData::TypePB::PB_PLANETARY_BROADENING }
 Pressure broadening types that used to exist. More...
 

Functions

JacPropMatType select_derivativeLineShape (const String &var, const String &coeff)
 Return the derivative type based on string input. More...
 
ArrayOfString AllLineShapeCoeffs ()
 All available line shape coefficients. More...
 
ArrayOfString AllLineShapeVars ()
 All available line shape variables. More...
 
String LineShape::temperaturemodel2string (TemperatureModel type) noexcept
 Turns selected TemperatureModel type into a string. More...
 
TemperatureModel LineShape::string2temperaturemodel (const String &type)
 Turns predefined strings into a TemperatureModel type. More...
 
std::ostream & LineShape::operator<< (std::ostream &os, Variable v)
 Output operator for Variable to be human-readable. More...
 
String LineShape::variable2string (Variable type) noexcept
 Turns selected Variable type into a string. More...
 
Variable LineShape::string2variable (const String &type)
 Turns predefined strings into a Variable type. More...
 
String LineShape::modelparameters2metadata (const ModelParameters mp, const Numeric T0)
 
NumericLineShape::SingleModelParameter (ModelParameters &mp, const String &type)
 Get a coefficient from ModelParameters by name. More...
 
bool LineShape::modelparameterEmpty (const ModelParameters mp) noexcept
 
std::ostream & LineShape::operator<< (std::ostream &os, const ModelParameters &mp)
 Output operator for ModelParameters. More...
 
std::istream & LineShape::operator>> (std::istream &is, ModelParameters &mp)
 Input operator for ModelParameters. More...
 
std::ostream & LineShape::operator<< (std::ostream &os, const SingleSpeciesModel &ssm)
 Output operator for SingleSpeciesModel. More...
 
std::istream & LineShape::operator>> (std::istream &is, SingleSpeciesModel &ssm)
 Input operator for SingleSpeciesModel. More...
 
String LineShape::shapetype2string (Type type) noexcept
 Turns selected Type into a string. More...
 
String LineShape::shapetype2metadatastring (Type type) noexcept
 Turns selected Type into a human readable string. More...
 
Type LineShape::string2shapetype (const String &type)
 Turns predefined strings into a Type. More...
 
std::ostream & LineShape::operator<< (std::ostream &os, Output x)
 Output operator for LineShape::Output. More...
 
constexpr Output LineShape::mirroredOutput (Output x) noexcept
 Output to be used by mirroring calls. More...
 
constexpr Output LineShape::negativeOutput (Output x) noexcept
 Output turned negative. More...
 
constexpr Output LineShape::si2cgs (Output x) noexcept
 Output turned from SI to CGS units. More...
 
constexpr Output LineShape::differenceOutput (Output y, Output x) noexcept
 Diff of two output. More...
 
Vector LineShape::vmrs (const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const QuantumIdentifier &self, const ArrayOfSpeciesTag &lineshape_species, bool self_in_list, bool bath_in_list, Type type)
 Returns a VMR vector for this model's main calculations. More...
 
std::ostream & LineShape::operator<< (std::ostream &, const Model &)
 
std::istream & LineShape::operator>> (std::istream &, Model &)
 
String LineShape::ModelShape2MetaData (const Model &m)
 
Model LineShape::MetaData2ModelShape (const String &s)
 
ArrayOfString LineShape::ModelMetaDataArray (const Model &m, const bool self, const bool bath, const ArrayOfSpeciesTag &sts, const Numeric T0)
 
std::istream & LineShape::from_artscat4 (std::istream &is, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, const QuantumIdentifier &qid)
 
std::istream & LineShape::from_linefunctiondata (std::istream &data, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species)
 
std::istream & LineShape::from_linemixingdata (std::istream &data, Model &lsc)
 Legacy reading of old deprecated LineMixingData class. More...
 
std::istream & LineShape::from_pressurebroadeningdata (std::istream &data, LineShape::Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, const QuantumIdentifier &qid)
 Legacy reading of old deprecated PressureBroadeningData class. More...
 
Index LineShape::LegacyLineFunctionData::temperaturemodel2legacynelem (TemperatureModel type) noexcept
 Length per variable for temperature model. More...
 
std::vector< Variable > LineShape::LegacyLineFunctionData::lineshapetag2variablesvector (String type)
 Line shape models from string. More...
 
std::vector< Variable > LineShape::LegacyLineFunctionData::linemixingtag2variablesvector (String type)
 Line mixing models from string. More...
 
LegacyLineMixingData::TypeLM LineShape::LegacyLineMixingData::string2typelm (String type)
 Line mixing types from string. More...
 
Index LineShape::LegacyLineMixingData::typelm2nelem (LegacyLineMixingData::TypeLM type)
 Line mixing types to number. More...
 
Model LineShape::LegacyLineMixingData::vector2modellm (Vector x, LegacyLineMixingData::TypeLM type)
 LineShape::Model from legacy input vector. More...
 
LegacyPressureBroadeningData::TypePB LineShape::LegacyPressureBroadeningData::string2typepb (String type)
 Pressure broadening types from string. More...
 
Index LineShape::LegacyPressureBroadeningData::self_listed (const QuantumIdentifier &qid, LegacyPressureBroadeningData::TypePB t)
 Pressure broadening if self exist. More...
 
Index LineShape::LegacyPressureBroadeningData::typepb2nelem (LegacyPressureBroadeningData::TypePB type)
 Pressure broadening types to number of elements. More...
 
void LineShape::LegacyPressureBroadeningData::vector2modelpb (LineShape::Type &mtype, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, Vector x, LegacyPressureBroadeningData::TypePB type, bool self_in_list)
 LineShape::Model from legacy input vector. More...
 

Variables

constexpr Index LineShape::nmaxTempModelParams = 4
 Current max number of coefficients. More...
 
constexpr Index LineShape::nVars = 9
 Current max number of line shape variables. More...
 

Detailed Description

Contains the line shape namespace.

Author
Richard Larsson
Date
2018-09-19

Contains the line shape namespace

This namespace computes all line shape parameters for any set of line shape we can use in ARTS. Should be extended for more use as seen fit.

Definition in file lineshapemodel.h.

Macro Definition Documentation

◆ ACCESS_INTERNAL

#define ACCESS_INTERNAL (   VARPOS)
Value:
ModelParameters& VARPOS() noexcept { return X[Index(Variable::VARPOS)]; } \
constexpr ModelParameters VARPOS() const noexcept { return X[Index(Variable::VARPOS)]; }

Definition at line 679 of file lineshapemodel.h.

◆ LSPC

#define LSPC (   XVAR,
  PVAR 
)
Value:
Numeric XVAR( \
Numeric T, Numeric T0, Numeric P [[maybe_unused]], ConstVectorView vmrs) \
const noexcept { \
return PVAR * \
std::inner_product( \
mdata.cbegin(), \
mdata.cend(), \
vmrs.begin(), \
0.0, \
std::plus<Numeric>(), \
[=](auto& x, auto vmr) -> Numeric { \
return vmr * x.compute(T, T0, Variable::XVAR); \
}); \
}

Definition at line 1060 of file lineshapemodel.h.

◆ LSPCT

#define LSPCT (   XVAR,
  PVAR 
)
Value:
Numeric d##XVAR##_dT( \
Numeric T, Numeric T0, Numeric P [[maybe_unused]], ConstVectorView vmrs) \
const noexcept { \
return PVAR * \
std::inner_product( \
mdata.cbegin(), \
mdata.cend(), \
vmrs.begin(), \
0.0, \
std::plus<Numeric>(), \
[=](auto& x, auto vmr) -> Numeric { \
return vmr * x.compute_dT(T, T0, Variable::XVAR); \
}); \
}

Definition at line 1107 of file lineshapemodel.h.

◆ LSPCV

#define LSPCV (   XVAR,
  PVAR 
)
Value:
Numeric d##XVAR##_dVMR(Numeric T, \
Numeric T0, \
Numeric P [[maybe_unused]], \
const Index deriv_pos) const noexcept { \
if (deriv_pos not_eq -1) \
return PVAR * mdata[deriv_pos].compute(T, T0, Variable::XVAR); \
else \
return 0; \
}

Definition at line 1086 of file lineshapemodel.h.

◆ LSPDC

#define LSPDC (   XVAR,
  DERIV,
  PVAR 
)
Value:
Numeric d##XVAR##DERIV(Numeric T, \
Numeric T0, \
Numeric P [[maybe_unused]], \
Index deriv_pos, \
ConstVectorView vmrs) const noexcept { \
if (deriv_pos not_eq -1) \
return vmrs[deriv_pos] * PVAR * \
mdata[deriv_pos].compute##DERIV(T, T0, Variable::XVAR); \
else \
return 0; \
}

Definition at line 1134 of file lineshapemodel.h.

◆ MODELPARAMCASEGETTER

#define MODELPARAMCASEGETTER (   X)    case Variable::X: out = X(); break;

◆ MODELPARAMCASESETTER

#define MODELPARAMCASESETTER (   X)
Value:
case Variable::X: \
X() = x; \
break

◆ RETURNINTERNALDERIVATIVE

#define RETURNINTERNALDERIVATIVE (   TYPE)
Value:
case JacPropMatType::LineShape##TYPE##X0: \
return d##TYPE##_dX0(T, T0, P, pos, vmrs); \
case JacPropMatType::LineShape##TYPE##X1: \
return d##TYPE##_dX1(T, T0, P, pos, vmrs); \
case JacPropMatType::LineShape##TYPE##X2: \
return d##TYPE##_dX2(T, T0, P, pos, vmrs); \
case JacPropMatType::LineShape##TYPE##X3: \
return d##TYPE##_dX3(T, T0, P, pos, vmrs)

◆ STRING2VARIABLEDEF

#define STRING2VARIABLEDEF (   X)     if (type == #X) return Variable::X

◆ VARIABLE2STRINGDEF

#define VARIABLE2STRINGDEF (   X)
Value:
case Variable::X: \
return #X

◆ x0

#define x0   X[Index(var)].X0

Definition at line 413 of file lineshapemodel.h.

◆ x1

#define x1   X[Index(var)].X1

Definition at line 414 of file lineshapemodel.h.

◆ x2

#define x2   X[Index(var)].X2

Definition at line 415 of file lineshapemodel.h.

◆ x3

#define x3   X[Index(var)].X3

Definition at line 416 of file lineshapemodel.h.

Typedef Documentation

◆ LineShapeModel

Definition at line 1660 of file lineshapemodel.h.

◆ LineShapeSingleSpeciesModel

Function Documentation

◆ AllLineShapeCoeffs()

ArrayOfString AllLineShapeCoeffs ( )

All available line shape coefficients.

Definition at line 37 of file lineshapemodel.cc.

Referenced by jacobianAddShapeCatalogParameters(), and select_derivativeLineShape().

◆ AllLineShapeVars()

ArrayOfString AllLineShapeVars ( )

◆ select_derivativeLineShape()

JacPropMatType select_derivativeLineShape ( const String var,
const String coeff 
)

Return the derivative type based on string input.

Parameters
[in]varVariable in AllLineShapeVars()
[in]coeffCoefficient in AllLineShapeCoeffs()
Returns
Derivative

Definition at line 43 of file lineshapemodel.cc.

References AllLineShapeCoeffs(), AllLineShapeVars(), and linalg::var().

Referenced by jacobianAddShapeCatalogParameter().

Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
VectorView::begin
Iterator1D begin()
Return iterator to first element.
Definition: matpackI.cc:144
ARTS::Var::x
Vector x(Workspace &ws) noexcept
Definition: autoarts.h:7346
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
LineShape::vmrs
Vector vmrs(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const QuantumIdentifier &self, const ArrayOfSpeciesTag &lineshape_species, bool self_in_list, bool bath_in_list, Type type)
Returns a VMR vector for this model's main calculations.
Definition: lineshapemodel.cc:474