8 #include "QuotientColProbe.hpp" 9 #include "columns/HyPerCol.hpp" 28 free(valueDescription);
36 valueDescription = NULL;
49 for (
auto &s : mOutputStreams) {
50 *s <<
"Probe_name,time,index," << valueDescription;
63 parent->parameters()->ioParamString(
64 ioFlag, name,
"valueDescription", &valueDescription,
"value",
true );
68 parent->parameters()->ioParamStringRequired(ioFlag, name,
"numerator", &numerator);
72 parent->parameters()->ioParamStringRequired(ioFlag, name,
"denominator", &denominator);
81 numerProbe = message->lookup<
BaseProbe>(std::string(numerator));
82 denomProbe = message->lookup<
BaseProbe>(std::string(denominator));
84 if (numerProbe == NULL || denomProbe == NULL) {
86 if (parent->columnId() == 0) {
87 if (numerProbe == NULL) {
89 "%s: numerator probe \"%s\" could not be found.\n",
93 if (denomProbe == NULL) {
95 "%s: denominator probe \"%s\" could not be found.\n",
101 int nNumValues, dNumValues;
105 if (nNumValues != dNumValues) {
106 if (parent->columnId() == 0) {
108 "%s: numerator probe \"%s\" and denominator " 109 "probe \"%s\" have differing numbers " 110 "of values (%d vs. %d)\n",
124 MPI_Barrier(parent->getCommunicator()->communicator());
127 return Response::SUCCESS;
133 if (parent->simulationTime() == 0.0) {
134 for (
int b = 0; b < numValues; b++) {
135 valuesBuffer[b] = 1.0;
143 for (
int b = 0; b < numValues; b++) {
144 valuesBuffer[b] = n[b] / d[b];
152 if (mOutputStreams.empty()) {
153 return Response::SUCCESS;
157 for (
int b = 0; b < numValues; b++) {
159 output(b) <<
"\"" << valueDescription <<
"\",";
161 output(b) << timevalue <<
"," << b <<
"," << valuesBuffer[b] << std::endl;
163 return Response::SUCCESS;
virtual ~QuotientColProbe()
virtual void calcValues(double timeValue) override
PrintStream & output(int b)
static bool completed(Status &a)
virtual void outputHeader() override
virtual void ioParam_valueDescription(enum ParamsIOFlag ioFlag)
valueDescription: a short description of what the quantities computed by getValues() represent...
int initialize(const char *name, HyPerCol *hc)
int initializeQuotientColProbe(const char *probename, HyPerCol *hc)
double * getValuesBuffer()
bool isWritingToFile() const
void getValues(double timevalue, double *valuesVector)
virtual void ioParam_numerator(enum ParamsIOFlag ioFlag)
numerator: A probe whose values are used in the numerators of the quotients. numerator can be a layer...
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual double referenceUpdateTime() const override
virtual void ioParam_denominator(enum ParamsIOFlag ioFlag)
denominator: A probe whose values are used in the denominators of the quotients. denominator can be a...
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual Response::Status outputState(double timevalue) override