BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorCoherentSum Class Reference

Information about particle form factor and abundance. More...

Public Member Functions

 FormFactorCoherentSum (double abundance)
 
void addCoherentPart (const FormFactorCoherentPart &part)
 
complex_t evaluate (const SimulationElement &sim_element) const
 
Eigen::Matrix2cd evaluatePol (const SimulationElement &sim_element) const
 
double radialExtension () const
 
double relativeAbundance () const
 
void scaleRelativeAbundance (double total_abundance)
 

Private Member Functions

 FormFactorCoherentSum (const std::vector< FormFactorCoherentPart > &parts, double abundance)
 

Private Attributes

double m_abundance
 
std::vector< FormFactorCoherentPartm_parts
 

Detailed Description

Information about particle form factor and abundance.

Definition at line 31 of file FormFactorCoherentSum.h.

Constructor & Destructor Documentation

◆ FormFactorCoherentSum() [1/2]

FormFactorCoherentSum::FormFactorCoherentSum ( double  abundance)

Definition at line 18 of file FormFactorCoherentSum.cpp.

18 : m_abundance(abundance) {}

◆ FormFactorCoherentSum() [2/2]

FormFactorCoherentSum::FormFactorCoherentSum ( const std::vector< FormFactorCoherentPart > &  parts,
double  abundance 
)
private

Definition at line 54 of file FormFactorCoherentSum.cpp.

56  : m_parts(parts), m_abundance(abundance)
57 {
58 }
std::vector< FormFactorCoherentPart > m_parts

Member Function Documentation

◆ addCoherentPart()

void FormFactorCoherentSum::addCoherentPart ( const FormFactorCoherentPart part)

Definition at line 20 of file FormFactorCoherentSum.cpp.

21 {
22  m_parts.push_back(part);
23 }

References m_parts.

◆ evaluate()

complex_t FormFactorCoherentSum::evaluate ( const SimulationElement sim_element) const

Definition at line 25 of file FormFactorCoherentSum.cpp.

26 {
27  complex_t result{};
28  for (const auto& part : m_parts)
29  result += part.evaluate(sim_element);
30  return result;
31 }
std::complex< double > complex_t
Definition: Complex.h:20

References m_parts.

◆ evaluatePol()

Eigen::Matrix2cd FormFactorCoherentSum::evaluatePol ( const SimulationElement sim_element) const

Definition at line 33 of file FormFactorCoherentSum.cpp.

34 {
35  Eigen::Matrix2cd result = Eigen::Matrix2cd::Zero();
36  for (const auto& part : m_parts)
37  result += part.evaluatePol(sim_element);
38  return result;
39 }

References m_parts.

◆ radialExtension()

double FormFactorCoherentSum::radialExtension ( ) const

Definition at line 49 of file FormFactorCoherentSum.cpp.

50 {
51  return m_parts[0].radialExtension();
52 }

References m_parts.

◆ relativeAbundance()

double FormFactorCoherentSum::relativeAbundance ( ) const
inline

Definition at line 43 of file FormFactorCoherentSum.h.

43 { return m_abundance; }

References m_abundance.

◆ scaleRelativeAbundance()

void FormFactorCoherentSum::scaleRelativeAbundance ( double  total_abundance)

Definition at line 41 of file FormFactorCoherentSum.cpp.

42 {
43  if (total_abundance <= 0.0)
44  throw std::runtime_error("FormFactorCoherentSum::scaleRelativeAbundance: "
45  "Trying to scale with non strictly positive factor.");
46  m_abundance /= total_abundance;
47 }

References m_abundance.

Referenced by ProcessedLayout::collectFormFactors().

Member Data Documentation

◆ m_abundance

double FormFactorCoherentSum::m_abundance
private

Definition at line 50 of file FormFactorCoherentSum.h.

Referenced by relativeAbundance(), and scaleRelativeAbundance().

◆ m_parts

std::vector<FormFactorCoherentPart> FormFactorCoherentSum::m_parts
private

Definition at line 49 of file FormFactorCoherentSum.h.

Referenced by addCoherentPart(), evaluate(), evaluatePol(), and radialExtension().


The documentation for this class was generated from the following files: