SofaViewer
`SofaViewer` provides visualization capabilities for SOFA simulations, handling user interface interactions such as key events, mouse events, and wheel events.
- module
- sofa.qt.viewer.SofaViewer.cpp
- namespace
- sofa::qt::viewer
- include
- sofa/qt/viewer/SofaViewer.h
- inherits
-
- BaseViewer
- description
The SofaViewer class in the SOFA framework is primarily focused on providing visualization capabilities and handling user interface interactions for simulations. It does not directly contribute to any governing equations or operators typically associated with FEM such as mass matrices, stiffness matrices, internal forces, residuals, constitutive laws, kinematic relations, or constraint handling. Instead, its role is more related to the display and interaction aspects of the simulation pipeline rather than the core numerical computations.
Role in the Global FEM Pipeline
- Assembly Phase:
SofaViewerdoes not directly participate in assembling global matrices or forces. - Time Integration: It does not handle time integration schemes such as implicit Euler or Newmark-type methods.
- Nonlinear Resolution: No involvement in nonlinear solve processes like Newton-Raphson iterations.
- Linear Resolution: Not responsible for linear system solvers (e.g., iterative Krylov methods, direct sparse factorizations).
- Update Phase: While it provides a
redrawmethod to ensure the scene is rendered correctly, this does not involve state update or velocity reconstruction in the context of FEM.
Numerical Methods and Discretization Choices
The component primarily deals with event handling (key events, mouse events, wheel events) and screen management rather than numerical methods specific to FEM. It provides interfaces for managing viewer tabs (removeViewerTab, configureViewerTab), taking screenshots (screenshot), setting background images (setBackgroundImage), and configuring the viewer settings (configure).
Integration into Variational / Lagrangian Mechanics Framework
The SofaViewer does not encode any specific variational or Lagrangian mechanics framework principles. Its functionality is purely concerned with graphical rendering and user interaction, which are orthogonal to the mathematical foundations of FEM.
In summary, while SofaViewer plays a crucial role in making simulations interactive and visually accessible, it has no direct mathematical or physical content related to the computational aspects of the finite element method. Its primary function is to facilitate visualization and user interaction with the simulation environment.
Methods
void
removeViewerTab
(QTabWidget * )
virtual
void
configureViewerTab
(QTabWidget * )
virtual
QWidget *
getQWidget
()
virtual
QString
helpString
()
virtual
void
captureEvent
()
virtual
void
keyPressEvent
(QKeyEvent * e)
virtual
void
keyReleaseEvent
(QKeyEvent * e)
virtual
bool
isControlPressed
()
void
wheelEvent
(QWheelEvent * e)
virtual
void
mouseMoveEvent
(QMouseEvent * e)
virtual
void
mousePressEvent
(QMouseEvent * e)
virtual
void
mouseReleaseEvent
(QMouseEvent * e)
virtual
bool
mouseEvent
(QMouseEvent * e)
virtual
void
configure
(sofa::component::setting::ViewerSetting * viewerConf)
virtual
const int
screenshotName
()
void
setPrefix
(const int & prefix, bool prependDirectory)
void
screenshot
(const int & filename, int compression_level)
virtual
void
setBackgroundImage
(int imageFileName)
virtual
void
redraw
()
virtual
void
redrawn
()
virtual
void
resizeW
(int )
virtual
void
resizeH
(int )
virtual
{
"name": "SofaViewer",
"namespace": "sofa::qt::viewer",
"module": "sofa.qt.viewer.SofaViewer.cpp",
"include": "sofa/qt/viewer/SofaViewer.h",
"doc": "",
"inherits": [
"BaseViewer"
],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "removeViewerTab",
"return_type": "void",
"params": [
{
"name": "",
"type": "QTabWidget *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "configureViewerTab",
"return_type": "void",
"params": [
{
"name": "",
"type": "QTabWidget *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getQWidget",
"return_type": "QWidget *",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "helpString",
"return_type": "QString",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "captureEvent",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "keyPressEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QKeyEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "keyReleaseEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QKeyEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isControlPressed",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "wheelEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QWheelEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mouseMoveEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QMouseEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mousePressEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QMouseEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mouseReleaseEvent",
"return_type": "void",
"params": [
{
"name": "e",
"type": "QMouseEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mouseEvent",
"return_type": "bool",
"params": [
{
"name": "e",
"type": "QMouseEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "configure",
"return_type": "void",
"params": [
{
"name": "viewerConf",
"type": "sofa::component::setting::ViewerSetting *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "screenshotName",
"return_type": "const int",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setPrefix",
"return_type": "void",
"params": [
{
"name": "prefix",
"type": "const int &"
},
{
"name": "prependDirectory",
"type": "bool"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "screenshot",
"return_type": "void",
"params": [
{
"name": "filename",
"type": "const int &"
},
{
"name": "compression_level",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setBackgroundImage",
"return_type": "void",
"params": [
{
"name": "imageFileName",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "redraw",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "redrawn",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "resizeW",
"return_type": "void",
"params": [
{
"name": "",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "resizeH",
"return_type": "void",
"params": [
{
"name": "",
"type": "int"
}
],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
}
],
"description": "<description>The `SofaViewer` class is part of the SOFA framework and belongs to the namespace `sofa::qt::viewer`. It inherits from `BaseViewer`, indicating its role in providing visualization capabilities for simulations within the SOFA ecosystem. The `SofaViewer` primarily handles user interface interactions, such as key events, mouse events, and wheel events, which are essential for interactive simulations.\n\nThe component interacts with other parts of the SOFA framework through methods like `configure`, which takes a `sofa::component::setting::ViewerSetting *` parameter to adjust viewer settings. It also provides methods for managing viewer tabs (`removeViewerTab`, `configureViewerTab`) and handling screenshots (`screenshot`).\n\nThe component's role includes rendering visual elements of the simulation, responding to user inputs (e.g., key presses, mouse movements), and ensuring that the scene is redrawn correctly (`redraw`, `redrawn` methods). It also supports setting background images and resizing the viewer window.\n\nFor practical usage, users can configure the viewer settings using the `configure` method, handle events through overridden event handler methods (like `keyPressEvent`, `mouseMoveEvent`), and manage rendering operations via methods like `redraw`. The `screenshot` method provides a way to capture images from the viewer.\n\nThe component's data fields are not explicitly listed in the provided metadata, indicating that its functionality is primarily driven by virtual methods and interactions with other SOFA components.</description>",
"maths": "The `SofaViewer` class in the SOFA framework is primarily focused on providing visualization capabilities and handling user interface interactions for simulations. It does not directly contribute to any governing equations or operators typically associated with FEM such as mass matrices, stiffness matrices, internal forces, residuals, constitutive laws, kinematic relations, or constraint handling. Instead, its role is more related to the display and interaction aspects of the simulation pipeline rather than the core numerical computations.\n\n### Role in the Global FEM Pipeline\n- **Assembly Phase**: `SofaViewer` does not directly participate in assembling global matrices or forces.\n- **Time Integration**: It does not handle time integration schemes such as implicit Euler or Newmark-type methods.\n- **Nonlinear Resolution**: No involvement in nonlinear solve processes like Newton-Raphson iterations.\n- **Linear Resolution**: Not responsible for linear system solvers (e.g., iterative Krylov methods, direct sparse factorizations).\n- **Update Phase**: While it provides a `redraw` method to ensure the scene is rendered correctly, this does not involve state update or velocity reconstruction in the context of FEM.\n\n### Numerical Methods and Discretization Choices\nThe component primarily deals with event handling (key events, mouse events, wheel events) and screen management rather than numerical methods specific to FEM. It provides interfaces for managing viewer tabs (`removeViewerTab`, `configureViewerTab`), taking screenshots (`screenshot`), setting background images (`setBackgroundImage`), and configuring the viewer settings (`configure`).\n\n### Integration into Variational / Lagrangian Mechanics Framework\nThe `SofaViewer` does not encode any specific variational or Lagrangian mechanics framework principles. Its functionality is purely concerned with graphical rendering and user interaction, which are orthogonal to the mathematical foundations of FEM.\n\nIn summary, while `SofaViewer` plays a crucial role in making simulations interactive and visually accessible, it has no direct mathematical or physical content related to the computational aspects of the finite element method. Its primary function is to facilitate visualization and user interaction with the simulation environment.",
"abstract": "`SofaViewer` provides visualization capabilities for SOFA simulations, handling user interface interactions such as key events, mouse events, and wheel events.",
"sheet": "# SofaViewer\n\n**Overview**\n\nThe `SofaViewer` class is part of the SOFA framework's visualization module. It inherits from `BaseViewer`, indicating its role in providing graphical rendering capabilities for simulations within the SOFA ecosystem. The component handles user interface interactions, such as key events (`keyPressEvent`, `keyReleaseEvent`), mouse events (`mouseMoveEvent`, `mousePressEvent`, `mouseReleaseEvent`), and wheel events (`wheelEvent`). It also provides methods for managing viewer tabs (`removeViewerTab`, `configureViewerTab`) and taking screenshots (`screenshot`).\n\n**Dependencies and Connections**\n\nThe `SofaViewer` interacts with other SOFA components through methods like `configure`, which takes a `sofa::component::setting::ViewerSetting *` parameter to adjust viewer settings. It also supports setting background images via the `setBackgroundImage` method.\n\n**Practical Notes**\n\nUsers can configure the viewer settings using the `configure` method and handle events through overridden event handler methods (like `keyPressEvent`, `mouseMoveEvent`). The component ensures that the scene is redrawn correctly (`redraw`, `redrawn` methods)."
}