aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b9286e40-80fe-41ab-903a-d6b447012e1e>2001-10-16 10:01:56 +0000
committertradke <tradke@b9286e40-80fe-41ab-903a-d6b447012e1e>2001-10-16 10:01:56 +0000
commitc53d5554a25ce77066a6dec2010544448699c648 (patch)
tree96ac460855667af3d30c293574dea8d7770a65cd
parentaf54ab3be5c8e1cf77a92f1604cc3db7352afe87 (diff)
Fixed compiler warnings.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusWave/WaveBinarySource/trunk@27 b9286e40-80fe-41ab-903a-d6b447012e1e
-rw-r--r--src/WaveBinary.c129
1 files changed, 59 insertions, 70 deletions
diff --git a/src/WaveBinary.c b/src/WaveBinary.c
index 007b18f..269a024 100644
--- a/src/WaveBinary.c
+++ b/src/WaveBinary.c
@@ -12,6 +12,7 @@ static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusWave_WaveBinarySource_WaveBinary_c)
+void WaveBinaryC(CCTK_ARGUMENTS);
int IndexCeilC(cGH *GH, CCTK_REAL coord_value, int d);
int IndexFloorC(cGH *GH, CCTK_REAL coord_value, int d);
@@ -21,9 +22,9 @@ void WaveBinaryC(CCTK_ARGUMENTS)
DECLARE_CCTK_ARGUMENTS
DECLARE_CCTK_PARAMETERS
- int i,j,k,d,index;
+ int i,j,k,d,vindex;
- /* the start/end points in local index space of the binary charge */
+ /* the start/end points in local vindex space of the binary charge */
int lowerloc[3];
int upperloc[3];
@@ -56,14 +57,14 @@ void WaveBinaryC(CCTK_ARGUMENTS)
/* The physical minimum/maximum coordinates of our grid chunk;
will use those to check if the charges are on our proc. */
- index = CCTK_GFINDEX3D(cctkGH,0,0,0);
- minc[0] = x[index];
- minc[1] = y[index];
- minc[2] = z[index];
- index = CCTK_GFINDEX3D(cctkGH,cctk_lsh[0]-1,cctk_lsh[1]-1,cctk_lsh[2]-1);
- maxc[0] = x[index];
- maxc[1] = y[index];
- maxc[2] = z[index];
+ vindex = CCTK_GFINDEX3D(cctkGH,0,0,0);
+ minc[0] = x[vindex];
+ minc[1] = y[vindex];
+ minc[2] = z[vindex];
+ vindex = CCTK_GFINDEX3D(cctkGH,cctk_lsh[0]-1,cctk_lsh[1]-1,cctk_lsh[2]-1);
+ maxc[0] = x[vindex];
+ maxc[1] = y[vindex];
+ maxc[2] = z[vindex];
/* we have two charges opposite, origin is the center
@@ -96,15 +97,15 @@ void WaveBinaryC(CCTK_ARGUMENTS)
{
/* check where our binaries are:
- - the can be on our grid chunk completly
- - we have a lower part of the source on our grid chunk
- - we have a upper part
- - the source covers a grid chunk completetly
-
- Get the floor-index of the lower bound and
- ceiling-index of the upper bound.
-
- Increase onthisproc : if equal to three, we have the source
+ - the can be on our grid chunk completly
+ - we have a lower part of the source on our grid chunk
+ - we have a upper part
+ - the source covers a grid chunk completetly
+
+ Get the floor-vindex of the lower bound and
+ ceiling-vindex of the upper bound.
+
+ Increase onthisproc : if equal to three, we have the source
*/
xproc = 0;
@@ -113,27 +114,27 @@ void WaveBinaryC(CCTK_ARGUMENTS)
if ((lbin[d]<=minc[d]) && (ubin[d]>=maxc[d]))
{
- xproc = 1;
+ xproc = 1;
}
else
{
- if ((minc[d]<=lbin[d]) && (lbin[d]<=maxc[d]))
- {
- lowerloc[d]=IndexFloorC(cctkGH, lbin[d],d);
- xproc = 1;
- }
- if ((minc[d]<=ubin[d]) && (ubin[d]<=maxc[d]))
- {
- upperloc[d]=IndexCeilC (cctkGH, ubin[d],d);
- xproc = 1;
- }
+ if ((minc[d]<=lbin[d]) && (lbin[d]<=maxc[d]))
+ {
+ lowerloc[d]=IndexFloorC(cctkGH, lbin[d],d);
+ xproc = 1;
+ }
+ if ((minc[d]<=ubin[d]) && (ubin[d]<=maxc[d]))
+ {
+ upperloc[d]=IndexCeilC (cctkGH, ubin[d],d);
+ xproc = 1;
+ }
}
onthisproc+=xproc;
}
/* Debugging debugging */
if (((firstcall==1)&&(CCTK_EQUALS(binary_verbose,"yes"))) ||
- (CCTK_EQUALS(binary_verbose,"debug")))
+ (CCTK_EQUALS(binary_verbose,"debug")))
{
printf("Charge: %f \n",charge_factor);
printf("On this proc: %d \n",onthisproc);
@@ -143,40 +144,40 @@ void WaveBinaryC(CCTK_ARGUMENTS)
printf(" x-extension: %f -> %f \n",lbin[0],ubin[0]);
printf(" y-extension: %f -> %f \n",lbin[1],ubin[1]);
printf(" z-extension: %f -> %f \n",lbin[2],ubin[2]);
- printf("Charge local index range: \n");
- printf(" x-index %d %d \n", lowerloc[0],upperloc[0]);
- printf(" y-index %d %d \n", lowerloc[1],upperloc[1]);
- printf(" z-index %d %d \n", lowerloc[2],upperloc[2]);
- index = CCTK_GFINDEX3D(cctkGH, lowerloc[0],lowerloc[1],lowerloc[2]);
- printf("Charge corner LOW: [%f %f %f] \n",x[index],y[index],z[index]);
- index = CCTK_GFINDEX3D(cctkGH, upperloc[0],upperloc[1],upperloc[2]);
- printf("Charge corner UP : [%f %f %f] \n",x[index],y[index],z[index]);
+ printf("Charge local vindex range: \n");
+ printf(" x-vindex %d %d \n", lowerloc[0],upperloc[0]);
+ printf(" y-vindex %d %d \n", lowerloc[1],upperloc[1]);
+ printf(" z-vindex %d %d \n", lowerloc[2],upperloc[2]);
+ vindex = CCTK_GFINDEX3D(cctkGH, lowerloc[0],lowerloc[1],lowerloc[2]);
+ printf("Charge corner LOW: [%f %f %f] \n",x[vindex],y[vindex],z[vindex]);
+ vindex = CCTK_GFINDEX3D(cctkGH, upperloc[0],upperloc[1],upperloc[2]);
+ printf("Charge corner UP : [%f %f %f] \n",x[vindex],y[vindex],z[vindex]);
printf(" MINC/MAXC [%f %f %f] [%f %f %f] \n\n\n",
- minc[0],minc[1],minc[2],
- maxc[0],maxc[1],maxc[2]);
+ minc[0],minc[1],minc[2],
+ maxc[0],maxc[1],maxc[2]);
}
- /* we have the source, no loop over the index boudary */
+ /* we have the source, no loop over the vindex boudary */
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);
- rad =
- ((x[index]-xs)*(x[index]-xs)) +
- ((y[index]-ys)*(y[index]-ys)) +
- ((z[index]-zs)*(z[index]-zs));
-
- if (rad<binary_size*binary_size)
- {
- phi[index] = phi[index] + charge_factor;
- }
- }
- }
+ for (j=lowerloc[1];j<=upperloc[1];j++)
+ {
+ for (i=lowerloc[0];i<=upperloc[0];i++)
+ {
+ vindex = CCTK_GFINDEX3D(cctkGH,i,j,k);
+ rad =
+ ((x[vindex]-xs)*(x[vindex]-xs)) +
+ ((y[vindex]-ys)*(y[vindex]-ys)) +
+ ((z[vindex]-zs)*(z[vindex]-zs));
+
+ if (rad<binary_size*binary_size)
+ {
+ phi[vindex] = phi[vindex] + charge_factor;
+ }
+ }
+ }
}
}
@@ -188,16 +189,4 @@ void WaveBinaryC(CCTK_ARGUMENTS)
/* Note, that we do not need to sync anything, since each grid
patch has filled out its ghostzones. */
-
- return;
}
-
-
-
-
-
-
-
-
-
-