.. _ogn_tutorial_simple_ogn_compute_vectorized_node:

Tutorial 28 - Node with simple OGN computeVectorized
====================================================

This tutorial demonstrates how to compose nodes that implements a very simple computeVectorized function. It shows how to access the data,
using the different available methods.

OgnTutorialVectorizedPassthrough.ogn
------------------------------------
The *ogn* file shows the implementation of a node named "omni.graph.tutorials.TutorialVectorizedPassThrough", which takes input
of a floating point value, and just copy it to its output.

.. literalinclude:: ../../../../../source/extensions/omni.graph.tutorials/tutorials/tutorial28/OgnTutorialVectorizedPassthrough.ogn
    :linenos:
    :language: json

OgnTutorialVectorizedPassthrough.cpp
------------------------------------
The *cpp* file contains the implementation of the node. It takes a floating point input and just copy it to its output,
demonstrating how to handle a vectorized compute. It shows what would be the implementation for a regular `compute` function,
and the different way it could implement a `computeVectorized` function.
- method #1: by switching the entire database to the next instance, while performing the computation in a loop  
- method #2: by directly indexing attributes for the right instance in a loop  
- method #3: by retrieving the raw data, and working directly with it  

.. literalinclude:: ../../../../../source/extensions/omni.graph.tutorials/tutorials/tutorial28/OgnTutorialVectorizedPassthrough.cpp
    :linenos:
    :language: c++
