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

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

#include <JPDFSupportkit.hh>

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

Public Member Functions

 JScatteringProbability ()
 Default constructor.
 

Static Public Member Functions

static double getScatteringProbability (const double x)
 Get scattering probability.
 
static double & get_weight ()
 Get reference to weight.
 
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 f4_t = "f4"
 
static constexpr const char *const p00075_t = "p00075"
 
static constexpr const char *const petzhold_t = "petzhold"
 

Friends

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

Detailed Description

Auxiliary data structure to customize scattering probability.

Definition at line 282 of file JPDFSupportkit.hh.

Constructor & Destructor Documentation

◆ JScatteringProbability()

JPHYSICS::JScatteringProbability::JScatteringProbability ( )
inline

Default constructor.

Definition at line 294 of file JPDFSupportkit.hh.

295 {
297 (*this)[f4_t] = f4;
298 (*this)[p00075_t] = p00075;
299 (*this)[petzhold_t] = petzhold;
300
301 get_weight() = 1.0;
302 get_function() = (*this)[default_t];
303 }
double p00075(const double x)
Model specific function to describe light scattering in water (p00075).
double petzhold(const double x)
Model specific function to describe light scattering in water (Petzhold).
double f4(const double x)
Model specific function to describe light scattering in water (f4).
double getScatteringProbability(const double x)
static constexpr const char *const default_t
static constexpr const char *const p00075_t
static double & get_weight()
Get reference to weight.
static constexpr const char *const petzhold_t
static constexpr const char *const f4_t
static mapped_type & get_function()
Get reference to global functon.

Member Function Documentation

◆ getScatteringProbability()

static double JPHYSICS::JScatteringProbability::getScatteringProbability ( const double x)
inlinestatic

Get scattering probability.

Parameters
xcosine scattering angle
Returns
probability

Definition at line 351 of file JPDFSupportkit.hh.

352 {
353 return (1.0 - get_weight()) * rayleigh(x) + get_weight() * (*get_function())(x);
354 }
double rayleigh(const double a, const double x)
Auxiliary method to describe light scattering in water (Rayleigh).

◆ get_weight()

static double & JPHYSICS::JScatteringProbability::get_weight ( )
inlinestatic

Get reference to weight.

Returns
weight

Definition at line 362 of file JPDFSupportkit.hh.

363 {
364 static double weight = 1.0;
365
366 return weight;
367 }

◆ get_function()

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

Get reference to global functon.

Returns
function

Definition at line 375 of file JPDFSupportkit.hh.

376 {
377 static mapped_type f1 = NAMESPACE::getScatteringProbability;
378
379 return f1;
380 }

Friends And Related Symbol Documentation

◆ operator>>

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

Read scattering probability from input stream.

Parameters
ininput stream
objectscattering probability
Returns
input stream

Definition at line 313 of file JPDFSupportkit.hh.

314 {
315 using namespace std;
316
317 for (string option; in >> option >> JScatteringProbability::get_weight(); ) {
318
319 JScatteringProbability::const_iterator p = object.find(option);
320
321 if (p != object.end())
323 else
324 in.setstate(ios_base::badbit);
325 }
326
327 return in;
328 }

◆ operator<<

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

Write scattering probability to output stream.

Parameters
outoutput stream
objectscattering probability
Returns
output stream

Definition at line 338 of file JPDFSupportkit.hh.

339 {
340 return out << getKey(object, default_t, get_function())
342 }
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::JScatteringProbability::default_t = "default"
staticconstexpr

Definition at line 285 of file JPDFSupportkit.hh.

◆ f4_t

const char* const JPHYSICS::JScatteringProbability::f4_t = "f4"
staticconstexpr

Definition at line 286 of file JPDFSupportkit.hh.

◆ p00075_t

const char* const JPHYSICS::JScatteringProbability::p00075_t = "p00075"
staticconstexpr

Definition at line 287 of file JPDFSupportkit.hh.

◆ petzhold_t

const char* const JPHYSICS::JScatteringProbability::petzhold_t = "petzhold"
staticconstexpr

Definition at line 288 of file JPDFSupportkit.hh.


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