|
Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
|
Abstract base class for all simulation elements. More...
#include <element.h>
Public Member Functions | |
| 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< Element > | clone () const =0 |
| void | close () |
| Element (const ElementCommonParameters ¶meters) | |
| 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 | |
| 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. | |
Abstract base class for all simulation elements.
Every element owns a set of named data components (e.g. "activation", "output"), a list of input elements, and a list of output elements. Concrete subclasses implement the init / step lifecycle and exchange data via addInput().
|
explicit |
Construct an element with the given common parameters.
| parameters | Name, label, and spatial dimensions. |
|
virtualdefault |
|
virtual |
Register inputElement as an upstream source for this element.
| inputElement | The element whose output will be read. |
| inputComponent | Which component of inputElement to read (default: "output"). |
Reimplemented in dnf_composer::element::Collapse, dnf_composer::element::Expand, dnf_composer::element::FieldCoupling, dnf_composer::element::Resize, and dnf_composer::element::Resize2D.
| void dnf_composer::element::Element::buildInputCache | ( | ) |
Cache raw pointers to input component data. Call after all element init()s complete.
|
virtual |
Resize all components to newDimensions and re-initialize.
| newDimensions | New spatial discretization. |
Reimplemented in dnf_composer::element::FieldCoupling, and dnf_composer::element::GaussFieldCoupling.
|
pure virtual |
Implemented in dnf_composer::element::AsymmetricGaussKernel, dnf_composer::element::AsymmetricGaussKernel2D, dnf_composer::element::BoostStimulus, dnf_composer::element::BoostStimulus2D, dnf_composer::element::Collapse, dnf_composer::element::CorrelatedNormalNoise, dnf_composer::element::CorrelatedNormalNoise2D, dnf_composer::element::Expand, dnf_composer::element::FieldCoupling, dnf_composer::element::GaussFieldCoupling, dnf_composer::element::GaussKernel, dnf_composer::element::GaussKernel2D, dnf_composer::element::GaussStimulus, dnf_composer::element::GaussStimulus2D, dnf_composer::element::MemoryTrace, dnf_composer::element::MemoryTrace2D, dnf_composer::element::MexicanHatKernel, dnf_composer::element::MexicanHatKernel2D, dnf_composer::element::NeuralField, dnf_composer::element::NeuralField2D, dnf_composer::element::NormalNoise, dnf_composer::element::NormalNoise2D, dnf_composer::element::OscillatoryKernel, dnf_composer::element::OscillatoryKernel2D, dnf_composer::element::Resize, dnf_composer::element::Resize2D, dnf_composer::element::TimedGaussStimulus, and dnf_composer::element::TimedGaussStimulus2D.
| void dnf_composer::element::Element::close | ( | ) |
| std::vector< double > dnf_composer::element::Element::getComponent | ( | const std::string & | componentName | ) |
Return a copy of the named component vector.
| componentName | E.g. "activation", "output", "input". |
| std::vector< std::string > dnf_composer::element::Element::getComponentList | ( | ) | const |
| std::vector< double > * dnf_composer::element::Element::getComponentPtr | ( | const std::string & | componentName | ) |
| const std::unordered_map< std::string, std::vector< double > > * dnf_composer::element::Element::getComponents | ( | ) | const |
Return a read-only pointer to the full components map.
| ElementCommonParameters dnf_composer::element::Element::getElementCommonParameters | ( | ) | const |
| std::vector< std::shared_ptr< Element > > dnf_composer::element::Element::getInputs | ( | ) |
| std::unordered_map< std::shared_ptr< Element >, std::string > dnf_composer::element::Element::getInputsAndComponents | ( | ) |
Return all inputs mapped to the component name they expose.
| ElementLabel dnf_composer::element::Element::getLabel | ( | ) | const |
| int dnf_composer::element::Element::getMaxSpatialDimension | ( | ) | const |
| std::vector< std::shared_ptr< Element > > dnf_composer::element::Element::getOutputs | ( | ) |
| int dnf_composer::element::Element::getSize | ( | ) | const |
Return the number of spatial samples (size = round(x_max / d_x)).
| double dnf_composer::element::Element::getStepSize | ( | ) | const |
Return the spatial resolution (d_x).
| int dnf_composer::element::Element::getUniqueIdentifier | ( | ) | const |
| std::string dnf_composer::element::Element::getUniqueName | ( | ) | const |
| bool dnf_composer::element::Element::hasInput | ( | ) | const |
| bool dnf_composer::element::Element::hasInput | ( | const std::string & | inputElementName, |
| const std::string & | inputComponent | ||
| ) |
| bool dnf_composer::element::Element::hasInput | ( | int | inputElementId, |
| const std::string & | inputComponent | ||
| ) |
| bool dnf_composer::element::Element::hasOutput | ( | ) | const |
| bool dnf_composer::element::Element::hasOutput | ( | const std::string & | outputElementName, |
| const std::string & | outputComponent | ||
| ) |
| bool dnf_composer::element::Element::hasOutput | ( | int | outputElementId, |
| const std::string & | outputComponent | ||
| ) |
|
pure virtual |
Initialize the element (called once before the simulation loop).
Implemented in dnf_composer::element::AsymmetricGaussKernel, dnf_composer::element::AsymmetricGaussKernel2D, dnf_composer::element::BoostStimulus, dnf_composer::element::BoostStimulus2D, dnf_composer::element::Collapse, dnf_composer::element::CorrelatedNormalNoise, dnf_composer::element::CorrelatedNormalNoise2D, dnf_composer::element::Expand, dnf_composer::element::FieldCoupling, dnf_composer::element::GaussFieldCoupling, dnf_composer::element::GaussKernel, dnf_composer::element::GaussKernel2D, dnf_composer::element::GaussStimulus, dnf_composer::element::GaussStimulus2D, dnf_composer::element::MemoryTrace, dnf_composer::element::MemoryTrace2D, dnf_composer::element::MexicanHatKernel, dnf_composer::element::MexicanHatKernel2D, dnf_composer::element::NeuralField, dnf_composer::element::NeuralField2D, dnf_composer::element::NormalNoise, dnf_composer::element::NormalNoise2D, dnf_composer::element::OscillatoryKernel, dnf_composer::element::OscillatoryKernel2D, dnf_composer::element::Resize, dnf_composer::element::Resize2D, dnf_composer::element::TimedGaussStimulus, and dnf_composer::element::TimedGaussStimulus2D.
| void dnf_composer::element::Element::print | ( | ) | const |
| void dnf_composer::element::Element::removeInput | ( | const std::string & | inputElementId | ) |
| void dnf_composer::element::Element::removeInput | ( | int | uniqueId | ) |
| void dnf_composer::element::Element::removeInputs | ( | ) |
| void dnf_composer::element::Element::removeOutput | ( | const std::string & | outputElementId | ) |
Deregister this element as an input of outputElementId.
| void dnf_composer::element::Element::removeOutput | ( | int | uniqueId | ) |
Deregister this element as an input of the element with uniqueId.
| void dnf_composer::element::Element::removeOutputs | ( | ) |
| void dnf_composer::element::Element::setUniqueName | ( | const std::string & | name | ) |
|
pure virtual |
Advance the element by one time step.
| t | Current simulation time. |
| deltaT | Integration step size. |
Implemented in dnf_composer::element::AsymmetricGaussKernel, dnf_composer::element::AsymmetricGaussKernel2D, dnf_composer::element::BoostStimulus, dnf_composer::element::BoostStimulus2D, dnf_composer::element::Collapse, dnf_composer::element::CorrelatedNormalNoise, dnf_composer::element::CorrelatedNormalNoise2D, dnf_composer::element::Expand, dnf_composer::element::FieldCoupling, dnf_composer::element::GaussFieldCoupling, dnf_composer::element::GaussKernel, dnf_composer::element::GaussKernel2D, dnf_composer::element::GaussStimulus, dnf_composer::element::GaussStimulus2D, dnf_composer::element::MemoryTrace, dnf_composer::element::MemoryTrace2D, dnf_composer::element::MexicanHatKernel, dnf_composer::element::MexicanHatKernel2D, dnf_composer::element::NeuralField, dnf_composer::element::NeuralField2D, dnf_composer::element::NormalNoise, dnf_composer::element::NormalNoise2D, dnf_composer::element::OscillatoryKernel, dnf_composer::element::OscillatoryKernel2D, dnf_composer::element::Resize, dnf_composer::element::Resize2D, dnf_composer::element::TimedGaussStimulus, and dnf_composer::element::TimedGaussStimulus2D.
|
pure virtual |
Implemented in dnf_composer::element::AsymmetricGaussKernel, dnf_composer::element::AsymmetricGaussKernel2D, dnf_composer::element::BoostStimulus, dnf_composer::element::BoostStimulus2D, dnf_composer::element::Collapse, dnf_composer::element::CorrelatedNormalNoise, dnf_composer::element::CorrelatedNormalNoise2D, dnf_composer::element::Expand, dnf_composer::element::FieldCoupling, dnf_composer::element::GaussFieldCoupling, dnf_composer::element::GaussKernel, dnf_composer::element::GaussKernel2D, dnf_composer::element::GaussStimulus, dnf_composer::element::GaussStimulus2D, dnf_composer::element::MemoryTrace, dnf_composer::element::MemoryTrace2D, dnf_composer::element::MexicanHatKernel, dnf_composer::element::MexicanHatKernel2D, dnf_composer::element::NeuralField, dnf_composer::element::NeuralField2D, dnf_composer::element::NormalNoise, dnf_composer::element::NormalNoise2D, dnf_composer::element::OscillatoryKernel, dnf_composer::element::OscillatoryKernel2D, dnf_composer::element::Resize, dnf_composer::element::Resize2D, dnf_composer::element::TimedGaussStimulus, and dnf_composer::element::TimedGaussStimulus2D.
| void dnf_composer::element::Element::updateInput | ( | ) |
Pull data from all registered input elements into this element's components.
|
protected |
Name, label, and spatial dimensions.
|
protected |
Named data arrays (e.g. "output").
|
protected |
Upstream elements and the component they expose.
|
protected |
Downstream elements that read this element's output.