Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 996e0aff authored by Matthias Frey's avatar Matthias Frey
Browse files

Merge branch 'master' of gitlab.psi.ch:frey_m/src

parents 97658f38 e63e17d5
No related branches found
No related tags found
1 merge request!16Merge AMR fork into OPAL/master
......@@ -185,27 +185,24 @@ void Distribution::uniformPerCell(const Array<Geometry>& geom,
nloc_m = 0;
std::mt19937_64 mt(0);
std::uniform_real_distribution<> dist(0.0, 1.0);
std::vector< Vektor<double, 3> > rn(nParticles);
for (std::size_t i = 0; i < nParticles; ++i) {
for (int d = 0; d < 3; ++d) {
rn[i](d) = dist(mt);
}
}
double dx[3] = {0.0, 0.0, 0.0}; // cell size (a bit smaller such that particles not a cell boundary)
double cidx[3] = {0, 0, 0}; // max. cell index for a level
// go through levels and add "nParticles" particles per cell
for (std::size_t i = 0; i < geom.size(); ++i) {
if ( Ippl::myNode() == 0 ) {
for (int d = 0; d < 3; ++d) {
dx[d] = geom[i].CellSize(d);
cidx[d] = nr[d] * std::pow(2, i);
std::mt19937_64 mt(0);
std::uniform_real_distribution<> dist(0.0, 1.0);
std::vector< Vektor<double, 3> > rn(nParticles);
for (std::size_t i = 0; i < nParticles; ++i) {
for (int d = 0; d < 3; ++d) {
rn[i](d) = dist(mt);
}
}
double dx[3] = {0.0, 0.0, 0.0}; // cell size (a bit smaller such that particles not a cell boundary)
double cidx[3] = {0, 0, 0}; // max. cell index for a level
for (int d = 0; d < 3; ++d)
dx[d] = geom[0].CellSize(d);
// map [0, 1] --> to cell dimension [0 + 0.25 * dx, 0.75 * dx]
std::vector< Vektor<double, 3> > mapped2cell(nParticles);
......@@ -214,8 +211,8 @@ void Distribution::uniformPerCell(const Array<Geometry>& geom,
mapped2cell[pi](d) = dx[d] * (0.5 * rn[pi](d) + 0.25);
}
for (int j = 0; j < ba[i].size(); ++j) {
Box bx = ba[i].get(j);
for (int j = 0; j < ba[0].size(); ++j) {
Box bx = ba[0].get(j);
for (int k = bx.loVect()[0]; k <= bx.hiVect()[0]; ++k) {
for (int l = bx.loVect()[1]; l <= bx.hiVect()[1]; ++l) {
......@@ -224,9 +221,9 @@ void Distribution::uniformPerCell(const Array<Geometry>& geom,
// assign particle position
for (std::size_t pi = 0; pi < nParticles; ++pi) {
// [index space] --> [physical domain]
double kk = geom[0].ProbLength(0) / cidx[0] * k + geom[0].ProbLo(0);
double ll = geom[0].ProbLength(1) / cidx[1] * l + geom[0].ProbLo(1);
double mm = geom[0].ProbLength(2) / cidx[2] * m + geom[0].ProbLo(2);
double kk = geom[0].ProbLength(0) / nr[0] * k + geom[0].ProbLo(0);
double ll = geom[0].ProbLength(1) / nr[1] * l + geom[0].ProbLo(1);
double mm = geom[0].ProbLength(2) / nr[2] * m + geom[0].ProbLo(2);
x_m.push_back( kk + mapped2cell[pi](0) );
y_m.push_back( ll + mapped2cell[pi](1) );
......@@ -244,7 +241,6 @@ void Distribution::uniformPerCell(const Array<Geometry>& geom,
}
}
}
}
}
......
......@@ -199,7 +199,7 @@ void doBoxLib(const Vektor<std::size_t, 3>& nr, std::size_t nParticlesPerCell,
bunch->gatherStatistics();
std::size_t nParticles = bunch->getLocalNum();
std::size_t nParticles = bunch->getTotalNum();
msg << "#Particles: " << nParticles << endl
<< "Charge per particle: " << bunch->getQM(0) << " C" << endl
<< "Total charge: " << nParticles * bunch->getQM(0) << " C" << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment