Back

Multi2Mapping

sofa::core::Multi2Mapping
BaseMapping
Doc (from source)

Specialized interface to describe many to many mapping. The inputs can be of two different types, while all the outputs must be of the same type.

Abstract (AI generated)

The Multi2Mapping component in SOFA facilitates many-to-many mappings between two different types of input models to a single output model, ensuring consistent transformations of coordinates, velocities, accelerations, and forces across these models.

Metadata
module
Sofa.framework.Core
namespace
sofa::core
include
sofa/core/Multi2Mapping.h
inherits
  • BaseMapping
templates
  • sofa::defaulttype::Vec1Types, sofa::defaulttype::Rigid3Types, sofa::defaulttype::Rigid3Types
  • sofa::defaulttype::Vec1Types, sofa::defaulttype::Vec3Types, sofa::defaulttype::Rigid3Types
  • sofa::defaulttype::Vec3Types, sofa::defaulttype::Rigid3Types, sofa::defaulttype::Vec3Types
  • sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types
description

The Multi2Mapping class in the SOFA framework is designed to facilitate many-to-many mappings between two different types of input models and a single type of output model. This mapping capability allows for flexible interactions between multiple data sources, which can be useful in various computational mechanics simulations involving multi-resolution coupling, attachments, or embedded meshes.

Governing Equations and Operators

Mapping Transformation

The Multi2Mapping class primarily deals with the transformation of input coordinates from two different types (denoted as $In1$ and $In2$) to a single type of output coordinate ($Out$). Mathematically, this mapping can be represented by the following transformations:
- Position: $\mathbf{x}_{out} = \mathcal{M}(\mathbf{x}_{in1}, \mathbf{x}_{in2})$
- Velocity: $\mathbf{v}_{out} = J(\mathbf{x}_{in1}, \mathbf{x}_{in2}) \cdot (\mathbf{v}_{in1}, \mathbf{v}_{in2})^T$

Here, the mapping function $\mathcal{M}$ and its Jacobian matrix $J$ are essential for relating the input coordinates and velocities to the output ones. The exact forms of these functions depend on the specific implementation details, which can vary based on the physical problem being modeled.

Constitutive or Kinematic Laws Involved

The Multi2Mapping itself does not directly involve constitutive laws such as strain measures, stress tensors, hyperelastic potentials, etc., since it is primarily a structural component designed to couple different models. However, the mapping function $\mathcal{M}$ and its Jacobian matrix $J$ can embody various kinematic relations or constraints that are essential for maintaining mechanical consistency between the input and output models.

Role in the Global FEM Pipeline

The Multi2Mapping component plays a crucial role in several stages of the global Finite Element Method (FEM) simulation pipeline:
- Assembly: It participates in assembling mappings, where it ensures that coordinates, velocities, accelerations, and forces are correctly transformed between input and output models.
- Time Integration: During time integration steps, it applies mapping transformations to update positions, velocities, and accelerations based on the current state of the simulation.
- Nonlinear Resolution: In nonlinear resolution schemes (e.g., Newton-Raphson iterations), Multi2Mapping ensures that constraints and mappings are consistently applied across multiple models.

Numerical Methods or Discretization Choices

The numerical methods implemented in Multi2Mapping include:
- Matrix-Free Operations: The mapping transformations often employ matrix-free operations, where the Jacobian matrix $J$ is not explicitly assembled. Instead, its action on vectors (e.g., velocities) is computed directly.
- Vectorized Data Access: It efficiently handles multiple input and output models through vectorized data access methods that ensure optimal performance in simulations involving large datasets or complex mappings.

Variational / Lagrangian Mechanics Framework Fit

In the broader variational and Lagrangian mechanics framework, Multi2Mapping serves as a bridge to couple different mechanical systems. While it does not directly contribute to the governing equations of motion (e.g., $\mathcal{L}(q, \dot{q})$ or $\ddot{u} = \nabla \cdot \sigma + \rho b$), its role is essential in maintaining consistency across different models. This includes ensuring that constraints and mappings preserve mechanical invariants such as force equilibrium (virtual work preservation) and energy conservation.

Summary

In summary, the Multi2Mapping class facilitates many-to-many mappings between two input model types and a single output type in the SOFA framework. Its primary role is to ensure consistent transformations of coordinates, velocities, accelerations, and forces across different models, thereby enabling flexible coupling mechanisms for multi-resolution simulations, attachments, or embedded meshes.

Data Fields
NameTypeDefaultHelp
f_applyRestPosition bool set to true to apply this mapping to restPosition at init
Methods
void addInputModel1 (State<In1> * , const int & path) virtual
void addInputModel2 (State<In2> * , const int & path) virtual
void addOutputModel (State<Out> * , const int & path) virtual
const VecFromModels1 & getFromModels1 ()
const VecFromModels2 & getFromModels2 ()
const VecToModels & getToModels ()
int getFrom ()
int getTo ()
int getMechFrom ()
int getMechTo ()
void apply (const MechanicalParams * mparams, MultiVecCoordId outPos, ConstMultiVecCoordId inPos) virtual
void apply (const MechanicalParams * mparams, const int & dataVecOutPos, const int & dataVecIn1Pos, const int & dataVecIn2Pos) virtual
void applyJ (const MechanicalParams * mparams, MultiVecDerivId outVel, ConstMultiVecDerivId inVel) virtual
void applyJ (const MechanicalParams * , const int & dataVecOutVel, const int & dataVecIn1Vel, const int & dataVecIn2Vel) virtual
void applyJ (const int & , const int & , const int & ) virtual
void applyJT (const MechanicalParams * mparams, MultiVecDerivId inForce, ConstMultiVecDerivId outForce) virtual
void applyJT (const MechanicalParams * mparams, const int & dataVecOut1Force, const int & dataVecOut2Force, const int & dataVecInForce) virtual
void applyJT (const ConstraintParams * cparams, MultiMatrixDerivId inConst, ConstMultiMatrixDerivId outConst) virtual
void applyJT (const ConstraintParams * , const int & , const int & , const int & ) virtual
void computeAccFromMapping (const MechanicalParams * mparams, MultiVecDerivId outAcc, ConstMultiVecDerivId inVel, ConstMultiVecDerivId inAcc) virtual
void computeAccFromMapping (const MechanicalParams * , const int & , const int & , const int & , const int & , const int & ) virtual
void init () virtual
void disable () virtual
bool canCreate (T *& obj, core::objectmodel::BaseContext * context, core::objectmodel::BaseObjectDescription * arg)
void getVecIn1Coord (const MultiVecCoordId id, int & v)
void getConstVecIn1Coord (const ConstMultiVecCoordId id, int & v)
void getVecIn1Deriv (const MultiVecDerivId id, int & v)
void getConstVecIn1Deriv (const ConstMultiVecDerivId id, int & v)
void getMatIn1Deriv (const MultiMatrixDerivId id, int & v)
void getConstMatIn1Deriv (const ConstMultiMatrixDerivId id, int & v)
void getVecIn2Coord (const MultiVecCoordId id, int & v)
void getConstVecIn2Coord (const ConstMultiVecCoordId id, int & v)
void getVecIn2Deriv (const MultiVecDerivId id, int & v)
void getConstVecIn2Deriv (const ConstMultiVecDerivId id, int & v)
void getMatIn2Deriv (const MultiMatrixDerivId id, int & v)
void getConstMatIn2Deriv (const ConstMultiMatrixDerivId id, int & v)
void getVecOutCoord (const MultiVecCoordId id, int & v)
void getConstVecOutCoord (const ConstMultiVecCoordId id, int & v)
void getVecOutDeriv (const MultiVecDerivId id, int & v)
void getConstVecOutDeriv (const ConstMultiVecDerivId id, int & v)
void getMatOutDeriv (const MultiMatrixDerivId id, int & v)
void getConstMatOutDeriv (const ConstMultiMatrixDerivId id, int & v)
{
  "name": "Multi2Mapping",
  "namespace": "sofa::core",
  "module": "Sofa.framework.Core",
  "include": "sofa/core/Multi2Mapping.h",
  "doc": "Specialized interface to describe many to many mapping.\n  The inputs can be of two different types, while all the outputs must be of the same type.",
  "inherits": [
    "BaseMapping"
  ],
  "templates": [
    "sofa::defaulttype::Vec1Types, sofa::defaulttype::Rigid3Types, sofa::defaulttype::Rigid3Types",
    "sofa::defaulttype::Vec1Types, sofa::defaulttype::Vec3Types, sofa::defaulttype::Rigid3Types",
    "sofa::defaulttype::Vec3Types, sofa::defaulttype::Rigid3Types, sofa::defaulttype::Vec3Types",
    "sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types, sofa::defaulttype::Vec3Types"
  ],
  "data_fields": [
    {
      "name": "f_applyRestPosition",
      "type": "bool",
      "xmlname": "applyRestPosition",
      "help": "set to true to apply this mapping to restPosition at init"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "addInputModel1",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "State<In1> *"
        },
        {
          "name": "path",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addInputModel2",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "State<In2> *"
        },
        {
          "name": "path",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addOutputModel",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "State<Out> *"
        },
        {
          "name": "path",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getFromModels1",
      "return_type": "const VecFromModels1 &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getFromModels2",
      "return_type": "const VecFromModels2 &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getToModels",
      "return_type": "const VecToModels &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getFrom",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getTo",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMechFrom",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMechTo",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "apply",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "outPos",
          "type": "MultiVecCoordId"
        },
        {
          "name": "inPos",
          "type": "ConstMultiVecCoordId"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "apply",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "dataVecOutPos",
          "type": "const int &"
        },
        {
          "name": "dataVecIn1Pos",
          "type": "const int &"
        },
        {
          "name": "dataVecIn2Pos",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": true,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJ",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "outVel",
          "type": "MultiVecDerivId"
        },
        {
          "name": "inVel",
          "type": "ConstMultiVecDerivId"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJ",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "const MechanicalParams *"
        },
        {
          "name": "dataVecOutVel",
          "type": "const int &"
        },
        {
          "name": "dataVecIn1Vel",
          "type": "const int &"
        },
        {
          "name": "dataVecIn2Vel",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJ",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJT",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "inForce",
          "type": "MultiVecDerivId"
        },
        {
          "name": "outForce",
          "type": "ConstMultiVecDerivId"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJT",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "dataVecOut1Force",
          "type": "const int &"
        },
        {
          "name": "dataVecOut2Force",
          "type": "const int &"
        },
        {
          "name": "dataVecInForce",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": true,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJT",
      "return_type": "void",
      "params": [
        {
          "name": "cparams",
          "type": "const ConstraintParams *"
        },
        {
          "name": "inConst",
          "type": "MultiMatrixDerivId"
        },
        {
          "name": "outConst",
          "type": "ConstMultiMatrixDerivId"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "applyJT",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "const ConstraintParams *"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeAccFromMapping",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const MechanicalParams *"
        },
        {
          "name": "outAcc",
          "type": "MultiVecDerivId"
        },
        {
          "name": "inVel",
          "type": "ConstMultiVecDerivId"
        },
        {
          "name": "inAcc",
          "type": "ConstMultiVecDerivId"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeAccFromMapping",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "const MechanicalParams *"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "disable",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "canCreate",
      "return_type": "bool",
      "params": [
        {
          "name": "obj",
          "type": "T *&"
        },
        {
          "name": "context",
          "type": "core::objectmodel::BaseContext *"
        },
        {
          "name": "arg",
          "type": "core::objectmodel::BaseObjectDescription *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "getVecIn1Coord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecIn1Coord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getVecIn1Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecIn1Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getMatIn1Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstMatIn1Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getVecIn2Coord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecIn2Coord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getVecIn2Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecIn2Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getMatIn2Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstMatIn2Deriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getVecOutCoord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecOutCoord",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecCoordId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getVecOutDeriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstVecOutDeriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiVecDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getMatOutDeriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const MultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "getConstMatOutDeriv",
      "return_type": "void",
      "params": [
        {
          "name": "id",
          "type": "const ConstMultiMatrixDerivId"
        },
        {
          "name": "v",
          "type": "int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    }
  ],
  "category": "Mappings",
  "description": "The Multi2Mapping class is a template-based mapping that connects two input models to one output model in the Sofa physics engine framework. It extends from the MultiMapping class and specializes it for scenarios where two different types of data are mapped onto another type.",
  "parameters": [
    {
      "name": "input1",
      "type": "Data<VecCoord>",
      "description": "The first input model that provides coordinate data."
    },
    {
      "name": "input2",
      "type": "Data<VecCoord>",
      "description": "The second input model that provides additional coordinate data, which can be of a different type than the first input."
    },
    {
      "name": "output",
      "type": "Data<VecCoord>",
      "description": "The output model where the result of mapping both inputs is applied. The type of this output could differ from both inputs depending on the template specialization."
    }
  ],
  "example_use_case": "This component can be used in simulations involving complex interactions between different types of physical models, for example, when you need to map data from a deformable body (Vec3Types) and a rigid object (Rigid3Types) onto another deformable or rigid model. This is particularly useful in biomechanical simulations where the interaction between flexible tissues and bones needs to be accurately modeled.",
  "template_specializations": [
    "defaulttype::Multi2Mapping<defaulttype::Vec1Types, defaulttype::Rigid3Types, defaulttype::Rigid3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec3Types, defaulttype::Rigid3Types, defaulttype::Vec3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec3Types, defaulttype::Rigid3Types, defaulttype::Rigid3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec3Types, defaulttype::Vec3Types, defaulttype::Vec3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec3Types, defaulttype::Vec1Types, defaulttype::Vec3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec1Types, defaulttype::Vec3Types, defaulttype::Rigid3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec1Types, defaulttype::Rigid3Types, defaulttype::Vec3Types>",
    "defaulttype::Multi2Mapping<defaulttype::Vec1Types, defaulttype::Vec1Types, defaulttype::Rigid3Types>"
  ],
  "dependencies": [
    "sofa/core/MultiMapping.h",
    "sofa/defaulttype/VecTypes.h",
    "sofa/defaulttype/RigidTypes.h"
  ],
  "implementation_details": "The Multi2Mapping class provides specialized methods for handling different types of input and output data. It has template specialization implementations that cater to specific combinations of Vec3, Rigid3 and Vec1 types. The mapping logic is implemented through virtual functions such as `apply()`, `applyJT()` and others, which are intended to be overridden by derived classes providing the actual mapping functionality.",
  "limitations": "The Multi2Mapping class requires template specialization for each combination of input and output data types it supports. Adding support for new combinations or different types would necessitate creating additional specializations.",
  "maths": "The **Multi2Mapping** class in the SOFA framework is designed to facilitate many-to-many mappings between two different types of input models and a single type of output model. This mapping capability allows for flexible interactions between multiple data sources, which can be useful in various computational mechanics simulations involving multi-resolution coupling, attachments, or embedded meshes.\n\n### Governing Equations and Operators\n\n#### Mapping Transformation\n\nThe Multi2Mapping class primarily deals with the transformation of input coordinates from two different types (denoted as $In1$ and $In2$) to a single type of output coordinate ($Out$). Mathematically, this mapping can be represented by the following transformations:\n- Position: $\\mathbf{x}_{out} = \\mathcal{M}(\\mathbf{x}_{in1}, \\mathbf{x}_{in2})$\n- Velocity: $\\mathbf{v}_{out} = J(\\mathbf{x}_{in1}, \\mathbf{x}_{in2}) \\cdot (\\mathbf{v}_{in1}, \\mathbf{v}_{in2})^T$\n\nHere, the mapping function $\\mathcal{M}$ and its Jacobian matrix $J$ are essential for relating the input coordinates and velocities to the output ones. The exact forms of these functions depend on the specific implementation details, which can vary based on the physical problem being modeled.\n\n#### Constitutive or Kinematic Laws Involved\n\nThe Multi2Mapping itself does not directly involve constitutive laws such as strain measures, stress tensors, hyperelastic potentials, etc., since it is primarily a structural component designed to couple different models. However, the mapping function $\\mathcal{M}$ and its Jacobian matrix $J$ can embody various kinematic relations or constraints that are essential for maintaining mechanical consistency between the input and output models.\n\n### Role in the Global FEM Pipeline\n\nThe Multi2Mapping component plays a crucial role in several stages of the global Finite Element Method (FEM) simulation pipeline:\n- **Assembly**: It participates in assembling mappings, where it ensures that coordinates, velocities, accelerations, and forces are correctly transformed between input and output models.\n- **Time Integration**: During time integration steps, it applies mapping transformations to update positions, velocities, and accelerations based on the current state of the simulation.\n- **Nonlinear Resolution**: In nonlinear resolution schemes (e.g., Newton-Raphson iterations), Multi2Mapping ensures that constraints and mappings are consistently applied across multiple models.\n\n### Numerical Methods or Discretization Choices\n\nThe numerical methods implemented in Multi2Mapping include:\n- **Matrix-Free Operations**: The mapping transformations often employ matrix-free operations, where the Jacobian matrix $J$ is not explicitly assembled. Instead, its action on vectors (e.g., velocities) is computed directly.\n- **Vectorized Data Access**: It efficiently handles multiple input and output models through vectorized data access methods that ensure optimal performance in simulations involving large datasets or complex mappings.\n\n### Variational / Lagrangian Mechanics Framework Fit\n\nIn the broader variational and Lagrangian mechanics framework, Multi2Mapping serves as a bridge to couple different mechanical systems. While it does not directly contribute to the governing equations of motion (e.g., $\\mathcal{L}(q, \\dot{q})$ or $\\ddot{u} = \\nabla \\cdot \\sigma + \\rho b$), its role is essential in maintaining consistency across different models. This includes ensuring that constraints and mappings preserve mechanical invariants such as force equilibrium (virtual work preservation) and energy conservation.\n\n### Summary\n\nIn summary, the Multi2Mapping class facilitates many-to-many mappings between two input model types and a single output type in the SOFA framework. Its primary role is to ensure consistent transformations of coordinates, velocities, accelerations, and forces across different models, thereby enabling flexible coupling mechanisms for multi-resolution simulations, attachments, or embedded meshes.",
  "abstract": "The Multi2Mapping component in SOFA facilitates many-to-many mappings between two different types of input models to a single output model, ensuring consistent transformations of coordinates, velocities, accelerations, and forces across these models.",
  "sheet": "# Multi2Mapping\n\n## Overview\n\nMulti2Mapping is a specialized mapping in the SOFA framework that connects two different types of input models (denoted as $In1$ and $In2$) to one output model ($Out$). It ensures consistent transformations between these models, facilitating flexible coupling mechanisms for multi-resolution simulations, attachments, or embedded meshes.\n\n## Parameters and Data\n\n- **f_applyRestPosition**: A boolean parameter that sets whether the mapping should be applied to rest positions at initialization. Default value is `false`.\n\n## Dependencies and Connections\n\nMulti2Mapping typically requires two input models of different types ($In1$ and $In2$) and one output model ($Out$). It fits into the scene graph by connecting these models through its mapping transformations, ensuring that coordinates, velocities, accelerations, and forces are correctly transformed between them."
}