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

Description

A stack of Slices.

Definition at line 38 of file SliceStack.h.

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

Public Member Functions

 SliceStack (const RoughnessModel roughness_model)
 
 SliceStack (const SliceStack &other)
 
void addNSlices (size_t n, double thickness, const Material &material, const LayerRoughness *roughness=nullptr)
 Adds n times the same slice to the stack. More...
 
void addSlice (double thickness, const Material &material, const LayerRoughness *roughness=nullptr)
 
void addTopSlice (double zbottom, const Material &material)
 
const LayerRoughnessbottomRoughness (size_t i_slice) const
 
bool containsMagneticMaterial () const
 
RoughnessModel roughnessModel () const
 
SliceStack setBField (const R3 &externalField)
 

Public Attributes

elements
 STL member. More...
 

Private Attributes

const RoughnessModel m_roughness_model
 

Constructor & Destructor Documentation

◆ SliceStack() [1/2]

SliceStack::SliceStack ( const RoughnessModel  roughness_model)
inline

Definition at line 40 of file SliceStack.h.

41  : m_roughness_model(roughness_model)
42  {
43  }
const RoughnessModel m_roughness_model
Definition: SliceStack.h:60

◆ SliceStack() [2/2]

SliceStack::SliceStack ( const SliceStack other)

Definition at line 19 of file SliceStack.cpp.

20  : std::vector<Slice>((std::vector<Slice>)other)
22 {
23 }
RoughnessModel roughnessModel() const
Definition: SliceStack.h:57

Member Function Documentation

◆ addNSlices()

void SliceStack::addNSlices ( size_t  n,
double  thickness,
const Material material,
const LayerRoughness roughness = nullptr 
)

Adds n times the same slice to the stack.

Definition at line 46 of file SliceStack.cpp.

48 {
49  ASSERT(thickness > 0);
50  ASSERT(n > 0);
51  const double slice_thickness = thickness / n;
52  addSlice(slice_thickness, material, roughness);
53  for (size_t i = 1; i < n; ++i)
54  addSlice(slice_thickness, material);
55 }
#define ASSERT(condition)
Definition: Assert.h:45
void addSlice(double thickness, const Material &material, const LayerRoughness *roughness=nullptr)
Definition: SliceStack.cpp:30

References addSlice(), and ASSERT.

Here is the call graph for this function:

◆ addSlice()

void SliceStack::addSlice ( double  thickness,
const Material material,
const LayerRoughness roughness = nullptr 
)

Definition at line 30 of file SliceStack.cpp.

32 {
33  ASSERT(!this->empty());
34  double top = this->back().zBottom();
35  ASSERT(thickness >= 0);
36  std::unique_ptr<ZLimits> zRange;
37  if (thickness == 0)
38  zRange = std::make_unique<ZLimits>(-ZLimits::inf, top);
39  else
40  zRange = std::make_unique<ZLimits>(top - thickness, top);
41  this->emplace_back(Slice(*zRange, material, {}, roughness));
42 }
Data structure containing the data of a single slice, for calculating the Fresnel coefficients.
Definition: Slice.h:31
static constexpr double inf
Definition: ZLimits.h:45

References ASSERT, and ZLimits::inf.

Referenced by addNSlices().

◆ addTopSlice()

void SliceStack::addTopSlice ( double  zbottom,
const Material material 
)

Definition at line 25 of file SliceStack.cpp.

26 {
27  this->emplace_back(Slice(ZLimits(zbottom, ZLimits::inf), material, {}, nullptr));
28 }
An interval. Limits are of type double, and may be infinite. Used for the z-coordinate,...
Definition: ZLimits.h:32

References ZLimits::inf.

◆ bottomRoughness()

const LayerRoughness * SliceStack::bottomRoughness ( size_t  i_slice) const

Definition at line 75 of file SliceStack.cpp.

76 {
77  if (i_slice + 1 < size())
78  return (*this)[i_slice + 1].topRoughness();
79  return nullptr;
80 }

Referenced by RoughMultiLayerContribution::get_sum8terms(), Compute::SpecularScalar::topLayerR(), and Compute::SpecularMagnetic::topLayerR().

◆ containsMagneticMaterial()

bool SliceStack::containsMagneticMaterial ( ) const

Definition at line 68 of file SliceStack.cpp.

69 {
70  return std::any_of(this->cbegin(), this->cend(), [](const Slice& slice) -> bool {
71  return slice.material().isMagneticMaterial();
72  });
73 }
const Material & material() const
Definition: Slice.cpp:51

References Slice::material().

Here is the call graph for this function:

◆ roughnessModel()

◆ setBField()

SliceStack SliceStack::setBField ( const R3 &  externalField)

Definition at line 57 of file SliceStack.cpp.

58 {
59  if (this->empty())
60  return *this;
61  const double M_z0 = this->at(0).material().magnetization().z();
62  const double H_z = externalField.z() + M_z0;
63  for (Slice& slice : *this)
64  slice.initBField(externalField, H_z);
65  return *this;
66 }
void initBField(R3 h_field, double h_z)
Initializes the magnetic B field from a given ambient field strength H.
Definition: Slice.cpp:93

References Slice::initBField().

Referenced by reSample::make().

Here is the call graph for this function:

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.

◆ m_roughness_model

const RoughnessModel SliceStack::m_roughness_model
private

Definition at line 60 of file SliceStack.h.

Referenced by roughnessModel().


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