16 #ifndef BORNAGAIN_CORE_SIMULATION_ISIMULATION_H
17 #define BORNAGAIN_CORE_SIMULATION_ISIMULATION_H
71 void setSampleBuilder(
const std::shared_ptr<ISampleBuilder>& sample_builder);
85 double sigma_factor = 0.0,
100 bool put_masked_areas_to_zero =
true);
136 size_t n_elements) = 0;
146 virtual void normalize(
size_t start_ind,
size_t n_elements) = 0;
Defines class DistributionHandler.
Defines interface IDetector2D.
Defines class Instrument.
Defines class ProgressHandler.
Defines class SampleProvider.
Defines class SimulationOptions.
Defines class SimulationResult.
An incident neutron or x-ray beam.
Provides the functionality to average over parameter distributions with weights.
Interface for a simulating the background signal.
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Interface for a single-threaded computation with given range of SimulationElements and ProgressHandle...
Abstract detector interface.
Interface for one-dimensional distributions.
Base class for tree-like structures containing parameterized objects.
Interface providing two-dimensional resolution function.
Interface to the class capable to build samples to simulate.
Abstract base class of OffSpecularSimulation, GISASSimulation and SpecularSimulation.
const Beam & beam() const
void setSample(const MultiLayer &sample)
The MultiLayer object will not be owned by the ISimulation object.
std::vector< const INode * > getChildren() const
Returns a vector of children.
virtual void updateIntensityMap()
virtual void validateParametrization(const ParameterDistribution &) const
Checks the distribution validity for simulation.
void runSingleSimulation(size_t batch_start, size_t batch_size, double weight=1.0)
Runs a single simulation with fixed parameter values.
SimulationOptions & getOptions()
const IDetector & detector() const
virtual size_t numberOfSimulationElements() const =0
Gets the number of elements this simulation needs to calculate.
virtual void setRawResults(const std::vector< double > &raw_data)=0
const DistributionHandler & getDistributionHandler() const
virtual void addDataToCache(double weight)=0
const IBackground * background() const
void setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
const MultiLayer * sample() const
void addParameterDistribution(const std::string ¶m_name, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
virtual std::unique_ptr< IComputation > generateSingleThreadedComputation(size_t start, size_t n_elements)=0
Generate a single threaded computation for a given range of simulation elements.
SampleProvider m_sample_provider
Instrument & instrument()
SimulationResult convertData(const OutputData< double > &data, bool put_masked_areas_to_zero=true)
Convert user data to SimulationResult object for later drawing in various axes units.
virtual ISimulation * clone() const =0
void runMPISimulation()
Run a simulation in a MPI environment.
const Instrument & instrument() const
void runSimulation()
Run a simulation, possibly averaged over parameter distributions.
SimulationOptions m_options
void setSampleBuilder(const std::shared_ptr< ISampleBuilder > &sample_builder)
const IDetector * getDetector() const
ProgressHandler & progress()
void setInstrument(const Instrument &instrument_)
virtual void moveDataFromCache()=0
virtual void addBackgroundIntensity(size_t start_ind, size_t n_elements)=0
const SimulationOptions & getOptions() const
virtual void initSimulationElementVector()=0
Initializes the vector of ISimulation elements.
const SimulationOptions & options() const
virtual void prepareSimulation()
Put into a clean state for running a simulation.
virtual SimulationResult result() const =0
Returns the results of the simulation in a format that supports unit conversion and export to numpy a...
std::unique_ptr< IBackground > m_background
virtual std::vector< double > rawResults() const =0
void subscribe(ProgressHandler::Callback_t inform)
void setBackground(const IBackground &bg)
DistributionHandler m_distribution_handler
IDetector * getDetector()
virtual void normalize(size_t start_ind, size_t n_elements)=0
Normalize the detector counts to beam intensity, to solid angle, and to exposure angle.
ProgressHandler m_progress
virtual size_t intensityMapSize() const =0
Returns the total number of the intensity values in the simulation result.
void setTerminalProgressMonitor()
Initializes a progress monitor that prints to stdout.
virtual void transferResultsToIntensityMap()
Creates the appropriate data structure (e.g.
void setOptions(const SimulationOptions &options)
Assembles beam, detector and their relative positions with respect to the sample.
IDetector * getDetector()
Our sample model: a stack of layers one below the other.
Templated class to store data of type double or CumulativeValue in multi-dimensional space.
A parametric distribution function, for use with any model parameter.
Maintains information about progress of a computation.
void subscribe(ProgressHandler::Callback_t callback)
std::function< bool(size_t)> Callback_t
Limits for a real fit parameter.
Holds either a Sample, or a SampleBuilderNode (which holds an ISampleBuilder).
Collect the different options for simulation.
Wrapper around OutputData<double> that also provides unit conversions.