Back

Indices2ValuesMapper

The `Indices2ValuesMapper` is a SOFA engine component designed to map input indices to corresponding values, producing an output vector of mapped values. It inherits from the `DataEngine` class and operates within the `sofa::component::engine::transform` namespace. The primary purpose of this mapper is to handle mappings between index lists and value lists, with options for default values when certain indices do not have associated input values. **Interactions with Other Components:** - It interacts with other SOFA components through its public methods: `init`, `reinit`, and `doUpdate`. These methods are virtual and can be overridden by derived classes if needed. - The component relies on data fields such as `f_inputValues` (existing values), `f_indices` (indices to map values onto), and `f_values` (values corresponding to indices). It also maintains an output field, `f_outputValues`, which holds the final mapped values. **Practical Usage Guidance:** - The `p_defaultValue` data field allows setting a default value for any indices that do not have a specific value defined. This ensures all output indices are assigned a meaningful value. - The component is typically used to transform index-value pairs into a continuous vector representation, useful in various computational simulations where indexed values need to be mapped onto a predefined set of points.

abstract
The `Indices2ValuesMapper` maps input indices to corresponding values, generating a continuous vector representation of indexed properties for use in SOFA simulations.
sheet
# Indices2ValuesMapper ## Overview The `Indices2ValuesMapper` is an engine component within the SOFA framework designed to handle mappings between index lists and value lists. It inherits from the `DataEngine` class and operates within the `sofa::component::engine::transform` namespace. ## Parameters and Data - **p_defaultValue**: A scalar value that serves as a default for indices without specific values defined in the input list. The type is `Real`, and its default value is 1.0. ## Practical Notes The component ensures all output indices are assigned meaningful values by using the specified default value when necessary. It is typically used to transform index-value pairs into a continuous vector representation, useful for various computational simulations where indexed properties need to be mapped onto predefined points.
description
The `Indices2ValuesMapper` is a SOFA engine component designed to map input indices to corresponding values, producing an output vector of mapped values. It inherits from the `DataEngine` class and operates within the `sofa::component::engine::transform` namespace. The primary purpose of this mapper is to handle mappings between index lists and value lists, with options for default values when certain indices do not have associated input values. **Interactions with Other Components:** - It interacts with other SOFA components through its public methods: `init`, `reinit`, and `doUpdate`. These methods are virtual and can be overridden by derived classes if needed. - The component relies on data fields such as `f_inputValues` (existing values), `f_indices` (indices to map values onto), and `f_values` (values corresponding to indices). It also maintains an output field, `f_outputValues`, which holds the final mapped values. **Practical Usage Guidance:** - The `p_defaultValue` data field allows setting a default value for any indices that do not have a specific value defined. This ensures all output indices are assigned a meaningful value. - The component is typically used to transform index-value pairs into a continuous vector representation, useful in various computational simulations where indexed values need to be mapped onto a predefined set of points.
maths
The `Indices2ValuesMapper` is an engine component within the SOFA framework designed to handle mappings between index lists and value lists. This mapper takes as input a list of indices, a corresponding list of values, and existing values (which can be empty), and produces an output vector of mapped values. The component also allows specifying a default value for any indices that do not have a specific value defined in the input list. ### Mathematical Description #### Input Data Fields: - **f_inputValues**: A vector of `Real` values representing existing values, which can be empty. \[ \mathbf{v}_{input} = [v_{1}, v_{2}, \ldots, v_{N}] \] - **f_indices**: A vector of `Real` indices that will map onto the output values. \[ \mathbf{i} = [i_{1}, i_{2}, \ldots, i_{M}] \] - **f_values**: A vector of `Real` values corresponding to each index in `f_indices`. \[ \mathbf{v}_{indices} = [w_{1}, w_{2}, \ldots, w_{M}] \] #### Output Data Fields: - **f_outputValues**: A vector of `Real` values representing the final mapped output values. \[ \mathbf{v}_{output} = [y_{1}, y_{2}, \ldots, y_{N}] \] #### Default Value Parameter: - **p_defaultValue**: A scalar value that is used for indices without a specific mapping defined in `f_indices` and `f_values`. The default value is set to 1.0. \[ v_{default} = p_{defaultValue} \] ### Mapping Process: The component performs the following steps during its `doUpdate` method: 1. **Initialization**: Clear the output values vector and resize it to match the size of `f_inputValues`. \[ |\mathbf{v}_{output}| = N \] 2. **Mapping Loop**: For each index in `f_inputValues`, search for a corresponding value in `f_indices` and `f_values`. If found, assign the corresponding value from `f_values`; otherwise, use the default value. \[ y_i = \begin{cases} w_j & \text{if } i_k = i_{indices} \text{ for some } k, j \\ v_{default} & \text{otherwise} \end{cases} \] 3. **Output**: The resulting `f_outputValues` vector contains the mapped values. \[ \mathbf{v}_{output} = [y_1, y_2, \ldots, y_N] \] ### Role in FEM Pipeline: The `Indices2ValuesMapper` component does not directly contribute to the governing equations or operators of a typical FEM simulation pipeline. Instead, it serves as an auxiliary tool for data transformation and preprocessing. Specifically, this mapper can be used to map indexed properties (such as material parameters, boundary conditions, etc.) onto a continuous vector representation that is required by other components in the SOFA framework. ### Numerical Methods and Discretization Choices: The component does not encode any specific numerical methods or discretization choices related to FEM. It operates on discrete data structures (vectors of indices and values) and performs a simple search-based mapping operation. ### Variational / Lagrangian Mechanics Framework: The `Indices2ValuesMapper` is not directly involved in the variational formulation, weak form derivation, or any other aspect of the Lagrangian mechanics framework. Its primary function is to handle data transformation, which can be useful for preparing input data for subsequent FEM operations. ### Conclusion: The `Indices2ValuesMapper` is a utility component designed to map indices to values and is not involved in the core mathematical or physical aspects of finite element simulations. It plays an auxiliary role in ensuring that indexed properties are correctly mapped onto continuous representations required by other SOFA components.
{
  "name": "Indices2ValuesMapper",
  "main": {
    "name": "Indices2ValuesMapper",
    "namespace": "sofa::component::engine::transform",
    "module": "Sofa.Component.Engine.Transform",
    "include": "sofa/component/engine/transform/Indices2ValuesMapper.h",
    "doc": "Input multiple values to output values mapper. Includes indices rules, such as replacement, resize.",
    "inherits": [
      "DataEngine"
    ],
    "templates": [
      "sofa::defaulttype::Vec3Types"
    ],
    "data_fields": [
      {
        "name": "p_defaultValue",
        "type": "Real",
        "xmlname": "defaultValue",
        "help": "Default value for indices without any value"
      }
    ],
    "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"
      }
    ]
  },
  "desc": {
    "description": "The `Indices2ValuesMapper` is a SOFA engine component designed to map input indices to corresponding values, producing an output vector of mapped values. It inherits from the `DataEngine` class and operates within the `sofa::component::engine::transform` namespace. The primary purpose of this mapper is to handle mappings between index lists and value lists, with options for default values when certain indices do not have associated input values.\n\n**Interactions with Other Components:**\n- It interacts with other SOFA components through its public methods: `init`, `reinit`, and `doUpdate`. These methods are virtual and can be overridden by derived classes if needed.\n- The component relies on data fields such as `f_inputValues` (existing values), `f_indices` (indices to map values onto), and `f_values` (values corresponding to indices). It also maintains an output field, `f_outputValues`, which holds the final mapped values.\n\n**Practical Usage Guidance:**\n- The `p_defaultValue` data field allows setting a default value for any indices that do not have a specific value defined. This ensures all output indices are assigned a meaningful value.\n- The component is typically used to transform index-value pairs into a continuous vector representation, useful in various computational simulations where indexed values need to be mapped onto a predefined set of points."
  },
  "maths": {
    "maths": "The `Indices2ValuesMapper` is an engine component within the SOFA framework designed to handle mappings between index lists and value lists. This mapper takes as input a list of indices, a corresponding list of values, and existing values (which can be empty), and produces an output vector of mapped values. The component also allows specifying a default value for any indices that do not have a specific value defined in the input list.\n\n### Mathematical Description\n\n#### Input Data Fields:\n- **f_inputValues**: A vector of `Real` values representing existing values, which can be empty.\n  \n    \\[ \\mathbf{v}_{input} = [v_{1}, v_{2}, \\ldots, v_{N}] \\]\n\n- **f_indices**: A vector of `Real` indices that will map onto the output values.\n  \n    \\[ \\mathbf{i} = [i_{1}, i_{2}, \\ldots, i_{M}] \\]\n\n- **f_values**: A vector of `Real` values corresponding to each index in `f_indices`.\n  \n    \\[ \\mathbf{v}_{indices} = [w_{1}, w_{2}, \\ldots, w_{M}] \\]\n\n#### Output Data Fields:\n- **f_outputValues**: A vector of `Real` values representing the final mapped output values.\n  \n    \\[ \\mathbf{v}_{output} = [y_{1}, y_{2}, \\ldots, y_{N}] \\]\n\n#### Default Value Parameter:\n- **p_defaultValue**: A scalar value that is used for indices without a specific mapping defined in `f_indices` and `f_values`. The default value is set to 1.0.\n  \n    \\[ v_{default} = p_{defaultValue} \\]\n\n### Mapping Process:\nThe component performs the following steps during its `doUpdate` method:\n\n1. **Initialization**: Clear the output values vector and resize it to match the size of `f_inputValues`.\n  \n    \\[ |\\mathbf{v}_{output}| = N \\]\n\n2. **Mapping Loop**: For each index in `f_inputValues`, search for a corresponding value in `f_indices` and `f_values`. If found, assign the corresponding value from `f_values`; otherwise, use the default value.\n  \n    \\[\n        y_i =\n            \\begin{cases}\n                w_j & \\text{if } i_k = i_{indices} \\text{ for some } k, j \\\\\n                v_{default} & \\text{otherwise}\n            \\end{cases}\n    \\]\n\n3. **Output**: The resulting `f_outputValues` vector contains the mapped values.\n  \n    \\[ \\mathbf{v}_{output} = [y_1, y_2, \\ldots, y_N] \\]\n\n### Role in FEM Pipeline:\nThe `Indices2ValuesMapper` component does not directly contribute to the governing equations or operators of a typical FEM simulation pipeline. Instead, it serves as an auxiliary tool for data transformation and preprocessing. Specifically, this mapper can be used to map indexed properties (such as material parameters, boundary conditions, etc.) onto a continuous vector representation that is required by other components in the SOFA framework.\n\n### Numerical Methods and Discretization Choices:\nThe component does not encode any specific numerical methods or discretization choices related to FEM. It operates on discrete data structures (vectors of indices and values) and performs a simple search-based mapping operation.\n\n### Variational / Lagrangian Mechanics Framework:\nThe `Indices2ValuesMapper` is not directly involved in the variational formulation, weak form derivation, or any other aspect of the Lagrangian mechanics framework. Its primary function is to handle data transformation, which can be useful for preparing input data for subsequent FEM operations.\n\n### Conclusion:\nThe `Indices2ValuesMapper` is a utility component designed to map indices to values and is not involved in the core mathematical or physical aspects of finite element simulations. It plays an auxiliary role in ensuring that indexed properties are correctly mapped onto continuous representations required by other SOFA components."
  },
  "summary": {
    "abstract": "The `Indices2ValuesMapper` maps input indices to corresponding values, generating a continuous vector representation of indexed properties for use in SOFA simulations.",
    "sheet": "# Indices2ValuesMapper\n\n## Overview\n\nThe `Indices2ValuesMapper` is an engine component within the SOFA framework designed to handle mappings between index lists and value lists. It inherits from the `DataEngine` class and operates within the `sofa::component::engine::transform` namespace.\n\n## Parameters and Data\n\n- **p_defaultValue**: A scalar value that serves as a default for indices without specific values defined in the input list. The type is `Real`, and its default value is 1.0.\n\n## Practical Notes\n\nThe component ensures all output indices are assigned meaningful values by using the specified default value when necessary. It is typically used to transform index-value pairs into a continuous vector representation, useful for various computational simulations where indexed properties need to be mapped onto predefined points."
  }
}