diff options
author | allen <allen@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2001-04-18 20:37:26 +0000 |
---|---|---|
committer | allen <allen@b9286e40-80fe-41ab-903a-d6b447012e1e> | 2001-04-18 20:37:26 +0000 |
commit | 273db6bcd613fa4af323b480651618af5fa27f70 (patch) | |
tree | 43a7edf8617968c7e86b0037e83d8b14f693f930 | |
parent | 008dd94e727453873e179592e3068e4cef864e5e (diff) |
Updating timelevel names, and some formatting changes.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveBinarySource/trunk@17 b9286e40-80fe-41ab-903a-d6b447012e1e
-rw-r--r-- | src/CoordinateStuff.c | 62 | ||||
-rw-r--r-- | src/WaveBinary.c | 23 |
2 files changed, 49 insertions, 36 deletions
diff --git a/src/CoordinateStuff.c b/src/CoordinateStuff.c index 6173e0f..9334e2a 100644 --- a/src/CoordinateStuff.c +++ b/src/CoordinateStuff.c @@ -25,7 +25,6 @@ @@*/ - int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) { int index_low,idummy; @@ -33,21 +32,27 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) CCTK_REAL cmin,cmax; if (d==0) + { CCTK_CoordRange(GH,&cmin,&cmax, 1, "x", "cart3d"); + } else if (d==1) + { CCTK_CoordRange(GH,&cmin,&cmax, 2, "y", "cart3d"); + } else if (d==2) + { CCTK_CoordRange(GH,&cmin,&cmax, 3, "z", "cart3d"); - else - CCTK_WARN(0,"IndexFloor: dimension is not valid. Fortran:1..3 C:0..2"); - - if ((coord_value<cmin)||(coord_value>cmax)) { - message = (char*)malloc(128*sizeof(char)); - sprintf(message, - "IndexFloor: coordinate value outside grid [%f,%f]: %f \n", - cmin, cmax, coord_value); - CCTK_WARN(2,message); - free(message); + } + else + { + CCTK_WARN(0,"IndexFloor: dimension is not valid. Fortran:1..3 C:0..2"); + } + + if ((coord_value<cmin)||(coord_value>cmax)) + { + CCTK_VWarn(2,__LINE__,__FILE__,CCTK_THORNSTRING, + "IndexFloor: coordinate value outside grid [%f,%f]: %f \n", + cmin, cmax, coord_value); return(-3); } @@ -55,11 +60,13 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d) index_low = idummy-GH->cctk_lbnd[d]; if (index_low<0) + { index_low = -1; - + } if (index_low>=GH->cctk_lsh[d]) + { index_low = -1; - + } return(index_low); } @@ -91,22 +98,27 @@ int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d) CCTK_REAL cmin,cmax; if (d==0) + { CCTK_CoordRange(GH,&cmin,&cmax, -1, "x", "cart3d"); + } else if (d==1) + { CCTK_CoordRange(GH,&cmin,&cmax, -1, "y", "cart3d"); + } else if (d==2) + { CCTK_CoordRange(GH,&cmin,&cmax, -1, "z", "cart3d"); + } else - CCTK_WARN(0,"IndexCeil: dimension is not valid. Fortran:1..3 C:0..2"); - + { + CCTK_WARN(0,"IndexCeilC: dimension is not valid. Fortran:1..3 C:0..2"); + } - if ((coord_value<cmin)||(coord_value>cmax)) { - message = (char*) malloc(256*sizeof(char)); - sprintf(message, - "IndexCeil: coordinate value outside grid [%f,%f]: %f \n", - cmin,cmax, coord_value); - CCTK_WARN(2,message); - free(message); + if ((coord_value<cmin)||(coord_value>cmax)) + { + CCTK_VWarn(2,__LINE__,__FILE__,CCTK_THORNSTRING, + "IndexCeil: coordinate value outside grid [%f,%f]: %f \n", + cmin,cmax, coord_value); return(-3); } @@ -114,11 +126,13 @@ int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d) index_up = idummy-GH->cctk_lbnd[d]; if (index_up<0) + { index_up = -1; - + } if (index_up>=GH->cctk_lsh[d]) + { index_up = -1; - + } return(index_up); } diff --git a/src/WaveBinary.c b/src/WaveBinary.c index 68f1fe9..568df21 100644 --- a/src/WaveBinary.c +++ b/src/WaveBinary.c @@ -4,11 +4,7 @@ /* Using Cactus infrastructure */ #include "cctk.h" - -/* Using Cactus parameters */ #include "cctk_Parameters.h" - -/* Using Cactus arguments lists */ #include "cctk_Arguments.h" int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d); @@ -17,10 +13,7 @@ int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d); void WaveBinaryC(CCTK_ARGUMENTS) { - /* Declare variables in argument list */ DECLARE_CCTK_ARGUMENTS - - /* Declare parameters */ DECLARE_CCTK_PARAMETERS int i,j,k,d,index; @@ -45,7 +38,8 @@ void WaveBinaryC(CCTK_ARGUMENTS) /* Because binary_charge and binary_size are a steerable parameters now, charge_factor needs to be recomputed at every iteration. */ - charge_factor = 3.0*binary_charge/(4.0*3.1415*binary_size*binary_size*binary_size); + charge_factor = 3.0*binary_charge/ + (4.0*3.1415*binary_size*binary_size*binary_size); /* Initialize the range arrays */ for (d=0;d<3;d++) @@ -77,8 +71,8 @@ void WaveBinaryC(CCTK_ARGUMENTS) /* calculate the center of a single binary source */ CCTK_CoordRange(cctkGH, &zmin, &zmax, -1, "z", "cart3d"); - xs = sign * binary_radius * cos(binary_omega*cctk_time); - ys = sign * binary_radius * sin(binary_omega*cctk_time); + xs = sign * binary_radius * cos(binary_omega*(cctk_time-cctk_delta_time)); + ys = sign * binary_radius * sin(binary_omega*(cctk_time-cctk_delta_time)); zs = (zmax-zmin)/2 + zmin; /* shortcuts for the physical boundaries of @@ -161,7 +155,9 @@ void WaveBinaryC(CCTK_ARGUMENTS) if (onthisproc==3) { for (k=lowerloc[2];k<=upperloc[2];k++) + { for (j=lowerloc[1];j<=upperloc[1];j++) + { for (i=lowerloc[0];i<=upperloc[0];i++) { index = CCTK_GFINDEX3D(cctkGH,i,j,k); @@ -171,14 +167,17 @@ void WaveBinaryC(CCTK_ARGUMENTS) ((z[index]-zs)*(z[index]-zs)); if (rad<binary_size*binary_size) - phi_n[index] = phi_n[index] + charge_factor; + { + phi[index] = phi[index] + charge_factor; + } } + } + } } /* end of the sign loop */ } - /* reset firstcall to zero */ firstcall = 0; |