diff options
author | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2001-08-07 23:29:46 +0000 |
---|---|---|
committer | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2001-08-07 23:29:46 +0000 |
commit | 1e96877a7699b070030f9ec7215af56c1eedaeba (patch) | |
tree | 1acf343d50daaaedd7a9bb859db3aea7d5520cd3 | |
parent | 7df4863b092e7c69d388302776d422ff83a37fd7 (diff) |
Fixed a bug in triggered info output.
This closes PR CactusBase-753.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@98 b589c3ab-70e8-4b4d-a09f-cba2dd200880
-rw-r--r-- | src/OutputInfo.c | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c index 0527425..5145c77 100644 --- a/src/OutputInfo.c +++ b/src/OutputInfo.c @@ -299,7 +299,8 @@ int IOBasic_TriggerInfoOutput (cGH *GH, int vindex) static void CheckSteerableParameters (iobasicGH *myGH) { DECLARE_CCTK_PARAMETERS - int out_old, times_set; + int vindex, out_old, times_set, update_info_reductions_list; + iobasic_reduction_t *reduction, *next; static int outInfo_vars_lastset = -1; static int outInfo_reductions_lastset = -1; @@ -330,13 +331,42 @@ static void CheckSteerableParameters (iobasicGH *myGH) /* check if the 'outInfo_reductions' parameter if it was changed */ times_set = CCTK_ParameterQueryTimesSet ("outInfo_reductions", CCTK_THORNSTRING); - myGH->info_reductions_changed |= times_set != outInfo_reductions_lastset; + update_info_reductions_list = times_set != outInfo_reductions_lastset; outInfo_reductions_lastset = times_set; /* check if the 'outInfo_vars' parameter if it was changed */ times_set = CCTK_ParameterQueryTimesSet ("outInfo_vars", CCTK_THORNSTRING); - myGH->info_reductions_changed |= times_set != outInfo_vars_lastset; + update_info_reductions_list |= times_set != outInfo_vars_lastset; outInfo_vars_lastset = times_set; + + if (update_info_reductions_list) + { + /* free old info output lists ... */ + for (vindex = CCTK_NumVars (); vindex >= 0; vindex--) + { + if (myGH->info_reductions[vindex].num_reductions > 0) + { + myGH->info_reductions[vindex].num_reductions = 0; + reduction = myGH->info_reductions[vindex].reductions; + while (reduction) + { + next = reduction->next; + free (reduction->name); + free (reduction); + reduction = next; + } + } + } + + /* ... and create new ones */ + if (CCTK_TraverseString (outInfo_vars, AssignReductionList, myGH, + CCTK_GROUP_OR_VAR) < 0) + { + CCTK_WARN (1, "Failed to parse 'IOBasic::outInfo_vars' parameter"); + } + + myGH->info_reductions_changed = 1; + } } @@ -542,31 +572,8 @@ static void PrintHeader (iobasicGH *myGH, int num_vars) DECLARE_CCTK_PARAMETERS int i, num_columns, vindex; char *vname; - iobasic_reduction_t *reduction, *next; - + iobasic_reduction_t *reduction; - /* free old info output lists ... */ - for (vindex = 0; vindex < num_vars; vindex++) - { - if (myGH->info_reductions[vindex].num_reductions > 0) - { - myGH->info_reductions[vindex].num_reductions = 0; - reduction = myGH->info_reductions[vindex].reductions; - while (reduction) - { - next = reduction->next; - free (reduction->name); - free (reduction); - reduction = next; - } - } - } - /* ... and create new ones */ - if (CCTK_TraverseString (outInfo_vars, AssignReductionList, myGH, - CCTK_GROUP_OR_VAR) < 0) - { - CCTK_WARN (1, "Failed to parse 'IOBasic::outInfo_vars' parameter"); - } /* count number of info values to output */ num_columns = 0; |