From 18cf79bbf3ebad825bcb8e5b270432072b4bf390 Mon Sep 17 00:00:00 2001 From: Gareth Tribello <gt@eider.asg> Date: Wed, 24 Jul 2013 09:40:38 +0100 Subject: [PATCH] Added fixes to checkpoint writing in analysis Checkpoint is appended in restart mode and overwritten when opened at start of calculation with no restart or when analysis is completed. Most of this is looked after within OFile now --- src/analysis/Analysis.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/analysis/Analysis.cpp b/src/analysis/Analysis.cpp index d2029d14e..606992bcf 100644 --- a/src/analysis/Analysis.cpp +++ b/src/analysis/Analysis.cpp @@ -156,14 +156,13 @@ old_norm(0.0) // Read in data from input file readDataFromFile( filename ); // Setup the restart file (append mode) - if( write_chq ) rfile.open( filename.c_str()); + if( write_chq ) rfile.open( filename.c_str() ); // In append mode automatically because of restart // Run the analysis if we stoped in the middle of it last time if( idata==ndata ) runAnalysis(); log.printf(" restarting analysis with %u points read from restart file\n",idata); } else if( write_chq ){ // Setup the restart file (delete any old one) - remove( filename.c_str() ); - rfile.open( filename.c_str()); + rfile.open( filename.c_str() ); // In overwrite mode automatically because there is no restart } if( write_chq ){ rfile.addConstantField("old_normalization"); @@ -299,7 +298,6 @@ void Analysis::runAnalysis(){ // Delete the checkpoint file if( write_chq ){ std::string filename = getName() + "_" + getLabel() + ".chkpnt"; - if( remove( filename.c_str() )!=0 ) warning("problem deleting checkpoint file " + filename ); // If we are running more than one calculation only reopen the restart file if( !single_run ) rfile.open( filename.c_str(), "w+" ); } -- GitLab