<commit_before>/*
 * KernelConn.hpp
 *
 *  Created on: Aug 6, 2009
 *      Author: gkenyon
 */

#ifndef KERNELCONN_HPP_
#define KERNELCONN_HPP_

#include "HyPerConn.hpp"
#ifdef PV_USE_MPI
#  include <mpi.h>
#else
#  include "../include/mpi_stubs.h"
#endif

namespace PV {

class KernelConn: public HyPerConn {

public:

   KernelConn();
   virtual ~KernelConn();

   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post,
              ChannelType channel, const char * filename = NULL, InitWeights *weightInit = NULL);
#ifdef OBSOLETE // marked obsolete Jul 25, 2011.  This case covered since other constructor's filename argumernt now has a default of null
   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post,
              ChannelType channel);
#endif // OBSOLETE
#ifdef OBSOLETE // marked obsolete Jul 25, 2011.  No routine calls it, and it doesn't make sense to define a connection without specifying a channel.
   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post);
#endif // OBSOLETE

   virtual int numDataPatches();

   virtual float minWeight(int axonId = 0);
   virtual float maxWeight(int axonId = 0);

#ifdef OBSOLETE //The following methods have been added to the new InitWeights classes.  Please
                //use the param "weightInitType" to choose an initialization type
   virtual int gauss2DCalcWeights(PVPatch * wp, int kPre, int noPost,
         int numFlanks, float shift, float rotate, float aspect, float sigma,
         float r2Max, float strength, float deltaThetaMax, float thetaMax,
         float bowtieFlag, float bowtieAngle);

   virtual int cocircCalcWeights(PVPatch * wp, int kPre, int noPre, int noPost,
         float sigma_cocirc, float sigma_kurve, float sigma_chord, float delta_theta_max,
         float cocirc_self, float delta_radius_curvature, int numFlanks, float shift,
         float aspect, float rotate, float sigma, float r2Max, float strength);
#endif

   virtual int normalizeWeights(PVPatch ** patches, int numPatches, int arborId);
   virtual int symmetrizeWeights(PVPatch ** patches, int numPatches, int arborId);

   PVPatch * getKernelPatch(int axonId, int kernelIndex)   {return kernelPatches[axonId][kernelIndex];}
   PVPatch ** getKernelPatches(int axonId)   {return kernelPatches[axonId];}
   inline void setKernelPatches(PVPatch** newKernelPatch, int axonId) {kernelPatches[axonId]=newKernelPatch;}
   inline void setKernelPatch(PVPatch* newKernelPatch, int axonId, int kernelIndex) {kernelPatches[axonId][kernelIndex]=newKernelPatch;}
   virtual int writeWeights(float time, bool last=false);
   inline PVPatch *** getAllKernelPatches() {return kernelPatches;}

   virtual int shrinkPatches(int arborId);

   bool getPlasticityFlag() {return plasticityFlag;}
   float getWeightUpdatePeriod() {return weightUpdatePeriod;}
   float getWeightUpdateTime() {return weightUpdateTime;}
   float getLastUpdateTime() {return lastUpdateTime;}

   virtual int correctPIndex(int patchIndex);

protected:
//   bool plasticityFlag;
   float weightUpdatePeriod;
   float weightUpdateTime;
   float lastUpdateTime;<commit_msg>Added comments to #endif's indicating what #ifdef is being ended (This made it easier to write a script to help find a bug caused by a file that got newly included when I changed a #define to #undef)<commit_after>/*
 * KernelConn.hpp
 *
 *  Created on: Aug 6, 2009
 *      Author: gkenyon
 */

#ifndef KERNELCONN_HPP_
#define KERNELCONN_HPP_

#include "HyPerConn.hpp"
#ifdef PV_USE_MPI
#  include <mpi.h>
#else
#  include "../include/mpi_stubs.h"
#endif // PV_USE_MPI

namespace PV {

class KernelConn: public HyPerConn {

public:

   KernelConn();
   virtual ~KernelConn();

   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post,
              ChannelType channel, const char * filename = NULL, InitWeights *weightInit = NULL);
#ifdef OBSOLETE // marked obsolete Jul 25, 2011.  This case covered since other constructor's filename argumernt now has a default of null
   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post,
              ChannelType channel);
#endif // OBSOLETE
#ifdef OBSOLETE // marked obsolete Jul 25, 2011.  No routine calls it, and it doesn't make sense to define a connection without specifying a channel.
   KernelConn(const char * name, HyPerCol * hc, HyPerLayer * pre, HyPerLayer * post);
#endif // OBSOLETE

   virtual int numDataPatches();

   virtual float minWeight(int axonId = 0);
   virtual float maxWeight(int axonId = 0);

#ifdef OBSOLETE //The following methods have been added to the new InitWeights classes.  Please
                //use the param "weightInitType" to choose an initialization type
   virtual int gauss2DCalcWeights(PVPatch * wp, int kPre, int noPost,
         int numFlanks, float shift, float rotate, float aspect, float sigma,
         float r2Max, float strength, float deltaThetaMax, float thetaMax,
         float bowtieFlag, float bowtieAngle);

   virtual int cocircCalcWeights(PVPatch * wp, int kPre, int noPre, int noPost,
         float sigma_cocirc, float sigma_kurve, float sigma_chord, float delta_theta_max,
         float cocirc_self, float delta_radius_curvature, int numFlanks, float shift,
         float aspect, float rotate, float sigma, float r2Max, float strength);
#endif // OBSOLETE

   virtual int normalizeWeights(PVPatch ** patches, int numPatches, int arborId);
   virtual int symmetrizeWeights(PVPatch ** patches, int numPatches, int arborId);

   PVPatch * getKernelPatch(int axonId, int kernelIndex)   {return kernelPatches[axonId][kernelIndex];}
   PVPatch ** getKernelPatches(int axonId)   {return kernelPatches[axonId];}
   inline void setKernelPatches(PVPatch** newKernelPatch, int axonId) {kernelPatches[axonId]=newKernelPatch;}
   inline void setKernelPatch(PVPatch* newKernelPatch, int axonId, int kernelIndex) {kernelPatches[axonId][kernelIndex]=newKernelPatch;}
   virtual int writeWeights(float time, bool last=false);
   inline PVPatch *** getAllKernelPatches() {return kernelPatches;}

   virtual int shrinkPatches(int arborId);

   bool getPlasticityFlag() {return plasticityFlag;}
   float getWeightUpdatePeriod() {return weightUpdatePeriod;}
   float getWeightUpdateTime() {return weightUpdateTime;}
   float getLastUpdateTime() {return lastUpdateTime;}

   virtual int correctPIndex(int patchIndex);

protected:
//   bool plasticityFlag;
   float weightUpdatePeriod;
   float weightUpdateTime;
   float lastUpdateTime;
{'fraction_non_alphanumeric': 0.08295142071494042, 'fraction_numerical': 0.006721662083715246, 'mean_word_length': 4.305510534846029, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4203637', 'n_tokens_mistral': 2052, 'n_tokens_neox': 1894, 'n_words': 660}