Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JPHYSICS::JAbsorptionLength Struct Reference

Auxiliary data structure to customize absorption length. More...

#include <JPDFSupportkit.hh>

Inheritance diagram for JPHYSICS::JAbsorptionLength:
std::map< std::string, double(*)(const double)>

Public Member Functions

 JAbsorptionLength ()
 Default constructor.
 

Static Public Member Functions

static double getAbsorptionLength (const double lambda)
 Get absorption length.
 
static double & get_factor ()
 Get reference to multiplication factor.
 
static double & get_offset ()
 Get reference to offset.
 
static mapped_type & get_function ()
 Get reference to global functon.
 

Static Public Attributes

static constexpr const char *const default_t = "default"
 
static constexpr const char *const nemo_t = "nemo"
 
static constexpr const char *const SmithAndBaker_t = "SmithAndBaker"
 

Friends

std::istream & operator>> (std::istream &in, JAbsorptionLength &object)
 Read absorption length from input stream.
 
std::ostream & operator<< (std::ostream &out, const JAbsorptionLength &object)
 Write absorption length to output stream.
 

Detailed Description

Auxiliary data structure to customize absorption length.

Definition at line 63 of file JPDFSupportkit.hh.

Constructor & Destructor Documentation

◆ JAbsorptionLength()

JPHYSICS::JAbsorptionLength::JAbsorptionLength ( )
inline

Default constructor.

Definition at line 74 of file JPDFSupportkit.hh.

75 {
79
80 get_factor() = 1.0;
81 get_offset() = 610.0;
82 get_function() = (*this)[default_t];
83 }
double getAbsorptionLengthSmithAndBaker(const double lambda)
Absorption length of deep-sea water according Smith & Baker.
double getAbsorptionLength(const double lambda)
static double & get_offset()
Get reference to offset.
static constexpr const char *const default_t
static constexpr const char *const SmithAndBaker_t
static double & get_factor()
Get reference to multiplication factor.
static constexpr const char *const nemo_t
static mapped_type & get_function()
Get reference to global functon.

Member Function Documentation

◆ getAbsorptionLength()

static double JPHYSICS::JAbsorptionLength::getAbsorptionLength ( const double lambda)
inlinestatic

Get absorption length.

Parameters
lambdawavelength of light [nm]
Returns
absorption length [m]

Definition at line 132 of file JPDFSupportkit.hh.

133 {
134 const double y = 1.0 / (get_factor() * (*get_function())(lambda)) + 1.0 / get_offset();
135
136 return 1.0 / y;
137 }

◆ get_factor()

static double & JPHYSICS::JAbsorptionLength::get_factor ( )
inlinestatic

Get reference to multiplication factor.

Returns
factor

Definition at line 145 of file JPDFSupportkit.hh.

146 {
147 static double factor = 1.0;
148
149 return factor;
150 }

◆ get_offset()

static double & JPHYSICS::JAbsorptionLength::get_offset ( )
inlinestatic

Get reference to offset.

Returns
offset

Definition at line 158 of file JPDFSupportkit.hh.

159 {
160 static double offset = 1.0e6;
161
162 return offset;
163 }

◆ get_function()

static mapped_type & JPHYSICS::JAbsorptionLength::get_function ( )
inlinestatic

Get reference to global functon.

Returns
function

Definition at line 171 of file JPDFSupportkit.hh.

172 {
173 static mapped_type f1 = NAMESPACE::getAbsorptionLength;
174
175 return f1;
176 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JAbsorptionLength & object )
friend

Read absorption length from input stream.

Parameters
ininput stream
objectabsorption length
Returns
input stream

Definition at line 93 of file JPDFSupportkit.hh.

94 {
95 using namespace std;
96
97 for (string option; in >> option >> JAbsorptionLength::get_factor() >> JAbsorptionLength::get_offset(); ) {
98
99 JAbsorptionLength::const_iterator p = object.find(option);
100
101 if (p != object.end())
103 else
104 in.setstate(ios_base::badbit);
105 }
106
107 return in;
108 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JAbsorptionLength & object )
friend

Write absorption length to output stream.

Parameters
outoutput stream
objectabsorption length
Returns
output stream

Definition at line 118 of file JPDFSupportkit.hh.

119 {
120 return out << getKey(object, default_t, get_function())
123 }
std::string getKey(const std::map< std::string, T > &map, const std::string &key, const T &value)
Auxiliary method to get preferred key for given value.

Member Data Documentation

◆ default_t

const char* const JPHYSICS::JAbsorptionLength::default_t = "default"
staticconstexpr

Definition at line 66 of file JPDFSupportkit.hh.

◆ nemo_t

const char* const JPHYSICS::JAbsorptionLength::nemo_t = "nemo"
staticconstexpr

Definition at line 67 of file JPDFSupportkit.hh.

◆ SmithAndBaker_t

const char* const JPHYSICS::JAbsorptionLength::SmithAndBaker_t = "SmithAndBaker"
staticconstexpr

Definition at line 68 of file JPDFSupportkit.hh.


The documentation for this struct was generated from the following file: