BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{UnitConverter1D.cpp} Namespace Reference

Functions

double getQ (double wavelength, double angle)
 
double getInvQ (double wavelength, double q)
 
std::unique_ptr< PointwiseAxiscreateTranslatedAxis (const IAxis &axis, std::function< double(double)> translator, std::string name)
 

Function Documentation

◆ getQ()

double anonymous_namespace{UnitConverter1D.cpp}::getQ ( double  wavelength,
double  angle 
)

Definition at line 243 of file UnitConverter1D.cpp.

244 {
245  return 4.0 * M_PI * std::sin(angle) / wavelength;
246 }
#define M_PI
Definition: MathConstants.h:39

References M_PI, and anonymous_namespace{SlicedCylindersBuilder.cpp}::wavelength().

Referenced by UnitConverterConvSpec::getTraslatorTo().

Here is the call graph for this function:

◆ getInvQ()

double anonymous_namespace{UnitConverter1D.cpp}::getInvQ ( double  wavelength,
double  q 
)

Definition at line 248 of file UnitConverter1D.cpp.

249 {
250  double sin_angle = q * wavelength / (4.0 * M_PI);
251  return std::asin(sin_angle);
252 }

References M_PI, and anonymous_namespace{SlicedCylindersBuilder.cpp}::wavelength().

Referenced by UnitConverterConvSpec::getTraslatorFrom().

Here is the call graph for this function:

◆ createTranslatedAxis()

std::unique_ptr< PointwiseAxis > anonymous_namespace{UnitConverter1D.cpp}::createTranslatedAxis ( const IAxis axis,
std::function< double(double)>  translator,
std::string  name 
)

Definition at line 255 of file UnitConverter1D.cpp.

256 {
257  auto coordinates = axis.getBinCenters();
258  for (size_t i = 0, size = coordinates.size(); i < size; ++i)
259  coordinates[i] = translator(coordinates[i]);
260  return std::make_unique<PointwiseAxis>(name, coordinates);
261 }
virtual std::vector< double > getBinCenters() const
Definition: IAxis.cpp:23

References IAxis::getBinCenters().

Referenced by UnitConverter1D::createConvertedAxis(), and UnitConverterConvSpec::UnitConverterConvSpec().

Here is the call graph for this function: