diff options
-rw-r--r-- | interface.ccl | 15 | ||||
-rw-r--r-- | src/driver/BH_diagnostics.cc | 6 |
2 files changed, 20 insertions, 1 deletions
diff --git a/interface.ccl b/interface.ccl index 4c683c1..707a8de 100644 --- a/interface.ccl +++ b/interface.ccl @@ -10,15 +10,30 @@ USES INCLUDE: SpaceMask.h ################################################################################ +# +# ***** aliased functions used from other thorns ***** +# + # we use an aliased function maybe provided by DriftCorrect SUBROUTINE SetDriftCorrectPosition \ (CCTK_POINTER_TO_CONST IN GH, \ CCTK_REAL IN x, CCTK_REAL IN y, CCTK_REAL IN z) USES FUNCTION SetDriftCorrectPosition +# +# This IOUtil function is used to determine whether the diagnostics file +# should be truncated or appended (as in a recovery run ) +# +CCTK_INT FUNCTION IO_TruncateOutputFiles(CCTK_POINTER_TO_CONST IN GH) +USES FUNCTION IO_TruncateOutputFiles + ################################################################################ # +# ***** aliased functions provided by this thorn ***** +# + +# # This thorn provides an aliased-function interface which other thorns # can use to find out about the horizons. Each function returns a status # code which is >= 0 for ok, or < 0 for an error. diff --git a/src/driver/BH_diagnostics.cc b/src/driver/BH_diagnostics.cc index 8cc4bf6..125177c 100644 --- a/src/driver/BH_diagnostics.cc +++ b/src/driver/BH_diagnostics.cc @@ -418,7 +418,11 @@ snprintf(file_name_buffer, IO_info::file_name_buffer_size, "%s/%s.ah%d.%s", directory, IO_info.BH_diagnostics_base_file_name, hn, IO_info.BH_diagnostics_file_name_extension); -FILE *fileptr = fopen(file_name_buffer, "w"); + +const char *const file_open_mode = IO_TruncateOutputFiles(state.cgi.GH) + ? "w" : "a"; + +FILE *fileptr = fopen(file_name_buffer, file_open_mode); if (fileptr == NULL) then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, "\n" |