aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@ff385933-4943-42dc-877b-ffc776028de6>2005-02-07 16:49:07 +0000
committertradke <tradke@ff385933-4943-42dc-877b-ffc776028de6>2005-02-07 16:49:07 +0000
commit29f9619048f7f16fdb89158caaa34906f1591781 (patch)
tree67f7f3876bbe942781f0604bf0a2ef667f1a118e
parentf4f83fe785ae7b7549c2d3a218fc28c3fd37b5e1 (diff)
Encode only those grid functions in NaNChecker::NaNmask for which NaNs were found.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/NaNChecker/trunk@75 ff385933-4943-42dc-877b-ffc776028de6
-rw-r--r--src/NaNCheck.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/NaNCheck.c b/src/NaNCheck.c
index c67b90f..13814c2 100644
--- a/src/NaNCheck.c
+++ b/src/NaNCheck.c
@@ -181,7 +181,6 @@ void NaNChecker_NaNCheck (CCTK_ARGUMENTS)
#endif
CCTK_TraverseString (check_vars, CheckForNaN, &info, CCTK_GROUP_OR_VAR);
-
if (info.NaNmask && info.bitmask)
{
sum_handle = CCTK_ReductionHandle ("sum");
@@ -721,7 +720,8 @@ static void PrintWarning (const char *error_type,
static void CheckForNaN (int vindex, const char *optstring, void *_info)
{
t_nanchecker_info *info;
- int i, nans_found;
+ int i, sum_handle;
+ CCTK_INT nans_found, global_nans_found;
int timelevel, fp_type, vtype, gtype, gindex, nelems;
char *fullname, *endptr;
const char *vtypename;
@@ -864,25 +864,32 @@ static void CheckForNaN (int vindex, const char *optstring, void *_info)
/* Do more than just print a warning ? */
if (nans_found > 0 && info->action_if_found && gdata.dim > 0)
{
- if (info->NaNmask && gtype == CCTK_GF)
+ if (info->NaNmask && gtype == CCTK_GF && info->bitmask < 8*sizeof (CCTK_INT))
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"There were %d NaN/Inf value(s) found in variable '%s' "
"(NaNmask bitfield %d)",
- nans_found, fullname, info->bitmask);
+ (int) nans_found, fullname, info->bitmask);
}
else
{
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"There were %d NaN/Inf value(s) found in variable '%s'",
- nans_found, fullname);
+ (int) nans_found, fullname);
}
}
- info->count += nans_found;
- if (gtype == CCTK_GF)
+ /* check if the (global) bitmask needs to be incremented */
+ if (info->NaNmask && gtype == CCTK_GF && info->bitmask < 8*sizeof (CCTK_INT))
{
- info->bitmask++;
+ sum_handle = CCTK_ReductionHandle ("sum");
+ CCTK_ReduceLocalScalar (info->GH, -1, sum_handle, &nans_found,
+ &global_nans_found, CCTK_VARIABLE_INT);
+ if (global_nans_found)
+ {
+ info->bitmask++;
+ }
}
+ info->count += nans_found;
if (coords)
{