[Commits] [svn:einsteintoolkit] GRHydro_InitData/trunk/src/ (Rev. 140)
rhaas at tapir.caltech.edu
rhaas at tapir.caltech.edu
Thu Aug 9 01:26:40 CDT 2012
User: rhaas
Date: 2012/08/09 01:26 AM
Modified:
/trunk/src/
GRHydro_Bondi.c, GRHydro_BondiM.c
Log:
GRHydro_InitData: change 2d array access to avoid compiler warnings
* don't access 2d array as 1d array through second index
* always assign something to rho_guess in Bondi solution
From: Roland Haas <roland.haas at physics.gatech.edu>
File Changes:
Directory: /trunk/src/
======================
File [modified]: GRHydro_Bondi.c
Delta lines: +29 -12
===================================================================
--- trunk/src/GRHydro_Bondi.c 2012-08-09 06:26:39 UTC (rev 139)
+++ trunk/src/GRHydro_Bondi.c 2012-08-09 06:26:40 UTC (rev 140)
@@ -123,13 +123,17 @@
for Kerr-Schild coordinates.
******************************************************************************/
-static void dxc_dxs_ks_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
+static void dxc_dxs_ks_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[NDIM][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL r, th, ph;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[0][i] = 0. ;
+ }
+ }
r = x_spher[RR];
th = x_spher[TH];
@@ -165,13 +169,17 @@
for Boyer-Lindquist coordinates.
******************************************************************************/
-static void dxc_dxs_bl_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
+static void dxc_dxs_bl_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[NDIM][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL r, th, ph, rterm, dr;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[j][i] = 0. ;
+ }
+ }
r = x_spher[RR];
th = x_spher[TH];
@@ -210,13 +218,17 @@
for "Isotropic" coordinates.
******************************************************************************/
-static void dxc_dxs_iso_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
+static void dxc_dxs_iso_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[NDIM][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL th, ph,r_iso;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[j][i] = 0. ;
+ }
+ }
/* BL spherical coordinates : */
th = x_spher[TH];
@@ -355,13 +367,17 @@
---------------
-- Covariant Kerr metric in Boyer-Lindquist coordinates.
****************************************************************************/
-static void bl_gcov_func( CCTK_REAL *x, CCTK_REAL gcov[][NDIM])
+static void bl_gcov_func( CCTK_REAL *x, CCTK_REAL gcov[NDIM][NDIM])
{
int i,j,k ;
CCTK_REAL sth,cth,s2,r2,DD,mu ;
CCTK_REAL r,th;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { gcov[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ gcov[i][j] = 0. ;
+ }
+ }
r = x[RR];
th = x[TH];
@@ -648,7 +664,8 @@
if( *rho < 0. ) {
if( r > 0.9*rs && r < 1.1*rs ) {
- *rho = rhos;
+ rho_guess = rhos;
+ *rho = rho_guess;
}
else {
// rhotmp = (sqrt(Qdot) - 1.) * (gamma_eos - 1.) / ( gamma_eos * K );
File [modified]: GRHydro_BondiM.c
Delta lines: +28 -11
===================================================================
--- trunk/src/GRHydro_BondiM.c 2012-08-09 06:26:39 UTC (rev 139)
+++ trunk/src/GRHydro_BondiM.c 2012-08-09 06:26:40 UTC (rev 140)
@@ -125,11 +125,15 @@
******************************************************************************/
static void dxc_dxs_ks_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL r, th, ph;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[j][i] = 0. ;
+ }
+ }
r = x_spher[RR];
th = x_spher[TH];
@@ -165,13 +169,17 @@
for Boyer-Lindquist coordinates.
******************************************************************************/
-static void dxc_dxs_bl_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
+static void dxc_dxs_bl_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[NDIM][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL r, th, ph, rterm, dr;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[j][i] = 0. ;
+ }
+ }
r = x_spher[RR];
th = x_spher[TH];
@@ -210,13 +218,17 @@
for "Isotropic" coordinates.
******************************************************************************/
-static void dxc_dxs_iso_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[][NDIM] )
+static void dxc_dxs_iso_calc(CCTK_REAL *x_cart, CCTK_REAL *x_spher, CCTK_REAL dxc_dxs[NDIM][NDIM] )
{
- int i;
+ int i, j;
CCTK_REAL th, ph,r_iso;
CCTK_REAL sth,cth,sph,cph;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { dxc_dxs[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ dxc_dxs[j][i] = 0. ;
+ }
+ }
/* BL spherical coordinates : */
th = x_spher[TH];
@@ -355,13 +367,17 @@
---------------
-- Covariant Kerr metric in Boyer-Lindquist coordinates.
****************************************************************************/
-static void bl_gcov_func( CCTK_REAL *x, CCTK_REAL gcov[][NDIM])
+static void bl_gcov_func( CCTK_REAL *x, CCTK_REAL gcov[NDIM][NDIM])
{
int i,j,k ;
CCTK_REAL sth,cth,s2,r2,DD,mu ;
CCTK_REAL r,th;
- for( i = 0 ; i < NDIM*NDIM ; i++ ) { gcov[0][i] = 0. ; }
+ for( i = 0 ; i < NDIM ; i++ ) {
+ for( j = 0 ; j < NDIM ; j++ ) {
+ gcov[i][j] = 0. ;
+ }
+ }
r = x[RR];
th = x[TH];
@@ -648,7 +664,8 @@
if( *rho < 0. ) {
if( r > 0.9*rs && r < 1.1*rs ) {
- *rho = rhos;
+ rho_guess = rhos;
+ *rho = rho_guess;
}
else {
// rhotmp = (sqrt(Qdot) - 1.) * (gamma_eos - 1.) / ( gamma_eos * K );
More information about the Commits
mailing list