Bugfixes;
Restarts now reproduce longer Sims
This commit is contained in:
@@ -364,10 +364,18 @@ void PoissonSolver::setPotential(blitz::Array<double, 3>& potential) {
|
||||
out << ". But expected a size of " << potential_.length();
|
||||
ERROR(out.str());
|
||||
}
|
||||
|
||||
// necessary since it's not guaranteed (or even likely) that both arrays
|
||||
// are indexed the same (i.e. potential_ is most likely starting from -1,
|
||||
// while the parameter array is most likely starting from 0)
|
||||
const int i_offset = potential.lbound(0) - potential_.lbound(0);
|
||||
const int j_offset = potential.lbound(1) - potential_.lbound(1);
|
||||
const int k_offset = potential.lbound(2) - potential_.lbound(2);
|
||||
|
||||
for(int i = potential_.lbound(0); i <= potential_.ubound(0); ++i) {
|
||||
for(int j = potential_.lbound(1); j <= potential_.ubound(1); ++j) {
|
||||
for(int k = potential_.lbound(2); k <= potential_.ubound(2); ++k) {
|
||||
potential_(i,j,k).value = potential(i,j,k);
|
||||
potential_(i,j,k).value = potential(i + i_offset,j + j_offset,k + k_offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user