Definition at line 114 of file IPositionBuilder.h.
|
std::unique_ptr< InterferenceRadialParaCrystal > | m_iff |
|
◆ RadialParacrystalPositionBuilder()
RadialParacrystalPositionBuilder::RadialParacrystalPositionBuilder |
( |
const InterferenceRadialParaCrystal * |
p_iff | ) |
|
◆ ~RadialParacrystalPositionBuilder()
RadialParacrystalPositionBuilder::~RadialParacrystalPositionBuilder |
( |
| ) |
|
|
overridedefault |
◆ 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.
36 std::random_device rd;
37 std::mt19937 gen(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);
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().
◆ generatePositionsImpl()
std::vector< std::vector< double > > RadialParacrystalPositionBuilder::generatePositionsImpl |
( |
double |
layer_size, |
|
|
double |
density = 0.0 |
|
) |
| const |
|
overrideprivatevirtual |
Implements IPositionBuilder.
Definition at line 222 of file IPositionBuilder.cpp.
224 std::vector<std::vector<double>> lattice_positions;
226 double distance =
m_iff->peakDistance();
230 int n = distance <= 0.0 ? 1 :
static_cast<int>(layer_size * std::sqrt(2.0) / distance);
232 lattice_positions.resize(2 * n + 1);
233 for (
auto& it : lattice_positions)
236 lattice_positions[0][0] = 0.0;
237 lattice_positions[0][1] = 0.0;
239 for (
int i = 1; i <= n; ++i) {
241 unsigned i_left =
static_cast<unsigned>(std::max(0, 2 * i - 3));
243 double offset =
m_iff->randomSample();
244 lattice_positions[2 * i - 1][0] = lattice_positions[i_left][0] + distance + offset;
245 lattice_positions[2 * i - 1][1] = 0.0;
248 offset =
m_iff->randomSample();
249 lattice_positions[2 * i][0] = lattice_positions[2 * (i - 1)][0] - distance + offset;
250 lattice_positions[2 * i][1] = 0.0;
252 return lattice_positions;
References m_iff.
◆ positionVariance()
double RadialParacrystalPositionBuilder::positionVariance |
( |
| ) |
const |
|
overrideprivatevirtual |
◆ m_iff
std::unique_ptr<InterferenceRadialParaCrystal> RadialParacrystalPositionBuilder::m_iff |
|
private |
The documentation for this class was generated from the following files: