aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhinder <hinder@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843>2013-10-09 17:55:48 +0000
committerhinder <hinder@4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843>2013-10-09 17:55:48 +0000
commit99c2e7db0607fc294df8d4e7fbaff9e9c7e8dc7e (patch)
tree50b2a9fec32633614d02357a615ab49c5e7ee429
parentbdd9b3cbb564d4aa50ed9e52cf0fa626fde6e693 (diff)
utils.cc: Treat all integration methods uniformly
All tests pass git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/Multipole/trunk@93 4f5cb9a8-4dd8-4c2d-9bbd-173fa4467843
-rw-r--r--src/utils.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/utils.cc b/src/utils.cc
index afd4278..dc2f879 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -345,24 +345,9 @@ void Multipole_Integrate(int array_size, int nthetap,
iu = Multipole_Index(0,1,ntheta);
CCTK_REAL dph = ph[iu] - ph[il];
- if (CCTK_Equals(integration_method, "midpoint"))
- {
- CCTK_REAL tempr = 0.0;
- CCTK_REAL tempi = 0.0;
-
- for (int i=0; i < array_size; i++) {
- // the below calculations take the integral of conj(array1)*array2
- tempr += ( array1r[i]*array2r[i] + array1i[i]*array2i[i] )
- *sin(th[i])*dth*dph;
- tempi += ( array1r[i]*array2i[i] - array1i[i]*array2r[i] )
- *sin(th[i])*dth*dph;
-
- *outre = tempr;
- *outim = tempi;
- }
- }
- else if (CCTK_Equals(integration_method, "Simpson") ||
- CCTK_Equals(integration_method, "DriscollHealy"))
+ if (CCTK_Equals(integration_method, "Simpson") ||
+ CCTK_Equals(integration_method, "DriscollHealy") ||
+ CCTK_Equals(integration_method, "midpoint"))
{
static CCTK_REAL *fr = 0;
static CCTK_REAL *fi = 0;
@@ -376,6 +361,7 @@ void Multipole_Integrate(int array_size, int nthetap,
allocated_memory = true;
}
+ // the below calculations take the integral of conj(array1)*array2*sin(th)
for (int i = 0; i < array_size; i++)
{
fr[i] = (array1r[i] * array2r[i] +
@@ -384,7 +370,12 @@ void Multipole_Integrate(int array_size, int nthetap,
array1i[i] * array2r[i] ) * sin(th[i]);
}
- if (CCTK_Equals(integration_method, "Simpson"))
+ if (CCTK_Equals(integration_method, "midpoint"))
+ {
+ *outre = Midpoint2DIntegral(fr, ntheta, nphi, dth, dph);
+ *outim = Midpoint2DIntegral(fi, ntheta, nphi, dth, dph);
+ }
+ else if (CCTK_Equals(integration_method, "Simpson"))
{
if (nphi % 2 != 0 || ntheta % 2 != 0)
{