Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
dnf_composer::element::Kernel Class Reference

Abstract base class for all convolution-based interaction kernels. More...

#include <kernel.h>

Inheritance diagram for dnf_composer::element::Kernel:
Collaboration diagram for dnf_composer::element::Kernel:

Public Member Functions

std::vector< int > getExtIndex () const
 Return the extended index used for circular convolution.
 
std::array< int, 2 > getKernelRange () const
 Return the non-negligible index range [min, max] of the kernel.
 
 Kernel (const ElementCommonParameters &elementCommonParameters)
 
 ~Kernel () override=default
 
- Public Member Functions inherited from dnf_composer::element::Element
virtual void addInput (const std::shared_ptr< Element > &inputElement, const std::string &inputComponent="output")
 Register inputElement as an upstream source for this element.
 
void buildInputCache ()
 Cache raw pointers to input component data. Call after all element init()s complete.
 
virtual void changeDimensions (const ElementDimensions &newDimensions)
 Resize all components to newDimensions and re-initialize.
 
virtual std::shared_ptr< Elementclone () const =0
 
void close ()
 
 Element (const ElementCommonParameters &parameters)
 Construct an element with the given common parameters.
 
std::vector< double > getComponent (const std::string &componentName)
 Return a copy of the named component vector.
 
std::vector< std::string > getComponentList () const
 
std::vector< double > * getComponentPtr (const std::string &componentName)
 
const std::unordered_map< std::string, std::vector< double > > * getComponents () const
 Return a read-only pointer to the full components map.
 
ElementCommonParameters getElementCommonParameters () const
 
std::vector< std::shared_ptr< Element > > getInputs ()
 
std::unordered_map< std::shared_ptr< Element >, std::string > getInputsAndComponents ()
 Return all inputs mapped to the component name they expose.
 
ElementLabel getLabel () const
 
int getMaxSpatialDimension () const
 
std::vector< std::shared_ptr< Element > > getOutputs ()
 
int getSize () const
 Return the number of spatial samples (size = round(x_max / d_x)).
 
double getStepSize () const
 Return the spatial resolution (d_x).
 
int getUniqueIdentifier () const
 
std::string getUniqueName () const
 
bool hasInput () const
 
bool hasInput (const std::string &inputElementName, const std::string &inputComponent)
 
bool hasInput (int inputElementId, const std::string &inputComponent)
 
bool hasOutput () const
 
bool hasOutput (const std::string &outputElementName, const std::string &outputComponent)
 
bool hasOutput (int outputElementId, const std::string &outputComponent)
 
virtual void init ()=0
 Initialize the element (called once before the simulation loop).
 
void print () const
 
void removeInput (const std::string &inputElementId)
 
void removeInput (int uniqueId)
 
void removeInputs ()
 
void removeOutput (const std::string &outputElementId)
 Deregister this element as an input of outputElementId.
 
void removeOutput (int uniqueId)
 Deregister this element as an input of the element with uniqueId.
 
void removeOutputs ()
 
void setUniqueName (const std::string &name)
 
virtual void step (double t, double deltaT)=0
 Advance the element by one time step.
 
virtual std::string toString () const =0
 
void updateInput ()
 Pull data from all registered input elements into this element's components.
 
virtual ~Element ()=default
 

Protected Attributes

int cutOfFactor
 Controls how far from the centre the kernel is truncated.
 
std::vector< int > extIndex
 Extended index array for circular (toroidal) convolution.
 
double fullSum
 Spatial integral of the kernel (used for global inhibition baseline).
 
std::array< int, 2 > kernelRange
 [min, max] index range of the non-negligible kernel support.
 
- Protected Attributes inherited from dnf_composer::element::Element
ElementCommonParameters commonParameters
 Name, label, and spatial dimensions.
 
std::unordered_map< std::string, std::vector< double > > components
 Named data arrays (e.g. "output").
 
std::unordered_map< std::shared_ptr< Element >, std::string > inputs
 Upstream elements and the component they expose.
 
std::unordered_map< std::shared_ptr< Element >, std::string > outputs
 Downstream elements that read this element's output.
 

Detailed Description

Abstract base class for all convolution-based interaction kernels.

Manages the pre-computed kernel range, extended index (for circular convolution), and the full spatial sum used for global inhibition terms. Concrete subclasses (GaussKernel, MexicanHatKernel, …) implement init() and step() to build and apply the specific kernel shape.

Constructor & Destructor Documentation

◆ Kernel()

dnf_composer::element::Kernel::Kernel ( const ElementCommonParameters elementCommonParameters)

◆ ~Kernel()

dnf_composer::element::Kernel::~Kernel ( )
overridedefault

Member Function Documentation

◆ getExtIndex()

std::vector< int > dnf_composer::element::Kernel::getExtIndex ( ) const

Return the extended index used for circular convolution.

◆ getKernelRange()

std::array< int, 2 > dnf_composer::element::Kernel::getKernelRange ( ) const

Return the non-negligible index range [min, max] of the kernel.

Member Data Documentation

◆ cutOfFactor

int dnf_composer::element::Kernel::cutOfFactor
protected

Controls how far from the centre the kernel is truncated.

◆ extIndex

std::vector<int> dnf_composer::element::Kernel::extIndex
protected

Extended index array for circular (toroidal) convolution.

◆ fullSum

double dnf_composer::element::Kernel::fullSum
protected

Spatial integral of the kernel (used for global inhibition baseline).

◆ kernelRange

std::array<int, 2> dnf_composer::element::Kernel::kernelRange
protected

[min, max] index range of the non-negligible kernel support.


The documentation for this class was generated from the following files: