|
Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
|
Collapses a 2D input field to a 1D output by reducing along one axis. More...
#include <collapse.h>
Public Member Functions | |
| void | addInput (const std::shared_ptr< Element > &inputElement, const std::string &inputComponent="output") override |
Register inputElement as an upstream source for this element. | |
| void | changeInputDimensions (const ElementDimensions &newInputDimensions) |
| Resize the 2D input field dimensions and rebuild the input buffer. | |
| std::shared_ptr< Element > | clone () const override |
| Collapse (const ElementCommonParameters &elementCommonParameters, const CollapseParameters ¶meters) | |
| Construct a Collapse element. | |
| CollapseParameters | getParameters () const |
| void | init () override |
| Initialize the element (called once before the simulation loop). | |
| void | setParameters (const CollapseParameters ¶meters) |
| void | step (double t, double deltaT) override |
| Advance the element by one time step. | |
| std::string | toString () const override |
Public Member Functions inherited from dnf_composer::element::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. | |
| 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) |
| 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) |
| void | updateInput () |
| Pull data from all registered input elements into this element's components. | |
| virtual | ~Element ()=default |
Additional Inherited Members | |
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. | |
Collapses a 2D input field to a 1D output by reducing along one axis.
On each step(), Collapse reads its 2D input field's "output" component (a y-major flattened Nx x Ny matrix) and reduces it along the dropped axis using the configured CompressionType, producing a 1D output the size of the kept axis. Useful for driving a 1D field from the marginal of a 2D field. Because the input and output dimensionalities differ, Collapse overrides addInput() to size the "input" component to the source's size and accepts a single input.
| dnf_composer::element::Collapse::Collapse | ( | const ElementCommonParameters & | elementCommonParameters, |
| const CollapseParameters & | parameters | ||
| ) |
Construct a Collapse element.
| elementCommonParameters | Name, label, and 1D output dimensions. |
| parameters | Collapse-specific parameters. |
|
overridevirtual |
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 from dnf_composer::element::Element.
| void dnf_composer::element::Collapse::changeInputDimensions | ( | const ElementDimensions & | newInputDimensions | ) |
Resize the 2D input field dimensions and rebuild the input buffer.
|
overridevirtual |
Implements dnf_composer::element::Element.
| CollapseParameters dnf_composer::element::Collapse::getParameters | ( | ) | const |
|
overridevirtual |
Initialize the element (called once before the simulation loop).
Implements dnf_composer::element::Element.
| void dnf_composer::element::Collapse::setParameters | ( | const CollapseParameters & | parameters | ) |
|
overridevirtual |
Advance the element by one time step.
| t | Current simulation time. |
| deltaT | Integration step size. |
Implements dnf_composer::element::Element.
|
overridevirtual |