BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
gui2::MaterialProfile Namespace Reference

Collection of methods borrowed from BornAgain for material profile calculations. More...

Functions

DAREFLCORE_EXPORT std::vector< complex_tCalculateProfile (const multislice_t &multilayer, int n_points, double z_min, double z_max)
 Calculate average material profile for given multilayer. More...
 
DAREFLCORE_EXPORT std::pair< double, double > DefaultMaterialProfileLimits (const multislice_t &multilayer)
 Get default z limits for generating a material profile. More...
 
DAREFLCORE_EXPORT std::vector< double > GenerateZValues (int n_points, double z_min, double z_max)
 Generate z values (equidistant) for use in MaterialProfile. More...
 

Detailed Description

Collection of methods borrowed from BornAgain for material profile calculations.

Function Documentation

◆ CalculateProfile()

std::vector< complex_t > gui2::MaterialProfile::CalculateProfile ( const multislice_t multilayer,
int  n_points,
double  z_min,
double  z_max 
)

Calculate average material profile for given multilayer.

Definition at line 22 of file materialprofile.cpp.

24 {
25  auto baSlices = Utils::createBornAgainSlices(multilayer);
26  ProfileHelper helper(baSlices);
27  std::vector<double> z_values = GenerateZValues(n_points, z_min, z_max);
28  return helper.calculateProfile(z_values);
29 }
Object that can generate the material profile of a sample as a function of depth.
Definition: ProfileHelper.h:36
DAREFLCORE_EXPORT std::vector< double > GenerateZValues(int n_points, double z_min, double z_max)
Generate z values (equidistant) for use in MaterialProfile.
DAREFLCORE_EXPORT std::vector< Slice > createBornAgainSlices(const multislice_t &multislice)

References gui2::ProfileHelper::calculateProfile(), gui2::Utils::createBornAgainSlices(), and GenerateZValues().

Referenced by gui2::SpecularToySimulation::sld_profile().

Here is the call graph for this function:

◆ DefaultMaterialProfileLimits()

std::pair< double, double > gui2::MaterialProfile::DefaultMaterialProfileLimits ( const multislice_t multilayer)

Get default z limits for generating a material profile.

Definition at line 32 of file materialprofile.cpp.

33 {
34  auto baSlices = Utils::createBornAgainSlices(multilayer);
35  ProfileHelper helper(baSlices);
36  return helper.defaultLimits();
37 }

References gui2::Utils::createBornAgainSlices(), and gui2::ProfileHelper::defaultLimits().

Referenced by gui2::SpecularToySimulation::sld_profile().

Here is the call graph for this function:

◆ GenerateZValues()

std::vector< double > gui2::MaterialProfile::GenerateZValues ( int  n_points,
double  z_min,
double  z_max 
)

Generate z values (equidistant) for use in MaterialProfile.

Definition at line 39 of file materialprofile.cpp.

40 {
41  std::vector<double> result;
42  if (n_points < 1)
43  return result;
44  double step = n_points > 1 ? (z_max - z_min) / (n_points - 1) : 0.0;
45  for (int i = 0; i < n_points; ++i) {
46  result.push_back(z_min + i * step);
47  }
48  return result;
49 }

Referenced by CalculateProfile().