BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IDetector Class Referenceabstract

Abstract detector interface. More...

Inheritance diagram for IDetector:
[legend]
Collaboration diagram for IDetector:
[legend]

Public Types

using const_iterator = const SimulationAreaIterator &
 

Public Member Functions

 IDetector ()
 
virtual ~IDetector ()
 
virtual void accept (INodeVisitor *visitor) const =0
 Calls the INodeVisitor's visit method. More...
 
void addAxis (const IAxis &axis)
 
void applyDetectorResolution (OutputData< double > *p_intensity_map) const
 Applies the detector resolution to the given intensity maps. More...
 
const IAxisaxis (size_t index) const
 
size_t axisBinIndex (size_t index, size_t selected_axis) const
 Calculate axis index for given global index. More...
 
IDetectorclone () const override=0
 
int copyNumber (const INode *node) const
 Returns copyNumber of child, which takes into account existence of children with same name. More...
 
OutputData< double > * createDetectorIntensity (const std::vector< SimulationElement > &elements) const
 Returns new intensity map with detector resolution applied. More...
 
std::unique_ptr< OutputData< double > > createDetectorMap () const
 Returns empty detector map in given axes units. More...
 
ParameterPoolcreateParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children. More...
 
virtual Axes::Units defaultAxesUnits () const
 Return default axes units. More...
 
const DetectionPropertiesdetectionProperties () const
 Returns detection properties. More...
 
virtual const DetectorMaskdetectorMask () const =0
 Returns detector masks container. More...
 
const IDetectorResolutiondetectorResolution () const
 Returns a pointer to detector resolution object. More...
 
size_t dimension () const
 Returns actual dimensionality of the detector (number of defined axes) More...
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number. More...
 
std::vector< const INode * > getChildren () const override
 Returns a vector of children. More...
 
const std::string & getName () const
 
virtual void init (const Beam &)
 Inits detector with the beam settings. More...
 
void iterate (std::function< void(const_iterator)> func, bool visit_masks=false) const
 
size_t numberOfSimulationElements () const
 Returns number of simulation elements. More...
 
virtual void onChange ()
 Action to be taken in inherited class when a parameter has changed. More...
 
RealParameterparameter (const std::string &name) const
 Returns parameter with given 'name'. More...
 
ParameterPoolparameterPool () const
 Returns pointer to the parameter pool. More...
 
std::string parametersToString () const
 Returns multiline string representing available parameters. More...
 
INodeparent ()
 
const INodeparent () const
 
std::vector< const INode * > progeny () const
 Returns a vector of all descendants. More...
 
virtual const RegionOfInterestregionOfInterest () const =0
 Returns region of interest if exists. More...
 
void registerChild (INode *node)
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
virtual void resetRegionOfInterest ()=0
 Resets region of interest making whole detector plane available for the simulation. More...
 
void setAnalyzerProperties (const kvector_t direction, double efficiency, double total_transmission)
 Sets the polarization analyzer characteristics of the detector. More...
 
void setDetectorResolution (const IDetectorResolution &p_detector_resolution)
 Sets the detector resolution. More...
 
void setName (const std::string &name)
 
void setParameterValue (const std::string &name, double value)
 
virtual void setParent (const INode *newParent)
 
void setResolutionFunction (const IResolutionFunction2D &resFunc)
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
size_t totalSize () const
 Returns total number of pixels. More...
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py) More...
 
virtual std::string treeToString () const
 Returns multiline string representing tree structure below the node. More...
 

Static Public Member Functions

static std::string XComponentName (const std::string &base_name)
 
static std::string YComponentName (const std::string &base_name)
 
static std::string ZComponentName (const std::string &base_name)
 

Protected Member Functions

 IDetector (const IDetector &other)
 
virtual std::string axisName (size_t index) const =0
 Returns the name for the axis with given index. More...
 
void clear ()
 
virtual std::unique_ptr< IAxiscreateAxis (size_t index, size_t n_bins, double min, double max) const
 Generates an axis with correct name and default binning for given index. More...
 

Protected Attributes

const size_t m_NP
 
std::vector< double > m_P
 

Private Member Functions

void setDataToDetectorMap (OutputData< double > &detectorMap, const std::vector< SimulationElement > &elements) const
 

Private Attributes

CloneableVector< IAxism_axes
 
DetectionProperties m_detection_properties
 
std::unique_ptr< IDetectorResolutionm_detector_resolution
 
std::string m_name
 
const INodem_parent {nullptr}
 
std::unique_ptr< ParameterPoolm_pool
 parameter pool (kind of pointer-to-implementation) More...
 

Detailed Description

Abstract detector interface.

Definition at line 36 of file IDetector.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 38 of file IDetector.h.

Constructor & Destructor Documentation

◆ IDetector() [1/2]

IDetector::IDetector ( )

Definition at line 22 of file IDetector.cpp.

23 {
25 }
DetectionProperties m_detection_properties
Definition: IDetector.h:115
void registerChild(INode *node)
Definition: INode.cpp:57

References m_detection_properties, and INode::registerChild().

Here is the call graph for this function:

◆ ~IDetector()

IDetector::~IDetector ( )
virtualdefault

◆ IDetector() [2/2]

IDetector::IDetector ( const IDetector other)
protected

Definition at line 27 of file IDetector.cpp.

28  : ICloneable()
29  , INode()
30  , m_axes(other.m_axes)
32 {
33  if (other.m_detector_resolution)
35  setName(other.getName());
37 }
ICloneable()=default
std::unique_ptr< IDetectorResolution > m_detector_resolution
Definition: IDetector.h:116
CloneableVector< IAxis > m_axes
Definition: IDetector.h:114
void setDetectorResolution(const IDetectorResolution &p_detector_resolution)
Sets the detector resolution.
Definition: IDetector.cpp:105
INode()
Definition: INode.h:51
const std::string & getName() const
void setName(const std::string &name)

References IParametricComponent::getName(), m_detection_properties, m_detector_resolution, INode::registerChild(), setDetectorResolution(), and IParametricComponent::setName().

Here is the call graph for this function:

Member Function Documentation

◆ accept()

virtual void INode::accept ( INodeVisitor visitor) const
pure virtualinherited

Calls the INodeVisitor's visit method.

Implemented in FormFactorDecoratorMaterial, FormFactorWeighted, FormFactorCrystal, FormFactorCoreShell, Lattice3D, MisesGaussPeakShape, MisesFisherGaussPeakShape, LorentzFisherPeakShape, GaussFisherPeakShape, IsotropicLorentzPeakShape, IsotropicGaussPeakShape, ParticleLayout, InterferenceFunctionHardDisk, InterferenceFunctionFinite3DLattice, InterferenceFunctionFinite2DLattice, InterferenceFunction3DLattice, InterferenceFunction2DSuperLattice, InterferenceFunction2DParaCrystal, InterferenceFunction2DLattice, InterferenceFunction1DLattice, SphericalDetector, SpecularDetector1D, FootprintSquare, FootprintGauss, Beam, OffSpecularSimulation, GISASSimulation, PoissonNoiseBackground, ConstantBackground, FormFactorSphereLogNormalRadius, FormFactorSphereGaussianRadius, FormFactorGaussSphere, FormFactorDecoratorRotation, FormFactorDecoratorPositionFactor, SampleProvider, SampleBuilderNode, ParticleDistribution, ParticleCoreShell, ParticleComposition, Particle, MesoCrystal, Crystal, MultiLayer, Layer, HexagonalLattice2D, SquareLattice2D, BasicLattice2D, FormFactorTruncatedSpheroid, FormFactorTruncatedSphere, FormFactorTruncatedCube, FormFactorTetrahedron, FormFactorSawtoothRippleLorentz, FormFactorSawtoothRippleGauss, FormFactorSawtoothRippleBox, FormFactorPyramid, FormFactorPrism6, FormFactorPrism3, FormFactorLongBoxLorentz, FormFactorLongBoxGauss, FormFactorIcosahedron, FormFactorHollowSphere, FormFactorHemiEllipsoid, FormFactorFullSpheroid, FormFactorFullSphere, FormFactorEllipsoidalCylinder, FormFactorDot, FormFactorDodecahedron, FormFactorCylinder, FormFactorCuboctahedron, FormFactorCosineRippleLorentz, FormFactorCosineRippleGauss, FormFactorCosineRippleBox, FormFactorCone6, FormFactorCone, FormFactorCantellatedCube, FormFactorBox, FormFactorBarLorentz, FormFactorBarGauss, FormFactorAnisoPyramid, FTDistribution2DVoigt, FTDistribution2DCone, FTDistribution2DGate, FTDistribution2DGauss, FTDistribution2DCauchy, FTDistribution1DVoigt, FTDistribution1DCosine, FTDistribution1DTriangle, FTDistribution1DGate, FTDistribution1DGauss, FTDistribution1DCauchy, FTDecayFunction2DVoigt, FTDecayFunction2DGauss, FTDecayFunction2DCauchy, FTDecayFunction1DVoigt, FTDecayFunction1DTriangle, FTDecayFunction1DGauss, FTDecayFunction1DCauchy, InterferenceFunctionTwin, InterferenceFunctionRadialParaCrystal, InterferenceFunctionNone, DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, DistributionGate, ResolutionFunction2DGaussian, ConvolutionDetectorResolution, Instrument, RectangularDetector, IsGISAXSDetector, DetectionProperties, SpecularSimulation, DepthProbeSimulation, LayerRoughness, LayerInterface, RotationEuler, RotationZ, RotationY, RotationX, IdentityRotation, and IAbstractParticle.

◆ addAxis()

void IDetector::addAxis ( const IAxis axis)

Definition at line 41 of file IDetector.cpp.

42 {
44 }
void push_back(T *t)
virtual IAxis * clone() const =0
clone function
const IAxis & axis(size_t index) const
Definition: IDetector.cpp:56

References axis(), IAxis::clone(), m_axes, and CloneableVector< T >::push_back().

Referenced by SpecularDetector1D::SpecularDetector1D(), SpecularDetector1D::setAxis(), IDetector2D::setDetectorParameters(), and SpecularSimulation::setScan().

Here is the call graph for this function:

◆ applyDetectorResolution()

void IDetector::applyDetectorResolution ( OutputData< double > *  p_intensity_map) const

Applies the detector resolution to the given intensity maps.

Definition at line 118 of file IDetector.cpp.

119 {
120  if (!p_intensity_map)
121  throw std::runtime_error("IDetector::applyDetectorResolution() -> "
122  "Error! Null pointer to intensity map");
123  if (m_detector_resolution) {
124  m_detector_resolution->applyDetectorResolution(p_intensity_map);
125  if (detectorMask() && detectorMask()->hasMasks()) {
126  // sets amplitude in masked areas to zero
127  std::unique_ptr<OutputData<double>> buff(new OutputData<double>());
128  buff->copyShapeFrom(*p_intensity_map);
129 
130  iterate([&](const_iterator it) {
131  (*buff)[it.roiIndex()] = (*p_intensity_map)[it.roiIndex()];
132  });
133  p_intensity_map->setRawDataVector(buff->getRawDataVector());
134  }
135  }
136 }
virtual const DetectorMask * detectorMask() const =0
Returns detector masks container.
const SimulationAreaIterator & const_iterator
Definition: IDetector.h:38
void iterate(std::function< void(const_iterator)> func, bool visit_masks=false) const
Definition: IDetector.cpp:197
void setRawDataVector(const std::vector< T > &data_vector)
Sets new values to raw data vector.
Definition: OutputData.h:556

References detectorMask(), iterate(), m_detector_resolution, SimulationAreaIterator::roiIndex(), and OutputData< T >::setRawDataVector().

Referenced by createDetectorIntensity(), and OffSpecularSimulation::transferDetectorImage().

Here is the call graph for this function:

◆ axis()

◆ axisBinIndex()

size_t IDetector::axisBinIndex ( size_t  index,
size_t  selected_axis 
) const

Calculate axis index for given global index.

Definition at line 63 of file IDetector.cpp.

64 {
65  const size_t dim = dimension();
66  size_t remainder(index);
67  size_t i_axis = dim;
68  for (size_t i = 0; i < dim; ++i) {
69  --i_axis;
70  if (selected_axis == i_axis)
71  return remainder % m_axes[i_axis]->size();
72  remainder /= m_axes[i_axis]->size();
73  }
74  throw std::runtime_error("IDetector::getAxisBinIndex() -> "
75  "Error! No axis with given number");
76 }

References dimension(), and m_axes.

Referenced by RectangularDetector::createPixel(), and SphericalDetector::createPixel().

Here is the call graph for this function:

◆ axisName()

virtual std::string IDetector::axisName ( size_t  index) const
protectedpure virtual

Returns the name for the axis with given index.

Implemented in SphericalDetector, SpecularDetector1D, and RectangularDetector.

Referenced by createAxis().

◆ clear()

void IDetector::clear ( )
protected

Definition at line 51 of file IDetector.cpp.

52 {
53  m_axes.clear();
54 }

References m_axes.

Referenced by SpecularDetector1D::setAxis(), and IDetector2D::setDetectorParameters().

◆ clone()

IDetector* IDetector::clone ( ) const
overridepure virtual

◆ copyNumber()

int INode::copyNumber ( const INode node) const
inherited

Returns copyNumber of child, which takes into account existence of children with same name.

Definition at line 94 of file INode.cpp.

95 {
96  if (node->parent() != this)
97  return -1;
98 
99  int result(-1), count(0);
100  for (auto child : getChildren()) {
101 
102  if (child == nullptr)
103  throw std::runtime_error("INode::copyNumber() -> Error. Nullptr as child.");
104 
105  if (child == node)
106  result = count;
107 
108  if (child->getName() == node->getName())
109  ++count;
110  }
111 
112  return count > 1 ? result : -1;
113 }
const INode * parent() const
Definition: INode.cpp:84
virtual std::vector< const INode * > getChildren() const
Returns a vector of children.
Definition: INode.cpp:63

References INode::getChildren(), IParametricComponent::getName(), and INode::parent().

Referenced by INode::displayName().

Here is the call graph for this function:

◆ createAxis()

std::unique_ptr< IAxis > IDetector::createAxis ( size_t  index,
size_t  n_bins,
double  min,
double  max 
) const
protectedvirtual

Generates an axis with correct name and default binning for given index.

Reimplemented in IsGISAXSDetector.

Definition at line 78 of file IDetector.cpp.

80 {
81  if (max <= min)
82  throw std::runtime_error("IDetector::createAxis() -> Error! max <= min");
83  if (n_bins == 0)
84  throw std::runtime_error("IDetector::createAxis() -> Error! Number n_bins can't be zero.");
85  return std::make_unique<FixedBinAxis>(axisName(index), n_bins, min, max);
86 }
virtual std::string axisName(size_t index) const =0
Returns the name for the axis with given index.

References axisName().

Referenced by IDetector2D::setDetectorParameters().

Here is the call graph for this function:

◆ createDetectorIntensity()

OutputData< double > * IDetector::createDetectorIntensity ( const std::vector< SimulationElement > &  elements) const

Returns new intensity map with detector resolution applied.

Map will be cropped to ROI if ROI is present.

Definition at line 144 of file IDetector.cpp.

145 {
146  std::unique_ptr<OutputData<double>> detectorMap(createDetectorMap());
147  if (!detectorMap)
148  throw std::runtime_error("Instrument::createDetectorIntensity:"
149  "can't create detector map.");
150 
151  setDataToDetectorMap(*detectorMap, elements);
153  applyDetectorResolution(detectorMap.get());
154 
155  return detectorMap.release();
156 }
void setDataToDetectorMap(OutputData< double > &detectorMap, const std::vector< SimulationElement > &elements) const
Definition: IDetector.cpp:175
void applyDetectorResolution(OutputData< double > *p_intensity_map) const
Applies the detector resolution to the given intensity maps.
Definition: IDetector.cpp:118
std::unique_ptr< OutputData< double > > createDetectorMap() const
Returns empty detector map in given axes units.
Definition: IDetector.cpp:158

References applyDetectorResolution(), createDetectorMap(), m_detector_resolution, and setDataToDetectorMap().

Here is the call graph for this function:

◆ createDetectorMap()

std::unique_ptr< OutputData< double > > IDetector::createDetectorMap ( ) const

Returns empty detector map in given axes units.

Definition at line 158 of file IDetector.cpp.

159 {
160  const size_t dim = dimension();
161  if (dim == 0)
162  throw std::runtime_error(
163  "Error in IDetector::createDetectorMap: dimensions of the detector are undefined");
164 
165  std::unique_ptr<OutputData<double>> result(new OutputData<double>);
166  for (size_t i = 0; i < dim; ++i)
167  if (auto roi = regionOfInterest())
168  result->addAxis(*roi->clipAxisToRoi(i, axis(i)));
169  else
170  result->addAxis(axis(i));
171 
172  return result;
173 }
virtual const RegionOfInterest * regionOfInterest() const =0
Returns region of interest if exists.

References axis(), dimension(), and regionOfInterest().

Referenced by createDetectorIntensity().

Here is the call graph for this function:

◆ createParameterTree()

ParameterPool * INode::createParameterTree ( ) const
virtualinherited

Creates new parameter pool, with all local parameters and those of its children.

Reimplemented from IParametricComponent.

Definition at line 126 of file INode.cpp.

127 {
128  std::unique_ptr<ParameterPool> result(new ParameterPool);
129 
130  for (const INode* child : progeny()) {
131  const std::string path = NodeUtils::nodePath(child, parent()) + "/";
132  child->parameterPool()->copyToExternalPool(path, result.get());
133  }
134 
135  return result.release();
136 }
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
std::vector< const INode * > progeny() const
Returns a vector of all descendants.
Definition: INode.cpp:68
Container with parameters for IParametricComponent object.
Definition: ParameterPool.h:29
std::string nodePath(const INode *node, const INode *root=nullptr)
Returns path composed of node's displayName, with respect to root node.
Definition: NodeUtils.cpp:89

References NodeUtils::nodePath(), INode::parent(), and INode::progeny().

Referenced by ISimulation::runSimulation(), DepthProbeSimulation::validateParametrization(), OffSpecularSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().

Here is the call graph for this function:

◆ defaultAxesUnits()

virtual Axes::Units IDetector::defaultAxesUnits ( ) const
inlinevirtual

Return default axes units.

Reimplemented in SphericalDetector, SpecularDetector1D, and RectangularDetector.

Definition at line 90 of file IDetector.h.

90 { return Axes::Units::DEFAULT; }

◆ detectionProperties()

◆ detectorMask()

virtual const DetectorMask* IDetector::detectorMask ( ) const
pure virtual

◆ detectorResolution()

const IDetectorResolution * IDetector::detectorResolution ( ) const

Returns a pointer to detector resolution object.

Definition at line 138 of file IDetector.cpp.

139 {
140  return m_detector_resolution.get();
141 }

References m_detector_resolution.

Referenced by TransformFromDomain::setDetectorResolution().

◆ dimension()

◆ displayName()

std::string INode::displayName ( ) const
inherited

Returns display name, composed from the name of node and it's copy number.

Definition at line 115 of file INode.cpp.

116 {
117  std::string result = getName();
118  if (m_parent) {
119  int index = m_parent->copyNumber(this);
120  if (index >= 0)
121  result = result + std::to_string(index);
122  }
123  return result;
124 }
const INode * m_parent
Definition: INode.h:83
int copyNumber(const INode *node) const
Returns copyNumber of child, which takes into account existence of children with same name.
Definition: INode.cpp:94

References INode::copyNumber(), IParametricComponent::getName(), and INode::m_parent.

Referenced by NodeUtils::nodePath().

Here is the call graph for this function:

◆ getChildren()

std::vector< const INode * > IDetector::getChildren ( ) const
overridevirtual

Returns a vector of children.

Reimplemented from INode.

Definition at line 192 of file IDetector.cpp.

193 {
194  return std::vector<const INode*>() << &m_detection_properties << m_detector_resolution;
195 }

References m_detection_properties, and m_detector_resolution.

◆ getName()

◆ init()

virtual void IDetector::init ( const Beam )
inlinevirtual

Inits detector with the beam settings.

Reimplemented in RectangularDetector.

Definition at line 46 of file IDetector.h.

46 {}

◆ iterate()

void IDetector::iterate ( std::function< void(const_iterator)>  func,
bool  visit_masks = false 
) const

Definition at line 197 of file IDetector.cpp.

198 {
199  if (this->dimension() == 0)
200  return;
201 
202  if (visit_masks) {
203  SimulationRoiArea area(this);
204  for (SimulationRoiArea::iterator it = area.begin(); it != area.end(); ++it)
205  func(it);
206  } else {
207  SimulationArea area(this);
208  for (SimulationArea::iterator it = area.begin(); it != area.end(); ++it)
209  func(it);
210  }
211 }
An iterator for SimulationArea.
Holds iteration logic over active detector channels in the presence of masked areas and RegionOfInter...
Holds iteration logic over active detector channels in the presence of ROI.

References SimulationArea::begin(), dimension(), and SimulationArea::end().

Referenced by applyDetectorResolution(), ISimulation::convertData(), GISASSimulation::intensityMapSize(), numberOfSimulationElements(), and setDataToDetectorMap().

Here is the call graph for this function:

◆ numberOfSimulationElements()

size_t IDetector::numberOfSimulationElements ( ) const

Returns number of simulation elements.

Definition at line 185 of file IDetector.cpp.

186 {
187  size_t result(0);
188  iterate([&result](const_iterator) { ++result; });
189  return result;
190 }

References iterate().

Here is the call graph for this function:

◆ onChange()

◆ parameter()

RealParameter * IParametricComponent::parameter ( const std::string &  name) const
inherited

Returns parameter with given 'name'.

Definition at line 86 of file IParametricComponent.cpp.

87 {
88  return m_pool->parameter(name);
89 }
std::unique_ptr< ParameterPool > m_pool
parameter pool (kind of pointer-to-implementation)
QString const & name(EShape k)
Definition: particles.cpp:21

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by DepthProbeSimulation::initialize(), SpecularSimulation::initialize(), Lattice3D::initialize(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), IParticle::registerPosition(), Layer::registerThickness(), Lattice2D::setRotationEnabled(), and DistributionLogNormal::setUnits().

Here is the call graph for this function:

◆ parameterPool()

ParameterPool* IParametricComponent::parameterPool ( ) const
inlineinherited

Returns pointer to the parameter pool.

Definition at line 39 of file IParametricComponent.h.

39 { return m_pool.get(); } // has non-const usages!

References IParametricComponent::m_pool.

Referenced by INode::INode(), IParametricComponent::IParametricComponent(), pyfmt2::argumentList(), SampleBuilderNode::borrow_builder_parameters(), SampleBuilderNode::reset(), and IDistribution1D::setUnits().

◆ parametersToString()

std::string IParametricComponent::parametersToString ( ) const
inherited

Returns multiline string representing available parameters.

Definition at line 43 of file IParametricComponent.cpp.

44 {
45  std::ostringstream result;
46  std::unique_ptr<ParameterPool> P_pool(createParameterTree());
47  result << *P_pool << "\n";
48  return result.str();
49 }
virtual ParameterPool * createParameterTree() const
Creates new parameter pool, with all local parameters and those of its children.

References IParametricComponent::createParameterTree().

Here is the call graph for this function:

◆ parent() [1/2]

INode * INode::parent ( )
inherited

Definition at line 89 of file INode.cpp.

90 {
91  return const_cast<INode*>(m_parent);
92 }

References INode::m_parent.

◆ parent() [2/2]

◆ progeny()

std::vector< const INode * > INode::progeny ( ) const
inherited

Returns a vector of all descendants.

Definition at line 68 of file INode.cpp.

69 {
70  std::vector<const INode*> result;
71  result.push_back(this);
72  for (const auto* child : getChildren()) {
73  for (const auto* p : child->progeny())
74  result.push_back(p);
75  }
76  return result;
77 }

References INode::getChildren().

Referenced by INode::createParameterTree(), and ParticleDistribution::generateParticles().

Here is the call graph for this function:

◆ regionOfInterest()

◆ registerChild()

void INode::registerChild ( INode node)
inherited

Definition at line 57 of file INode.cpp.

58 {
59  ASSERT(node);
60  node->setParent(this);
61 }
#define ASSERT(condition)
Definition: Assert.h:31
virtual void setParent(const INode *newParent)
Definition: INode.cpp:79

References ASSERT, and INode::setParent().

Referenced by Beam::Beam(), Crystal::Crystal(), IDetector(), Instrument::Instrument(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), Particle::Particle(), ParticleDistribution::ParticleDistribution(), ParticleLayout::addAndRegisterAbstractParticle(), ParticleCoreShell::addAndRegisterCore(), MultiLayer::addAndRegisterInterface(), MultiLayer::addAndRegisterLayer(), ParticleCoreShell::addAndRegisterShell(), Layer::addLayout(), ParticleComposition::addParticlePointer(), ISimulation::initialize(), MesoCrystal::initialize(), Beam::operator=(), Instrument::operator=(), IParticle::rotate(), ParticleLayout::setAndRegisterInterferenceFunction(), ISimulation::setBackground(), InterferenceFunction1DLattice::setDecayFunction(), InterferenceFunction2DLattice::setDecayFunction(), Instrument::setDetector(), setDetectorResolution(), Beam::setFootprintFactor(), Particle::setFormFactor(), InterferenceFunctionFinite3DLattice::setLattice(), InterferenceFunctionRadialParaCrystal::setProbabilityDistribution(), InterferenceFunction2DParaCrystal::setProbabilityDistributions(), ConvolutionDetectorResolution::setResolutionFunction(), IParticle::setRotation(), LayerInterface::setRoughness(), and InterferenceFunction2DSuperLattice::setSubstructureIFF().

Here is the call graph for this function:

◆ registerParameter()

RealParameter & IParametricComponent::registerParameter ( const std::string &  name,
double *  parpointer 
)
inherited

Definition at line 51 of file IParametricComponent.cpp.

52 {
53  return m_pool->addParameter(
54  new RealParameter(name, data, getName(), [&]() -> void { onChange(); }));
55 }
virtual void onChange()
Action to be taken in inherited class when a parameter has changed.
Wraps a parameter of type double.
Definition: RealParameter.h:31

References IParametricComponent::getName(), IParametricComponent::m_pool, RealSpace::Particles::name(), and IParametricComponent::onChange().

Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), CylindersInBABuilder::CylindersInBABuilder(), DetectionProperties::DetectionProperties(), HexagonalLattice2D::HexagonalLattice2D(), IInterferenceFunction::IInterferenceFunction(), INode::INode(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), Lattice2D::Lattice2D(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleDistribution::ParticleDistribution(), PlainMultiLayerBySLDBuilder::PlainMultiLayerBySLDBuilder(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), ResonatorBuilder::ResonatorBuilder(), SquareLattice2D::SquareLattice2D(), TriangularRippleBuilder::TriangularRippleBuilder(), IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::registerVector(), ParticleLayout::registerWeight(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ registerVector()

void IParametricComponent::registerVector ( const std::string &  base_name,
kvector_t p_vec,
const std::string &  units = "nm" 
)
inherited

Definition at line 57 of file IParametricComponent.cpp.

59 {
60  registerParameter(XComponentName(base_name), &((*p_vec)[0])).setUnit(units);
61  registerParameter(YComponentName(base_name), &((*p_vec)[1])).setUnit(units);
62  registerParameter(ZComponentName(base_name), &((*p_vec)[2])).setUnit(units);
63 }
static std::string XComponentName(const std::string &base_name)
static std::string ZComponentName(const std::string &base_name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
static std::string YComponentName(const std::string &base_name)
RealParameter & setUnit(const std::string &name)
MVVM_MODEL_EXPORT std::string base_name(const std::string &path)
Provide the filename of a file path.
Definition: fileutils.cpp:78

References ModelView::Utils::base_name(), IParametricComponent::registerParameter(), RealParameter::setUnit(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by Beam::Beam(), DetectionProperties::DetectionProperties(), InterferenceFunctionTwin::InterferenceFunctionTwin(), MultiLayer::MultiLayer(), Lattice3D::initialize(), and IParticle::registerPosition().

Here is the call graph for this function:

◆ removeParameter()

void IParametricComponent::removeParameter ( const std::string &  name)
inherited

Definition at line 91 of file IParametricComponent.cpp.

92 {
93  m_pool->removeParameter(name);
94 }

References IParametricComponent::m_pool, and RealSpace::Particles::name().

Referenced by IParticle::registerAbundance(), ParticleLayout::registerParticleDensity(), Layer::registerThickness(), IParametricComponent::removeVector(), and Lattice2D::setRotationEnabled().

Here is the call graph for this function:

◆ removeVector()

void IParametricComponent::removeVector ( const std::string &  base_name)
inherited

Definition at line 96 of file IParametricComponent.cpp.

References ModelView::Utils::base_name(), IParametricComponent::removeParameter(), IParametricComponent::XComponentName(), IParametricComponent::YComponentName(), and IParametricComponent::ZComponentName().

Referenced by IParticle::registerPosition().

Here is the call graph for this function:

◆ resetRegionOfInterest()

virtual void IDetector::resetRegionOfInterest ( )
pure virtual

Resets region of interest making whole detector plane available for the simulation.

Implemented in SpecularDetector1D, and IDetector2D.

◆ setAnalyzerProperties()

void IDetector::setAnalyzerProperties ( const kvector_t  direction,
double  efficiency,
double  total_transmission 
)

Sets the polarization analyzer characteristics of the detector.

Definition at line 99 of file IDetector.cpp.

101 {
102  m_detection_properties.setAnalyzerProperties(direction, efficiency, total_transmission);
103 }
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.

References m_detection_properties, and DetectionProperties::setAnalyzerProperties().

Referenced by StandardSimulations::BasicGISAS00(), StandardSimulations::BasicPolarizedGISAS(), StandardSimulations::MaxiGISAS00(), StandardSimulations::MiniGISASPolarizationMM(), StandardSimulations::MiniGISASPolarizationMP(), StandardSimulations::MiniGISASPolarizationPM(), and StandardSimulations::MiniGISASPolarizationPP().

Here is the call graph for this function:

◆ setDataToDetectorMap()

void IDetector::setDataToDetectorMap ( OutputData< double > &  detectorMap,
const std::vector< SimulationElement > &  elements 
) const
private

Definition at line 175 of file IDetector.cpp.

177 {
178  if (elements.empty())
179  return;
180  iterate([&](const_iterator it) {
181  detectorMap[it.roiIndex()] = elements[it.elementIndex()].intensity();
182  });
183 }

References SimulationAreaIterator::elementIndex(), iterate(), and SimulationAreaIterator::roiIndex().

Referenced by createDetectorIntensity().

Here is the call graph for this function:

◆ setDetectorResolution()

void IDetector::setDetectorResolution ( const IDetectorResolution p_detector_resolution)

Sets the detector resolution.

Definition at line 105 of file IDetector.cpp.

106 {
107  m_detector_resolution.reset(p_detector_resolution.clone());
109 }
virtual IDetectorResolution * clone() const =0

References IDetectorResolution::clone(), m_detector_resolution, and INode::registerChild().

Referenced by IDetector(), and setResolutionFunction().

Here is the call graph for this function:

◆ setName()

void IParametricComponent::setName ( const std::string &  name)
inlineinherited

Definition at line 69 of file IParametricComponent.h.

69 { m_name = name; }

References IParametricComponent::m_name, and RealSpace::Particles::name().

Referenced by BasicLattice2D::BasicLattice2D(), Beam::Beam(), ConvolutionDetectorResolution::ConvolutionDetectorResolution(), Crystal::Crystal(), DetectionProperties::DetectionProperties(), DistributionHandler::DistributionHandler(), FormFactorCoreShell::FormFactorCoreShell(), FormFactorCrystal::FormFactorCrystal(), FormFactorDecoratorMaterial::FormFactorDecoratorMaterial(), FormFactorDecoratorPositionFactor::FormFactorDecoratorPositionFactor(), FormFactorDecoratorRotation::FormFactorDecoratorRotation(), FormFactorWeighted::FormFactorWeighted(), HexagonalLattice2D::HexagonalLattice2D(), IDetector(), INode::INode(), Instrument::Instrument(), InterferenceFunction1DLattice::InterferenceFunction1DLattice(), InterferenceFunction2DLattice::InterferenceFunction2DLattice(), InterferenceFunction2DParaCrystal::InterferenceFunction2DParaCrystal(), InterferenceFunction2DSuperLattice::InterferenceFunction2DSuperLattice(), InterferenceFunction3DLattice::InterferenceFunction3DLattice(), InterferenceFunctionFinite2DLattice::InterferenceFunctionFinite2DLattice(), InterferenceFunctionFinite3DLattice::InterferenceFunctionFinite3DLattice(), InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(), InterferenceFunctionNone::InterferenceFunctionNone(), InterferenceFunctionRadialParaCrystal::InterferenceFunctionRadialParaCrystal(), InterferenceFunctionTwin::InterferenceFunctionTwin(), ISampleBuilder::ISampleBuilder(), IsGISAXSDetector::IsGISAXSDetector(), Lattice3D::Lattice3D(), Layer::Layer(), LayerInterface::LayerInterface(), LayerRoughness::LayerRoughness(), MultiLayer::MultiLayer(), ParticleCoreShell::ParticleCoreShell(), ParticleDistribution::ParticleDistribution(), ParticleLayout::ParticleLayout(), RectangularDetector::RectangularDetector(), ResolutionFunction2DGaussian::ResolutionFunction2DGaussian(), SampleBuilderNode::SampleBuilderNode(), SphericalDetector::SphericalDetector(), SquareLattice2D::SquareLattice2D(), Layer::clone(), LayersWithAbsorptionBuilder::createSampleByIndex(), Basic2DParaCrystalBuilder::createSampleByIndex(), ParticleInVacuumBuilder::createSampleByIndex(), SimpleMagneticRotationBuilder::createSampleByIndex(), DepthProbeSimulation::initialize(), GISASSimulation::initialize(), OffSpecularSimulation::initialize(), SpecularSimulation::initialize(), SpecularDetector1D::initialize(), MesoCrystal::initialize(), Particle::initialize(), ParticleComposition::initialize(), Beam::operator=(), SampleBuilderNode::operator=(), SampleBuilderNode::reset(), and SampleBuilderNode::setSBN().

Here is the call graph for this function:

◆ setParameterValue()

void IParametricComponent::setParameterValue ( const std::string &  name,
double  value 
)
inherited

Definition at line 65 of file IParametricComponent.cpp.

66 {
67  if (name.find('*') == std::string::npos && name.find('/') == std::string::npos) {
68  m_pool->setParameterValue(name, value);
69  } else {
70  std::unique_ptr<ParameterPool> P_pool{createParameterTree()};
71  if (name.find('*') != std::string::npos)
72  P_pool->setMatchedParametersValue(name, value);
73  else
74  P_pool->setParameterValue(name, value);
75  }
76 }
int setMatchedParametersValue(const std::string &wildcards, double value)
Sets value of the nonzero parameters that match pattern ('*' allowed), or throws.

References IParametricComponent::createParameterTree(), IParametricComponent::m_pool, RealSpace::Particles::name(), and ParameterPool::setMatchedParametersValue().

Referenced by AsymRippleBuilder::buildSample(), and IParametricComponent::setVectorValue().

Here is the call graph for this function:

◆ setParent()

void INode::setParent ( const INode newParent)
virtualinherited

Reimplemented in SampleProvider.

Definition at line 79 of file INode.cpp.

80 {
81  m_parent = newParent;
82 }

References INode::m_parent.

Referenced by INode::registerChild(), SampleProvider::setBuilder(), and SampleProvider::setParent().

◆ setResolutionFunction()

void IDetector::setResolutionFunction ( const IResolutionFunction2D resFunc)

Definition at line 112 of file IDetector.cpp.

113 {
114  ConvolutionDetectorResolution convFunc(resFunc);
115  setDetectorResolution(convFunc);
116 }
Convolutes the intensity in 1 or 2 dimensions with a resolution function.

References setDetectorResolution().

Referenced by ISimulation::setDetectorResolutionFunction().

Here is the call graph for this function:

◆ setVectorValue()

void IParametricComponent::setVectorValue ( const std::string &  base_name,
kvector_t  value 
)
inherited

Definition at line 78 of file IParametricComponent.cpp.

79 {
83 }
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:67
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:65
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:63
void setParameterValue(const std::string &name, double value)

References ModelView::Utils::base_name(), IParametricComponent::setParameterValue(), BasicVector3D< T >::x(), IParametricComponent::XComponentName(), BasicVector3D< T >::y(), IParametricComponent::YComponentName(), BasicVector3D< T >::z(), and IParametricComponent::ZComponentName().

Here is the call graph for this function:

◆ totalSize()

size_t IDetector::totalSize ( ) const

Returns total number of pixels.

Definition at line 88 of file IDetector.cpp.

89 {
90  const size_t dim = dimension();
91  if (dim == 0)
92  return 0;
93  size_t result = 1;
94  for (size_t i_axis = 0; i_axis < dim; ++i_axis)
95  result *= m_axes[i_axis]->size();
96  return result;
97 }

References dimension(), and m_axes.

Referenced by SimulationArea::SimulationArea(), IDetector2D::getGlobalIndex(), IsGISAXSDetector::indexOfSpecular(), RectangularDetector::indexOfSpecular(), and SphericalDetector::indexOfSpecular().

Here is the call graph for this function:

◆ transferToCPP()

virtual void ICloneable::transferToCPP ( )
inlinevirtualinherited

Used for Python overriding of clone (see swig/tweaks.py)

Definition at line 34 of file ICloneable.h.

◆ treeToString()

std::string INode::treeToString ( ) const
virtualinherited

Returns multiline string representing tree structure below the node.

Definition at line 52 of file INode.cpp.

53 {
54  return NodeUtils::nodeToString(this);
55 }
std::string nodeToString(const INode *node)
Returns multiline string representing tree structure starting from given node.
Definition: NodeUtils.cpp:81

References NodeUtils::nodeToString().

Here is the call graph for this function:

◆ XComponentName()

std::string IParametricComponent::XComponentName ( const std::string &  base_name)
staticinherited

Definition at line 103 of file IParametricComponent.cpp.

104 {
105  return base_name + "X";
106 }

References ModelView::Utils::base_name().

Referenced by Lattice3D::initialize(), IParticle::registerPosition(), IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ YComponentName()

std::string IParametricComponent::YComponentName ( const std::string &  base_name)
staticinherited

Definition at line 108 of file IParametricComponent.cpp.

109 {
110  return base_name + "Y";
111 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

◆ ZComponentName()

std::string IParametricComponent::ZComponentName ( const std::string &  base_name)
staticinherited

Definition at line 113 of file IParametricComponent.cpp.

114 {
115  return base_name + "Z";
116 }

References ModelView::Utils::base_name().

Referenced by IParametricComponent::registerVector(), IParametricComponent::removeVector(), IParametricComponent::setVectorValue(), and VectorParameterTranslator::translate().

Here is the call graph for this function:

Member Data Documentation

◆ m_axes

CloneableVector<IAxis> IDetector::m_axes
private

Definition at line 114 of file IDetector.h.

Referenced by addAxis(), axis(), axisBinIndex(), clear(), dimension(), and totalSize().

◆ m_detection_properties

DetectionProperties IDetector::m_detection_properties
private

Definition at line 115 of file IDetector.h.

Referenced by IDetector(), getChildren(), and setAnalyzerProperties().

◆ m_detector_resolution

std::unique_ptr<IDetectorResolution> IDetector::m_detector_resolution
private

◆ m_name

std::string IParametricComponent::m_name
privateinherited

◆ m_NP

const size_t INode::m_NP
protectedinherited

Definition at line 88 of file INode.h.

Referenced by INode::INode().

◆ m_P

std::vector<double> INode::m_P
protectedinherited

Definition at line 89 of file INode.h.

Referenced by INode::INode(), and IFootprintFactor::setWidthRatio().

◆ m_parent

const INode* INode::m_parent {nullptr}
privateinherited

Definition at line 83 of file INode.h.

Referenced by INode::displayName(), INode::parent(), and INode::setParent().

◆ m_pool


The documentation for this class was generated from the following files: