8 #include "RequireAllZeroActivityProbe.hpp" 12 RequireAllZeroActivityProbe::RequireAllZeroActivityProbe(
const char *name, HyPerCol *hc) {
17 RequireAllZeroActivityProbe::RequireAllZeroActivityProbe() { initialize_base(); }
19 int RequireAllZeroActivityProbe::initialize_base() {
return PV_SUCCESS; }
21 int RequireAllZeroActivityProbe::initialize(
const char *name, HyPerCol *hc) {
22 int status = StatsProbe::initialize(name, hc);
33 void RequireAllZeroActivityProbe::ioParam_buffer(
enum ParamsIOFlag ioFlag) {
34 requireType(BufActivity);
38 parent->parameters()->ioParamValue(ioFlag, name,
"exitOnFailure", &exitOnFailure, exitOnFailure);
42 pvAssert(!parent->parameters()->presentAndNotBeenRead(name,
"exitOnFailure"));
44 parent->parameters()->ioParamValue(
47 "immediateExitOnFailure",
48 &immediateExitOnFailure,
49 immediateExitOnFailure);
52 immediateExitOnFailure =
false;
59 Fatal() << getDescription() <<
": StatsProbe::outputState failed at time " << timed <<
".\n";
61 for (
int b = 0; b < parent->getNBatch(); b++) {
67 nonzeroFoundMessage(nonzeroTime, parent->columnId() == 0, immediateExitOnFailure);
70 return Response::SUCCESS;
73 void RequireAllZeroActivityProbe::nonzeroFoundMessage(
78 std::stringstream message(
"");
79 message << getDescription_c() <<
": Nonzero activity found at time " << badTime <<
"\n";
81 Fatal() << message.str();
84 WarnLog() << message.str();
88 MPI_Barrier(parent->getCommunicator()->communicator());
93 RequireAllZeroActivityProbe::~RequireAllZeroActivityProbe() {
95 if (exitOnFailure && getNonzeroFound()) {
96 nonzeroFoundMessage(nonzeroTime, parent->columnId() == 0,
true );
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_immediateExitOnFailure(enum ParamsIOFlag ioFlag)
immediateExitOnFailure: determines when finding a nonzero value causes an exit with an error...
virtual Response::Status outputState(double timef) override
virtual Response::Status outputState(double timed) override
static bool completed(Status &a)
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_exitOnFailure(enum ParamsIOFlag ioFlag)
exitOnFailure: If true, will error out if a nonzero value is encountered. Default is true...