aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-07-29 13:28:18 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-07-29 13:28:18 +0000
commit955d7ea6026d47a2d05457187612649de61efd4e (patch)
tree230d2d89204c016fd830339f10488ce37b32146e
parent9ff4c59ad241f4dd9a6ae875f503d723a8bc0ddc (diff)
- inherit from IO
- add new parameters BH_diagnostics_directory h_directory which both default to IO::out_dir - change code to use these for output directories - change code to auto-create output directories if they don't already exist git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1157 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r--interface.ccl2
-rw-r--r--param.ccl166
-rw-r--r--src/driver/BH_diagnostics.cc22
-rw-r--r--src/driver/Newton.cc6
-rw-r--r--src/driver/driver.hh31
-rw-r--r--src/driver/io.cc148
-rw-r--r--src/driver/setup.cc18
7 files changed, 244 insertions, 149 deletions
diff --git a/interface.ccl b/interface.ccl
index 7337c49..8f8055d 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -2,7 +2,7 @@
# $Header$
implements: AHFinderDirect
-inherits: Grid ADMBase StaticConformal SpaceMask always
+inherits: Grid ADMBase StaticConformal SpaceMask IO always
# include file provided by SpaceMask
USES INCLUDE: SpaceMask.h
diff --git a/param.ccl b/param.ccl
index 6b24d1d..18637e7 100644
--- a/param.ccl
+++ b/param.ccl
@@ -21,6 +21,11 @@ USES KEYWORD rotation_axis
shares: ADMBase
USES KEYWORD metric_type
+# we need to look at IO::out_dir to set the default for our own
+# output directory parameters
+shares: IO
+USES STRING out_dir
+
# all remaining parameters are private to this thorn
private:
@@ -147,7 +152,7 @@ keyword initial_guess_method[11] \
string initial_guess__read_from_named_file__file_name[11] \
"file name to read initial guess from"
{
-.+ :: "file name to read initial guess from"
+".+" :: "file name to read initial guess from"
} "h.gp"
# parameters for initial_guess_method = "Kerr/Kerr"
@@ -256,6 +261,55 @@ real initial_guess__coord_ellipsoid__z_radius[11] "z radius of ellipsoid"
########################################
#
+# parameters for BH diagnostics
+#
+
+#
+# The file format is currently hard-wired to a simple ASCII format:
+# - there is one file per AH
+# - after some header comments (starting with '#'),
+# there is one line per successful-AH-finding
+# (there is *no* line if we fail to find an AH)
+# - each line contains various tab-separated fields, as described by
+# the header comment
+#
+boolean output_BH_diagnostics \
+ "should we output BH diagnostics to a data file for each AH found?"
+{
+} "true"
+
+#
+# These file names are actually just "base" file names, with the full
+# file names being given by a printf() format "%s/%s.ah%d.%s",
+# where
+# - the first %s is the BH diagnostics directory as set by the
+# BH_diagnostics_directory parameter; this is automagically created
+# if it doesn't already exist
+# - the second %s is the base file name,
+# - the %d is the global Cactus time iteration number cctk_iteration,
+# - the third %s is the file name extension as set by the
+# BH_diagnostics_file_name_extension parameter
+#
+string BH_diagnostics_directory "directory for BH diagnostics output file(s)"
+{
+".+" :: "any nonempty string"
+"^$" :: "an empty string to default to IO::out_dir"
+} ""
+string BH_diagnostics_base_file_name \
+ "base file name for BH diagnostics output file(s)"
+{
+".+" :: "any nonempty string"
+} "BH_diagnostics"
+
+string BH_diagnostics_file_name_extension \
+ "extension for BH diagnostics data files"
+{
+".+" :: "any nonempty string"
+} "gp"
+
+########################################
+
+#
# parameters for horizon-shape and other similar data files
#
@@ -300,40 +354,49 @@ boolean output_ghost_zones_for_h \
string ASCII_gnuplot_file_name_extension \
"extension for ASCII (gnuplot) data files"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "gp"
string HDF5_file_name_extension "extension for HDF5 data files"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "hdf5"
#
# These file names are actually just "base" file names, with the full
-# file names being given by a printf() format "%s.t%d.ah%d[.it%d].%s",
+# file names being given by a printf() format "%s/%s.t%d.ah%d[.it%d].%s",
# where
-# - the first %s is the base file name,
+# - the first %s is the output directory as set by the h_directory
+# parameter (this same directory is used for all of these files);
+# this is automagically created if it doesn't already exist
+# - the second %s is the base file name,
# - the first %d is the global Cactus time iteration number cctk_iteration,
# - the second %d is the apparent horizon number,
# - the optional third %d is the horizon finder iteration number
-# - the second %s is the file name extension
+# - the third %s is the file name extension
# {ASCII,HDF5}_data_file_name_extension
#
+string h_directory \
+ "directory for horizon shape and other similar output (or input) file(s)"
+{
+".+" :: "any nonempty string"
+"^$" :: "an empty string to default to IO::out_dir"
+} ""
string h_base_file_name \
"base file name for horizon shape h input/output file(s)"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "h"
string Theta_base_file_name "base file name for Theta(h) output file(s)"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "Theta"
string Delta_h_base_file_name \
"base file name for horizon-shape-update Delta_h output file(s)"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "Delta_h"
#
@@ -342,10 +405,13 @@ string Delta_h_base_file_name \
# for each patch to specify some of the patch metadata.
#
# If we write them, the control file names are given by a printf() format
-# "%s.ah%d.%s", where
-# - the first %s is h_base_file_name
+# "%s/%s.ah%d.%s", where
+# - the first %s is the output directory as set by the h_directory
+# parameter (this same directory is used for all of these files);
+# this is automagically created if it doesn't already exist
+# - the second %s is h_base_file_name
# - the %d is the apparent horizon number
-# - the second %s is the file name extension OpenDX_control_file_name_extension
+# - the third %s is the file name extension OpenDX_control_file_name_extension
#
boolean output_OpenDX_control_files \
"should we output OpenDX control files to allow reading of AHFinderDirect \
@@ -355,53 +421,12 @@ boolean output_OpenDX_control_files \
string OpenDX_control_file_name_extension \
"file name extension for OpenDX control files"
{
-.+ :: "any nonempty string"
+".+" :: "any nonempty string"
} "dx"
########################################
#
-# parameters for BH diagnostics
-#
-
-#
-# The file format is currently hard-wired to a simple ASCII format:
-# - there is one file per AH
-# - after some header comments (starting with '#'),
-# there is one line per successful-AH-finding
-# (there is *no* line if we fail to find an AH)
-# - each line contains various tab-separated fields, as described by
-# the header comment
-#
-boolean output_BH_diagnostics \
- "should we output BH diagnostics to a data file for each AH found?"
-{
-} "true"
-
-#
-# These file names are actually just "base" file names, with the full
-# file names being given by a printf() format "%s.ah%d.%s",
-# where
-# - the first %s is the base file name,
-# - the %d is the global Cactus time iteration number cctk_iteration,
-# - the second %s is the file name extension as set by the
-# BH_diagnostics_file_name_extension parameter
-#
-string BH_diagnostics_base_file_name \
- "base file name for BH diagnostics output file(s)"
-{
-.+ :: "any nonempty string"
-} "BH_diagnostics"
-
-string BH_diagnostics_file_name_extension \
- "extension for BH diagnostics data files"
-{
-.+ :: "any nonempty string"
-} "gp"
-
-########################################
-
-#
# parameters mainly for debugging
#
@@ -421,7 +446,7 @@ boolean debugging_output_at_each_Newton_iteration \
string Jacobian_base_file_name "base file name for Jacobian output file(s)"
{
-.+ :: "any valid file name"
+".+" :: "any valid file name"
} "Jacobian.dat"
################################################################################
@@ -516,7 +541,7 @@ boolean set_new_style_mask \
#
string old_style_mask_gridfn_name "name of the old-style mask grid function"
{
-.+ :: "any valid Cactus grid function name"
+".+" :: "any valid Cactus grid function name"
} "SpaceMask::emask"
real old_style_mask_inside_value \
"set the old-style mask to this value in the 'inside' region"
@@ -539,30 +564,30 @@ real old_style_mask_outside_value \
#
string new_style_mask_gridfn_name "name of the new-style mask grid function"
{
-.+ :: "any valid Cactus grid function name"
+".+" :: "any valid Cactus grid function name"
} "SpaceMask::space_mask"
string new_style_mask_bitfield_name \
"name of the new-style mask bit field ('type') as registered with SpaceMask"
{
-.+ :: "any valid bit field ('type') name registered with the SpaceMask thorn"
+".+" :: "any valid bit field ('type') name registered with the SpaceMask thorn"
} "mask"
string new_style_mask_inside_value \
"set the specified bit field of the new-style mask to this named state \
at grid points in the 'inside' region"
{
-.+ :: "any state name registered with the SpaceMask thorn"
+".+" :: "any state name registered with the SpaceMask thorn"
} "inside"
string new_style_mask_buffer_value \
"set the specified bit field of the new-style mask to this named state \
at grid points in the 'buffer' region"
{
-.+ :: "any state name registered with the SpaceMask thorn"
+".+" :: "any state name registered with the SpaceMask thorn"
} "buffer"
string new_style_mask_outside_value \
"set the specified bit field of the new-style mask to this named state \
at grid points in the 'outside' region"
{
-.+ :: "any state name registered with the SpaceMask thorn"
+".+" :: "any state name registered with the SpaceMask thorn"
} "outside"
################################################################################
@@ -969,13 +994,13 @@ boolean test_all_Jacobian_compute_methods \
string coordinate_system_name \
"name under which the coordinate system is registered in Cactus"
{
-.+ :: "any string (in practice it should be nonempty)"
+".+" :: "any nonempty string"
} "cart3d"
string geometry_interpolator_name \
"name under which the geometry interpolation operator is registered in Cactus"
{
-.+ :: "any string"
+".+" :: "any nonempty string"
} "Hermite polynomial interpolation"
#
@@ -988,7 +1013,8 @@ string geometry_interpolator_name \
string geometry_interpolator_pars \
"parameters for the geometry interpolator"
{
-.* :: "any string acceptable to Util_TableSetFromString() and to the interpolator"
+".*" :: \
+ "any string acceptable to Util_TableSetFromString() and to the interpolator"
} "order=3 \
boundary_off_centering_tolerance={1.0e-10 1.0e-10 1.0e-10 1.0e-10 1.0e-10 1.0e-10} \
boundary_extrapolation_tolerance={0.0 0.0 0.0 0.0 0.0 0.0}"
@@ -1089,13 +1115,14 @@ boolean check_that_geometry_is_finite \
string interpatch_interpolator_name \
"name under which the interpatch interpolation operator is registered in Cactus"
{
-.+ :: "any string (in practice it should be nonempty)"
+".+" :: "any string (in practice it should be nonempty)"
} "Lagrange polynomial interpolation"
string interpatch_interpolator_pars \
"parameters for the interpatch interpolator"
{
-.* :: "any string acceptable to Util_TableSetFromString() and to the interpolator"
+".*" :: \
+ "any string acceptable to Util_TableSetFromString() and to the interpolator"
} "order=5"
################################################################################
@@ -1116,14 +1143,15 @@ string interpatch_interpolator_pars \
string surface_interpolator_name \
"name under which the surface interpolation operator is registered in Cactus"
{
-"" :: "the empty string if this interpolator isn't going to be used"
-.+ :: "any string (in practice it should be nonempty)"
+"^$" :: "the empty string if this interpolator isn't going to be used"
+".+" :: "any string (in practice it should be nonempty)"
} "Lagrange polynomial interpolation"
string surface_interpolator_pars \
"parameters for the surface interpolator"
{
-.* :: "any string acceptable to Util_TableSetFromString() and to the interpolator"
+".*" :: \
+ "any string acceptable to Util_TableSetFromString() and to the interpolator"
} "order=3 \
boundary_off_centering_tolerance={1.0e-10 1.0e-10 1.0e-10 1.0e-10} \
boundary_extrapolation_tolerance={0.0 0.0 0.0 0.0}"
diff --git a/src/driver/BH_diagnostics.cc b/src/driver/BH_diagnostics.cc
index 0a8b8e1..733d2f3 100644
--- a/src/driver/BH_diagnostics.cc
+++ b/src/driver/BH_diagnostics.cc
@@ -333,12 +333,24 @@ FILE* BH_diagnostics::setup_output_file(const struct IO_info& IO_info,
int N_horizons, int hn)
const
{
-const int N_file_name_buffer = 200;
-char file_name_buffer[N_file_name_buffer];
+char file_name_buffer[IO_info::file_name_buffer_size];
-snprintf(file_name_buffer, N_file_name_buffer,
- "%s.ah%d.%s",
- IO_info.BH_diagnostics_base_file_name,
+const char* directory = IO_info.BH_diagnostics_directory;
+const int status = CCTK_CreateDirectory(IO_info.default_directory_permission,
+ directory);
+if (status < 0)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" BH_diagnostics::setup_output_file():\n"
+" error %d trying to create output directory\n"
+" \"%s\"!"
+ ,
+ status,
+ directory); /*NOTREACHED*/
+
+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");
if (fileptr == NULL)
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc
index 1e7efbc..dd92984 100644
--- a/src/driver/Newton.cc
+++ b/src/driver/Newton.cc
@@ -376,10 +376,8 @@ if (hs.has_genuine_horizons())
then {
// if this is the first time we've output h for this
// horizon, maybe output an OpenDX control file?
- if (IO_info.output_OpenDX_control_files
- && !AH_data_ptr->OpenDX_control_file_written)
- then output_OpenDX_control_file(*ps_ptr,
- IO_info, hn);
+ if (!AH_data_ptr->h_files_written)
+ then setup_h_files(*ps_ptr, IO_info, hn);
output_gridfn(*ps_ptr, gfns::gfn__h,
IO_info, IO_info.h_base_file_name,
hn, verbose_info
diff --git a/src/driver/driver.hh b/src/driver/driver.hh
index c60d3b6..74fddaa 100644
--- a/src/driver/driver.hh
+++ b/src/driver/driver.hh
@@ -122,26 +122,40 @@ struct solver_info
//
struct IO_info
{
+ // buffer size for file names
+ // ... file names longer than this will be truncated, but
+ // they will NOT overflow the buffer (we always use snprintf(3))
+ enum { file_name_buffer_size = 512 };
+
+ // default permissions for newly created directories
+ // = full access to everyone; the user's umask
+ // should cut this down to something reasonable
+ enum { default_directory_permission = 0777 };
+
enum horizon_file_format horizon_file_format;
bool output_initial_guess;
int output_h_every, output_Theta_every;
// based on the above, do we want to output things now (this time step)?
bool output_h, output_Theta;
+ bool output_BH_diagnostics;
+ const char* BH_diagnostics_directory;
+ const char* BH_diagnostics_base_file_name;
+ const char* BH_diagnostics_file_name_extension;
+
bool output_ghost_zones_for_h;
const char* ASCII_gnuplot_file_name_extension;
const char* HDF5_file_name_extension;
+ const char* h_directory;
const char* h_base_file_name;
const char* Theta_base_file_name;
const char* Delta_h_base_file_name;
+
const char* Jacobian_base_file_name;
+
bool output_OpenDX_control_files;
const char* OpenDX_control_file_name_extension;
- bool output_BH_diagnostics;
- const char* BH_diagnostics_base_file_name;
- const char* BH_diagnostics_file_name_extension;
-
// this is used to choose file names
int time_iteration; // the Cactus time interation number
// (cctk_iteration)
@@ -280,9 +294,8 @@ struct AH_data
struct initial_guess_info initial_guess_info;
bool found_flag; // did we find this horizon (successfully)
- bool OpenDX_control_file_written; // have we written an
- // OpenDX control file
- // (for this horizon) yet?
+ bool h_files_written; // have we written horizon-shape or similar
+ // files for this horizon yet?
struct BH_diagnostics BH_diagnostics;
FILE *BH_diagnostics_fileptr;
@@ -389,12 +402,10 @@ void input_gridfn(patch_system& ps, int unknown_gfn,
void input_gridfn__explicit_name(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info,
const char file_name[], bool print_msg_flag);
+void setup_h_files(patch_system& ps, const struct IO_info& IO_info, int hn);
void output_gridfn(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info, const char base_file_name[],
int hn, bool print_msg_flag, int AHF_iteration = 0);
-void output_OpenDX_control_file(const patch_system& ps,
- const struct IO_info& IO_info,
- int hn);
void output_Jacobians(const patch_system& ps,
const Jacobian* Jac_NP_ptr,
const Jacobian* Jac_SD_FDdr_ptr,
diff --git a/src/driver/io.cc b/src/driver/io.cc
index e9b737c..5fb8807 100644
--- a/src/driver/io.cc
+++ b/src/driver/io.cc
@@ -3,8 +3,10 @@
//
// input_gridfn - read an angular grid function from an input file
// input_gridfn__explicit_name - ... with the input file explicitly named
+//
+// setup_h_files - set up to write horizon-shape and similar output files
+/// output_OpenDX_control_file - write an OpenDX control file for an output file
// output_gridfn - write an angular grid function to an output file
-// output_OpenDX_control_file - write an OpenDX control file for an output file
// output_Jacobians - write a Jacobian matrix or matrices to an output file
//
/// io_file_name - compute file name for angular-gridfn I/O file
@@ -47,18 +49,25 @@ using jtutil::error_exit;
#include "driver.hh"
//******************************************************************************
+//******************************************************************************
+//******************************************************************************
//
// prototypes for functions local to this file
//
namespace {
+void output_OpenDX_control_file(const patch_system& ps,
+ const struct IO_info& IO_info,
+ int hn);
const char* io_file_name(const struct IO_info& IO_info,
const char base_file_name[],
int hn, int AHF_iteration = 0);
}
//******************************************************************************
+//******************************************************************************
+//******************************************************************************
//
// This function inputs a gridfn from a data file, with the file name
@@ -123,6 +132,81 @@ default:
}
//******************************************************************************
+//******************************************************************************
+//******************************************************************************
+
+//
+// This function sets up to output horizon-shape or similar data files:
+// - it creates the output directory if this doesn't already exist
+// - it writes the OpenDX control files if this is desired
+//
+void setup_h_files(patch_system& ps, const struct IO_info& IO_info, int hn)
+{
+// create the output directory (if it doesn't already exist)
+const int status = CCTK_CreateDirectory(IO_info.default_directory_permission,
+ IO_info.h_directory);
+if (status < 0)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" setup_h_files():\n"
+" error %d trying to create output directory\n"
+" \"%s\"!"
+ ,
+ status,
+ IO_info.h_directory); /*NOTREACHED*/
+
+output_OpenDX_control_file(ps, IO_info, hn);
+}
+
+//******************************************************************************
+
+//
+// This function outputs an OpenDX control file to allow Thomas Radke's
+// OpenDX macros to read in a "ASCII (gnuplot)" data file produced by
+// output_gridfn() .
+//
+namespace {
+void output_OpenDX_control_file(const patch_system& ps,
+ const struct IO_info& IO_info,
+ int hn)
+{
+static char file_name_buffer[IO_info::file_name_buffer_size];
+snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.ah%d.%s",
+ IO_info.h_directory, IO_info.h_base_file_name, hn,
+ IO_info.OpenDX_control_file_name_extension);
+
+FILE *fileptr = fopen(file_name_buffer, "w");
+if (fileptr == NULL)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "output_OpenDX_control_file(): can't open output file \"%s\"!",
+ file_name_buffer); /*NOTREACHED*/
+
+fprintf(fileptr, "# list the size of each patch (N_rho x N_sigma)\n");
+ for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
+ {
+ const patch& p = ps.ith_patch(pn);
+ fprintf(fileptr, "object \"%s patch\" class array ", p.name());
+ fprintf(fileptr, "type int rank 1 shape 2 items 1 data follows %d %d\n",
+ p.effective_N_irho(IO_info.output_ghost_zones_for_h),
+ p.effective_N_isigma(IO_info.output_ghost_zones_for_h));
+ }
+fprintf(fileptr, "\n");
+
+fprintf(fileptr, "# collect all patch sizes into a single OpenDX group\n");
+fprintf(fileptr, "# for the ImportAHFinderDirectGnuplot macro to read\n");
+fprintf(fileptr, "object \"patchsizes\" class group\n");
+ for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
+ {
+ const patch& p = ps.ith_patch(pn);
+ fprintf(fileptr, "member %d value \"%s patch\"\n", pn, p.name());
+ }
+
+fclose(fileptr);
+}
+ }
+
+//******************************************************************************
//
// This function outputs a gridfn from a data file.
@@ -194,53 +278,6 @@ default:
//******************************************************************************
//
-// This function outputs an OpenDX control file to allow Thomas Radke's
-// OpenDX macros to read in a "ASCII (gnuplot)" data file produced by
-// output_gridfn() .
-//
-void output_OpenDX_control_file(const patch_system& ps,
- const struct IO_info& IO_info,
- int hn)
-{
-const int N_file_name_buffer = 200;
-static char file_name_buffer[N_file_name_buffer];
-snprintf(file_name_buffer, N_file_name_buffer,
- "%s.ah%d.%s",
- IO_info.h_base_file_name, hn,
- IO_info.OpenDX_control_file_name_extension);
-
-FILE *fileptr = fopen(file_name_buffer, "w");
-if (fileptr == NULL)
- then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
- "output_Jacobians(): can't open output file \"%s\"!",
- file_name_buffer); /*NOTREACHED*/
-
-fprintf(fileptr, "# list the size of each patch (N_rho x N_sigma)\n");
- for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
- {
- const patch& p = ps.ith_patch(pn);
- fprintf(fileptr, "object \"%s patch\" class array ", p.name());
- fprintf(fileptr, "type int rank 1 shape 2 items 1 data follows %d %d\n",
- p.effective_N_irho(IO_info.output_ghost_zones_for_h),
- p.effective_N_isigma(IO_info.output_ghost_zones_for_h));
- }
-fprintf(fileptr, "\n");
-
-fprintf(fileptr, "# collect all patch sizes into a single OpenDX group\n");
-fprintf(fileptr, "# for the ImportAHFinderDirectGnuplot macro to read\n");
-fprintf(fileptr, "object \"patchsizes\" class group\n");
- for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
- {
- const patch& p = ps.ith_patch(pn);
- fprintf(fileptr, "member %d value \"%s patch\"\n", pn, p.name());
- }
-
-fclose(fileptr);
-}
-
-//******************************************************************************
-
-//
// This function prints one or two Jacobian matrices (and their difference
// in the latter case) to a named output file.
//
@@ -389,8 +426,7 @@ const char* io_file_name(const struct IO_info& IO_info,
const char base_file_name[],
int hn, int AHF_iteration /* = 0 */)
{
-const int N_file_name_buffer = 200;
-static char file_name_buffer[N_file_name_buffer];
+static char file_name_buffer[IO_info::file_name_buffer_size];
const char* file_name_extension;
switch (IO_info.horizon_file_format)
@@ -411,14 +447,14 @@ default:
}
if (AHF_iteration == 0)
- then snprintf(file_name_buffer, N_file_name_buffer,
- "%s.t%d.ah%d.%s",
- base_file_name,
+ then snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.t%d.ah%d.%s",
+ IO_info.h_directory, base_file_name,
IO_info.time_iteration, hn,
file_name_extension);
- else snprintf(file_name_buffer, N_file_name_buffer,
- "%s.t%d.ah%d.it%d.%s",
- base_file_name,
+ else snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.t%d.ah%d.it%d.%s",
+ IO_info.h_directory, base_file_name,
IO_info.time_iteration, hn, AHF_iteration,
file_name_extension);
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index b48faa9..1e4cc9e 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -247,18 +247,28 @@ IO_info.output_h_every = output_h_every;
IO_info.output_Theta_every = output_Theta_every;
IO_info.output_h = false; // dummy value
IO_info.output_Theta = false; // dummy value
+
+IO_info.output_BH_diagnostics = (output_BH_diagnostics != 0);
+IO_info.BH_diagnostics_directory
+ = (strlen(BH_diagnostics_directory) == 0)
+ ? /* IO:: */ out_dir
+ : BH_diagnostics_directory;
+IO_info.BH_diagnostics_base_file_name = BH_diagnostics_base_file_name;
+IO_info.BH_diagnostics_file_name_extension = BH_diagnostics_file_name_extension;
+
IO_info.output_ghost_zones_for_h = (output_ghost_zones_for_h != 0);
IO_info.ASCII_gnuplot_file_name_extension = ASCII_gnuplot_file_name_extension;
IO_info.HDF5_file_name_extension = HDF5_file_name_extension;
+IO_info.h_directory
+ = (strlen(h_directory) == 0)
+ ? /* IO:: */ out_dir
+ : h_directory;
IO_info.h_base_file_name = h_base_file_name;
IO_info.Theta_base_file_name = Theta_base_file_name;
IO_info.Delta_h_base_file_name = Delta_h_base_file_name;
IO_info.Jacobian_base_file_name = Jacobian_base_file_name;
IO_info.output_OpenDX_control_files = (output_OpenDX_control_files != 0);
IO_info.OpenDX_control_file_name_extension = OpenDX_control_file_name_extension;
-IO_info.output_BH_diagnostics = (output_BH_diagnostics != 0);
-IO_info.BH_diagnostics_base_file_name = BH_diagnostics_base_file_name;
-IO_info.BH_diagnostics_file_name_extension = BH_diagnostics_file_name_extension;
IO_info.time_iteration = 0;
IO_info.time = 0.0;
@@ -501,7 +511,7 @@ if (strlen(surface_interpolator_name) > 0)
}
AH_data.found_flag = false;
- AH_data.OpenDX_control_file_written = false;
+ AH_data.h_files_written = false;
AH_data.BH_diagnostics_fileptr = NULL;
}
}