aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/carpet_public.hh
diff options
context:
space:
mode:
authorschnetter <>2003-09-30 09:58:00 +0000
committerschnetter <>2003-09-30 09:58:00 +0000
commit5ce91891bcaef1e9db4115659dbe20ab4ba98e64 (patch)
tree10a55137d3035b56ac2f7e0e5618a81d51d78a13 /Carpet/Carpet/src/carpet_public.hh
parent8853f70930b2bcee06762746f781e19c423d584a (diff)
Change grid array handling in the component loop macros. When looping
Change grid array handling in the component loop macros. When looping over grid arrays, "component" now denotes the current component for grid arrays. darcs-hash:20030930095842-07bb3-f2c754f5886431d78eb7fd68ecf810059c1b78c4.gz
Diffstat (limited to 'Carpet/Carpet/src/carpet_public.hh')
-rw-r--r--Carpet/Carpet/src/carpet_public.hh24
1 files changed, 18 insertions, 6 deletions
diff --git a/Carpet/Carpet/src/carpet_public.hh b/Carpet/Carpet/src/carpet_public.hh
index 4f22311e3..d5720ccd4 100644
--- a/Carpet/Carpet/src/carpet_public.hh
+++ b/Carpet/Carpet/src/carpet_public.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.36 2003/09/19 16:08:37 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/carpet_public.hh,v 1.37 2003/09/30 11:58:42 schnetter Exp $
// It is assumed that the number of components of all arrays is equal
// to the number of components of the grid functions, and that their
@@ -222,6 +222,12 @@ namespace Carpet {
// Component iterator
+ // Loop over all components. If grouptype is CCTK_GF, then loop
+ // over grid function components. If grouptype is CCTK_ARRAY (or
+ // CCTK_SCALAR), then loop over grid array (or grid scalar)
+ // components. In the latter case, component denotes the current
+ // grid array component, i.e. it cannot be used to index grid
+ // functions.
#define BEGIN_COMPONENT_LOOP(cgh, grouptype) \
do { \
int _cl; \
@@ -236,8 +242,8 @@ namespace Carpet {
_minc=0; \
_maxc=hh->components(reflevel); \
} else { \
- _minc=component; \
- _maxc=component+1; \
+ _minc=0; \
+ _maxc=CCTK_nProcs(_cgh); \
} \
for (int _c=_minc; _c<_maxc; ++_c) { \
if (component!=_c) set_component (_cgh, _c); \
@@ -251,12 +257,18 @@ namespace Carpet {
+ // Loop over all processor-local components. If grouptype is
+ // CCTK_GF, then loop over grid function components. If grouptype
+ // is CCTK_ARRAY (or CCTK_SCALAR), then loop over grid array (or
+ // grid scalar) components, i.e. execute the loop just once. In the
+ // latter case, component denotes the current grid array component,
+ // i.e. it cannot be used to index grid functions.
#define BEGIN_LOCAL_COMPONENT_LOOP(cgh, grouptype) \
do { \
int _lcl; \
cGH * const _cgh = const_cast<cGH*>(cgh); \
int const _grouptype = (grouptype); \
- int const _savec = (component); \
+ int const _savec = component; \
int _minc, _maxc; \
if (_grouptype == CCTK_GF) { \
assert (reflevel>=0 && reflevel<hh->reflevels()); \
@@ -265,8 +277,8 @@ namespace Carpet {
_minc=0; \
_maxc=hh->components(reflevel); \
} else { \
- _minc=component; \
- _maxc=component+1; \
+ _minc=CCTK_MyProc(_cgh); \
+ _maxc=_minc+1; \
} \
for (int _c=_minc; _c<_maxc; ++_c) { \
if (_grouptype!=CCTK_GF || hh->is_local(reflevel,_c)) { \