BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleLayoutComputation Class Referencefinal
Collaboration diagram for ParticleLayoutComputation:

Public Member Functions

 ParticleLayoutComputation (const ProcessedLayout *p_layout, const SimulationOptions &options, bool polarized)
 
 ~ParticleLayoutComputation ()
 
void compute (SimulationElement &elem) const
 
void mergeRegionMap (std::map< size_t, std::vector< HomogeneousRegion >> &region_map) const
 

Private Attributes

const ProcessedLayoutmp_layout
 
std::unique_ptr< const IInterferenceFunctionStrategymP_strategy
 
double m_surface_density
 
std::map< size_t, std::vector< HomogeneousRegion > > m_region_map
 

Detailed Description

Computes the scattering contribution from one particle layout.

Used by DWBAComputation.

Definition at line 32 of file ParticleLayoutComputation.h.

Constructor & Destructor Documentation

◆ ParticleLayoutComputation()

ParticleLayoutComputation::ParticleLayoutComputation ( const ProcessedLayout p_layout,
const SimulationOptions options,
bool  polarized 
)

Definition at line 21 of file ParticleLayoutComputation.cpp.

24  : mp_layout(p_layout)
25 {
26  LayoutStrategyBuilder builder(p_layout, options, polarized);
27  mP_strategy.reset(builder.releaseStrategy());
28  m_region_map = p_layout->regionMap();
29  m_surface_density = p_layout->surfaceDensity();
30 }
Methods to generate a simulation strategy for a ParticleLayoutComputation.
const ProcessedLayout * mp_layout
std::map< size_t, std::vector< HomogeneousRegion > > m_region_map
std::unique_ptr< const IInterferenceFunctionStrategy > mP_strategy
std::map< size_t, std::vector< HomogeneousRegion > > regionMap() const
double surfaceDensity() const

References m_region_map, m_surface_density, mP_strategy, ProcessedLayout::regionMap(), LayoutStrategyBuilder::releaseStrategy(), and ProcessedLayout::surfaceDensity().

Here is the call graph for this function:

◆ ~ParticleLayoutComputation()

ParticleLayoutComputation::~ParticleLayoutComputation ( )
default

Member Function Documentation

◆ compute()

void ParticleLayoutComputation::compute ( SimulationElement elem) const

Definition at line 34 of file ParticleLayoutComputation.cpp.

35 {
36  double alpha_f = elem.getAlphaMean();
37  size_t n_layers = mp_layout->numberOfSlices();
38  if (n_layers > 1 && alpha_f < 0) {
39  return; // zero for transmission with multilayers (n>1)
40  } else {
41  elem.addIntensity(mP_strategy->evaluate(elem) * m_surface_density);
42  }
43 }
size_t numberOfSlices() const
void addIntensity(double intensity)
double getAlphaMean() const

References SimulationElement::addIntensity(), SimulationElement::getAlphaMean(), m_surface_density, mp_layout, mP_strategy, and ProcessedLayout::numberOfSlices().

Here is the call graph for this function:

◆ mergeRegionMap()

void ParticleLayoutComputation::mergeRegionMap ( std::map< size_t, std::vector< HomogeneousRegion >> &  region_map) const

Merges its region map into the given one (notice non-const reference parameter)

Definition at line 45 of file ParticleLayoutComputation.cpp.

47 {
48  for (auto& entry : m_region_map) {
49  size_t i = entry.first;
50  auto& regions = entry.second;
51  region_map[i].insert(region_map[i].begin(), regions.begin(), regions.end());
52  }
53 }

References m_region_map.

Referenced by DWBASingleComputation::addLayoutComputation().

Member Data Documentation

◆ mp_layout

const ProcessedLayout* ParticleLayoutComputation::mp_layout
private

Definition at line 45 of file ParticleLayoutComputation.h.

Referenced by compute().

◆ mP_strategy

std::unique_ptr<const IInterferenceFunctionStrategy> ParticleLayoutComputation::mP_strategy
private

Definition at line 46 of file ParticleLayoutComputation.h.

Referenced by compute(), and ParticleLayoutComputation().

◆ m_surface_density

double ParticleLayoutComputation::m_surface_density
private

Definition at line 47 of file ParticleLayoutComputation.h.

Referenced by compute(), and ParticleLayoutComputation().

◆ m_region_map

std::map<size_t, std::vector<HomogeneousRegion> > ParticleLayoutComputation::m_region_map
private

Definition at line 48 of file ParticleLayoutComputation.h.

Referenced by mergeRegionMap(), and ParticleLayoutComputation().


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