From ab4da15a98917a570e3b03735a166ab9a310e2b4 Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 13 Jul 2010 15:47:07 +0000 Subject: fix compiler warnings git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/TOVSolver/trunk@117 1bdb13ef-5d69-4035-bb54-08abeb3aa7f1 --- src/external.inc | 13 ++++++------- src/tov.c | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/external.inc b/src/external.inc index 94509b1..a44dbfd 100644 --- a/src/external.inc +++ b/src/external.inc @@ -367,10 +367,10 @@ CCTK_INT TOV_Rescale_Sources( *vel0_p_p, *vel1_p_p, *vel2_p_p, *scon0_p_p, *scon1_p_p, *scon2_p_p; CCTK_REAL *u, *source, *mom_source[3]; CCTK_REAL psip, my_psi4, sqrt_det, vx, vy, vz, v_2, - w_lorentz_2, d_w_lorentz_2, D_h_w; + w_lorentz_2, D_h_w; CCTK_REAL vlowx, vlowy, vlowz; - CCTK_INT i, type; - CCTK_REAL rhoold, rhonew, f, df; + CCTK_INT type; + CCTK_REAL rhoold, rhonew; int i3D; static int debug = 1; FILE *debugfile = NULL; @@ -440,7 +440,6 @@ CCTK_INT TOV_Rescale_Sources( { if (source[i3D]>0.0) { - int count=0; if (debug && (fabs(z[i3D])<1.e-15)) { fprintf(debugfile, @@ -464,8 +463,10 @@ CCTK_INT TOV_Rescale_Sources( rho[i3D] = 1.e-10; rhoold = rhonew = rho[i3D]; #ifdef OLD_NR + int count=0; do { + CCTK_REAL f, df; count++; vx = mom_source[0][i3D]/my_psi4/ (source[i3D]/my_psi4/my_psi4+TOV_K[0] * pow(rhonew, TOV_Gamma[0])); @@ -498,7 +499,7 @@ CCTK_INT TOV_Rescale_Sources( TOV_K[0] * TOV_Gamma[0] * pow(rhonew, TOV_Gamma[0]-1.); */ /* d_w_lorentz_2/drhonew */ - d_w_lorentz_2 = + CCTK_REAL d_w_lorentz_2 = -2 * w_lorentz_2*w_lorentz_2 * v_2 * TOV_K[0]*TOV_Gamma[0]*pow(rhonew, TOV_Gamma[0]-1) / (source[i3D]/my_psi4/my_psi4 + TOV_K[0]*pow(rhonew, TOV_Gamma[0])); @@ -647,8 +648,6 @@ void TOV_write_1D_datafile(CCTK_ARGUMENTS) void TOVSolverC_export_local_variables(CCTK_REAL **exported_TOV_press_1d, CCTK_REAL **exported_TOV_m_1d, CCTK_REAL **exported_TOV_phi_1d, CCTK_REAL **exported_TOV_rbar_1d, CCTK_REAL **exported_TOV_r_1d) { - int i; - *exported_TOV_press_1d = TOV_press_1d; *exported_TOV_m_1d = TOV_m_1d; *exported_TOV_phi_1d = TOV_phi_1d; diff --git a/src/tov.c b/src/tov.c index 73bb46f..3c82c44 100644 --- a/src/tov.c +++ b/src/tov.c @@ -149,7 +149,7 @@ void TOV_C_Source_RHS(CCTK_REAL r, CCTK_REAL K, CCTK_REAL Gamma, r_minus_two_m = r - 2.0 * m; - if ((r==0.0) && (m==0.0)) + if ((r<=0.0) && (m<=0.0)) { source_data[1] = 0.0; source_data[2] = 0.0; @@ -219,7 +219,7 @@ void TOV_C_Integrate_RHS(CCTK_ARGUMENTS) star_i = star * TOV_Num_Radial; /* check for parameters */ - if ((TOV_Rho_Central[star]==0.0) && (GRHydro_rho_central>0.0)) + if ((TOV_Rho_Central[star]<=0.0) && (GRHydro_rho_central>0.0)) rho_central=GRHydro_rho_central; else rho_central=TOV_Rho_Central[star]; @@ -283,7 +283,7 @@ void TOV_C_Integrate_RHS(CCTK_ARGUMENTS) old_data[0] = TOV_press_1d[i]; old_data[1] = TOV_m_1d[i]; old_data[2] = TOV_phi_1d[i]; - if (TOV_rbar_1d[i]==TOV_r_1d[i]) + if (fabs(TOV_rbar_1d[i] - TOV_r_1d[i]) < LOCAL_TINY) old_data[3] = 0.0; else old_data[3] = log(TOV_rbar_1d[i] / TOV_r_1d[i]); @@ -377,7 +377,7 @@ void TOV_C_Integrate_RHS(CCTK_ARGUMENTS) CCTK_VInfo(CCTK_THORNSTRING, "Information about the TOVs used:"); CCTK_VInfo("", "TOV radius mass bary_mass mass(g) cent.rho rho(cgi) K K(cgi) Gamma"); for (i=0; i