gd-sofa-utils 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: gd-sofa-utils
3
+ Version: 0.0.1
4
+ Requires-Python: ==3.12.*
5
+ Description-Content-Type: text/markdown
6
+ License-File: LICENSE
7
+ Requires-Dist: gd-py-utils
8
+ Requires-Dist: randomname
9
+ Requires-Dist: colour
10
+ Requires-Dist: param
11
+ Requires-Dist: treelib
12
+ Requires-Dist: numpy
13
+ Requires-Dist: pandas
14
+ Provides-Extra: docs
15
+ Requires-Dist: mkdocs; extra == "docs"
16
+ Requires-Dist: mkdocs-material; extra == "docs"
17
+ Requires-Dist: mkdocs-mermaid2-plugin; extra == "docs"
18
+ Requires-Dist: mkdocs-snippets; extra == "docs"
19
+ Requires-Dist: mkdocs-exclude; extra == "docs"
20
+ Requires-Dist: mkdocstrings-python; extra == "docs"
21
+ Dynamic: license-file
22
+
23
+ # gdsofa
24
+
25
+ **gdsofa** is a lightweight Python library for building and running [SOFA](https://www.sofa-framework.org/) (Simulation Open Framework Architecture) scenes programmatically. It provides a scene graph API (nodes, components, parameters, controllers) and a runner for headless or GUI simulations.
26
+
27
+ [**Docs**]()
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install gd-sofa-utils
33
+ ```
@@ -0,0 +1,22 @@
1
+ gd_sofa_utils-0.0.1.dist-info/licenses/LICENSE,sha256=uz4uxhirI-dYflckMrhAsLoEAo79MnrZSw7PUGoxQk8,702
2
+ gdsofa/__init__.py,sha256=vnr-pBXf9fnVbJRojkzg7mpaNLym7j9jkJSPoK5Fo_0,302
3
+ gdsofa/load_SOFA.py,sha256=nCCt-L0Kg7bGo9u7MX1tUoNruf8oAlReW9qdEyzWZE8,759
4
+ gdsofa/sofa_parameters.py,sha256=01qsYHzOQbRpQeSRfv_nqi9xbBie3QGLmE44vFq1yRw,4615
5
+ gdsofa/sofawrap.py,sha256=xNtbXQ84o2TCdJaZ5urPsMpVOTuEIfD-FHztBJE_qNM,4726
6
+ gdsofa/utils.py,sha256=gFGfTB6bjdAXdNMYfex1vjASiNwIlp0c68dBiZeISt8,4823
7
+ gdsofa/visual.py,sha256=j22Sc50SdnUUmoZI9hBiaetI_W7aerzJV5FphtYcStw,1306
8
+ gdsofa/comps/__init__.py,sha256=Ex2YSKhU4g2dDiKoohhckpbi0JnHK3Q-EzNUMSwjAzg,74
9
+ gdsofa/comps/_build_dynamic_lib.py,sha256=BI3NW3V-cBlrQfcIyYAnOQV0-84khv-AAFztrlN6OS8,2563
10
+ gdsofa/comps/_dyn.py,sha256=GFbszEiEbiGgbfB4oV1OHmuLD32e8vu-pgwsBuklLYk,58627
11
+ gdsofa/comps/base_component.py,sha256=5FNRlnAihORaZeH4iPf5kDNePQPXT3Ni8bpbD-JwKTA,7683
12
+ gdsofa/controller/__init__.py,sha256=oYpuoezdKHpptt-JQoP4z44AiewxvEuNJfS7wmc-AB0,121
13
+ gdsofa/controller/controller.py,sha256=6aDMyWpjoRX2qTDRJHp3i3sqfxX1YJZmsYpS4Mabjpg,6909
14
+ gdsofa/controller/controller_data.py,sha256=qjWGRlxd1rLN3uypRhjy3dRdnnzIwwWyhR7yDfG_Ros,463
15
+ gdsofa/core/__init__.py,sha256=BbZsXmokk72R9lN6Li0fyFCaewKxJv_ud3abXup50VM,155
16
+ gdsofa/core/component.py,sha256=CbXY__Zgz5rjecNHrBBvjfMYw2A2K5qZqZTGR-ka88c,1577
17
+ gdsofa/core/links.py,sha256=4Cci2DbTs1mbXwDobcMlVyC1Z-UCNBk0e8D8yqNo8xQ,1730
18
+ gdsofa/core/node.py,sha256=XPofecMvjkg3mHhEh7V0f79yPVy0cBwrntktf-NrnTE,13190
19
+ gd_sofa_utils-0.0.1.dist-info/METADATA,sha256=wjimN75ohQfVkHnopidVPM4DtySzhHMMqKfiWPxH27Y,1015
20
+ gd_sofa_utils-0.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
21
+ gd_sofa_utils-0.0.1.dist-info/top_level.txt,sha256=j-H7rCItpTRmFGpF67gTmvedpWL7jgL-YmABGOqZRNA,7
22
+ gd_sofa_utils-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,16 @@
1
+ The GNU General Public License (GPL)
2
+
3
+ Copyright (c) 2026, Gaëtan Desrues, Inria, France
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -0,0 +1 @@
1
+ gdsofa
gdsofa/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ from gdsofa.load_SOFA import load_SOFA
2
+ from gdsofa.visual import VISUAL
3
+ from gdsofa.sofa_parameters import BaseSOFAParams, Filename, Foldername
4
+ from gdsofa.sofawrap import RootNode, RunSofa
5
+ from gdsofa.controller import *
6
+ from gdsofa.core import *
7
+ from gdsofa.utils import *
8
+ from gdsofa.comps import *
@@ -0,0 +1,2 @@
1
+ from gdsofa.comps.base_component import *
2
+ from gdsofa.comps._dyn import *
@@ -0,0 +1,81 @@
1
+ import logging
2
+ import re
3
+ from pathlib import Path
4
+
5
+ import gdutils as gd
6
+ from gdsofa import *
7
+
8
+ # bien penser à commenter `from SofaModel.comps._dyn import *` pour faire tourner ce fichier
9
+ # (se base sur globals())
10
+
11
+ def main(force=True):
12
+ out = tf.f(__file__, "out", dump=True)
13
+ root = Path(tf.env("SOFA_ROOT") / "Sofa")
14
+
15
+ def g(r):
16
+ fnames = []
17
+ for x in (root / r).rglob("build.make"):
18
+ if (y := x.parent.name).endswith(".dir"):
19
+ if not y[:-4].endswith("_test"):
20
+ fnames.append({"a": str(x), "b": y[:-4]})
21
+ return fnames
22
+
23
+ def extract_cpp_objects(info):
24
+ filepath = info["a"]
25
+ cpp_names = set()
26
+ pattern = re.compile(r"/([^/]+)\.cpp\.o")
27
+ with open(filepath, "r") as f:
28
+ for line in f:
29
+ match = pattern.search(line)
30
+ if match:
31
+ name = re.sub(r"\[.*\]", "", match.group(1)) # Remove anything like [GraphScattered]
32
+ if name and name[0].isupper():
33
+ cpp_names.add(name)
34
+ return {"info": info["b"], "reqs": sorted(cpp_names)}
35
+
36
+ if tf.greedy_download(fname := out / "fnames.json", force=force):
37
+ tf.dump_json(fname, {"Component": g("Component"), "GL": g("GL")})
38
+ fnames = tf.load_json(fname)
39
+
40
+ if tf.greedy_download(fname_objs := out / "objs.json", force=force):
41
+ objs = []
42
+ for xx in fnames["Component"]:
43
+ objs.append(extract_cpp_objects(xx))
44
+ for xx in fnames["GL"]:
45
+ objs.append(extract_cpp_objects(xx))
46
+ tf.dump_json(fname_objs, objs)
47
+ objs = tf.load_json(fname_objs)
48
+ # pprint(objs)
49
+
50
+ if tf.greedy_download(fname_2 := out / "dyn.py", force=force):
51
+ glb = globals()
52
+ s = "from SofaModel.core.component import TObject\n\n__all__ = [\n"
53
+ s += f'\t"REQUIRED_PLUGINS",\n'
54
+ for x in objs:
55
+ # s +=
56
+ for comp in x["reqs"]:
57
+ if comp not in glb:
58
+ s += f'\t"{comp}",\n'
59
+ s += "]\n\n\n"
60
+
61
+ for x in objs:
62
+ for comp in x["reqs"]:
63
+ if comp not in glb:
64
+ s += f"class {comp}(TObject):\n\tpass\n\n"
65
+
66
+ s += "REQUIRED_PLUGINS = {\n"
67
+ for x in objs:
68
+ for comp in x["reqs"]:
69
+ s += f'\t"{comp}": "{x['info']}",\n'
70
+ s += "}\n"
71
+
72
+ gd.dump_str(fname_2, s)
73
+
74
+
75
+ log = logging.getLogger(__name__)
76
+
77
+ if __name__ == "__main__":
78
+ logging.basicConfig(level=logging.INFO)
79
+ log = gd.get_logger()
80
+
81
+ main()