Back

MergeSets

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

Merge two sets of indices using specified boolean operation. This class merge 2 coordinate vectors.

Abstract (AI generated)

`MergeSets` performs boolean operations (union, intersection, difference, symmetric_difference) on two sets of indices and outputs a merged set.

Metadata
module
Sofa.Component.Engine.Generate
namespace
sofa::component::engine::generate
include
sofa/component/engine/generate/MergeSets.h
inherits
  • DataEngine
templates
  • int
  • unsigned int
description

The MergeSets component in the SOFA framework is designed to perform boolean operations on two sets of indices, resulting in a merged set. This component does not directly contribute to the core mathematical and physical models used in FEM simulation (such as mass matrices, stiffness matrices, or internal forces). Instead, it provides functionality for manipulating index sets, which can be useful in various stages of the FEM pipeline where indexing is necessary (e.g., when defining subsets of nodes for boundary conditions, constraints, or other operations that require set manipulations).

Governing Equations and Operators

The MergeSets component does not implement any governing equations from continuum mechanics or variational principles. Its primary function is to perform boolean operations on sets, which are discrete in nature.

  • Union: The union of two sets $A$ and $B$, denoted as $A igcup B$, is the set that contains all elements from both sets without duplicates.
$$ A igcup B = \{ x : x ext{ in } A ext{ or } x ext{ in } B \} $$
  • Intersection: The intersection of two sets $A$ and $B$, denoted as $A igcap B$, is the set that contains all elements common to both sets.
$$ A igcap B = \{ x : x ext{ in } A ext{ and } x ext{ in } B \} $$
  • Difference: The difference of two sets $A$ and $B$, denoted as $A - B$, is the set that contains all elements from $A$ that are not in $B$.
$$ A - B = \{ x : x ext{ in } A ext{ and } x ext{ not in } B \} $$
  • Symmetric Difference: The symmetric difference of two sets $A$ and $B$, denoted as $A igtriangleup B$, is the set that contains elements from either $A$ or $B$ but not both.
$$ A igtriangleup B = (A - B) igcup (B - A) $$

Role in FEM Pipeline

  • Assembly Phase: During the assembly phase, when constructing global matrices and vectors, it may be necessary to merge or intersect index sets. For example, if certain nodes are subject to multiple boundary conditions, MergeSets can help manage these subsets.

  • Constraint Handling: Constraints often involve specific subsets of degrees-of-freedom (DOFs). MergeSets can help in defining and manipulating the indices corresponding to constrained DOFs.

Numerical Methods or Discretization Choices

The component does not implement any numerical methods from discretization schemes used in FEM, such as spatial discretization with shape functions, numerical integration using Gauss quadrature, time discretization with implicit Euler, etc. Instead, it performs set operations which are purely logical and do not involve numerical approximation.

Fit into the Variational/Lagrangian Mechanics Framework

  • MergeSets does not directly fit into the variational or Lagrangian mechanics framework as it is a utility component for index manipulation rather than for solving physical equations. However, its operations can indirectly support various stages of the FEM simulation pipeline where set operations on indices are required.

Summary

The MergeSets component is a utility in the SOFA framework that performs boolean operations (union, intersection, difference, symmetric_difference) on index sets. It does not contribute to core mathematical or physical models but provides essential functionality for managing subsets of nodes during various stages of FEM simulations.

Data Fields
NameTypeDefaultHelp
f_in1 VecIndex first set of indices
f_in2 VecIndex second set of indices
f_out VecIndex merged set of indices
Methods
void init () virtual
void reinit () virtual
void doUpdate () virtual
{
  "name": "MergeSets",
  "namespace": "sofa::component::engine::generate",
  "module": "Sofa.Component.Engine.Generate",
  "include": "sofa/component/engine/generate/MergeSets.h",
  "doc": "Merge two sets of indices using specified boolean operation.\n\nThis class merge 2 coordinate vectors.",
  "inherits": [
    "DataEngine"
  ],
  "templates": [
    "int",
    "unsigned int"
  ],
  "data_fields": [
    {
      "name": "f_in1",
      "type": "VecIndex",
      "xmlname": "in1",
      "help": "first set of indices"
    },
    {
      "name": "f_in2",
      "type": "VecIndex",
      "xmlname": "in2",
      "help": "second set of indices"
    },
    {
      "name": "f_out",
      "type": "VecIndex",
      "xmlname": "out",
      "help": "merged set of indices"
    }
  ],
  "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 `MergeSets` component in the SOFA framework merges two sets of indices using specified boolean operations (union, intersection, difference, symmetric_difference). It is part of the `Sofa.Component.Engine.Generate` module and inherits from `DataEngine`. This component takes two input data fields (`f_in1`, `f_in2`) representing the first and second set of indices respectively, and produces an output field (`f_out`) containing the merged set of indices based on the specified operation (`f_op`). The operations are defined as strings ('union', 'intersection', 'difference', or 'symmetric_difference') and can be configured in the component's parameters. `MergeSets` supports both integer and unsigned integer index types.",
  "maths": "The `MergeSets` component in the SOFA framework is designed to perform boolean operations on two sets of indices, resulting in a merged set. This component does not directly contribute to the core mathematical and physical models used in FEM simulation (such as mass matrices, stiffness matrices, or internal forces). Instead, it provides functionality for manipulating index sets, which can be useful in various stages of the FEM pipeline where indexing is necessary (e.g., when defining subsets of nodes for boundary conditions, constraints, or other operations that require set manipulations).\n\n### Governing Equations and Operators\nThe `MergeSets` component does not implement any governing equations from continuum mechanics or variational principles. Its primary function is to perform boolean operations on sets, which are discrete in nature.\n\n- **Union**: The union of two sets \\(A\\) and \\(B\\), denoted as \\(A \bigcup B\\), is the set that contains all elements from both sets without duplicates.\n  \n  \n  \\[ A \bigcup B = \\{ x : x \text{ in } A \text{ or } x \text{ in } B \\} \\]\n\n- **Intersection**: The intersection of two sets \\(A\\) and \\(B\\), denoted as \\(A \bigcap B\\), is the set that contains all elements common to both sets.\n  \n  \\[ A \bigcap B = \\{ x : x \text{ in } A \text{ and } x \text{ in } B \\} \\]\n\n- **Difference**: The difference of two sets \\(A\\) and \\(B\\), denoted as \\(A - B\\), is the set that contains all elements from \\(A\\) that are not in \\(B\\).\n  \n  \\[ A - B = \\{ x : x \text{ in } A \text{ and } x \text{ not in } B \\} \\]\n\n- **Symmetric Difference**: The symmetric difference of two sets \\(A\\) and \\(B\\), denoted as \\(A \bigtriangleup B\\), is the set that contains elements from either \\(A\\) or \\(B\\) but not both.\n  \n  \\[ A \bigtriangleup B = (A - B) \bigcup (B - A) \\]\n\n### Role in FEM Pipeline\n- **Assembly Phase**: During the assembly phase, when constructing global matrices and vectors, it may be necessary to merge or intersect index sets. For example, if certain nodes are subject to multiple boundary conditions, `MergeSets` can help manage these subsets.\n\n- **Constraint Handling**: Constraints often involve specific subsets of degrees-of-freedom (DOFs). `MergeSets` can help in defining and manipulating the indices corresponding to constrained DOFs.\n\n### Numerical Methods or Discretization Choices\nThe component does not implement any numerical methods from discretization schemes used in FEM, such as spatial discretization with shape functions, numerical integration using Gauss quadrature, time discretization with implicit Euler, etc. Instead, it performs set operations which are purely logical and do not involve numerical approximation.\n\n### Fit into the Variational/Lagrangian Mechanics Framework\n- `MergeSets` does not directly fit into the variational or Lagrangian mechanics framework as it is a utility component for index manipulation rather than for solving physical equations. However, its operations can indirectly support various stages of the FEM simulation pipeline where set operations on indices are required.\n\n### Summary\nThe `MergeSets` component is a utility in the SOFA framework that performs boolean operations (union, intersection, difference, symmetric_difference) on index sets. It does not contribute to core mathematical or physical models but provides essential functionality for managing subsets of nodes during various stages of FEM simulations.",
  "abstract": "`MergeSets` performs boolean operations (union, intersection, difference, symmetric_difference) on two sets of indices and outputs a merged set.",
  "sheet": "# MergeSets\n\n**Overview**\n\nThe `MergeSets` component is part of the SOFA framework's engine for generating data. It inherits from `DataEngine` and performs boolean operations (union, intersection, difference, symmetric_difference) on two sets of indices (`f_in1`, `f_in2`) to produce a merged set (`f_out`).\n\n**Parameters and Data**\n\n- **f_in1**: First set of indices. Type: `VecIndex`.\n- **f_in2**: Second set of indices. Type: `VecIndex`.\n- **f_out**: Merged set of indices based on the specified boolean operation. Type: `VecIndex`.\n\n**Dependencies and Connections**\n\nThis component typically requires two input sets (`f_in1`, `f_in2`) and outputs a merged set (`f_out`). It can be connected to other components that require index manipulation, such as those handling boundary conditions or constraints.\n\n**Practical Notes**\n\n- Ensure the boolean operation is correctly specified for the desired output.\n- The component supports both integer and unsigned integer index types."
}