Back

NormEngine

sofa::component::engine::generate::NormEngine
DataEngine
Doc (from source)

Convert Vec in Real convert a vector of Vecs in a vector of their l-norms

Abstract (AI generated)

The NormEngine component computes the l-norms of vectors from an input array, generating an output array of scalar norms based on a specified norm type.

Metadata
module
Sofa.Component.Engine.Generate
namespace
sofa::component::engine::generate
include
sofa/component/engine/generate/NormEngine.h
inherits
  • DataEngine
templates
  • type::Vec3
description

Mathematical Description

The NormEngine component in the SOFA framework is designed to compute norms (magnitudes) of vectors from an input array and generate an output array of these scalar values. The specific norm used can be specified via the normType parameter, allowing for different types of norms.

Norm Definitions

  • l-norms: For a given vector $ extbf{v} = (v_1, v_2, extellipsis, v_n)$, the l-norm is defined as:
  • For positive integer $p > 0$:
    $$ || extbf{v}||_p = igg(ig|v_1ig|^p + ig|v_2ig|^p + extellipsis + ig|v_nig|^pigg)^{ rac{1}{p}} $$
  • For $p ightarrow ext{infinity}$ (or a negative value for normType):
    $$ || extbf{v}||_{ ext{inf}} = ext{max}ig(ig|v_1ig|, ig|v_2ig|, extellipsis, ig|v_nig|ig) $$

Data Fields and Operations

  • Input: The input is an array of vectors represented as VecData (type::vector). Each vector in the array has a specific dimensionality (e.g., 3D points).
  • Output: The output is an array of scalar norms represented as VecReal (type::vector). For each input vector $ extbf{v}_i$, the corresponding norm value is computed and stored.

Workflow

  1. Initialization:
  2. The component initializes its data fields (d_input, d_output, d_normType).
  3. Update Process:
  4. During the doUpdate() method, it processes each vector in the input array using the specified norm type.
  5. For each vector $ extbf{v}_i$ in the input array, the corresponding scalar norm value is computed as follows:
    $$ ext{norm} = || extbf{v}_i||_p $$
    where $p$ can be any positive integer or a negative value for the infinite norm.
  6. The computed norms are stored in the d_output array, resulting in an array of scalar values.

Role in FEM Pipeline

  • Role: This component is purely computational and does not directly contribute to any governing equations (such as mass matrix $M$, stiffness matrix $K$, internal forces $f_{ ext{int}}$, residual $R$) or the nonlinear/linear solve stages of a typical FEM pipeline.
  • Purpose: It serves as an auxiliary tool for post-processing, providing scalar norm values from vector data. This can be useful in various analyses and diagnostics within simulations.

Numerical Methods

The component employs standard mathematical operations to compute norms, which are fundamental in linear algebra and do not involve advanced numerical methods or discretization techniques specific to FEM.

Variational / Lagrangian Mechanics Framework

  • Relevance: The NormEngine does not directly fit into the variational/Lagrangian mechanics framework as it performs basic vector norm computations rather than solving equations of motion, constraints, or any other aspects related to continuum mechanics.
Data Fields
NameTypeDefaultHelp
d_input VecData input array of 3d points
d_output VecReal output array of scalar norms
d_normType int The type of norm. Use a negative value for the infinite norm.
Methods
void init () virtual
void reinit () virtual
void doUpdate () virtual
{
  "name": "NormEngine",
  "namespace": "sofa::component::engine::generate",
  "module": "Sofa.Component.Engine.Generate",
  "include": "sofa/component/engine/generate/NormEngine.h",
  "doc": "Convert Vec in Real\n\nconvert a vector of Vecs in a vector of their l-norms",
  "inherits": [
    "DataEngine"
  ],
  "templates": [
    "type::Vec3"
  ],
  "data_fields": [
    {
      "name": "d_input",
      "type": "VecData",
      "xmlname": "input",
      "help": "input array of 3d points"
    },
    {
      "name": "d_output",
      "type": "VecReal",
      "xmlname": "output",
      "help": "output array of scalar norms"
    },
    {
      "name": "d_normType",
      "type": "int",
      "xmlname": "normType",
      "help": "The type of norm. Use a negative value for the infinite norm."
    }
  ],
  "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": "public"
    }
  ],
  "description": "The `NormEngine` component is part of the Sofa.Component.Engine.Generate module and converts an array of vectors (Vecs) into their respective l-norm values, resulting in an array of scalar norms. This component inherits from `DataEngine`, which enables it to function as a data processing node within SOFA's scenegraph architecture.\n\n### Role and Purpose\n`NormEngine` is designed to compute the norm (magnitude) of each vector in a given input array and produce an output array containing these scalar values. It supports different types of norms, specified via the `normType` parameter, which can be adjusted for various use cases.\n\n### Interactions with Other Components\n- **Input:** The component takes an input array of 3D points (`VecData`) as its primary data field (`d_input`).\n- **Output:** It generates an output array of scalar norms (`VecReal`), stored in the `d_output` data field.\n- **Norm Type:** A parameter (`normType`) defines which norm to compute. The type can be set using a negative value for the infinite norm, or positive values for other l-norms.\n\n### Practical Usage Guidance and Data Fields\n- `input`: The input array of 3D points is provided via the `d_input` data field.\n- `output`: The resulting scalar norms are stored in the `d_output` data field after processing.\n- `normType`: Specifies the type of norm to compute, allowing for flexibility in how vector magnitudes are calculated. Negative values can be used for infinite norms.",
  "maths": "### Mathematical Description\n\nThe `NormEngine` component in the SOFA framework is designed to compute norms (magnitudes) of vectors from an input array and generate an output array of these scalar values. The specific norm used can be specified via the `normType` parameter, allowing for different types of norms.\n\n#### Norm Definitions\n- **l-norms**: For a given vector \\(\textbf{v} = (v_1, v_2, \textellipsis, v_n)\\), the l-norm is defined as:\n  - For positive integer \\(p > 0\\):\n    \\[ ||\textbf{v}||_p = \bigg(\big|v_1\big|^p + \big|v_2\big|^p + \textellipsis + \big|v_n\big|^p\bigg)^{\frac{1}{p}} \\]\n  - For \\(p \rightarrow \text{infinity}\\) (or a negative value for `normType`):\n    \\[ ||\textbf{v}||_{\text{inf}} = \text{max}\big(\big|v_1\big|, \big|v_2\big|, \textellipsis, \big|v_n\big|\big) \\]\n\n#### Data Fields and Operations\n- **Input**: The input is an array of vectors represented as `VecData` (type::vector<DataType>). Each vector in the array has a specific dimensionality (e.g., 3D points).\n- **Output**: The output is an array of scalar norms represented as `VecReal` (type::vector<Real>). For each input vector \\(\textbf{v}_i\\), the corresponding norm value is computed and stored.\n\n#### Workflow\n1. **Initialization**:\n   - The component initializes its data fields (`d_input`, `d_output`, `d_normType`).\n2. **Update Process**:\n   - During the `doUpdate()` method, it processes each vector in the input array using the specified norm type.\n   - For each vector \\(\textbf{v}_i\\) in the input array, the corresponding scalar norm value is computed as follows:\n     \\[ \text{norm} = ||\textbf{v}_i||_p \\]\n     where \\(p\\) can be any positive integer or a negative value for the infinite norm.\n   - The computed norms are stored in the `d_output` array, resulting in an array of scalar values.\n\n#### Role in FEM Pipeline\n- **Role**: This component is purely computational and does not directly contribute to any governing equations (such as mass matrix \\(M\\), stiffness matrix \\(K\\), internal forces \\(f_{\text{int}}\\), residual \\(R\\)) or the nonlinear/linear solve stages of a typical FEM pipeline.\n- **Purpose**: It serves as an auxiliary tool for post-processing, providing scalar norm values from vector data. This can be useful in various analyses and diagnostics within simulations.\n\n#### Numerical Methods\nThe component employs standard mathematical operations to compute norms, which are fundamental in linear algebra and do not involve advanced numerical methods or discretization techniques specific to FEM.\n\n### Variational / Lagrangian Mechanics Framework\n- **Relevance**: The `NormEngine` does not directly fit into the variational/Lagrangian mechanics framework as it performs basic vector norm computations rather than solving equations of motion, constraints, or any other aspects related to continuum mechanics.\n",
  "abstract": "The NormEngine component computes the l-norms of vectors from an input array, generating an output array of scalar norms based on a specified norm type.",
  "sheet": "# NormEngine\n\n**Overview:**\nNormEngine is part of the Sofa.Component.Engine.Generate module and inherits from `DataEngine`. It processes an array of vectors to compute their respective l-norms, producing an output array of scalar values. The component supports different types of norms specified via the `normType` parameter.\n\n**Mathematical Model:**\nThe NormEngine computes the norm (magnitude) of each vector in a given input array and produces an output array containing these scalar values. The specific norm used can be specified via the `normType` parameter, allowing for different types of norms.\n\n#### Norm Definitions\n- **l-norms**: For a given vector \\(\\mathbf{v} = (v_1, v_2, \\dots, v_n)\\), the l-norm is defined as:\n  - For positive integer \\(p > 0\\):\n    \\[ ||\\mathbf{v}||_p = \\bigg(|v_1|^p + |v_2|^p + \\dots + |v_n|^p\\bigg)^{\\frac{1}{p}} \\]\n  - For \\(p \\rightarrow \\infty\\) (or a negative value for `normType`):\n    \\[ ||\\mathbf{v}||_{\\infty} = \\max(|v_1|, |v_2|, \\dots, |v_n|) \\]\n\n**Parameters and Data:**\nThe component exposes the following significant data fields:\n- **input (`d_input`)**: The input array of 3D points (type `VecData`).\n- **output (`d_output`)**: The output array of scalar norms (type `VecReal`).\n- **normType (`d_normType`)**: Specifies the type of norm to compute. Use a negative value for the infinite norm.\n\n**Dependencies and Connections:**\nThe NormEngine component is fully standalone and does not require any other SOFA components or data exchanges within the scene graph."
}