Révision | 2f58139b365dae239ce06a812e1954e99ed04cc4 (tree) |
---|---|
l'heure | 2013-08-23 16:06:32 |
Auteur | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Limit the number of GEDIIS history entries. #31854
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1492 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -251,7 +251,7 @@ void GEDIIS::SearchMinimum(boost::shared_ptr<ElectronicStructure> electronicStru | ||
251 | 251 | MallocerFreer::GetInstance()->Free(&matrixGEDIISForce , molecule.GetNumberAtoms(), CartesianType_end); |
252 | 252 | } |
253 | 253 | |
254 | -GEDIIS::GEDIISHistory::GEDIISHistory(){ | |
254 | +GEDIIS::GEDIISHistory::GEDIISHistory():maxEntryCount(5){ | |
255 | 255 | this->SetMessages(); |
256 | 256 | } |
257 | 257 |
@@ -272,6 +272,10 @@ void GEDIIS::GEDIISHistory::AddEntry(double energy, | ||
272 | 272 | const MolDS_base::Molecule& molecule, |
273 | 273 | double const* const* matrixForce){ |
274 | 274 | this->entryList.push_back(new Entry(energy, molecule, matrixForce)); |
275 | + if(this->entryList.size() > this->maxEntryCount){ | |
276 | + delete this->entryList.front(); | |
277 | + this->entryList.pop_front(); | |
278 | + } | |
275 | 279 | } |
276 | 280 | |
277 | 281 | void GEDIIS::GEDIISHistory::DiscardEntries(){ |
@@ -62,6 +62,7 @@ protected: | ||
62 | 62 | double** matrixCoordinate; |
63 | 63 | double** matrixForce; |
64 | 64 | }; |
65 | + const int maxEntryCount; | |
65 | 66 | typedef std::list< const Entry* > entryList_t; |
66 | 67 | entryList_t entryList; |
67 | 68 | void SetMessages(); |