![]() |
Enzo
|
The unique runtime representation of a node. More...
#include <GeometryOperator.h>
Public Member Functions | |
GeometryOperator (enzo::nt::OpId opId, op::OpInfo opInfo) | |
Constructs a new node. | |
GeometryOperator (const GeometryOperator &)=delete | |
Deleted copy constructor to avoid accidental copies. | |
GeometryOperator & | operator= (const GeometryOperator &)=delete |
Deleted copy assignment operator to avoid accidental copies. | |
void | cookOp (op::Context context) |
Computes the output geometry based on the cookOp definition in nt::GeometryOpDef. This is set by the opInfo constructor parameter. | |
geo::Geometry & | getOutputGeo (unsigned int outputIndex) const |
Returns the current output geometry. | |
void | addInputConnection (std::shared_ptr< nt::GeometryConnection > connection) |
Adds a GeometryConnection to one of the inputs. Replacing old connections if needed. | |
void | addOutputConnection (std::shared_ptr< nt::GeometryConnection > connection) |
Adds a GeometryConnection to one of the outputs. Replacing old connections if needed. | |
void | removeInputConnection (unsigned int inputIndex) |
Removes an input from the node's container. | |
void | removeOutputConnection (const nt::GeometryConnection *connection) |
Removes an output from the node's container. | |
std::vector< std::weak_ptr< const GeometryConnection > > | getInputConnections () const |
Returns a vector containing weak pointers for all input connections. | |
std::vector< std::weak_ptr< const GeometryConnection > > | getOutputConnections () const |
Returns a vector containing weak pointers for all output connections. | |
std::optional< std::reference_wrapper< const GeometryConnection > > | getInputConnection (size_t index) const |
Returns an optional connection from a specific input index. | |
std::vector< std::weak_ptr< prm::Parameter > > | getParameters () |
Returns all parameters belonging to this node. | |
std::weak_ptr< prm::Parameter > | getParameter (std::string parameterName) |
Returns a parameter with the given name belonging to this node. | |
std::string | getLabel () |
NOT YET IMPLEMENTED. Returns the runtime label given to this node as a unique identifier within it's scope. | |
std::string | getTypeName () |
Returns the name belonging to this type of node (eg. grid or transform). Not to be confused with the label. | |
void | dirtyNode (bool dirtyDescendents=true) |
Marks the outputed geometry as outdated and notifies the network. | |
bool | isDirty () |
Returns true if the node is dirty and false if the node is clean (does not need cooking). | |
unsigned int | getMinInputs () const |
Returns the minimum number of input connections required for the node to function. These are in order so 3 would mean the first three inputs must have a connection. | |
unsigned int | getMaxInputs () const |
Returns the maximum number of input connections accepted by the node. | |
unsigned int | getMaxOutputs () const |
Returns the number of available outputs the node provides. | |
Public Attributes | |
boost::signals2::signal< void(nt::OpId opId, bool dirtyDescendents)> | nodeDirtied |
A signal emitted when the node is dirtied. This will usually notify the NetworkManager. | |
The unique runtime representation of a node.
nt::GeometryOperator::GeometryOperator | ( | enzo::nt::OpId | opId, |
op::OpInfo | opInfo ) |
Constructs a new node.
opId | the operator id assigned to this node. For most situations this should be set by the nt::NetworkManager |
opInfo | The data class informing the node what its properties are that set it apart from other nodes. This is what makes a grid node different to a transform node. |
void nt::GeometryOperator::addInputConnection | ( | std::shared_ptr< nt::GeometryConnection > | connection | ) |
Adds a GeometryConnection to one of the inputs. Replacing old connections if needed.
Which input is decided and stored on the connection.
Nodes can only have one connection so it will automatically remove existing connections with the same index, prioritizing the new one.
void nt::GeometryOperator::addOutputConnection | ( | std::shared_ptr< nt::GeometryConnection > | connection | ) |
Adds a GeometryConnection to one of the outputs. Replacing old connections if needed.
Which output is decided and stored on the connection.
Nodes can only have one connection so it will automatically remove existing connections with the same index, prioritizing the new one.
void enzo::nt::GeometryOperator::dirtyNode | ( | bool | dirtyDescendents = true | ) |
Marks the outputed geometry as outdated and notifies the network.
dirtyDescendents | Sets whether all descendents (nodes connected directly or indirectly to the output of this node) are also dirtied. This is usually what you want. |
std::optional< std::reference_wrapper< const nt::GeometryConnection > > nt::GeometryOperator::getInputConnection | ( | size_t | index | ) | const |
Returns an optional connection from a specific input index.
std::vector< std::weak_ptr< const nt::GeometryConnection > > nt::GeometryOperator::getInputConnections | ( | ) | const |
Returns a vector containing weak pointers for all input connections.
Connections returned by this function are weak pointers to indicate ownership belongs to the node/network and can be modified or deleted at any time.
std::string nt::GeometryOperator::getLabel | ( | ) |
NOT YET IMPLEMENTED. Returns the runtime label given to this node as a unique identifier within it's scope.
std::vector< std::weak_ptr< const nt::GeometryConnection > > nt::GeometryOperator::getOutputConnections | ( | ) | const |
Returns a vector containing weak pointers for all output connections.
Connections returned by this function are weak pointers to indicate ownership belongs to the node/network and can be modified or deleted at any time.
geo::Geometry & enzo::nt::GeometryOperator::getOutputGeo | ( | unsigned int | outputIndex | ) | const |
Returns the current output geometry.
Does not trigger a cook so if the geometry may be outdated if not cooked first.
std::weak_ptr< prm::Parameter > nt::GeometryOperator::getParameter | ( | std::string | parameterName | ) |
Returns a parameter with the given name belonging to this node.
std::string nt::GeometryOperator::getTypeName | ( | ) |
Returns the name belonging to this type of node (eg. grid or transform). Not to be confused with the label.
The type name decided at compile time and is shared across all nodes of the given type. All grids nodes share the same type name. Labels on the other hand are unique identifiers for a given runtime node (eg. myGrid1, groundGrid, wall).
void nt::GeometryOperator::removeInputConnection | ( | unsigned int | inputIndex | ) |
Removes an input from the node's container.
Does not remove the connection from any other node it's connected to, likely causing undefined behavior if called incorrectly.
void nt::GeometryOperator::removeOutputConnection | ( | const nt::GeometryConnection * | connection | ) |
Removes an output from the node's container.
Does not remove the connection from any other node it's connected to, likely causing undefined behavior if called incorrectly.