BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParaCrystal2DPositionBuilder Class Reference

Description

Definition at line 90 of file IPositionBuilder.h.

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

Public Member Functions

 ParaCrystal2DPositionBuilder (const Interference2DParaCrystal *p_iff)
 
 ~ParaCrystal2DPositionBuilder () override
 
std::vector< std::vector< double > > generatePositions (double layer_size, double density=0.0) const
 

Private Member Functions

std::vector< std::vector< double > > generatePositionsImpl (double layer_size, double density=0.0) const override
 
double positionVariance () const override
 

Private Attributes

std::unique_ptr< Interference2DParaCrystal > m_iff
 

Constructor & Destructor Documentation

◆ ParaCrystal2DPositionBuilder()

ParaCrystal2DPositionBuilder::ParaCrystal2DPositionBuilder ( const Interference2DParaCrystal *  p_iff)

Definition at line 158 of file IPositionBuilder.cpp.

159  : m_iff(p_iff->clone())
160 {
161 }
std::unique_ptr< Interference2DParaCrystal > m_iff

◆ ~ParaCrystal2DPositionBuilder()

ParaCrystal2DPositionBuilder::~ParaCrystal2DPositionBuilder ( )
overridedefault

Member Function Documentation

◆ generatePositions()

std::vector< std::vector< double > > IPositionBuilder::generatePositions ( double  layer_size,
double  density = 0.0 
) const
inherited

Definition at line 29 of file IPositionBuilder.cpp.

31 {
32  std::vector<std::vector<double>> positions = generatePositionsImpl(layer_size, density);
33  double pos_var = positionVariance();
34  if (pos_var > 0.0) {
35  // random generator and distribution
36  std::random_device rd; // Will be used to obtain a seed for the random number engine
37  std::mt19937 gen(rd()); // Standard mersenne_twister_engine seeded with rd()
38  std::normal_distribution<double> dis(0.0, std::sqrt(pos_var));
39  for (auto& position : positions) {
40  for (auto& coordinate : position)
41  coordinate += dis(gen);
42  }
43  }
44  return positions;
45 }
virtual std::vector< std::vector< double > > generatePositionsImpl(double layer_size, double density=0.0) const =0
virtual double positionVariance() const =0

References IPositionBuilder::generatePositionsImpl(), and IPositionBuilder::positionVariance().

Here is the call graph for this function:

◆ generatePositionsImpl()

std::vector< std::vector< double > > ParaCrystal2DPositionBuilder::generatePositionsImpl ( double  layer_size,
double  density = 0.0 
) const
overrideprivatevirtual

Implements IPositionBuilder.

Definition at line 166 of file IPositionBuilder.cpp.

167 {
168  return GUI::RealSpace::Paracrystal2D::latticePositions(m_iff.get(), layer_size);
169 }
std::vector< std::vector< double > > latticePositions(const Interference2DParaCrystal *, double layer_size)

References GUI::RealSpace::Paracrystal2D::latticePositions(), and m_iff.

Here is the call graph for this function:

◆ positionVariance()

double ParaCrystal2DPositionBuilder::positionVariance ( ) const
overrideprivatevirtual

Implements IPositionBuilder.

Definition at line 171 of file IPositionBuilder.cpp.

172 {
173  return m_iff->positionVariance();
174 }

References m_iff.

Member Data Documentation

◆ m_iff

std::unique_ptr<Interference2DParaCrystal> ParaCrystal2DPositionBuilder::m_iff
private

Definition at line 99 of file IPositionBuilder.h.

Referenced by generatePositionsImpl(), and positionVariance().


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