aboutsummaryrefslogtreecommitdiff
path: root/ML_ADM/src/ML_ADM_constraints_boundary.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2011-09-23 16:44:23 -0400
committerErik Schnetter <schnetter@gmail.com>2011-09-23 16:44:23 -0400
commitf4407d369e6c3e63a5d13731c1837b4855bacdf3 (patch)
tree8dc0d560ae8259fc70bc786d88f83fa653d67a3d /ML_ADM/src/ML_ADM_constraints_boundary.cc
parent105dc566b1af31970d611961c9cde235cab6a2c4 (diff)
Regenerate code for ADM thorn
Diffstat (limited to 'ML_ADM/src/ML_ADM_constraints_boundary.cc')
-rw-r--r--ML_ADM/src/ML_ADM_constraints_boundary.cc217
1 files changed, 179 insertions, 38 deletions
diff --git a/ML_ADM/src/ML_ADM_constraints_boundary.cc b/ML_ADM/src/ML_ADM_constraints_boundary.cc
index b5322c5..3df350b 100644
--- a/ML_ADM/src/ML_ADM_constraints_boundary.cc
+++ b/ML_ADM/src/ML_ADM_constraints_boundary.cc
@@ -13,13 +13,14 @@
#include "GenericFD.h"
#include "Differencing.h"
#include "loopcontrol.h"
+#include "vectors.h"
/* Define macros used in calculations */
#define INITVALUE (42)
#define QAD(x) (SQR(SQR(x)))
-#define INV(x) ((1.0) / (x))
-#define SQR(x) ((x) * (x))
-#define CUB(x) ((x) * (x) * (x))
+#define INV(x) (kdiv(ToReal(1.0),x))
+#define SQR(x) (kmul(x,x))
+#define CUB(x) (kmul(x,SQR(x)))
extern "C" void ML_ADM_constraints_boundary_SelectBCs(CCTK_ARGUMENTS)
{
@@ -57,6 +58,20 @@ static void ML_ADM_constraints_boundary_Body(cGH const * restrict const cctkGH,
const char *groups[] = {"ML_ADM::ML_Ham","ML_ADM::ML_mom"};
GenericFD_AssertGroupStorage(cctkGH, "ML_ADM_constraints_boundary", 2, groups);
+ switch(fdOrder)
+ {
+ case 2:
+ break;
+
+ case 4:
+ break;
+
+ case 6:
+ break;
+
+ case 8:
+ break;
+ }
/* Include user-supplied include files */
@@ -67,38 +82,111 @@ static void ML_ADM_constraints_boundary_Body(cGH const * restrict const cctkGH,
ptrdiff_t const cdi = sizeof(CCTK_REAL) * di;
ptrdiff_t const cdj = sizeof(CCTK_REAL) * dj;
ptrdiff_t const cdk = sizeof(CCTK_REAL) * dk;
- CCTK_REAL const dx = ToReal(CCTK_DELTA_SPACE(0));
- CCTK_REAL const dy = ToReal(CCTK_DELTA_SPACE(1));
- CCTK_REAL const dz = ToReal(CCTK_DELTA_SPACE(2));
- CCTK_REAL const dt = ToReal(CCTK_DELTA_TIME);
- CCTK_REAL const dxi = INV(dx);
- CCTK_REAL const dyi = INV(dy);
- CCTK_REAL const dzi = INV(dz);
- CCTK_REAL const khalf = 0.5;
- CCTK_REAL const kthird = 1/3.0;
- CCTK_REAL const ktwothird = 2.0/3.0;
- CCTK_REAL const kfourthird = 4.0/3.0;
- CCTK_REAL const keightthird = 8.0/3.0;
- CCTK_REAL const hdxi = 0.5 * dxi;
- CCTK_REAL const hdyi = 0.5 * dyi;
- CCTK_REAL const hdzi = 0.5 * dzi;
+ CCTK_REAL_VEC const dx = ToReal(CCTK_DELTA_SPACE(0));
+ CCTK_REAL_VEC const dy = ToReal(CCTK_DELTA_SPACE(1));
+ CCTK_REAL_VEC const dz = ToReal(CCTK_DELTA_SPACE(2));
+ CCTK_REAL_VEC const dt = ToReal(CCTK_DELTA_TIME);
+ CCTK_REAL_VEC const dxi = INV(dx);
+ CCTK_REAL_VEC const dyi = INV(dy);
+ CCTK_REAL_VEC const dzi = INV(dz);
+ CCTK_REAL_VEC const khalf = ToReal(0.5);
+ CCTK_REAL_VEC const kthird = ToReal(1.0/3.0);
+ CCTK_REAL_VEC const ktwothird = ToReal(2.0/3.0);
+ CCTK_REAL_VEC const kfourthird = ToReal(4.0/3.0);
+ CCTK_REAL_VEC const keightthird = ToReal(8.0/3.0);
+ CCTK_REAL_VEC const hdxi = kmul(ToReal(0.5), dxi);
+ CCTK_REAL_VEC const hdyi = kmul(ToReal(0.5), dyi);
+ CCTK_REAL_VEC const hdzi = kmul(ToReal(0.5), dzi);
/* Initialize predefined quantities */
- CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx);
- CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy);
- CCTK_REAL const p1o12dz = 0.0833333333333333333333333333333*INV(dz);
- CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy);
- CCTK_REAL const p1o144dxdz = 0.00694444444444444444444444444444*INV(dx)*INV(dz);
- CCTK_REAL const p1o144dydz = 0.00694444444444444444444444444444*INV(dy)*INV(dz);
- CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx));
- CCTK_REAL const pm1o12dy2 = -0.0833333333333333333333333333333*INV(SQR(dy));
- CCTK_REAL const pm1o12dz2 = -0.0833333333333333333333333333333*INV(SQR(dz));
+ CCTK_REAL_VEC const p1o12dx = kmul(INV(dx),ToReal(0.0833333333333333333333333333333));
+ CCTK_REAL_VEC const p1o12dy = kmul(INV(dy),ToReal(0.0833333333333333333333333333333));
+ CCTK_REAL_VEC const p1o12dz = kmul(INV(dz),ToReal(0.0833333333333333333333333333333));
+ CCTK_REAL_VEC const p1o144dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.00694444444444444444444444444444)));
+ CCTK_REAL_VEC const p1o144dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.00694444444444444444444444444444)));
+ CCTK_REAL_VEC const p1o144dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.00694444444444444444444444444444)));
+ CCTK_REAL_VEC const p1o180dx2 = kmul(INV(SQR(dx)),ToReal(0.00555555555555555555555555555556));
+ CCTK_REAL_VEC const p1o180dy2 = kmul(INV(SQR(dy)),ToReal(0.00555555555555555555555555555556));
+ CCTK_REAL_VEC const p1o180dz2 = kmul(INV(SQR(dz)),ToReal(0.00555555555555555555555555555556));
+ CCTK_REAL_VEC const p1o2dx = kmul(INV(dx),ToReal(0.5));
+ CCTK_REAL_VEC const p1o2dy = kmul(INV(dy),ToReal(0.5));
+ CCTK_REAL_VEC const p1o2dz = kmul(INV(dz),ToReal(0.5));
+ CCTK_REAL_VEC const p1o3600dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.000277777777777777777777777777778)));
+ CCTK_REAL_VEC const p1o3600dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.000277777777777777777777777777778)));
+ CCTK_REAL_VEC const p1o3600dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.000277777777777777777777777777778)));
+ CCTK_REAL_VEC const p1o4dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(0.25)));
+ CCTK_REAL_VEC const p1o4dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(0.25)));
+ CCTK_REAL_VEC const p1o4dydz = kmul(INV(dy),kmul(INV(dz),ToReal(0.25)));
+ CCTK_REAL_VEC const p1o5040dx2 = kmul(INV(SQR(dx)),ToReal(0.000198412698412698412698412698413));
+ CCTK_REAL_VEC const p1o5040dy2 = kmul(INV(SQR(dy)),ToReal(0.000198412698412698412698412698413));
+ CCTK_REAL_VEC const p1o5040dz2 = kmul(INV(SQR(dz)),ToReal(0.000198412698412698412698412698413));
+ CCTK_REAL_VEC const p1o60dx = kmul(INV(dx),ToReal(0.0166666666666666666666666666667));
+ CCTK_REAL_VEC const p1o60dy = kmul(INV(dy),ToReal(0.0166666666666666666666666666667));
+ CCTK_REAL_VEC const p1o60dz = kmul(INV(dz),ToReal(0.0166666666666666666666666666667));
+ CCTK_REAL_VEC const p1o705600dxdy = kmul(INV(dx),kmul(INV(dy),ToReal(1.41723356009070294784580498866e-6)));
+ CCTK_REAL_VEC const p1o705600dxdz = kmul(INV(dx),kmul(INV(dz),ToReal(1.41723356009070294784580498866e-6)));
+ CCTK_REAL_VEC const p1o705600dydz = kmul(INV(dy),kmul(INV(dz),ToReal(1.41723356009070294784580498866e-6)));
+ CCTK_REAL_VEC const p1o840dx = kmul(INV(dx),ToReal(0.00119047619047619047619047619048));
+ CCTK_REAL_VEC const p1o840dy = kmul(INV(dy),ToReal(0.00119047619047619047619047619048));
+ CCTK_REAL_VEC const p1o840dz = kmul(INV(dz),ToReal(0.00119047619047619047619047619048));
+ CCTK_REAL_VEC const p1odx2 = INV(SQR(dx));
+ CCTK_REAL_VEC const p1ody2 = INV(SQR(dy));
+ CCTK_REAL_VEC const p1odz2 = INV(SQR(dz));
+ CCTK_REAL_VEC const pm1o12dx2 = kmul(INV(SQR(dx)),ToReal(-0.0833333333333333333333333333333));
+ CCTK_REAL_VEC const pm1o12dy2 = kmul(INV(SQR(dy)),ToReal(-0.0833333333333333333333333333333));
+ CCTK_REAL_VEC const pm1o12dz2 = kmul(INV(SQR(dz)),ToReal(-0.0833333333333333333333333333333));
+
+ /* Jacobian variable pointers */
+ bool const use_jacobian = (!CCTK_IsFunctionAliased("MultiPatch_GetMap") || MultiPatch_GetMap(cctkGH) != jacobian_identity_map)
+ && strlen(jacobian_group) > 0;
+ if (use_jacobian && strlen(jacobian_derivative_group) == 0)
+ {
+ CCTK_WARN (1, "GenericFD::jacobian_group and GenericFD::jacobian_derivative_group must both be set to valid group names");
+ }
+
+ CCTK_REAL const *restrict jacobian_ptrs[9];
+ if (use_jacobian) GenericFD_GroupDataPointers(cctkGH, jacobian_group,
+ 9, jacobian_ptrs);
+
+ CCTK_REAL const *restrict const J11 = use_jacobian ? jacobian_ptrs[0] : 0;
+ CCTK_REAL const *restrict const J12 = use_jacobian ? jacobian_ptrs[1] : 0;
+ CCTK_REAL const *restrict const J13 = use_jacobian ? jacobian_ptrs[2] : 0;
+ CCTK_REAL const *restrict const J21 = use_jacobian ? jacobian_ptrs[3] : 0;
+ CCTK_REAL const *restrict const J22 = use_jacobian ? jacobian_ptrs[4] : 0;
+ CCTK_REAL const *restrict const J23 = use_jacobian ? jacobian_ptrs[5] : 0;
+ CCTK_REAL const *restrict const J31 = use_jacobian ? jacobian_ptrs[6] : 0;
+ CCTK_REAL const *restrict const J32 = use_jacobian ? jacobian_ptrs[7] : 0;
+ CCTK_REAL const *restrict const J33 = use_jacobian ? jacobian_ptrs[8] : 0;
+
+ CCTK_REAL const *restrict jacobian_derivative_ptrs[18];
+ if (use_jacobian) GenericFD_GroupDataPointers(cctkGH, jacobian_derivative_group,
+ 18, jacobian_derivative_ptrs);
+
+ CCTK_REAL const *restrict const dJ111 = use_jacobian ? jacobian_derivative_ptrs[0] : 0;
+ CCTK_REAL const *restrict const dJ112 = use_jacobian ? jacobian_derivative_ptrs[1] : 0;
+ CCTK_REAL const *restrict const dJ113 = use_jacobian ? jacobian_derivative_ptrs[2] : 0;
+ CCTK_REAL const *restrict const dJ122 = use_jacobian ? jacobian_derivative_ptrs[3] : 0;
+ CCTK_REAL const *restrict const dJ123 = use_jacobian ? jacobian_derivative_ptrs[4] : 0;
+ CCTK_REAL const *restrict const dJ133 = use_jacobian ? jacobian_derivative_ptrs[5] : 0;
+ CCTK_REAL const *restrict const dJ211 = use_jacobian ? jacobian_derivative_ptrs[6] : 0;
+ CCTK_REAL const *restrict const dJ212 = use_jacobian ? jacobian_derivative_ptrs[7] : 0;
+ CCTK_REAL const *restrict const dJ213 = use_jacobian ? jacobian_derivative_ptrs[8] : 0;
+ CCTK_REAL const *restrict const dJ222 = use_jacobian ? jacobian_derivative_ptrs[9] : 0;
+ CCTK_REAL const *restrict const dJ223 = use_jacobian ? jacobian_derivative_ptrs[10] : 0;
+ CCTK_REAL const *restrict const dJ233 = use_jacobian ? jacobian_derivative_ptrs[11] : 0;
+ CCTK_REAL const *restrict const dJ311 = use_jacobian ? jacobian_derivative_ptrs[12] : 0;
+ CCTK_REAL const *restrict const dJ312 = use_jacobian ? jacobian_derivative_ptrs[13] : 0;
+ CCTK_REAL const *restrict const dJ313 = use_jacobian ? jacobian_derivative_ptrs[14] : 0;
+ CCTK_REAL const *restrict const dJ322 = use_jacobian ? jacobian_derivative_ptrs[15] : 0;
+ CCTK_REAL const *restrict const dJ323 = use_jacobian ? jacobian_derivative_ptrs[16] : 0;
+ CCTK_REAL const *restrict const dJ333 = use_jacobian ? jacobian_derivative_ptrs[17] : 0;
/* Loop over the grid points */
#pragma omp parallel
- LC_LOOP3 (ML_ADM_constraints_boundary,
+ LC_LOOP3VEC (ML_ADM_constraints_boundary,
i,j,k, min[0],min[1],min[2], max[0],max[1],max[2],
- cctk_lsh[0],cctk_lsh[1],cctk_lsh[2])
+ cctk_lsh[0],cctk_lsh[1],cctk_lsh[2],
+ CCTK_REAL_VEC_SIZE)
{
ptrdiff_t const index = di*i + dj*j + dk*k;
@@ -106,26 +194,79 @@ static void ML_ADM_constraints_boundary_Body(cGH const * restrict const cctkGH,
+
/* Include user supplied include files */
/* Precompute derivatives */
+ switch(fdOrder)
+ {
+ case 2:
+ break;
+
+ case 4:
+ break;
+
+ case 6:
+ break;
+
+ case 8:
+ break;
+ }
+
/* Calculate temporaries and grid functions */
- CCTK_REAL HL = 0;
+ CCTK_REAL_VEC HL = ToReal(0);
+
+ CCTK_REAL_VEC M1L = ToReal(0);
+
+ CCTK_REAL_VEC M2L = ToReal(0);
+
+ CCTK_REAL_VEC M3L = ToReal(0);
+
+ /* If necessary, store only partial vectors after the first iteration */
+
+ if (CCTK_REAL_VEC_SIZE > 2 && CCTK_BUILTIN_EXPECT(i < lc_imin && i+CCTK_REAL_VEC_SIZE > lc_imax, 0))
+ {
+ ptrdiff_t const elt_count_lo = lc_imin-i;
+ ptrdiff_t const elt_count_hi = lc_imax-i;
+ vec_store_nta_partial_mid(H[index],HL,elt_count_lo,elt_count_hi);
+ vec_store_nta_partial_mid(M1[index],M1L,elt_count_lo,elt_count_hi);
+ vec_store_nta_partial_mid(M2[index],M2L,elt_count_lo,elt_count_hi);
+ vec_store_nta_partial_mid(M3[index],M3L,elt_count_lo,elt_count_hi);
+ break;
+ }
+
+ /* If necessary, store only partial vectors after the first iteration */
- CCTK_REAL M1L = 0;
+ if (CCTK_REAL_VEC_SIZE > 1 && CCTK_BUILTIN_EXPECT(i < lc_imin, 0))
+ {
+ ptrdiff_t const elt_count = lc_imin-i;
+ vec_store_nta_partial_hi(H[index],HL,elt_count);
+ vec_store_nta_partial_hi(M1[index],M1L,elt_count);
+ vec_store_nta_partial_hi(M2[index],M2L,elt_count);
+ vec_store_nta_partial_hi(M3[index],M3L,elt_count);
+ continue;
+ }
- CCTK_REAL M2L = 0;
+ /* If necessary, store only partial vectors after the last iteration */
- CCTK_REAL M3L = 0;
+ if (CCTK_REAL_VEC_SIZE > 1 && CCTK_BUILTIN_EXPECT(i+CCTK_REAL_VEC_SIZE > lc_imax, 0))
+ {
+ ptrdiff_t const elt_count = lc_imax-i;
+ vec_store_nta_partial_lo(H[index],HL,elt_count);
+ vec_store_nta_partial_lo(M1[index],M1L,elt_count);
+ vec_store_nta_partial_lo(M2[index],M2L,elt_count);
+ vec_store_nta_partial_lo(M3[index],M3L,elt_count);
+ break;
+ }
/* Copy local copies back to grid functions */
- H[index] = HL;
- M1[index] = M1L;
- M2[index] = M2L;
- M3[index] = M3L;
+ vec_store_nta(H[index],HL);
+ vec_store_nta(M1[index],M1L);
+ vec_store_nta(M2[index],M2L);
+ vec_store_nta(M3[index],M3L);
}
- LC_ENDLOOP3 (ML_ADM_constraints_boundary);
+ LC_ENDLOOP3VEC (ML_ADM_constraints_boundary);
}
extern "C" void ML_ADM_constraints_boundary(CCTK_ARGUMENTS)