15 #ifndef BORNAGAIN_CORE_SIMULATION_SIMULATION_H
16 #define BORNAGAIN_CORE_SIMULATION_SIMULATION_H
67 double total_transmission);
72 void setSampleBuilder(
const std::shared_ptr<ISampleBuilder>& sample_builder);
86 double sigma_factor = 0.0,
101 bool put_masked_areas_to_zero =
true);
132 size_t n_elements) = 0;
142 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.
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...
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.
Assembles beam, detector and their relative positions with respect to the sample.
Our sample model: a stack of layers one below the other.
Template class to store data of any type 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.
Pure virtual base class of OffSpecularSimulation, GISASSimulation and SpecularSimulation.
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.
virtual void moveDataFromCache()=0
SimulationOptions m_options
virtual void validateParametrization(const ParameterDistribution &) const
Checks the distribution validity for simulation.
const SimulationOptions & getOptions() const
void setBackground(const IBackground &bg)
const Instrument & instrument() const
virtual Simulation * clone() const =0
virtual void updateIntensityMap()
void setTerminalProgressMonitor()
Initializes a progress monitor that prints to stdout.
void removeDetectorResolutionFunction()
void runMPISimulation()
Run a simulation in a MPI environment.
ProgressHandler & progress()
void setSample(const MultiLayer &sample)
The MultiLayer object will not be owned by the Simulation object.
const IBackground * background() const
virtual void initSimulationElementVector()=0
Initializes the vector of Simulation elements.
void setSampleBuilder(const std::shared_ptr< ISampleBuilder > &sample_builder)
void runSimulation()
Run a simulation, possibly averaged over parameter distributions.
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
std::vector< const INode * > getChildren() const
Returns a vector of children (const).
const DistributionHandler & getDistributionHandler() const
virtual void prepareSimulation()
Put into a clean state for running a simulation.
void subscribe(ProgressHandler::Callback_t inform)
std::unique_ptr< IBackground > m_background
virtual size_t intensityMapSize() const =0
Returns the total number of the intensity values in the simulation result.
virtual void transferResultsToIntensityMap()
Creates the appropriate data structure (e.g.
SampleProvider m_sample_provider
SimulationOptions & getOptions()
const MultiLayer * sample() const
Instrument & instrument()
double getBeamIntensity() const
virtual void addDataToCache(double weight)=0
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.
DistributionHandler m_distribution_handler
void setOptions(const SimulationOptions &options)
virtual std::vector< double > rawResults() const =0
virtual void addBackgroundIntensity(size_t start_ind, size_t n_elements)=0
void setBeamIntensity(double intensity)
virtual SimulationResult result() const =0
Returns the results of the simulation in a format that supports unit conversion and export to numpy a...
void addParameterDistribution(const std::string ¶m_name, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
void runSingleSimulation(size_t batch_start, size_t batch_size, double weight=1.0)
Runs a single simulation with fixed parameter values.
ProgressHandler m_progress
const SimulationOptions & options() const
virtual void setRawResults(const std::vector< double > &raw_data)=0
void setBeamPolarization(const kvector_t bloch_vector)
Sets the beam polarization according to the given Bloch vector.
virtual size_t numberOfSimulationElements() const =0
Gets the number of elements this simulation needs to calculate.
void setDetectorResolutionFunction(const IResolutionFunction2D &resolution_function)
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.
void setInstrument(const Instrument &instrument_)