Ejemplo n.º 1
0
int main(int argc, char * argv[])
{
   PV_Init * initObj = new PV_Init(&argc, &argv, false/*allowUnrecognizedArguments*/);
   PV::HyPerCol * hc = new PV::HyPerCol("test_cocirc column", initObj);
   
   const char * preLayerName = "test_cocirc pre";
   const char * postLayerName = "test_cocirc post";
   
   PV::Example * pre = new PV::Example(preLayerName, hc);
   assert(pre);
   PV::Example * post = new PV::Example(postLayerName, hc);
   assert(post);
   PV::HyPerConn * cHyPer = new HyPerConn("test_cocirc hyperconn", hc);
   assert(cHyPer);
   PV::HyPerConn * cCocirc = new HyPerConn("test_cocirc cocircconn", hc);
   assert(cCocirc);
   
   PV::Example * pre2 = new PV::Example("test_cocirc pre 2", hc);
   assert(pre2);
   PV::Example * post2 = new PV::Example("test_cocirc post 2", hc);
   assert(post2);
   PV::HyPerConn * cHyPer1to2 = new HyPerConn("test_cocirc hyperconn 1 to 2", hc);
   assert(cHyPer1to2);
   PV::HyPerConn * cCocirc1to2 = new HyPerConn("test_cocirc cocircconn 1 to 2", hc);
   assert(cCocirc1to2);
   PV::HyPerConn * cHyPer2to1 = new HyPerConn("test_cocirc hyperconn 2 to 1", hc);
   assert(cHyPer2to1);
   PV::HyPerConn * cCocirc2to1 = new HyPerConn("test_cocirc cocircconn 2 to 1", hc);
   assert(cCocirc2to1);

   hc->ensureDirExists(hc->getOutputPath());
   
   for (int l=0; l<hc->numberOfLayers(); l++) {
      HyPerLayer * layer = hc->getLayer(l);
      int status = layer->communicateInitInfo();
      assert(status==PV_SUCCESS);
      layer->setInitInfoCommunicatedFlag();
   }   
   for (int c=0; c<hc->numberOfConnections(); c++) {
      BaseConnection * conn = hc->getConnection(c);
      int status = conn->communicateInitInfo();
      assert(status==PV_SUCCESS);
      conn->setInitInfoCommunicatedFlag();
   }
   
   for (int l=0; l<hc->numberOfLayers(); l++) {
      HyPerLayer * layer = hc->getLayer(l);
      int status = layer->allocateDataStructures();
      assert(status==PV_SUCCESS);
      layer->setDataStructuresAllocatedFlag();
   }
   
   for (int c=0; c<hc->numberOfConnections(); c++) {
      BaseConnection * conn = hc->getConnection(c);
      int status = conn->allocateDataStructures();
      assert(status==PV_SUCCESS);
      conn->setDataStructuresAllocatedFlag();
   }

   const int axonID = 0;
   int num_pre_extended = pre->clayer->numExtended;
   assert(num_pre_extended == cHyPer->getNumWeightPatches());

   int status = 0;
   for (int kPre = 0; kPre < num_pre_extended; kPre++) {
      status = check_cocirc_vs_hyper(cHyPer, cCocirc, kPre, axonID);
      assert(status==0);
      status = check_cocirc_vs_hyper(cHyPer1to2, cCocirc1to2, kPre, axonID);
      assert(status==0);
      status = check_cocirc_vs_hyper(cHyPer2to1, cCocirc2to1, kPre, axonID);
      assert(status==0);
   }

   delete hc;
   delete initObj;
   return 0;
}