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

Performs a single-threaded DWBA computation with given sample and simulation parameters. More...

Inheritance diagram for DWBAComputation:
[legend]
Collaboration diagram for DWBAComputation:
[legend]

Public Member Functions

 DWBAComputation (const MultiLayer &multilayer, const SimulationOptions &options, ProgressHandler &progress, std::vector< SimulationElement >::iterator begin_it, std::vector< SimulationElement >::iterator end_it, bool forcePolarized=false)
 
 ~DWBAComputation () override
 
std::string errorMessage () const
 
bool isCompleted () const
 
void run ()
 

Protected Attributes

std::unique_ptr< ProcessedSamplem_processed_sample
 
ProgressHandlerm_progress
 
SimulationOptions m_sim_options
 
ComputationStatus m_status
 

Private Member Functions

void runProtected () override
 

Private Attributes

std::vector< SimulationElement >::iterator m_begin_it
 These iterators define the span of detector bins this simulation will work on. More...
 
std::vector< SimulationElement >::iterator m_end_it
 
DWBASingleComputation m_single_computation
 Contains the information, necessary to calculate the Fresnel coefficients. More...
 

Detailed Description

Performs a single-threaded DWBA computation with given sample and simulation parameters.

Controlled by the multi-threading machinery in ISimulation::runSingleSimulation().

Definition at line 35 of file DWBAComputation.h.

Constructor & Destructor Documentation

◆ DWBAComputation()

DWBAComputation::DWBAComputation ( const MultiLayer multilayer,
const SimulationOptions options,
ProgressHandler progress,
std::vector< SimulationElement >::iterator  begin_it,
std::vector< SimulationElement >::iterator  end_it,
bool  forcePolarized = false 
)

Definition at line 31 of file DWBAComputation.cpp.

36  : IComputation(multilayer, options, progress, forcePolarized)
37  , m_begin_it(begin_it)
38  , m_end_it(end_it)
39 {
40  const IFresnelMap* p_fresnel_map = m_processed_sample->fresnelMap();
41  bool polarized = m_processed_sample->containsMagneticMaterial() || forcePolarized;
42 
43  for (const ProcessedLayout& layout : m_processed_sample->layouts()) {
46  }
47  // scattering from rough surfaces in DWBA
48  if (m_processed_sample->hasRoughness())
53 }
DWBASingleComputation m_single_computation
Contains the information, necessary to calculate the Fresnel coefficients.
std::vector< SimulationElement >::iterator m_begin_it
These iterators define the span of detector bins this simulation will work on.
std::vector< SimulationElement >::iterator m_end_it
void addLayoutComputation(ParticleLayoutComputation *p_layout_comp)
void setRoughnessComputation(RoughMultiLayerComputation *p_roughness_comp)
void setSpecularBinComputation(GISASSpecularComputation *p_spec_comp)
Computes the specular signal in the bin where q_parallel = 0.
IComputation(const MultiLayer &sample, const SimulationOptions &options, ProgressHandler &progress, bool forcePolarized=false)
std::unique_ptr< ProcessedSample > m_processed_sample
Definition: IComputation.h:54
SimulationOptions m_sim_options
Definition: IComputation.h:51
Holds the necessary information to calculate the radiation wavefunction in every layer for different ...
Definition: IFresnelMap.h:34
Computes the scattering contribution from one particle layout.
Data structure that contains preprocessed data for a single layout.
Computes the diffuse reflection from the rough interfaces of a multilayer.
bool includeSpecular() const
matrixFFVector_t polarized(const SimulationElement &sim_element, const std::vector< FormFactorCoherentSum > &ff_wrappers)

References DWBASingleComputation::addLayoutComputation(), SimulationOptions::includeSpecular(), IComputation::m_processed_sample, IComputation::m_sim_options, m_single_computation, FormFactorPrecompute::polarized(), DWBASingleComputation::setRoughnessComputation(), and DWBASingleComputation::setSpecularBinComputation().

Here is the call graph for this function:

◆ ~DWBAComputation()

DWBAComputation::~DWBAComputation ( )
overridedefault

Member Function Documentation

◆ errorMessage()

std::string IComputation::errorMessage ( ) const
inlineinherited

Definition at line 48 of file IComputation.h.

48 { return m_status.errorMessage(); }
std::string errorMessage() const
ComputationStatus m_status
Definition: IComputation.h:53

References ComputationStatus::errorMessage(), and IComputation::m_status.

Here is the call graph for this function:

◆ isCompleted()

bool IComputation::isCompleted ( ) const
inlineinherited

Definition at line 47 of file IComputation.h.

47 { return m_status.isCompleted(); }
bool isCompleted() const

References ComputationStatus::isCompleted(), and IComputation::m_status.

Here is the call graph for this function:

◆ run()

void IComputation::run ( )
inherited

Definition at line 31 of file IComputation.cpp.

32 {
34  try {
35  runProtected();
37  } catch (const std::exception& ex) {
38  m_status.setFailed(ex.what());
39  }
40 }
void setFailed(const std::string &message)
virtual void runProtected()=0

References IComputation::m_status, IComputation::runProtected(), ComputationStatus::setCompleted(), ComputationStatus::setFailed(), and ComputationStatus::setRunning().

Here is the call graph for this function:

◆ runProtected()

void DWBAComputation::runProtected ( )
overrideprivatevirtual

Implements IComputation.

Definition at line 62 of file DWBAComputation.cpp.

63 {
64  if (!m_progress->alive())
65  return;
67  for (auto it = m_begin_it; it != m_end_it; ++it) {
68  if (!m_progress->alive())
69  break;
71  }
72 }
void compute(SimulationElement &elem) const
void setProgressHandler(ProgressHandler *p_progress)
ProgressHandler * m_progress
Definition: IComputation.h:52

References ProgressHandler::alive(), DWBASingleComputation::compute(), m_begin_it, m_end_it, IComputation::m_progress, m_single_computation, and DWBASingleComputation::setProgressHandler().

Here is the call graph for this function:

Member Data Documentation

◆ m_begin_it

std::vector<SimulationElement>::iterator DWBAComputation::m_begin_it
private

These iterators define the span of detector bins this simulation will work on.

Definition at line 46 of file DWBAComputation.h.

Referenced by runProtected().

◆ m_end_it

std::vector<SimulationElement>::iterator DWBAComputation::m_end_it
private

Definition at line 46 of file DWBAComputation.h.

Referenced by runProtected().

◆ m_processed_sample

std::unique_ptr<ProcessedSample> IComputation::m_processed_sample
protectedinherited

◆ m_progress

ProgressHandler* IComputation::m_progress
protectedinherited

◆ m_sim_options

SimulationOptions IComputation::m_sim_options
protectedinherited

Definition at line 51 of file IComputation.h.

Referenced by DWBAComputation().

◆ m_single_computation

DWBASingleComputation DWBAComputation::m_single_computation
private

Contains the information, necessary to calculate the Fresnel coefficients.

Definition at line 48 of file DWBAComputation.h.

Referenced by DWBAComputation(), and runProtected().

◆ m_status

ComputationStatus IComputation::m_status
protectedinherited

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