diff options
Diffstat (limited to 'src/utils.cc')
-rw-r--r-- | src/utils.cc | 29 |
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) { |