From 07d12df03f216b25fef1d4b930cb3b1e9e68c108 Mon Sep 17 00:00:00 2001 From: Roland Haas Date: Wed, 22 Feb 2012 07:59:46 -0800 Subject: CarpetIOBasic: Add output criterion "divisor" Support output criterion "divisor" in CarpetIOBasic. --- Carpet/CarpetIOBasic/param.ccl | 1 + Carpet/CarpetIOBasic/src/iobasic.cc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) --- Carpet/CarpetIOBasic/param.ccl | 1 + Carpet/CarpetIOBasic/src/iobasic.cc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'Carpet/CarpetIOBasic') diff --git a/Carpet/CarpetIOBasic/param.ccl b/Carpet/CarpetIOBasic/param.ccl index 252e873e8..8d105ff6a 100644 --- a/Carpet/CarpetIOBasic/param.ccl +++ b/Carpet/CarpetIOBasic/param.ccl @@ -28,6 +28,7 @@ KEYWORD outInfo_criterion "Criterion to select scalar output intervals, override { "never" :: "Never output" "iteration" :: "Output every so many iterations" + "divisor" :: "Output if iteration mod divisor == 0." "time" :: "Output every that much coordinate time" } "iteration" diff --git a/Carpet/CarpetIOBasic/src/iobasic.cc b/Carpet/CarpetIOBasic/src/iobasic.cc index 2d0dcb895..2c413e3c2 100644 --- a/Carpet/CarpetIOBasic/src/iobasic.cc +++ b/Carpet/CarpetIOBasic/src/iobasic.cc @@ -562,6 +562,23 @@ namespace CarpetIOBasic { output_this_iteration = false; } + } else if (CCTK_EQUALS (myoutcriterion, "divisor")) { + + int myoutevery = outInfo_every; + if (myoutevery == -2) { + myoutevery = out_every; + } + if (myoutevery <= 0) { + // output is disabled + output_this_iteration = false; + } else if ((cctk_iteration % myoutevery) == 0 ) { + // we already decided to output this iteration + output_this_iteration = true; + } else { + // we want no output at this iteration + output_this_iteration = false; + } + } else if (CCTK_EQUALS (myoutcriterion, "time")) { CCTK_REAL myoutdt = outInfo_dt; -- cgit v1.2.3