Back

SceneLoaderXML

sofa::simulation::SceneLoaderXML
SceneLoader
Abstract (AI generated)

`SceneLoaderXML` loads and writes SOFA simulation scenes from/to XML files with extensions `.xml` or `.scn`, parsing the content into a simulation graph structure.

Metadata
module
Sofa.framework.Simulation.Common
namespace
sofa::simulation
include
sofa/simulation/common/SceneLoaderXML.h
inherits
  • SceneLoader
description

The SceneLoaderXML component in the SOFA framework is primarily responsible for parsing and instantiating simulation scenes described in XML format. It handles loading and writing scenes defined by files with extensions .xml or .scn. The component interacts with other components to load topology, mechanical state, solvers, mappings, and more by interpreting XML elements that define these aspects of the simulation pipeline. Below is a detailed mathematical and physical description of its role in the broader variational/Lagrangian mechanics framework.

Governing Equations or Operators Contributed

  • Mass Matrix ((M")): Not directly contributed; SceneLoaderXML loads descriptions that may include mass properties.
  • Stiffness Matrix ((K")): Not directly contributed; SceneLoaderXML loads descriptions that may define elastic properties leading to stiffness matrices.
  • Internal Force ((f_{int}\
Methods
bool canLoadFileExtension (const char * extension) virtual
bool canWriteFileExtension (const char * extension) virtual
sofa::simulation::NodeSPtr doLoad (const int & filename, const int & sceneArgs) virtual
void write (sofa::simulation::Node * node, const char * filename) virtual
NodeSPtr processXML (xml::BaseElement * xml, const char * filename)
NodeSPtr doLoadFromMemory (const char * filename, const char * data)
NodeSPtr loadFromMemory (const char * filename, const char * data)
int getFileTypeDesc ()
void getExtensionList (ExtensionList * list) virtual
bool syntaxForAddingRequiredPlugin (const int & pluginName, const int & listComponents, int & ss, sofa::simulation::Node * nodeWhereAdded)
{
  "name": "SceneLoaderXML",
  "namespace": "sofa::simulation",
  "module": "Sofa.framework.Simulation.Common",
  "include": "sofa/simulation/common/SceneLoaderXML.h",
  "doc": "",
  "inherits": [
    "SceneLoader"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "canLoadFileExtension",
      "return_type": "bool",
      "params": [
        {
          "name": "extension",
          "type": "const char *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "canWriteFileExtension",
      "return_type": "bool",
      "params": [
        {
          "name": "extension",
          "type": "const char *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "doLoad",
      "return_type": "sofa::simulation::NodeSPtr",
      "params": [
        {
          "name": "filename",
          "type": "const int &"
        },
        {
          "name": "sceneArgs",
          "type": "const int &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "write",
      "return_type": "void",
      "params": [
        {
          "name": "node",
          "type": "sofa::simulation::Node *"
        },
        {
          "name": "filename",
          "type": "const char *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "processXML",
      "return_type": "NodeSPtr",
      "params": [
        {
          "name": "xml",
          "type": "xml::BaseElement *"
        },
        {
          "name": "filename",
          "type": "const char *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "doLoadFromMemory",
      "return_type": "NodeSPtr",
      "params": [
        {
          "name": "filename",
          "type": "const char *"
        },
        {
          "name": "data",
          "type": "const char *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "loadFromMemory",
      "return_type": "NodeSPtr",
      "params": [
        {
          "name": "filename",
          "type": "const char *"
        },
        {
          "name": "data",
          "type": "const char *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "getFileTypeDesc",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getExtensionList",
      "return_type": "void",
      "params": [
        {
          "name": "list",
          "type": "ExtensionList *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "syntaxForAddingRequiredPlugin",
      "return_type": "bool",
      "params": [
        {
          "name": "pluginName",
          "type": "const int &"
        },
        {
          "name": "listComponents",
          "type": "const int &"
        },
        {
          "name": "ss",
          "type": "int &"
        },
        {
          "name": "nodeWhereAdded",
          "type": "sofa::simulation::Node *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `SceneLoaderXML` is a SOFA component in the `sofa::simulation` namespace, part of the `Sofa.framework.Simulation.Common` module. It inherits from the `SceneLoader` class and handles loading and writing scenes defined by XML files with extensions `.xml` or `.scn`. This loader can also process XML content directly from memory.\n\nIn the SOFA ecosystem, `SceneLoaderXML` is responsible for parsing and instantiating simulation scenes described in XML format. It interacts with other components to load topology, mechanical state, solvers, mappings, and more by interpreting XML elements that define these aspects.\n\nMethods like `canLoadFileExtension`, `canWriteFileExtension`, `doLoad`, `write`, `processXML`, `loadFromMemory`, and `getFileTypeDesc` are key for managing scene files. Practical usage involves calling methods to load scenes from file paths or memory, ensuring that the appropriate simulation components are correctly initialized.\n\nThe component handles XML content by converting it into a simulation graph structure (NodeSPtr), allowing SOFA's simulation framework to use these definitions for running interactive simulations.",
  "maths": "The `SceneLoaderXML` component in the SOFA framework is primarily responsible for parsing and instantiating simulation scenes described in XML format. It handles loading and writing scenes defined by files with extensions `.xml` or `.scn`. The component interacts with other components to load topology, mechanical state, solvers, mappings, and more by interpreting XML elements that define these aspects of the simulation pipeline. Below is a detailed mathematical and physical description of its role in the broader variational/Lagrangian mechanics framework.\n\n### Governing Equations or Operators Contributed\n- **Mass Matrix** (\\(M\")): Not directly contributed; `SceneLoaderXML` loads descriptions that may include mass properties.\n- **Stiffness Matrix** (\\(K\")): Not directly contributed; `SceneLoaderXML` loads descriptions that may define elastic properties leading to stiffness matrices.\n- **Internal Force** (\\(f_{int}\\",
  "abstract": "`SceneLoaderXML` loads and writes SOFA simulation scenes from/to XML files with extensions `.xml` or `.scn`, parsing the content into a simulation graph structure.",
  "sheet": "# SceneLoaderXML\n\n**Overview:**\nThe `SceneLoaderXML` component in the `sofa::simulation` namespace is part of the `Sofa.framework.Simulation.Common` module. It inherits from the `SceneLoader` class and handles loading and writing scenes defined by XML files with extensions `.xml` or `.scn`. This loader can also process XML content directly from memory, converting it into a simulation graph structure (NodeSPtr) for use in SOFA's simulation framework.\n\n**Dependencies and Connections:**\nThe `SceneLoaderXML` component interacts with other components to load topology, mechanical state, solvers, mappings, and more by interpreting XML elements that define these aspects. It is typically used at the beginning of a simulation setup to instantiate the scene graph structure from an XML description.\n\n**Practical Notes:**\nWhen using `SceneLoaderXML`, ensure that the XML files are correctly formatted and contain all necessary components for the desired simulation. The component can handle both file-based loading (`doLoad`) and memory-based processing (`processXML`), providing flexibility in how scenes are defined and loaded."
}