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

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

#include <JPDFSupportkit.hh>

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

Public Member Functions

 JScatteringLength ()
 Default constructor.
 

Static Public Member Functions

static double getScatteringLength (const double lambda)
 Get scattering length.
 
static double & get_factor ()
 Get reference to multiplication factor.
 
static mapped_type & get_function ()
 Get reference to global functon.
 

Static Public Attributes

static constexpr const char *const default_t = "default"
 

Friends

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

Detailed Description

Auxiliary data structure to customize scattering length.

Definition at line 183 of file JPDFSupportkit.hh.

Constructor & Destructor Documentation

◆ JScatteringLength()

JPHYSICS::JScatteringLength::JScatteringLength ( )
inline

Default constructor.

Definition at line 192 of file JPDFSupportkit.hh.

193 {
195
196 get_factor() = 1.0;
197 get_function() = (*this)[default_t];
198 }
double getScatteringLength(const double lambda)
static constexpr const char *const default_t
static double & get_factor()
Get reference to multiplication factor.
static mapped_type & get_function()
Get reference to global functon.

Member Function Documentation

◆ getScatteringLength()

static double JPHYSICS::JScatteringLength::getScatteringLength ( const double lambda)
inlinestatic

Get scattering length.

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

Definition at line 246 of file JPDFSupportkit.hh.

247 {
248 return get_factor() * (*get_function())(lambda);
249 }

◆ get_factor()

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

Get reference to multiplication factor.

Returns
factor

Definition at line 257 of file JPDFSupportkit.hh.

258 {
259 static double factor = 1.0;
260
261 return factor;
262 }

◆ get_function()

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

Get reference to global functon.

Returns
function

Definition at line 270 of file JPDFSupportkit.hh.

271 {
272 static mapped_type f1 = NAMESPACE::getScatteringLength;
273
274 return f1;
275 }

Friends And Related Symbol Documentation

◆ operator>>

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

Read scattering length from input stream.

Parameters
ininput stream
objectscattering length
Returns
input stream

Definition at line 208 of file JPDFSupportkit.hh.

209 {
210 using namespace std;
211
212 for (string option; in >> option >> JScatteringLength::get_factor(); ) {
213
214 JScatteringLength::const_iterator p = object.find(option);
215
216 if (p != object.end())
218 else
219 in.setstate(ios_base::badbit);
220 }
221
222 return in;
223 }

◆ operator<<

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

Write scattering length to output stream.

Parameters
outoutput stream
objectscattering length
Returns
output stream

Definition at line 233 of file JPDFSupportkit.hh.

234 {
235 return out << getKey(object, default_t, get_function())
237 }
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::JScatteringLength::default_t = "default"
staticconstexpr

Definition at line 186 of file JPDFSupportkit.hh.


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