15 #ifndef BORNAGAIN_SIM_SIMULATION_ISIMULATION_H
16 #define BORNAGAIN_SIM_SIMULATION_ISIMULATION_H
20 #include <heinz/Vectors3D.h>
57 double sigma_factor = 0.0,
70 void subscribe(
const std::function<
bool(
size_t)>& inform);
110 double weight = 1.0);
117 size_t n_elements) = 0;
127 virtual void normalize(
size_t start_ind,
size_t n_elements) = 0;
Defines class DistributionHandler.
Stores radiation power per bin.
Provides the functionality to average over parameter distributions with weights.
Abstract base class for background noise, to be added to simulated scattering.
Interface for a single-threaded computation with given range of DiffuseElements and ProgressHandler.
Interface to provide axis translations to different units for simulation output.
Interface for one-dimensional distributions.
Base class for tree-like structures containing parameterized objects.
Abstract base class, holds the infrastructure to run a simulation.
void addParameterDistribution(ParameterDistribution::WhichParameter whichParameter, const IDistribution1D &distribution, size_t nbr_samples, double sigma_factor=0.0, const RealLimits &limits=RealLimits())
std::shared_ptr< MultiLayer > m_sample
virtual ICoordSystem * createCoordSystem() const =0
virtual size_t numberOfElements() const =0
Gets the number of elements this simulation needs to calculate.
virtual void prepareSimulation()=0
Put into a clean state for running a simulation.
virtual void initElementVector()=0
Initializes the vector of ISimulation elements.
virtual void updateIntensityMap()
ProgressHandler & progress()
virtual void validateParametrization(const ParameterDistribution &) const
Checks the distribution validity for simulation.
virtual void addDataToCache(double weight)=0
const IBackground * background() const
virtual SimulationResult pack_result()=0
Sets m_result.
void subscribe(const std::function< bool(size_t)> &inform)
const MultiLayer * sample() const
std::vector< const INode * > nodeChildren() const override
Returns all children.
ISimulation(ISimulation &&)=default
const SimulationOptions & options() const
virtual void moveDataFromCache()=0
virtual void addBackgroundIntensity(size_t start_ind, size_t n_elements)=0
void runSingleSimulation(const reSample &re_sample, size_t batch_start, size_t batch_size, double weight=1.0)
Runs a single simulation with fixed parameter values. If desired, the simulation is run in several th...
const std::vector< ParameterDistribution > & getDistributions() const
virtual std::unique_ptr< IComputation > createComputation(const reSample &re_sample, size_t start, size_t n_elements)=0
Generate a single threaded computation for a given range of simulation elements.
std::shared_ptr< SimulationOptions > m_options
std::shared_ptr< ProgressHandler > m_progress
virtual bool force_polarized() const =0
Force polarized computation even in absence of sample magnetization or external fields.
ISimulation(const ISimulation &)=delete
ISimulation(const MultiLayer &sample)
SimulationResult simulate()
Run a simulation, and return the result.
std::shared_ptr< IBackground > m_background
void setBackground(const IBackground &bg)
virtual void initDistributionHandler()
std::string unitOfParameter(ParameterDistribution::WhichParameter which) const
DistributionHandler m_distribution_handler
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.
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.
Our sample model: a stack of layers one below the other.
A parametric distribution function, for use with any model parameter.
Maintains information about progress of a computation.
Limits for a real fit parameter.
Collect the different options for simulation.SimulationOptions.
Wrapper around Datafield that also provides unit conversions.
Data structure that contains all the necessary data for scattering calculations.