/**
 * @time
 * @l
 */
int GradientCheckProbe::outputState(double timed)
{
#ifdef PV_USE_MPI
   InterColComm * icComm = parent->icCommunicator();
   MPI_Comm comm = icComm->globalCommunicator();
   int rank = icComm->globalCommRank();
#endif // PV_USE_MPI
   std::cout << name << " probeOutputState on timestep " << timed << "\n";

   return PV_SUCCESS;
}
int main(int argc, char * argv[]) {
   PV_Init* initObj = new PV_Init(&argc, &argv, false/*allowUnrecognizedArguments*/);
   InterColComm * icComm = new InterColComm(initObj->getArguments());

   PV_Arguments * arguments = initObj->getArguments();
   if (arguments->getParamsFile() != NULL) {
      int rank = icComm->globalCommRank();
      if (rank==0) {
         fprintf(stderr, "%s does not take -p as an option.  Instead the necessary params file is hard-coded.\n", arguments->getProgramName());
      }
      MPI_Barrier(MPI_COMM_WORLD);
      exit(EXIT_FAILURE);
   }

   arguments->setParamsFile("input/TransposeHyPerConnTest.params");

   initObj->initialize();

   // Don't call buildandrun because it will delete hc before returning. (I could use the customexit hook)
   HyPerCol * hc = build(initObj);
   hc->run(); // Weight values are initialized when run calls allocateDataStructures

   int status = PV_SUCCESS;

   HyPerConn * originalMap = NULL;
   TransposeConn * transpose = NULL;
   TransposeConn * transposeOfTranspose = NULL;

   BaseConnection * baseConn;
   baseConn = hc->getConnFromName("Original Map for One to One Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to One Test of TransposeConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to One Test of TransposeConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-one case, TransposeConn");

   baseConn = hc->getConnFromName("Original Map for Many to One Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for Many to One Test of TransposeConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for Many to One Test of TransposeConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "Many-to-one case, TransposeConn");

   baseConn = hc->getConnFromName("Original Map for One to Many Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to Many Test of TransposeConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to Many Test of TransposeConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-many case, TransposeConn");

   baseConn = hc->getConnFromName("Original Map for One to One Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to One Test of FeedbackConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to One Test of FeedbackConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-one case, FeedbackConn");

   baseConn = hc->getConnFromName("Original Map for Many to One Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for Many to One Test of FeedbackConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for Many to One Test of FeedbackConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "Many-to-one case, FeedbackConn");

   baseConn = hc->getConnFromName("Original Map for One to Many Test");
   originalMap = dynamic_cast<HyPerConn *>(baseConn);
   //assert(originalMap->usingSharedWeights());
   transpose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose for One to Many Test of FeedbackConn"));
   transposeOfTranspose = dynamic_cast<TransposeConn *>(hc->getConnFromName("Transpose of Transpose for One to Many Test of FeedbackConn"));
   status = testTransposeOfTransposeWeights(originalMap, transpose, transposeOfTranspose, "One-to-many case, FeedbackConn");

   delete hc;
   delete initObj;
   return status;
}