Enzo
Loading...
Searching...
No Matches
enzo::nt::GeometryOpDef Class Referenceabstract

Abstract class used to create new operators. More...

#include <GeometryOpDef.h>

Public Member Functions

 GeometryOpDef (nt::NetworkManager *network, op::OpInfo opInfo)
 Sets up internal state.
 
virtual void cookOp (op::Context context)=0
 This function is called at runtime to create the output geometry.
 
geo::GeometrygetOutputGeo (unsigned outputIndex)
 Returns the current output geometry.
 
void throwError (std::string error)
 Stops the cook and displays an error. Use inside the cookOp function.
 
unsigned int getMinInputs () const
 Returns the minimum number of input connections required for the node to function. Set by op::OpInfo when registering the operator.
 
unsigned int getMaxInputs () const
 Returns the maximum number of input connections accepted by the node. Set by op::OpInfo when registering the operator.
 
unsigned int getMaxOutputs () const
 Returns the number of available outputs the node provides. Set by op::OpInfo when registering the operator.
 

Protected Member Functions

bool outputRequested (unsigned int outputIndex)
 
void setOutputGeometry (unsigned int outputIndex, enzo::geo::Geometry geometry)
 

Protected Attributes

const op::OpInfo opInfo_
 
nt::NetworkManagernetwork_
 

Detailed Description

Abstract class used to create new operators.

The operator definition is a base class from which new geometry operators are inherited from. It provides and abstracted interface, to read and write data about itself and the context it is being computed.

The class exposes utility functions for setting outputs and reading information about itself like the number of inputs.

The most important part of this node is the virtual cookOp member function. This must be overridden to implement the node's logic when being cooked. When a node is cooked it takes the optional input geometry from the context class and outputs new geometry based on the purpose of that operator.

Member Function Documentation

◆ cookOp()

virtual void enzo::nt::GeometryOpDef::cookOp ( op::Context context)
pure virtual

This function is called at runtime to create the output geometry.

Postcondition
When overriding, this function must call setOutputGeo(n) at the end of a successful cook. Any outputs that are not set will output an emtpy geometry object.

◆ getOutputGeo()

enzo::geo::Geometry & enzo::nt::GeometryOpDef::getOutputGeo ( unsigned outputIndex)

Returns the current output geometry.

For use by the runtime Node Does not force a cook.

Todo
move to friend class Node

◆ throwError()

void enzo::nt::GeometryOpDef::throwError ( std::string error)

Stops the cook and displays an error. Use inside the cookOp function.

Todo
Add visual error to GUI

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