diff --git a/lib/nBodySim.cpp b/lib/nBodySim.cpp index 85243dcd4173193c45056d9c14ffafa55854431f..570011f0c1b8316ee5c8d1a3f055450d1c8ed8f4 100644 --- a/lib/nBodySim.cpp +++ b/lib/nBodySim.cpp @@ -29,9 +29,8 @@ nBodySim::nBodySim(std::string datafile) { } } - softening_ = new double[nParticles_]; for (unsigned i=0; i < nParticles_; ++i) { - file >> softening_[i]; + file >> softening_; } potential_ = new double[nParticles_]; @@ -52,7 +51,6 @@ nBodySim::~nBodySim() { delete[] masses_; delete[] positions_; delete[] velocities_; - delete[] softening_; delete[] potential_; delete[] forces_; } @@ -223,7 +221,7 @@ void nBodySim::saveState2file(unsigned step, std::string filename) const { } // save softening for (unsigned i=0; i < nParticles_; ++i) { - file << softening_[i] << std::endl; + file << softening_ << std::endl; } // save potential for (unsigned i=0; i < nParticles_; ++i) { diff --git a/lib/nBodySim.hpp b/lib/nBodySim.hpp index c6fc75c23e3f72cf277ec04b722df66e1b34e06c..997cf3b3521a52cf3603a2f684c48134d89cf806 100644 --- a/lib/nBodySim.hpp +++ b/lib/nBodySim.hpp @@ -37,7 +37,7 @@ private: double* masses_; double* positions_; double* velocities_; - double* softening_; + double softening_; double* potential_; double* forces_; double meanInterparticleDistance_;