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

Public Member Functions

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

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

Private Member Functions

void runProtected () override
 

Private Attributes

DepthProbeElementIter m_begin_it
 
DepthProbeElementIter m_end_it
 
DepthProbeComputationTerm m_computation_term
 

Detailed Description

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

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

Definition at line 29 of file DepthProbeComputation.h.

Member Typedef Documentation

◆ DepthProbeElementIter

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

Definition at line 31 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), m_begin_it(begin_it), m_end_it(end_it),
32 {
33 }
DepthProbeComputationTerm m_computation_term
DepthProbeElementIter m_begin_it
DepthProbeElementIter m_end_it
std::unique_ptr< ProcessedSample > mP_processed_sample
Definition: IComputation.h:50
IComputation(const MultiLayer &sample, const SimulationOptions &options, ProgressHandler &progress)

◆ ~DepthProbeComputation()

DepthProbeComputation::~DepthProbeComputation ( )
overridedefault

Member Function Documentation

◆ runProtected()

void DepthProbeComputation::runProtected ( )
overrideprivatevirtual

Implements IComputation.

Definition at line 37 of file DepthProbeComputation.cpp.

38 {
39  if (!mp_progress->alive())
40  return;
42  for (auto it = m_begin_it; it != m_end_it; ++it) {
44  }
45 }
void setProgressHandler(ProgressHandler *p_progress)
void compute(DepthProbeElement &elem) const
ProgressHandler * mp_progress
Definition: IComputation.h:48

References ProgressHandler::alive(), DepthProbeComputationTerm::compute(), m_begin_it, m_computation_term, m_end_it, IComputation::mp_progress, and DepthProbeComputationTerm::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

DepthProbeElementIter DepthProbeComputation::m_begin_it
private

Definition at line 42 of file DepthProbeComputation.h.

Referenced by runProtected().

◆ m_end_it

DepthProbeElementIter DepthProbeComputation::m_end_it
private

Definition at line 42 of file DepthProbeComputation.h.

Referenced by runProtected().

◆ m_computation_term

DepthProbeComputationTerm DepthProbeComputation::m_computation_term
private

Definition at line 43 of file DepthProbeComputation.h.

Referenced by runProtected().

◆ m_sim_options

SimulationOptions IComputation::m_sim_options
protectedinherited

Definition at line 47 of file IComputation.h.

Referenced by DWBAComputation::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: