BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorCoherentSum Class Reference
Collaboration diagram for FormFactorCoherentSum:

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 relativeAbundance () const
 
void scaleRelativeAbundance (double total_abundance)
 
double radialExtension () const
 

Private Member Functions

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

Private Attributes

std::vector< FormFactorCoherentPartm_parts
 
double m_abundance
 

Detailed Description

Information about particle form factor and abundance.

Definition at line 26 of file FormFactorCoherentSum.h.

Constructor & Destructor Documentation

◆ FormFactorCoherentSum() [1/2]

FormFactorCoherentSum::FormFactorCoherentSum ( double  abundance)

Definition at line 19 of file FormFactorCoherentSum.cpp.

19 : m_abundance(abundance) {}

◆ FormFactorCoherentSum() [2/2]

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

Definition at line 59 of file FormFactorCoherentSum.cpp.

61  : m_parts(parts), m_abundance(abundance)
62 {
63 }
std::vector< FormFactorCoherentPart > m_parts

Member Function Documentation

◆ addCoherentPart()

void FormFactorCoherentSum::addCoherentPart ( const FormFactorCoherentPart part)

Definition at line 21 of file FormFactorCoherentSum.cpp.

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

References m_parts.

◆ evaluate()

complex_t FormFactorCoherentSum::evaluate ( const SimulationElement sim_element) const

Definition at line 26 of file FormFactorCoherentSum.cpp.

27 {
28  complex_t result{};
29  for (auto& part : m_parts) {
30  result += part.evaluate(sim_element);
31  }
32  return result;
33 }
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 35 of file FormFactorCoherentSum.cpp.

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

References m_parts.

◆ relativeAbundance()

double FormFactorCoherentSum::relativeAbundance ( ) const
inline

Definition at line 39 of file FormFactorCoherentSum.h.

39 { return m_abundance; }

References m_abundance.

◆ scaleRelativeAbundance()

void FormFactorCoherentSum::scaleRelativeAbundance ( double  total_abundance)

Definition at line 44 of file FormFactorCoherentSum.cpp.

45 {
46  if (total_abundance > 0.0) {
47  m_abundance /= total_abundance;
48  return;
49  }
50  throw Exceptions::LogicErrorException("FormFactorCoherentSum::scaleRelativeAbundance: "
51  "Trying to scale with non strictly positive factor.");
52 }

References m_abundance.

◆ radialExtension()

double FormFactorCoherentSum::radialExtension ( ) const

Definition at line 54 of file FormFactorCoherentSum.cpp.

55 {
56  return m_parts[0].radialExtension();
57 }

References m_parts.

Member Data Documentation

◆ m_parts

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

Definition at line 45 of file FormFactorCoherentSum.h.

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

◆ m_abundance

double FormFactorCoherentSum::m_abundance
private

Definition at line 46 of file FormFactorCoherentSum.h.

Referenced by relativeAbundance(), and scaleRelativeAbundance().


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