BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
reSample Class Reference

Description

Data structure that contains all the necessary data for scattering calculations.

If the usage of average materials is requested, layers and particles are sliced into multiple slices and the average material is calculated for each slice.

Definition at line 41 of file ReSample.h.

Collaboration diagram for reSample:
[legend]

Public Member Functions

 reSample (const reSample &)=delete
 
 ~reSample ()
 
const SliceStackaverageSlices () const
 
const SliceavgeSlice (size_t i) const
 
bool containsMagneticMaterial () const
 
double crossCorrSpectralFun (R3 kvec, size_t j, size_t k) const
 Fourier transform of the correlation function of roughnesses between the interfaces. More...
 
Fluxes fluxesIn (const R3 &k) const
 
Fluxes fluxesOut (const R3 &k) const
 
bool hasRoughness () const
 
const std::vector< reLayout > & layouts () const
 
size_t numberOfSlices () const
 
bool polarizing () const
 Contains magnetic material, or nonzero magnetic field. More...
 
const MultiLayersample () const
 
double sliceBottomZ (size_t i) const
 
double sliceTopZ (size_t i) const
 

Static Public Member Functions

static reSample make (const MultiLayer &sample, const SimulationOptions &options, bool forcePolarized=false)
 Factory method that wraps the private constructor. More...
 

Private Member Functions

 reSample (const MultiLayer &sample, bool polarized, std::vector< reLayout > &&layouts, const SliceStack &refined_stack)
 

Private Attributes

std::vector< reLayoutm_layouts
 
const bool m_polarized
 
const MultiLayerm_sample
 
const SliceStack m_stack
 

Constructor & Destructor Documentation

◆ reSample() [1/2]

reSample::reSample ( const reSample )
delete

Referenced by make().

◆ ~reSample()

reSample::~reSample ( )
default

◆ reSample() [2/2]

reSample::reSample ( const MultiLayer sample,
bool  polarized,
std::vector< reLayout > &&  layouts,
const SliceStack refined_stack 
)
private

Definition at line 325 of file ReSample.cpp.

327  : m_sample(sample)
328  , m_polarized(polarized)
329  , m_layouts(std::move(layouts))
330  , m_stack(refined_stack)
331 {
332 }
const MultiLayer & m_sample
Definition: ReSample.h:69
std::vector< reLayout > m_layouts
Definition: ReSample.h:71
const bool m_polarized
Definition: ReSample.h:70
const std::vector< reLayout > & layouts() const
Definition: ReSample.cpp:351
const SliceStack m_stack
Definition: ReSample.h:72
const MultiLayer & sample() const
Definition: ReSample.h:58

Member Function Documentation

◆ averageSlices()

const SliceStack & reSample::averageSlices ( ) const

◆ avgeSlice()

const Slice & reSample::avgeSlice ( size_t  i) const

◆ containsMagneticMaterial()

bool reSample::containsMagneticMaterial ( ) const

Definition at line 366 of file ReSample.cpp.

367 {
368  return m_polarized;
369 }

References m_polarized.

Referenced by polarizing().

◆ crossCorrSpectralFun()

double reSample::crossCorrSpectralFun ( R3  kvec,
size_t  j,
size_t  k 
) const

Fourier transform of the correlation function of roughnesses between the interfaces.

Definition at line 398 of file ReSample.cpp.

399 {
400  const double xCorrLength = m_sample.crossCorrLength();
401  if (xCorrLength <= 0.0)
402  return 0.0;
403  const double z_j = sliceBottomZ(j);
404  const double z_k = sliceBottomZ(k);
405  const LayerRoughness* rough_j = m_stack.at(j + 1).topRoughness();
406  const LayerRoughness* rough_k = m_stack.at(k + 1).topRoughness();
407  if (!rough_j || !rough_k)
408  return 0.0;
409  const double sigma_j = rough_j->sigma();
410  const double sigma_k = rough_k->sigma();
411  if (sigma_j <= 0 || sigma_k <= 0)
412  return 0.0;
413  return 0.5
414  * ((sigma_k / sigma_j) * rough_j->spectralFunction(kvec)
415  + (sigma_j / sigma_k) * rough_k->spectralFunction(kvec))
416  * std::exp(-1 * std::abs(z_j - z_k) / xCorrLength);
417 }
A roughness of interface between two layers.
double spectralFunction(R3 kvec) const
Returns power spectral density of the surface roughness.
double sigma() const
Returns rms of roughness.
double crossCorrLength() const
Returns cross correlation length of roughnesses between interfaces.
Definition: MultiLayer.h:69
double sliceBottomZ(size_t i) const
Definition: ReSample.cpp:361

References MultiLayer::crossCorrLength(), m_sample, m_stack, LayerRoughness::sigma(), sliceBottomZ(), and LayerRoughness::spectralFunction().

Referenced by RoughMultiLayerContribution::compute().

Here is the call graph for this function:

◆ fluxesIn()

Fluxes reSample::fluxesIn ( const R3 &  k) const

Definition at line 384 of file ReSample.cpp.

385 {
386  if (m_polarized)
389 }
Fluxes fluxes(const SliceStack &slices, const R3 &k, bool forward)
Computes refraction angle reflection/transmission coefficients for given sliced sample and wavevector...
Fluxes fluxes(const SliceStack &slices, const R3 &k)
Computes refraction angles and transmission/reflection coefficients for given coherent wave propagati...

References Compute::SpecularScalar::fluxes(), Compute::SpecularMagnetic::fluxes(), m_polarized, and m_stack.

Referenced by DepthProbeComputation::runProtected(), and DWBAComputation::runProtected().

Here is the call graph for this function:

◆ fluxesOut()

Fluxes reSample::fluxesOut ( const R3 &  k) const

Definition at line 391 of file ReSample.cpp.

392 {
393  if (m_polarized)
394  return Compute::SpecularMagnetic::fluxes(m_stack, -k, false);
396 }

References Compute::SpecularScalar::fluxes(), Compute::SpecularMagnetic::fluxes(), m_polarized, and m_stack.

Referenced by DWBAComputation::runProtected().

Here is the call graph for this function:

◆ hasRoughness()

bool reSample::hasRoughness ( ) const

Definition at line 376 of file ReSample.cpp.

377 {
378  for (const auto& slice : m_stack)
379  if (slice.topRoughness())
380  return true;
381  return false;
382 }

References m_stack, and Slice::topRoughness().

Here is the call graph for this function:

◆ layouts()

const std::vector< reLayout > & reSample::layouts ( ) const

Definition at line 351 of file ReSample.cpp.

352 {
353  return m_layouts;
354 }

References m_layouts.

Referenced by make().

◆ make()

reSample reSample::make ( const MultiLayer sample,
const SimulationOptions options,
bool  forcePolarized = false 
)
static

Factory method that wraps the private constructor.

Definition at line 309 of file ReSample.cpp.

311 {
312  const bool polarized = forcePolarized || sample.isMagnetic() || sample.externalField() != R3();
313 
314  // slices1: accounting for roughness, but not yet for particles
315  const SliceStack slices1 = slicify(sample, options).setBField(sample.externalField());
316 
317  std::vector<reLayout> layouts = collectLayouts(sample, slices1, polarized);
318 
319  const SliceStack refined_stack =
320  options.useAvgMaterials() ? refineStack(slices1, layouts) : slices1;
321 
322  return reSample(sample, polarized, std::move(layouts), refined_stack);
323 }
bool isMagnetic() const
Returns true if there is any magnetic material in this ISampleNode.
Definition: ISampleNode.cpp:39
R3 externalField() const
Returns the external field applied to the sample (units: A/m)
Definition: MultiLayer.h:71
bool useAvgMaterials() const
A stack of Slices.
Definition: SliceStack.h:38
SliceStack setBField(const R3 &externalField)
Definition: SliceStack.cpp:57
reSample(const reSample &)=delete

References reSample(), MultiLayer::externalField(), ISampleNode::isMagnetic(), layouts(), sample(), SliceStack::setBField(), and SimulationOptions::useAvgMaterials().

Referenced by swigAPI::defaultMaterialProfileLimits(), swigAPI::materialProfileSLD(), and ISimulation::simulate().

Here is the call graph for this function:

◆ numberOfSlices()

size_t reSample::numberOfSlices ( ) const

Definition at line 336 of file ReSample.cpp.

337 {
338  return m_stack.size();
339 }

References m_stack.

Referenced by RoughMultiLayerContribution::compute(), and DepthProbeComputation::runProtected().

◆ polarizing()

bool reSample::polarizing ( ) const

Contains magnetic material, or nonzero magnetic field.

Definition at line 371 of file ReSample.cpp.

372 {
373  return containsMagneticMaterial() || m_sample.externalField() != R3{};
374 }
bool containsMagneticMaterial() const
Definition: ReSample.cpp:366

References containsMagneticMaterial(), MultiLayer::externalField(), and m_sample.

Referenced by SpecularComputation::runProtected().

Here is the call graph for this function:

◆ sample()

const MultiLayer& reSample::sample ( ) const
inline

Definition at line 58 of file ReSample.h.

58 { return m_sample; }

References m_sample.

Referenced by RoughMultiLayerContribution::compute(), and make().

◆ sliceBottomZ()

double reSample::sliceBottomZ ( size_t  i) const

Definition at line 361 of file ReSample.cpp.

362 {
363  return m_stack.at(i).zBottom();
364 }

References m_stack.

Referenced by crossCorrSpectralFun(), and DepthProbeComputation::runProtected().

◆ sliceTopZ()

double reSample::sliceTopZ ( size_t  i) const

Definition at line 356 of file ReSample.cpp.

357 {
358  return m_stack.at(i).zTop();
359 }

References m_stack.

Referenced by DepthProbeComputation::runProtected().

Member Data Documentation

◆ m_layouts

std::vector<reLayout> reSample::m_layouts
private

Definition at line 71 of file ReSample.h.

Referenced by layouts().

◆ m_polarized

const bool reSample::m_polarized
private

Definition at line 70 of file ReSample.h.

Referenced by containsMagneticMaterial(), fluxesIn(), and fluxesOut().

◆ m_sample

const MultiLayer& reSample::m_sample
private

Definition at line 69 of file ReSample.h.

Referenced by crossCorrSpectralFun(), polarizing(), and sample().

◆ m_stack

const SliceStack reSample::m_stack
private

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