From ba7a7d6baf8e549ee1ffbcf8c50e8f63ef561900 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 26 Feb 2009 09:07:06 +0000 Subject: output residuum and initial guess debug information only on processor 0 git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/TwoPunctures/trunk@91 b2a53a04-0f4f-0410-87ed-f9f25ced00cf --- src/FuncAndJacobian.c | 11 ++++++----- src/TwoPunctures.c | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/FuncAndJacobian.c b/src/FuncAndJacobian.c index 7a6e13b..3dd4a87 100644 --- a/src/FuncAndJacobian.c +++ b/src/FuncAndJacobian.c @@ -263,11 +263,12 @@ F_of_v (CCTK_POINTER_TO_CONST cctkGH, sources[Index(0,i,j,k,1,n1,n2,n3)]=0.0; Derivatives_AB3 (nvar, n1, n2, n3, v); - FILE *debugfile; CCTK_REAL psi, psi2, psi4, psi7, r_plus, r_minus; - if (do_residuum_debug_output) + FILE *debugfile = NULL; + if (do_residuum_debug_output && CCTK_MyProc(cctkGH) == 0) { - debugfile=fopen("res.dat", "w"); + debugfile = fopen("res.dat", "w"); + assert(debugfile); } for (i = 0; i < n1; i++) { @@ -325,7 +326,7 @@ F_of_v (CCTK_POINTER_TO_CONST cctkGH, u.d23[indx] = U.d23[ivar]; /* U_yz*/ u.d33[indx] = U.d33[ivar]; /* U_zz*/ } - if (do_residuum_debug_output && (k==0)) + if (debugfile && (k==0)) { r_plus = sqrt ((x - par_b) * (x - par_b) + y * y + z * z); r_minus = sqrt ((x + par_b) * (x + par_b) + y * y + z * z); @@ -355,7 +356,7 @@ F_of_v (CCTK_POINTER_TO_CONST cctkGH, } } } - if (do_residuum_debug_output) + if (debugfile) { fclose(debugfile); } diff --git a/src/TwoPunctures.c b/src/TwoPunctures.c index b548037..d961815 100644 --- a/src/TwoPunctures.c +++ b/src/TwoPunctures.c @@ -76,9 +76,10 @@ void set_initial_guess(CCTK_POINTER_TO_CONST cctkGH, v.d0[indx]/=(-cos(Pih * (2 * i + 1) / n1)-1.0); } Derivatives_AB3 (nvar, n1, n2, n3, v); - if (do_initial_debug_output) + if (do_initial_debug_output && CCTK_MyProc(cctkGH) == 0) { debug_file=fopen("initial.dat", "w"); + assert(debug_file); for (ivar = 0; ivar < nvar; ivar++) for (i = 0; i < n1; i++) for (j = 0; j < n2; j++) -- cgit v1.2.3