aboutsummaryrefslogtreecommitdiff
path: root/src/InterpLocalUniform.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/InterpLocalUniform.c')
-rw-r--r--src/InterpLocalUniform.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/InterpLocalUniform.c b/src/InterpLocalUniform.c
index 30a5f9a..7cc6ff0 100644
--- a/src/InterpLocalUniform.c
+++ b/src/InterpLocalUniform.c
@@ -70,7 +70,7 @@ CCTK_FILEVERSION(AEITHorns_AEILocalInterp_src_InterpLocalUniform_c)
/******************************************************************************/
/*
- * *****data structures and functions local to this file *****
+ * ***** data structures and functions local to this file *****
*/
/**************************************/
@@ -1112,6 +1112,63 @@ if (N_dims > MAX_N_DIMS)
/******************************************************************************/
/*
+ * if logging is requested,
+ * open a logging file if we haven't already done so
+ */
+ {
+static FILE* log_fp = NULL;
+const bool log_interp_coords
+ = (AEILocalInterp_get_int_param("AEILocalInterp", "log_interp_coords") != 0);
+
+if (log_interp_coords && (log_fp == NULL))
+ then {
+ /* open logging file & write header */
+
+ #define FILE_NAME_BUFFER_SIZE 100
+ char file_name[FILE_NAME_BUFFER_SIZE];
+ Util_snprintf(file_name, FILE_NAME_BUFFER_SIZE,
+ "AEILocalInterp.proc%d.log",
+ CCTK_MyProc(NULL));
+
+ log_fp = fopen(file_name, "w");
+ if (log_fp == NULL)
+ then CCTK_VWarn(ERROR_MSG_SEVERITY_LEVEL,
+ __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" CCTK_InterpLocalUniform(): can't open coordinate logging file\n"
+" \"%s\"!\n"
+ ,
+ file_name); /*NOTREACHED*/
+
+ fprintf(log_fp, "## any missing data (eg if N_dims < 3 or N_interp_points < 3) is printed as 0\n");
+ fprintf(log_fp, "# column 1 = N_dims\n");
+ fprintf(log_fp, "# column 2 = N_interp_points\n");
+ fprintf(log_fp, "# column 3 = grid x_min\n");
+ fprintf(log_fp, "# column 4 = grid delta_x\n");
+ fprintf(log_fp, "# column 5 = grid x_max\n");
+ fprintf(log_fp, "# column 6 = grid y_min\n");
+ fprintf(log_fp, "# column 7 = grid delta_y\n");
+ fprintf(log_fp, "# column 8 = grid y_max\n");
+ fprintf(log_fp, "# column 9 = grid z_min\n");
+ fprintf(log_fp, "# column 10 = grid delta_z\n");
+ fprintf(log_fp, "# column 11 = grid z_max\n");
+ fprintf(log_fp, "# column 12 = interp_x[0]\n");
+ fprintf(log_fp, "# column 13 = interp_y[0]\n");
+ fprintf(log_fp, "# column 14 = interp_z[0]\n");
+ fprintf(log_fp, "# column 15 = interp_x[1]\n");
+ fprintf(log_fp, "# column 16 = interp_y[1]\n");
+ fprintf(log_fp, "# column 17 = interp_z[1]\n");
+ fprintf(log_fp, "# column 18 = interp_x[2]\n");
+ fprintf(log_fp, "# column 19 = interp_y[2]\n");
+ fprintf(log_fp, "# column 20 = interp_z[2]\n");
+ fprintf(log_fp, "# column 21 = interp_x[N_interp_points-1]\n");
+ fprintf(log_fp, "# column 22 = interp_y[N_interp_points-1]\n");
+ fprintf(log_fp, "# column 23 = interp_z[N_interp_points-1]\n");
+ }
+
+/******************************************************************************/
+
+/*
* get the parameters from the parameter table, filling in defaults as needed
*/
@@ -1567,7 +1624,7 @@ const int return_code
N_output_arrays,
output_array_type_codes, output_arrays,
operand_indices, operation_codes,
- debug,
+ debug, (log_interp_coords ? log_fp : NULL),
&error_info,
&molecule_structure_flags,
p_molecule_min_max_m_info,
@@ -1675,6 +1732,7 @@ return return_code; /*** NORMAL RETURN ***/
}
}
}
+ }
}
/******************************************************************************/