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

Public Member Functions

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

Protected Attributes

SimulationOptions m_sim_options
 
ProgressHandlermp_progress
 
ComputationStatus m_status
 
std::unique_ptr< ProcessedSamplemP_processed_sample
 

Private Member Functions

void runProtected () override
 

Private Attributes

std::vector< SimulationElement >::iterator m_begin_it
 
std::vector< SimulationElement >::iterator m_end_it
 
DWBASingleComputation m_single_computation
 

Detailed Description

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

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

Definition at line 30 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 
)

Definition at line 31 of file DWBAComputation.cpp.

35  : IComputation(multilayer, options, progress), m_begin_it(begin_it), m_end_it(end_it)
36 {
37  auto p_fresnel_map = mP_processed_sample->fresnelMap();
38  bool polarized = mP_processed_sample->containsMagneticMaterial();
39  for (const auto& layout : mP_processed_sample->layouts()) {
41  new ParticleLayoutComputation(&layout, m_sim_options, polarized));
42  }
43  // scattering from rough surfaces in DWBA
44  if (mP_processed_sample->hasRoughness())
49 }
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.
std::unique_ptr< ProcessedSample > mP_processed_sample
Definition: IComputation.h:50
IComputation(const MultiLayer &sample, const SimulationOptions &options, ProgressHandler &progress)
SimulationOptions m_sim_options
Definition: IComputation.h:47
Computes the scattering contribution from one particle layout.
Computes the diffuse reflection from the rough interfaces of a multilayer.
bool includeSpecular() const

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

Here is the call graph for this function:

◆ ~DWBAComputation()

DWBAComputation::~DWBAComputation ( )
overridedefault

Member Function Documentation

◆ runProtected()

void DWBAComputation::runProtected ( )
overrideprivatevirtual

Implements IComputation.

Definition at line 58 of file DWBAComputation.cpp.

59 {
60  if (!mp_progress->alive())
61  return;
63  for (auto it = m_begin_it; it != m_end_it; ++it) {
64  if (!mp_progress->alive())
65  break;
67  }
68 }
void compute(SimulationElement &elem) const
void setProgressHandler(ProgressHandler *p_progress)
ProgressHandler * mp_progress
Definition: IComputation.h:48

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

Here is the call graph for this function:

◆ run()

void IComputation::run ( )
inherited

Definition at line 30 of file IComputation.cpp.

31 {
33  try {
34  runProtected();
36  } catch (const std::exception& ex) {
37  m_status.setErrorMessage(std::string(ex.what()));
39  }
40 }
void setErrorMessage(const std::string &message)
virtual void runProtected()=0
ComputationStatus m_status
Definition: IComputation.h:49

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

Here is the call graph for this function:

◆ isCompleted()

bool IComputation::isCompleted ( ) const
inlineinherited

Definition at line 43 of file IComputation.h.

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

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

Here is the call graph for this function:

◆ errorMessage()

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

Definition at line 44 of file IComputation.h.

44 { return m_status.errorMessage(); }
std::string errorMessage() const

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

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 42 of file DWBAComputation.h.

Referenced by runProtected().

◆ m_end_it

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

Definition at line 42 of file DWBAComputation.h.

Referenced by runProtected().

◆ m_single_computation

DWBASingleComputation DWBAComputation::m_single_computation
private

Contains the information, necessary to calculate the Fresnel coefficients.

Definition at line 44 of file DWBAComputation.h.

Referenced by DWBAComputation(), and runProtected().

◆ m_sim_options

SimulationOptions IComputation::m_sim_options
protectedinherited

Definition at line 47 of file IComputation.h.

Referenced by DWBAComputation().

◆ mp_progress

ProgressHandler* IComputation::mp_progress
protectedinherited

◆ m_status

ComputationStatus IComputation::m_status
protectedinherited

◆ mP_processed_sample

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

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