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

Description

Functions that are only used in the swig *.i files

Functions

std::pair< double, double > defaultMaterialProfileLimits (const MultiLayer &sample)
 Get default z limits for generating a material profile. More...
 
std::vector< double > generateZValues (int n_points, double z_min, double z_max)
 
std::vector< complex_t > materialProfileSLD (const MultiLayer &sample, int n_points, double z_min, double z_max)
 Calculate average material profile for given sample. More...
 

Function Documentation

◆ defaultMaterialProfileLimits()

std::pair< double, double > swigAPI::defaultMaterialProfileLimits ( const MultiLayer sample)

Get default z limits for generating a material profile.

Definition at line 42 of file MultiLayerFuncs.cpp.

43 {
44  SimulationOptions options;
45  options.setUseAvgMaterials(true);
46  const reSample resample = reSample::make(sample, options);
47  ProfileHelper helper(resample.averageSlices());
48  return helper.defaultLimits();
49 }
Object that can generate the material profile of a sample as a function of depth.
Definition: ProfileHelper.h:34
Collect the different options for simulation.SimulationOptions.
void setUseAvgMaterials(bool use_avg_materials)
Data structure that contains all the necessary data for scattering calculations.
Definition: ReSample.h:41
static reSample make(const MultiLayer &sample, const SimulationOptions &options, bool forcePolarized=false)
Factory method that wraps the private constructor.
Definition: ReSample.cpp:309
const SliceStack & averageSlices() const
Definition: ReSample.cpp:341

References reSample::averageSlices(), ProfileHelper::defaultLimits(), reSample::make(), and SimulationOptions::setUseAvgMaterials().

Here is the call graph for this function:

◆ generateZValues()

std::vector< double > swigAPI::generateZValues ( int  n_points,
double  z_min,
double  z_max 
)

Definition at line 20 of file MultiLayerFuncs.cpp.

21 {
22  std::vector<double> result;
23  if (n_points < 1)
24  return result;
25  double step = n_points > 1 ? (z_max - z_min) / (n_points - 1) : 0.0;
26  for (int i = 0; i < n_points; ++i)
27  result.push_back(z_min + i * step);
28  return result;
29 }

Referenced by materialProfileSLD().

◆ materialProfileSLD()

std::vector< complex_t > swigAPI::materialProfileSLD ( const MultiLayer sample,
int  n_points,
double  z_min,
double  z_max 
)

Calculate average material profile for given sample.

Definition at line 31 of file MultiLayerFuncs.cpp.

33 {
34  SimulationOptions options;
35  options.setUseAvgMaterials(true);
36  const reSample resample = reSample::make(sample, options);
37  ProfileHelper helper(resample.averageSlices());
38  std::vector<double> z_values = generateZValues(n_points, z_min, z_max);
39  return helper.calculateProfile(z_values);
40 }
std::vector< double > generateZValues(int n_points, double z_min, double z_max)

References reSample::averageSlices(), ProfileHelper::calculateProfile(), generateZValues(), reSample::make(), and SimulationOptions::setUseAvgMaterials().

Here is the call graph for this function: