Back

ExampleEngine

sofa::component::engine::ExampleEngine
DataEngine
Doc (from source)

Example Engine Template Engine as example

Abstract (AI generated)

The ExampleEngine is an example template engine that translates input 3D point positions along the x-axis by 20 units to produce output positions.

Metadata
module
SofaTestPlugin
namespace
sofa::component::engine
include
engine/ExampleEngine.h
inherits
  • DataEngine
templates
  • sofa::defaulttype::Vec3Types
description

The ExampleEngine is an example template engine that demonstrates the usage of engines in the SOFA framework. It operates on 3D points (Vec3Types) and provides a simple transformation by translating input positions along the x-axis by a fixed amount (20 units). The component has two primary data fields:

  • input_position (f_inputX): This field represents an array of 3D points, denoted as $ extbf{P}_{ ext{in}} = egin{pmatrix} P_{1, ext{x}} & P_{1, ext{y}} & P_{1, ext{z}} \\ P_{2, ext{x}} & P_{2, ext{y}} & P_{2, ext{z}} \\ \vdots & \vdots & \vdots \\ P_{n, ext{x}} & P_{n, ext{y}} & P_{n, ext{z}} \end{pmatrix} $.
  • output_position (f_outputX): This field represents the transformed array of 3D points, denoted as $ extbf{P}_{ ext{out}} = \begin{pmatrix} P'_{1, ext{x}} & P'_{1, ext{y}} & P'_{1, ext{z}} \\ P'_{2, ext{x}} & P'_{2, ext{y}} & P'_{2, ext{z}} \\ \vdots & \vdots & \vdots \\ P'_{n, ext{x}} & P'_{n, ext{y}} & P'_{n, ext{z}} \end{pmatrix} $.

The transformation performed by the doUpdate method is given by:

$ M $

for each input point $ K $.

The init and klzzwxh:0005 methods are placeholders for initialization logic, while the klzzwxh:0006 method performs the actual transformation. This component fits into the broader variational/Lagrangian mechanics framework as a simple data processing engine that transforms input positions to output positions.

In summary, this component does not contribute directly to any governing equations or operators such as mass matrix $ M $, stiffness matrix $ K $, internal force $ f_{\text{int}} $, residual $ R $, etc. Instead, it serves as an example of how engines in SOFA can be used for simple transformations or more complex computations on input data to generate output.

Data Fields
NameTypeDefaultHelp
f_inputX VecCoord input array of 3d points
f_outputX VecCoord output array of 3d points
Methods
void init () virtual
void reinit () virtual
void doUpdate () virtual
{
  "name": "ExampleEngine",
  "namespace": "sofa::component::engine",
  "module": "SofaTestPlugin",
  "include": "engine/ExampleEngine.h",
  "doc": "Example Engine\n\nTemplate Engine as example",
  "inherits": [
    "DataEngine"
  ],
  "templates": [
    "sofa::defaulttype::Vec3Types"
  ],
  "data_fields": [
    {
      "name": "f_inputX",
      "type": "VecCoord",
      "xmlname": "input_position",
      "help": "input array of 3d points"
    },
    {
      "name": "f_outputX",
      "type": "VecCoord",
      "xmlname": "output_position",
      "help": "output array of 3d points"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "reinit",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "doUpdate",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    }
  ],
  "description": "The `ExampleEngine` is an example template engine that demonstrates the usage of engines in the SOFA framework, specifically within the SofaTestPlugin module. It inherits from the `DataEngine` class and operates on 3D points (`Vec3Types`).\n\nThis component provides functionality to transform input positions by translating them along the x-axis by a fixed amount (20 units). The engine has two primary data fields:\n- **input_position** (`f_inputX`): Input array of 3D points.\n- **output_position** (`f_outputX`): Output array of 3D points, which is the transformed version of the input positions.\n\nThe component interacts with other SOFA components through its initialization and update methods:\n- `init`: Initializes the engine.\n- `reinit`: Reinitializes the engine and triggers an update.\n- `doUpdate`: Performs the actual transformation on the input data to produce the output.\n\nThis example demonstrates how engines in SOFA can be used for simple transformations or more complex computations, where input data is processed to generate output. It showcases the basic structure of a templated engine within the framework.",
  "maths": "The `ExampleEngine` is an example template engine that demonstrates the usage of engines in the SOFA framework. It operates on 3D points (`Vec3Types`) and provides a simple transformation by translating input positions along the x-axis by a fixed amount (20 units). The component has two primary data fields:\n\n- **input_position** (`f_inputX`): This field represents an array of 3D points, denoted as \\( \textbf{P}_{\text{in}} = \begin{pmatrix} P_{1,\text{x}} & P_{1,\text{y}} & P_{1,\text{z}} \\\\ P_{2,\text{x}} & P_{2,\text{y}} & P_{2,\text{z}} \\\\ \\vdots & \\vdots & \\vdots \\\\ P_{n,\text{x}} & P_{n,\text{y}} & P_{n,\text{z}} \\end{pmatrix} \\).\n- **output_position** (`f_outputX`): This field represents the transformed array of 3D points, denoted as \\( \textbf{P}_{\text{out}} = \\begin{pmatrix} P'_{1,\text{x}} & P'_{1,\text{y}} & P'_{1,\text{z}} \\\\ P'_{2,\text{x}} & P'_{2,\text{y}} & P'_{2,\text{z}} \\\\ \\vdots & \\vdots & \\vdots \\\\ P'_{n,\text{x}} & P'_{n,\text{y}} & P'_{n,\text{z}} \\end{pmatrix} \\).\n\nThe transformation performed by the `doUpdate` method is given by:\n\\[ P'_{i,\text{x}} = P_{i,\text{x}} + 20, \\quad P'_{i,\text{y}} = P_{i,\text{y}}, \\quad P'_{i,\text{z}} = P_{i,\text{z}}, \\]\nfor each input point \\( \textbf{P}_i = (P_{i,\text{x}}, P_{i,\text{y}}, P_{i,\text{z}}) \\).\n\nThe `init` and `reinit` methods are placeholders for initialization logic, while the `doUpdate` method performs the actual transformation. This component fits into the broader variational/Lagrangian mechanics framework as a simple data processing engine that transforms input positions to output positions.\n\nIn summary, this component does not contribute directly to any governing equations or operators such as mass matrix \\( M \\), stiffness matrix \\( K \\), internal force \\( f_{\\text{int}} \\), residual \\( R \\), etc. Instead, it serves as an example of how engines in SOFA can be used for simple transformations or more complex computations on input data to generate output.",
  "abstract": "The ExampleEngine is an example template engine that translates input 3D point positions along the x-axis by 20 units to produce output positions.",
  "sheet": "<h1>ExampleEngine</h1>\n\n<h2>Overview</h2>\n<p>The `ExampleEngine` is a demonstration component within the SofaTestPlugin module, inheriting from `DataEngine`. It processes input arrays of 3D points and translates them along the x-axis by 20 units to generate output positions.</p>\n\n<h2>Parameters and Data</h2>\n<p>The significant data fields are:</p>\n<ul>\n<li><strong>input_position (f_inputX)</strong>: Input array of 3D points, denoted as \\(\\mathbf{P}_{\\text{in}} = \\begin{pmatrix} P_{1,x} & P_{1,y} & P_{1,z} \\\\ P_{2,x} & P_{2,y} & P_{2,z} \\\\ \\vdots & \\vdots & \\vdots \\\\ P_{n,x} & P_{n,y} & P_{n,z} \\end{pmatrix}\\).</li>\n<li><strong>output_position (f_outputX)</strong>: Output array of 3D points, denoted as \\(\\mathbf{P}_{\\text{out}} = \\begin{pmatrix} P'_{1,x} & P'_{1,y} & P'_{1,z} \\\\ P'_{2,x} & P'_{2,y} & P'_{2,z} \\\\ \\vdots & \\vdots & \\vdots \\\\ P'_{n,x} & P'_{n,y} & P'_{n,z} \\end{pmatrix}\\).</li>\n</ul>\n\n<h2>Mathematical Model</h2>\n<p>The transformation performed by the `doUpdate` method is given by:</p>\n\\[P'_{i,x} = P_{i,x} + 20, \\quad P'_{i,y} = P_{i,y}, \\quad P'_{i,z} = P_{i,z}\\]\n<p>for each input point \\(\\mathbf{P}_i = (P_{i,x}, P_{i,y}, P_{i,z})\\).</p>"
}