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

Performs a single-threaded depth probe computation with given sample. More...

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

Public Member Functions

 DepthProbeComputation (const MultiLayer &multilayer, const SimulationOptions &options, ProgressHandler &progress, DepthProbeElementIter begin_it, DepthProbeElementIter end_it)
 
 ~DepthProbeComputation () 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 Types

using DepthProbeElementIter = std::vector< DepthProbeElement >::iterator
 

Private Member Functions

void runProtected () override
 

Private Attributes

DepthProbeElementIter m_begin_it
 
DepthProbeComputationTerm m_computation_term
 
DepthProbeElementIter m_end_it
 

Detailed Description

Performs a single-threaded depth probe computation with given sample.

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

Definition at line 34 of file DepthProbeComputation.h.

Member Typedef Documentation

◆ DepthProbeElementIter

using DepthProbeComputation::DepthProbeElementIter = std::vector<DepthProbeElement>::iterator
private

Definition at line 35 of file DepthProbeComputation.h.

Constructor & Destructor Documentation

◆ DepthProbeComputation()

DepthProbeComputation::DepthProbeComputation ( const MultiLayer multilayer,
const SimulationOptions options,
ProgressHandler progress,
DepthProbeElementIter  begin_it,
DepthProbeElementIter  end_it 
)

Definition at line 25 of file DepthProbeComputation.cpp.

30  : IComputation(multilayer, options, progress)
31  , m_begin_it(begin_it)
32  , m_end_it(end_it)
34 {
35 }
DepthProbeComputationTerm m_computation_term
DepthProbeElementIter m_begin_it
DepthProbeElementIter m_end_it
IComputation(const MultiLayer &sample, const SimulationOptions &options, ProgressHandler &progress, bool forcePolarized=false)
std::unique_ptr< ProcessedSample > m_processed_sample
Definition: IComputation.h:54

◆ ~DepthProbeComputation()

DepthProbeComputation::~DepthProbeComputation ( )
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 DepthProbeComputation::runProtected ( )
overrideprivatevirtual

Implements IComputation.

Definition at line 39 of file DepthProbeComputation.cpp.

40 {
41  if (!m_progress->alive())
42  return;
44  for (auto it = m_begin_it; it != m_end_it; ++it) {
46  }
47 }
void setProgressHandler(ProgressHandler *p_progress)
void compute(DepthProbeElement &elem) const
ProgressHandler * m_progress
Definition: IComputation.h:52

References ProgressHandler::alive(), DepthProbeComputationTerm::compute(), m_begin_it, m_computation_term, m_end_it, IComputation::m_progress, and DepthProbeComputationTerm::setProgressHandler().

Here is the call graph for this function:

Member Data Documentation

◆ m_begin_it

DepthProbeElementIter DepthProbeComputation::m_begin_it
private

Definition at line 46 of file DepthProbeComputation.h.

Referenced by runProtected().

◆ m_computation_term

DepthProbeComputationTerm DepthProbeComputation::m_computation_term
private

Definition at line 47 of file DepthProbeComputation.h.

Referenced by runProtected().

◆ m_end_it

DepthProbeElementIter DepthProbeComputation::m_end_it
private

Definition at line 46 of file DepthProbeComputation.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::DWBAComputation().

◆ m_status

ComputationStatus IComputation::m_status
protectedinherited

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