vector
Regular vector Using CPUMemoryManager, it has the same behavior as std::vector with extra conveniences: - string serialization (making it usable in Data) - operator[] is checking if the index is within the bounds in debug
`sofa::type::vector` extends `std::vector`, adding string serialization for Data objects and bounds-checking on indexing, ensuring safe data management within SOFA simulations.
- module
- Sofa.framework.Type
- namespace
- sofa::type
- include
- sofa/type/vector.h
- description
The sofa::type::vector is not directly involved in the governing equations or operators typical of FEM simulation, such as the mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, residual $R$, etc. Instead, it serves a supporting role by providing an enhanced vector class that extends std::vector. This specialized vector class is used for managing collections of homogeneous data types efficiently within SOFA simulations.
Mathematical and Physical Description:
-
Governing Equations or Operators: The component does not contribute directly to the governing equations of FEM. Its primary function is to provide a robust container for storing and manipulating data.
-
Constitutive or Kinematic Laws: There are no constitutive or kinematic laws involved in this component as it is purely a data management tool. It facilitates operations like assignment (
operator=), element access (operator[]), reading/writing, filling with values (fill), and resizing without preserving elements (fastResize). -
Role in the Global FEM Pipeline: The
sofa::type::vectoris used internally by other SOFA components to manage collections of data. It does not directly participate in assembly, time integration, nonlinear solve, linear solve, constraint handling, or mapping steps of the FEM pipeline. However, it ensures that these operations can be performed efficiently and safely. -
Numerical Methods or Discretization Choices: The
sofa::type::vectoritself does not implement any numerical methods or discretization choices directly related to FEM simulation. It provides convenient and safe data manipulation functions, which are used by other components in the SOFA framework that do implement these methods. -
Variational / Lagrangian Mechanics Framework: The component is an auxiliary tool that supports various aspects of variational and Lagrangian mechanics frameworks indirectly through efficient and error-checked data management. This ensures that the underlying simulation algorithms can operate on well-managed data structures, contributing to the robustness and reliability of the overall simulation framework.
Methods
vector<T, MemoryManager> &
operator=
(const int & x)
vector<T, MemoryManager> &
operator=
(int && v)
int
operator[]
(int n)
int &
write
(int & os)
int &
read
(int & in)
void
fill
(const T & value)
void
fastResize
(int n)
{
"name": "vector",
"namespace": "sofa::type",
"module": "Sofa.framework.Type",
"include": "sofa/type/vector.h",
"doc": "Regular vector\nUsing CPUMemoryManager, it has the same behavior as std::vector with extra conveniences:\n - string serialization (making it usable in Data)\n - operator[] is checking if the index is within the bounds in debug",
"inherits": [],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "operator=",
"return_type": "vector<T, MemoryManager> &",
"params": [
{
"name": "x",
"type": "const int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "operator=",
"return_type": "vector<T, MemoryManager> &",
"params": [
{
"name": "v",
"type": "int &&"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "operator[]",
"return_type": "int",
"params": [
{
"name": "n",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "write",
"return_type": "int &",
"params": [
{
"name": "os",
"type": "int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "read",
"return_type": "int &",
"params": [
{
"name": "in",
"type": "int &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "fill",
"return_type": "void",
"params": [
{
"name": "value",
"type": "const T &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "fastResize",
"return_type": "void",
"params": [
{
"name": "n",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `sofa::type::vector` is a specialized vector class in the SOFA framework, designed to extend and enhance the functionality of the standard C++ `std::vector`. It supports string serialization, making it suitable for use with Data objects within SOFA. Additionally, it includes bounds-checking on the `operator[]` method in debug mode to prevent out-of-bounds access errors. This class uses the `CPUMemoryManager`, ensuring that it behaves similarly to a standard vector but adds extra conveniences such as safe indexing and serialization.\n\nThe methods provided by this component include assignment operators (`operator=`), element access (`operator[]`), reading/writing operations, filling with values (`fill`), and resizing without preserving elements (`fastResize`). These methods facilitate the manipulation of data within the vector in a manner that is compatible with SOFA's requirements for simulation tasks.\n\nThis class is typically used internally by other SOFA components to manage collections of homogeneous data types efficiently. It interacts with SOFA’s Data objects, enabling serialization and deserialization operations which are crucial for storing and loading simulation states.",
"maths": "The `sofa::type::vector` is not directly involved in the governing equations or operators typical of FEM simulation, such as the mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, residual $R$, etc. Instead, it serves a supporting role by providing an enhanced vector class that extends `std::vector`. This specialized vector class is used for managing collections of homogeneous data types efficiently within SOFA simulations.\n\n### Mathematical and Physical Description:\n\n- **Governing Equations or Operators**: The component does not contribute directly to the governing equations of FEM. Its primary function is to provide a robust container for storing and manipulating data.\n\n- **Constitutive or Kinematic Laws**: There are no constitutive or kinematic laws involved in this component as it is purely a data management tool. It facilitates operations like assignment (`operator=`), element access (`operator[]`), reading/writing, filling with values (`fill`), and resizing without preserving elements (`fastResize`).\n\n- **Role in the Global FEM Pipeline**: The `sofa::type::vector` is used internally by other SOFA components to manage collections of data. It does not directly participate in assembly, time integration, nonlinear solve, linear solve, constraint handling, or mapping steps of the FEM pipeline. However, it ensures that these operations can be performed efficiently and safely.\n\n- **Numerical Methods or Discretization Choices**: The `sofa::type::vector` itself does not implement any numerical methods or discretization choices directly related to FEM simulation. It provides convenient and safe data manipulation functions, which are used by other components in the SOFA framework that do implement these methods.\n\n- **Variational / Lagrangian Mechanics Framework**: The component is an auxiliary tool that supports various aspects of variational and Lagrangian mechanics frameworks indirectly through efficient and error-checked data management. This ensures that the underlying simulation algorithms can operate on well-managed data structures, contributing to the robustness and reliability of the overall simulation framework.",
"abstract": "`sofa::type::vector` extends `std::vector`, adding string serialization for Data objects and bounds-checking on indexing, ensuring safe data management within SOFA simulations.",
"sheet": "# sofa::type::vector\n\n**Overview**\n\nThe `sofa::type::vector` is a specialized vector class that extends the functionality of `std::vector`. It supports string serialization for use with Data objects and includes bounds-checking on indexing in debug mode. This ensures safe and efficient data management within SOFA simulations.\n\n**Practical Notes**\n\nThe `sofa::type::vector` is used internally by other SOFA components to manage collections of homogeneous data types efficiently. It facilitates operations like assignment (`operator=`), element access (`operator[]`), reading/writing, filling with values (`fill`), and resizing without preserving elements (`fastResize`). These methods ensure that the underlying simulation algorithms can operate on well-managed data structures, contributing to the robustness and reliability of the overall simulation framework."
}