Definition at line 55 of file IPositionBuilder.h.
◆ RandomPositionBuilder()
RandomPositionBuilder::RandomPositionBuilder |
( |
| ) |
|
|
default |
◆ ~RandomPositionBuilder()
RandomPositionBuilder::~RandomPositionBuilder |
( |
| ) |
|
|
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 > > RandomPositionBuilder::generatePositionsImpl |
( |
double |
layer_size, |
|
|
double |
density = 0.0 |
|
) |
| const |
|
overrideprivatevirtual |
Implements IPositionBuilder.
Definition at line 66 of file IPositionBuilder.cpp.
69 std::vector<std::vector<double>> lattice_positions;
70 std::vector<double> position;
74 int num_particles =
static_cast<int>(density * (2 * layer_size) * (2 * layer_size));
77 std::random_device rd;
78 std::mt19937 gen(rd());
79 std::uniform_real_distribution<double> dis(0.0, 1.0);
81 for (
int i = 1; i <= num_particles; ++i) {
83 position.push_back(dis(gen) * 2 * layer_size - layer_size);
84 position.push_back(dis(gen) * 2 * layer_size - layer_size);
86 lattice_positions.push_back(position);
89 return lattice_positions;
◆ positionVariance()
double RandomPositionBuilder::positionVariance |
( |
| ) |
const |
|
overrideprivatevirtual |
The documentation for this class was generated from the following files: