summaryrefslogtreecommitdiff
path: root/src/include/cctk_Loop.h.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/cctk_Loop.h.pl')
-rwxr-xr-xsrc/include/cctk_Loop.h.pl68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/include/cctk_Loop.h.pl b/src/include/cctk_Loop.h.pl
index d290df79..899d34f5 100755
--- a/src/include/cctk_Loop.h.pl
+++ b/src/include/cctk_Loop.h.pl
@@ -388,13 +388,13 @@ for $dim (1,2,3,4) {
# Loop over all faces, edges, and corners
(reverse (rpt (bsnl ' for (int cctki2_[C]dir=-1; cctki2_[C]dir<=+1; ++cctki2_[C]dir) {'))),
(bsnl ' int cctki2_any_bbox ='),
- (bsnlsep [rpt ' (cctki2_[C]dir==-1 ? cctki2_bbox[[2*I]] : 0) || (cctki2_[C]dir==+1 ? cctki2_bbox[[2*I+1]] : 0)'], '||', ';'),
+ (bsnlsep [rpt ' (cctki2_[C]dir<0 ? cctki2_bbox[[2*I]] : 0) || (cctki2_[C]dir>0 ? cctki2_bbox[[2*I+1]] : 0)'], '||', ';'),
(bsnl ' if (cctki2_any_bbox) {'),
(bsnl ' int const cctki2_bmin[] = {'),
- (rpt (bsnl ' cctki2_[C]dir==-1 ? 0 : cctki2_[C]dir==0 ? cctki2_blo[[I]] : cctki2_lsh[[I]] - cctki2_bhi[[I]],')),
+ (rpt (bsnl ' cctki2_[C]dir<0 ? 0 : cctki2_[C]dir==0 ? cctki2_blo[[I]] : cctki2_lsh[[I]] - cctki2_bhi[[I]],')),
(bsnl ' };'),
(bsnl ' int const cctki2_bmax[] = {'),
- (rpt (bsnl ' cctki2_[C]dir==-1 ? cctki2_blo[[I]] : cctki2_[C]dir==0 ? cctki2_lsh[[I]] - cctki2_bhi[[I]] : cctki2_lsh[[I]],')),
+ (rpt (bsnl ' cctki2_[C]dir<0 ? cctki2_blo[[I]] : cctki2_[C]dir==0 ? cctki2_lsh[[I]] - cctki2_bhi[[I]] : cctki2_lsh[[I]],')),
(bsnl ' };'),
(bsnl ' CCTK_LOOP[DIM]STR_NORMAL(name##_boundaries,'),
(bsnl ' '.(crpt '[C]').','),
@@ -459,15 +459,15 @@ for $dim (1,2,3,4) {
# Loop over all faces, edges, and corners
(reverse (rpt (bsnl ' for (int cctki2_[C]dir=-1; cctki2_[C]dir<=+1; ++cctki2_[C]dir) {'))),
(bsnl ' int cctki2_any_bbox ='),
- (bsnlsep [rpt ' (cctki2_[C]dir==-1 ? cctki2_bbox[[2*I]] : 0) || (cctki2_[C]dir==+1 ? cctki2_bbox[[2*I+1]] : 0)'], '||', ';'),
+ (bsnlsep [rpt ' (cctki2_[C]dir<0 ? cctki2_bbox[[2*I]] : 0) || (cctki2_[C]dir>0 ? cctki2_bbox[[2*I+1]] : 0)'], '||', ';'),
(bsnl ' int cctki2_all_bbox ='),
- (bsnlsep [rpt ' (cctki2_[C]dir==-1 ? cctki2_bbox[[2*I]] : 1) && (cctki2_[C]dir==+1 ? cctki2_bbox[[2*I+1]] : 1)'], '&&', ';'),
+ (bsnlsep [rpt ' (cctki2_[C]dir<0 ? cctki2_bbox[[2*I]] : 1) && (cctki2_[C]dir>0 ? cctki2_bbox[[2*I+1]] : 1)'], '&&', ';'),
(bsnl ' if (cctki2_all_bbox && cctki2_any_bbox) {'),
(bsnl ' int const cctki2_bmin[] = {'),
- (rpt (bsnl ' cctki2_[C]dir==-1 ? 0 : cctki2_[C]dir==0 ? cctki2_blo[[I]] : cctki2_lsh[[I]] - cctki2_bhi[[I]],')),
+ (rpt (bsnl ' cctki2_[C]dir<0 ? 0 : cctki2_[C]dir==0 ? cctki2_blo[[I]] : cctki2_lsh[[I]] - cctki2_bhi[[I]],')),
(bsnl ' };'),
(bsnl ' int const cctki2_bmax[] = {'),
- (rpt (bsnl ' cctki2_[C]dir==-1 ? cctki2_blo[[I]] : cctki2_[C]dir==0 ? cctki2_lsh[[I]] - cctki2_bhi[[I]] : cctki2_lsh[[I]],')),
+ (rpt (bsnl ' cctki2_[C]dir<0 ? cctki2_blo[[I]] : cctki2_[C]dir==0 ? cctki2_lsh[[I]] - cctki2_bhi[[I]] : cctki2_lsh[[I]],')),
(bsnl ' };'),
(bsnl ' CCTK_LOOP[DIM]STR_NORMAL(name##_intboundaries,'),
(bsnl ' '.(crpt '[C]').','),
@@ -727,10 +727,11 @@ for $dim (1,2,3,4) {
(reverse (rpt (bsnl (' && do [C] = name/**/0_[C]min' .
# Align i-loop to vector size
'[I==1? - modulo(' . (sep '', rpt '[I==1?(imin:+name/**/0_[C-1]ash*([C]]') . (sep '', rpt ')') . ', name/**/0_istr):]' .
- ', name/**/0_[C]max')))),
- (rpt (bsnl ' && if (name/**/0_[C]dir< 0) n[C] = [C]')),
- (rpt (bsnl ' && if (name/**/0_[C]dir==0) n[C] = 0')),
- (rpt (bsnl ' && if (name/**/0_[C]dir> 0) n[C] = name/**/0_[C]max+1-[C]')),
+ ', name/**/0_[C]max' .
+ '[I==1?, name/**/0_istr:]')))),
+ (rpt (bsnl ' && n[C] = 0')),
+ (rpt (bsnl ' && if (name/**/0_[C]dir < 0) n[C] = [C]')),
+ (rpt (bsnl ' && if (name/**/0_[C]dir > 0) n[C] = name/**/0_[C]max+1-[C]')),
(nl ''),
(bsnl '#define CCTK_ENDLOOP[DIM]STR_NORMAL(name)'),
(rpt (bsnl ' && end do')),
@@ -870,6 +871,7 @@ for $dim (1,2,3,4) {
(nl ''),
(bsnl '#define CCTK_LOOP[DIM]STR_BOUNDARIES_OMP_PRIVATE(name)'),
(bsnl ' CCTK_LOOP[DIM]STR_NORMAL_OMP_PRIVATE(name/**/_boundaries)'),
+ (bsnl ' && !$omp private (name/**/2_bmin, name/**/2_bmax)'),
(nl ''),
(bsnl '#define CCTK_LOOP[DIM]STR_BOUNDARIES(name,'),
(bsnl ' '.(crpt '[C]').','),
@@ -887,16 +889,16 @@ for $dim (1,2,3,4) {
# Loop over all faces, edges, and corners
(reverse (rpt (bsnl ' && do name/**/2_[C]dir=-1, +1'))),
(bsnl ' && name/**/2_any_bbox = .false.'),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxlo([I+1]) /= 0')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxhi([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxlo([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxhi([I+1]) /= 0')),
(bsnl ' && if (name/**/2_any_bbox) then'),
(rpt (bsnl ' && name/**/2_bmin([I+1]) = name/**/2_blo([I+1])+1')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_bmin([I+1]) = 1')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_bmin([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_bmin([I+1]) = 1')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_bmin([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
(rpt (bsnl ' && name/**/2_bmax([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_bmax([I+1]) = name/**/2_blo([I+1])')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_bmax([I+1]) = cctk_lsh([I+1])')),
- (bsnl ' CCTK_LOOP[DIM]STR_NORMAL(name/**/_boundaries,'),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_bmax([I+1]) = name/**/2_blo([I+1])')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_bmax([I+1]) = cctk_lsh([I+1])')),
+ (bsnl ' && CCTK_LOOP[DIM]STR_NORMAL(name/**/_boundaries,'),
(bsnl ' '.(crpt '[C]').','),
(bsnl ' '.(crpt 'n[C]').','),
(bsnl ' '.(crpt 'name/**/2_[C]dir').','),
@@ -946,11 +948,13 @@ for $dim (1,2,3,4) {
(bsnl ' && integer :: name/**/2_bboxlo([DIM]), name/**/2_bboxhi([DIM])'),
(bsnl ' && integer :: name/**/2_istr'),
(rpt (bsnl ' && integer :: name/**/2_[C]dir')),
- (bsnl ' && logical :: name/**/2_any_bbox, name/**/2_all_bbox'),
+ (bsnl ' && logical :: name/**/2_any_bbox, name/**/2_all_bbox'),
(bsnl ' && integer :: name/**/2_bmin([DIM]), name/**/2_bmax([DIM])'),
(nl ''),
(bsnl '#define CCTK_LOOP[DIM]STR_INTBOUNDARIES_OMP_PRIVATE(name)'),
(bsnl ' CCTK_LOOP[DIM]STR_NORMAL_OMP_PRIVATE(name/**/_intboundaries)'),
+ (bsnl ' && !$omp private (name/**/2_any_bbox, name/**/2_all_bbox)'),
+ (bsnl ' && !$omp private (name/**/2_bmin, name/**/2_bmax'),
(nl ''),
(bsnl '#define CCTK_LOOP[DIM]STR_INTBOUNDARIES(name,'),
(bsnl ' '.(crpt '[C]').','),
@@ -968,19 +972,19 @@ for $dim (1,2,3,4) {
# Loop over all faces, edges, and corners
(reverse (rpt (bsnl ' && do name/**/2_[C]dir=-1, +1'))),
(bsnl ' && name/**/2_any_bbox = .false.'),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxlo([I+1]) /= 0')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxhi([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxlo([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_any_bbox = name/**/2_any_bbox .or. name/**/2_bboxhi([I+1]) /= 0')),
(bsnl ' && name/**/2_all_bbox = .true.'),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_all_bbox = name/**/2_all_bbox .and. name/**/2_bboxlo([I+1]) /= 0')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_all_bbox = name/**/2_all_bbox .and. name/**/2_bboxhi([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_all_bbox = name/**/2_all_bbox .and. name/**/2_bboxlo([I+1]) /= 0')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_all_bbox = name/**/2_all_bbox .and. name/**/2_bboxhi([I+1]) /= 0')),
(bsnl ' && if (name/**/2_all_bbox .and. name/**/2_any_bbox) then'),
(rpt (bsnl ' && name/**/2_bmin([I+1]) = name/**/2_blo([I+1])+1')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_bmin([I+1]) = 1')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_bmin([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_bmin([I+1]) = 1')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_bmin([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
(rpt (bsnl ' && name/**/2_bmax([I+1]) = cctk_lsh([I+1]) - name/**/2_bhi([I+1])')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==-1) name/**/2_bmax([I+1]) = name/**/2_blo([I+1])')),
- (rpt (bsnl ' && if (name/**/2_[C]dir==+1) name/**/2_bmax([I+1]) = cctk_lsh([I+1])')),
- (bsnl ' CCTK_LOOP[DIM]STR_NORMAL(name/**/_intboundaries,'),
+ (rpt (bsnl ' && if (name/**/2_[C]dir<0) name/**/2_bmax([I+1]) = name/**/2_blo([I+1])')),
+ (rpt (bsnl ' && if (name/**/2_[C]dir>0) name/**/2_bmax([I+1]) = cctk_lsh([I+1])')),
+ (bsnl ' && CCTK_LOOP[DIM]STR_NORMAL(name/**/_intboundaries,'),
(bsnl ' '.(crpt '[C]').','),
(bsnl ' '.(crpt 'n[C]').','),
(bsnl ' '.(crpt 'name/**/2_[C]dir').','),
@@ -1071,14 +1075,14 @@ for $dim (1,2,3,4) {
(bsnl ' && name/**/3_ierr = GetBoundarySizesAndTypes'),
(bsnl ' (cctkGH, [2*DIM], name/**/3_bndsize, name/**/3_is_ghostbnd, name/**/3_is_symbnd, name/**/3_is_physbnd)'),
(bsnl ' && !$omp end single copyprivate(name/**/3_bndsize)'),
- (bsnl ' CCTK_LOOP[DIM]STR_INTERIOR(name/**/_int,'),
+ (bsnl ' && CCTK_LOOP[DIM]STR_INTERIOR(name/**/_int,'),
(bsnl ' '.(crpt '[C]').','),
(bsnl ' '.(crpt 'name/**/3_bndsize([2*I+1]+1)').','),
(bsnl ' '.(crpt 'name/**/3_bndsize([2*I+2])').','),
(bsnl ' imin,imax, (istr))'),
(nl ''),
(bsnl '#define CCTK_ENDLOOP[DIM]STR_INT(name)'),
- (bsnl ' CCTK_ENDLOOP[DIM]STR_INTERIOR(name/**/int)'),
+ (bsnl ' CCTK_ENDLOOP[DIM]STR_INTERIOR(name/**/_int)'),
(nl ''),
(nl ''),
(nl ''),
@@ -1121,7 +1125,7 @@ for $dim (1,2,3,4) {
(bsnl ' && name/**/3_ierr = GetBoundarySizesAndTypes'),
(bsnl ' (cctkGH, [2*DIM], name/**/3_bndsize, name/**/3_is_ghostbnd, name/**/3_is_symbnd, name/**/3_is_physbnd)'),
(bsnl ' && !$omp end single copyprivate(name/**/3_bndsize, name/**/3_is_physbnd)'),
- (bsnl ' CCTK_LOOP[DIM]STR_BOUNDARIES(name/**/_bnd,'),
+ (bsnl ' && CCTK_LOOP[DIM]STR_BOUNDARIES(name/**/_bnd,'),
(bsnl ' '.(crpt '[C]').','),
(bsnl ' '.(crpt 'n[C]').','),
(bsnl ' '.(crpt 'name/**/3_bndsize([2*I+1])+1').','),
@@ -1177,7 +1181,7 @@ for $dim (1,2,3,4) {
(bsnl ' && name/**/3_ierr = GetBoundarySizesAndTypes'),
(bsnl ' (cctkGH, [2*DIM], name/**/3_bndsize, name/**/3_is_ghostbnd, name/**/3_is_symbnd, name/**/3_is_physbnd)'),
(bsnl ' && !$omp end single copyprivate(name/**/3_bndsize, name/**/3_is_physbnd)'),
- (bsnl ' CCTK_LOOP[DIM]STR_INTBOUNDARIES(name/**/_bnd,'),
+ (bsnl ' && CCTK_LOOP[DIM]STR_INTBOUNDARIES(name/**/_bnd,'),
(bsnl ' '.(crpt '[C]').','),
(bsnl ' '.(crpt 'n[C]').','),
(bsnl ' '.(crpt 'name/**/3_bndsize([2*I+1]+1)').','),