diff options
author | eschnett <> | 2001-03-01 11:40:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-01 11:40:00 +0000 |
commit | 310f0ea48d18866b773136aed11200b6eda6378b (patch) | |
tree | 445d3e34ce8b89812994b6614f7bc9f4acbc7fe2 /CarpetExtra/CarpetRegridTest/src/TestGaussian.c |
Initial revision
darcs-hash:20010301114010-f6438-12fb8a9ffcc80e86c0a97e37b5b0dae0dbc59b79.gz
Diffstat (limited to 'CarpetExtra/CarpetRegridTest/src/TestGaussian.c')
-rw-r--r-- | CarpetExtra/CarpetRegridTest/src/TestGaussian.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/CarpetExtra/CarpetRegridTest/src/TestGaussian.c b/CarpetExtra/CarpetRegridTest/src/TestGaussian.c new file mode 100644 index 000000000..be786c245 --- /dev/null +++ b/CarpetExtra/CarpetRegridTest/src/TestGaussian.c @@ -0,0 +1,45 @@ +#include <math.h> + +#include "cctk.h" +#include "cctk_Parameters.h" +#include "cctk_Arguments.h" + + +static const char *rcsid = "$Header: /home/eschnett/C/carpet/Carpet/CarpetExtra/CarpetRegridTest/src/TestGaussian.c,v 1.3 2004/05/27 13:22:49 schnetter Exp $"; + +CCTK_FILEVERSION(CarpetExtra_CarpetRegridTest_TestGaussian_c); + +void CarpetRegrid_TestGaussian(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS; + DECLARE_CCTK_ARGUMENTS; + + int i,j,k; + + int index; + CCTK_REAL X, Y, Z, R; + + + for(k=0; k<cctk_lsh[2]; k++) + { + for(j=0; j<cctk_lsh[1]; j++) + { + for(i=0; i<cctk_lsh[0]; i++) + { + index = CCTK_GFINDEX3D(cctkGH,i,j,k); + + X = x[index]; + Y = y[index]; + Z = z[index]; + + R = sqrt(X*X + Y*Y + Z*Z); + + phi_error[index] = phi[index] - amplitude*exp( - pow( (R - radius) / sigma, 2.0 ) ); + phi_relerror[index] = phi_error[index] / (amplitude*exp( - pow( (R - radius) / sigma, 2.0 ) ) ); + } + } + } + + // CCTK_VInfo(CCTK_THORNSTRING,"Performed CarpetRegridTest"); + +} |