15 #ifndef BORNAGAIN_CORE_SIMULATION_SIMULATION_H
16 #define BORNAGAIN_CORE_SIMULATION_SIMULATION_H
54 void setInstrument(
const Instrument& instrument_);
55 const Instrument& instrument()
const {
return m_instrument; }
56 Instrument& instrument() {
return m_instrument; }
58 void setBeamIntensity(
double intensity);
59 double getBeamIntensity()
const;
64 void removeDetectorResolutionFunction();
67 double total_transmission);
72 void setSampleBuilder(
const std::shared_ptr<ISampleBuilder>& sample_builder);
75 const IBackground* background()
const {
return m_background.get(); }
84 void addParameterDistribution(
const std::string& param_name,
86 double sigma_factor = 0.0,
89 const DistributionHandler& getDistributionHandler()
const {
return m_distribution_handler; }
95 void subscribe(ProgressHandler::Callback_t inform) { m_progress.subscribe(inform); }
101 bool put_masked_areas_to_zero =
true);
115 virtual void updateIntensityMap() {}
126 void runSingleSimulation(
size_t batch_start,
size_t batch_size,
double weight = 1.0);
131 virtual std::unique_ptr<IComputation> generateSingleThreadedComputation(
size_t start,
132 size_t n_elements) = 0;
137 virtual void addBackgroundIntensity(
size_t start_ind,
size_t n_elements) = 0;
142 virtual void normalize(
size_t start_ind,
size_t n_elements) = 0;
144 virtual void addDataToCache(
double weight) = 0;
146 virtual void moveDataFromCache() = 0;
149 virtual std::vector<double> rawResults()
const = 0;
150 virtual void setRawResults(
const std::vector<double>& raw_data) = 0;
157 std::unique_ptr<IBackground> m_background;
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.
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.
void setTerminalProgressMonitor()
Initializes a progress monitor that prints to stdout.
void runMPISimulation()
Run a simulation in a MPI environment.
void setSample(const MultiLayer &sample)
The MultiLayer object will not be owned by the Simulation object.
virtual void initSimulationElementVector()=0
Initializes the vector of Simulation elements.
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).
virtual void prepareSimulation()
Put into a clean state for running a simulation.
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.
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 SimulationResult result() const =0
Returns the results of the simulation in a format that supports unit conversion and export to numpy a...
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.