Skip to content

Commit bbdaba5

Browse files
authored
Merge pull request #502 from skim0119/mod/examples-timestepper
2 parents 6621944 + cac0229 commit bbdaba5

File tree

98 files changed

+1192
-3214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1192
-3214
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ __pycache__/
88

99
*.swp
1010
.vscode
11+
docs/_gallery
12+
docs/gen_modules
13+
docs/sg_execution_times.rst
1114

1215
# Distribution / packaging
1316
.Python

.readthedocs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ version: 2
44
# Set the version of Python and other tools you might need
55
build:
66
os: ubuntu-24.04
7+
apt_packages:
8+
- ffmpeg
79
tools: { python: "3.10" }
810
jobs:
911
create_environment:
@@ -14,6 +16,7 @@ build:
1416
install:
1517
- "true"
1618

19+
1720
# Build documentation in the docs/ directory with Sphinx
1821
sphinx:
1922
builder: html

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@ pytestcache-remove:
112112
build-remove:
113113
rm -rf build/ dist/
114114

115+
.PHONY: doc-remove
116+
doc-remove:
117+
rm -rf docs/_build docs/gen_modules/ docs/sg_execution_times.rst docs/_gallery/
118+
115119
.PHONY: cleanup
116-
cleanup: pycache-remove dsstore-remove ipynbcheckpoints-remove pytestcache-remove mypycache-remove build-remove
120+
cleanup: pycache-remove dsstore-remove ipynbcheckpoints-remove pytestcache-remove mypycache-remove build-remove doc-remove
117121

118122
all: format-codestyle cleanup test
119123

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div align='center'>
22
<h1> PyElastica </h1>
33

4-
[![CI][badge-CI]][link-CI] [![Documentation Status][badge-docs-status]][link-docs-status] [![codecov][badge-codecov]][link-codecov] [![Downloads][badge-pepy-download-count]][link-pepy-download-count] [![DOI][badge-doi]][link-doi] [![Binder][badge-binder]][link-binder] [![Gitter][badge-gitter]][link-gitter]
4+
[![CI][badge-CI]][link-CI] [![Documentation Status][badge-docs-status]][link-docs-status] [![codecov][badge-codecov]][link-codecov] [![Downloads][badge-pepy-download-count]][link-pepy-download-count] [![DOI][badge-doi]][link-doi] [![Gitter][badge-gitter]][link-gitter]
55
</div>
66

77
PyElastica is the python implementation of **Elastica**: an *open-source* project for simulating assemblies of slender, one-dimensional structures using Cosserat Rod theory.
@@ -84,13 +84,6 @@ We ask that any publications which use Elastica cite as following:
8484
- [Controlling a CyberOctopus soft arm with muscle-like actuation](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9683318) (UIUC, 2020) (IEEE CDC 2021)
8585
- [Energy shaping control of a CyberOctopus soft arm](https://ieeexplore.ieee.org/document/9304408) (UIUC, 2020) (IEEE CDC 2020)
8686

87-
## Tutorials
88-
[![Binder][badge-binder-tutorial]][link-binder]
89-
90-
We have created several Jupyter notebooks and Python scripts to help users get started with PyElastica. The Jupyter notebooks are available on Binder, allowing you to try out some of the tutorials without having to install PyElastica.
91-
92-
We have also included an example script for visualizing PyElastica simulations using POVray. This script is located in the examples folder ([`examples/Visualization`](examples/Visualization)).
93-
9487
## Contribution
9588

9689
If you would like to participate, please read our [contribution guideline](CONTRIBUTING.md). Private development branches are moved to [elastica-python](https://github.com/GazzolaLab/elastica-python) repository; access is limited to the core developers, collaborators, and maintainers.
@@ -122,7 +115,6 @@ _Names arranged alphabetically_
122115
[badge-pypi]: https://badge.fury.io/py/pyelastica.svg
123116
[badge-CI]: https://github.com/GazzolaLab/PyElastica/workflows/CI/badge.svg
124117
[badge-docs-status]: https://readthedocs.org/projects/pyelastica/badge/?version=latest
125-
[badge-binder]: https://mybinder.org/badge_logo.svg
126118
[badge-pepy-download-count]: https://pepy.tech/badge/pyelastica
127119
[badge-codecov]: https://codecov.io/gh/GazzolaLab/PyElastica/branch/master/graph/badge.svg
128120
[badge-gitter]: https://badges.gitter.im/PyElastica/community.svg
@@ -133,7 +125,5 @@ _Names arranged alphabetically_
133125
[link-pepy-download-count]: https://pepy.tech/project/pyelastica
134126
[link-codecov]: https://codecov.io/gh/GazzolaLab/PyElastica
135127

136-
[badge-binder-tutorial]: https://img.shields.io/badge/Launch-PyElastica%20Tutorials-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2Hxk17yl1vzmljzm1j0nlX1olL3AJXWAAAAbXRSTlMAEBAQHx8gICAuLjAwMDw9PUBAQEpQUFBXV1hgYGBkcHBwcXl8gICAgoiIkJCQlJicnJ2goKCmqK+wsLC4usDAwMjP0NDQ1NbW3Nzg4ODi5+3v8PDw8/T09PX29vb39/f5+fr7+/z8/Pz9/v7+zczCxgAABC5JREFUeAHN1ul3k0UU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IVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC
137-
[link-binder]: https://mybinder.org/v2/gh/GazzolaLab/PyElastica/master?filepath=examples%2FBinder%2F0_PyElastica_Tutorials_Overview.ipynb
138128
[link-gitter]: https://gitter.im/PyElastica/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
139129
[link-doi]: https://zenodo.org/badge/latestdoi/254172891

docs/api/callback.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
Callback Functions
22
===================
33

4-
.. _constraints:
5-
64
.. automodule:: elastica.callback_functions
75

86
Description
97
-----------
108

11-
The frequency at which you have your callback function save data will depend on what information you need from the simulation. Excessive call backs can cause performance penalties, however, it is rarely necessary to make call backs at a frequency that this becomes a problem. We have found that making a call back roughly every 100 iterations has a negligible performance penalty.
9+
The frequency at which you have your callback function save data will depend on what information you need from the simulation. Excessive call backs can cause performance penalties, however, it is rarely necessary to make call backs at a frequency that this becomes a problem. We have found that making a call back roughly every 100 iterations has a negligible performance penalty.
1210

1311
Currently, all data saved from call back functions is saved in memory. If you have many rods or are running for a long time, you may want to consider editing the call back function to write the saved data to disk so you do not run out of memory during the simulation.
1412

@@ -19,8 +17,8 @@ Currently, all data saved from call back functions is saved in memory. If you ha
1917
ExportCallBack
2018
MyCallBack
2119

22-
Built-in Constraints
23-
--------------------
20+
Built-in Callbacks
21+
------------------
2422

2523
.. autoclass:: CallBackBaseClass
2624
:special-members: __init__
@@ -30,4 +28,3 @@ Built-in Constraints
3028

3129
.. autoclass:: MyCallBack
3230
:special-members: __init__
33-

docs/api/constraints.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Constraints
55

66
.. automodule:: elastica.boundary_conditions
77

8+
89
Description
910
-----------
1011

@@ -21,8 +22,6 @@ Constraints are equivalent to displacement boundary condition.
2122
GeneralConstraint
2223
FixedConstraint
2324
HelicalBucklingBC
24-
FreeRod
25-
OneEndFixedRod
2625

2726
Compatibility
2827
~~~~~~~~~~~~~
@@ -72,7 +71,3 @@ Built-in Constraints
7271

7372
.. autoclass:: HelicalBucklingBC
7473
:special-members: __init__
75-
76-
.. autoclass:: FreeRod
77-
78-
.. autoclass:: OneEndFixedRod

docs/api/damping.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ LaplaceDissipationFilter ✅ ❌
2828
=============================== ==== ===========
2929

3030

31-
Built-in Constraints
32-
--------------------
31+
Built-in Dampers
32+
----------------
3333

3434
.. autoclass:: DamperBase
3535
:inherited-members:

docs/api/utility.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
Utility Functions
2-
==================
2+
=================
33

44
Here, we provide some useful functions that we often use along with elastica.
55

66
Transformations
7-
-----------------
7+
---------------
8+
89
.. automodule:: elastica.transformations
910
:members:
1011
:exclude-members: __weakref__
1112

13+
1214
Math
1315
----
16+
1417
.. automodule:: elastica._calculus
1518
:members:
1619
:exclude-members: __weakref__
@@ -25,6 +28,7 @@ Math
2528

2629
Miscellaneous
2730
-------------
31+
2832
.. automodule:: elastica.utils
2933
:members:
3034
:exclude-members: __weakref__

docs/conf.py

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@
1313

1414
import os
1515
import sys
16+
import datetime
1617

17-
sys.path.insert(0, os.path.abspath('../'))
18+
sys.path.insert(0, os.path.abspath("../"))
1819

1920
from elastica.version import VERSION
2021

2122

2223
# -- Project information -----------------------------------------------------
2324

24-
project = 'PyElastica'
25-
copyright = '2025, Gazzola Lab'
26-
author = 'Gazzola Lab'
25+
YEAR = datetime.datetime.now().year
2726

28-
# The full version, including alpha/beta/rc tags
27+
project = "PyElastica"
28+
copyright = f"{YEAR}, Gazzola Lab"
29+
author = "Gazzola Lab"
2930
release = VERSION
3031

3132

@@ -35,17 +36,40 @@
3536
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3637
# ones.
3738
extensions = [
38-
'sphinx.ext.autodoc',
39-
'sphinx.ext.autosectionlabel',
40-
'sphinx_autodoc_typehints',
39+
"sphinx.ext.autodoc",
40+
"sphinx.ext.autosectionlabel",
41+
"sphinx_autodoc_typehints",
4142
#'sphinx.ext.napoleon',
42-
'sphinx.ext.viewcode',
43-
'sphinx.ext.mathjax',
43+
"sphinx.ext.viewcode",
44+
"sphinx.ext.mathjax",
45+
"sphinxcontrib.video",
4446
"sphinxcontrib.mermaid",
45-
'numpydoc',
46-
'myst_parser',
47+
"numpydoc",
48+
"myst_parser",
49+
"sphinx_gallery.gen_gallery",
4750
]
4851

52+
# To add example in gallery,
53+
# 1. run script should start with GALLERY_KEY
54+
# 2. Some README(.rst/.md/.txt) file should be in the directory
55+
GALLERY_KEY = "run"
56+
sphinx_gallery_conf = {
57+
"examples_dirs": "../examples",
58+
"subsection_order": [
59+
"../examples/TimoshenkoBeamCase",
60+
"*",
61+
"../examples/ContinuumSnakeCase",
62+
],
63+
"gallery_dirs": "_gallery",
64+
"backreferences_dir": "gen_modules/backreferences",
65+
"example_extensions": ".py",
66+
"ignore_pattern": rf"^(?!.*{GALLERY_KEY})[^/\\]+\.py$",
67+
"filename_pattern": f"/{GALLERY_KEY}_.*",
68+
# 'nested_sections': True,
69+
"first_notebook_cell": ("# PyElastica installation\n" "# !pip install pyelastica"),
70+
# "parallel": 2,
71+
}
72+
4973
myst_enable_extensions = [
5074
"amsmath",
5175
"colon_fence",
@@ -57,48 +81,52 @@
5781
]
5882

5983
# Add any paths that contain templates here, relative to this directory.
60-
templates_path = ['_templates']
84+
templates_path = ["_templates"]
6185

6286
# List of patterns, relative to source directory, that match files and
6387
# directories to ignore when looking for source files.
6488
# This pattern also affects html_static_path and html_extra_path.
6589
exclude_patterns = [
66-
"README.md", # File reserved to explain how documentationing works.
67-
]
90+
"README.md", # File reserved to explain how documentationing works.
91+
]
6892

69-
autodoc_default_flags = ['members', 'private-members', 'special-members', 'show-inheritance']
93+
autodoc_default_flags = [
94+
"members",
95+
"private-members",
96+
"special-members",
97+
"show-inheritance",
98+
]
7099
autosectionlabel_prefix_document = True
71100

72-
source_parsers = {
73-
}
74-
source_suffix = ['.rst', '.md']
101+
source_parsers = {}
102+
source_suffix = [".rst", ".md"]
75103

76-
master_doc = 'index'
104+
master_doc = "index"
77105
# -- Options for HTML output -------------------------------------------------
78106

79107
# The theme to use for HTML and HTML Help pages. See the documentation for
80108
# a list of builtin themes.
81109

82-
html_theme = 'sphinx_book_theme'
110+
html_theme = "sphinx_book_theme"
83111
html_theme_options = {
84112
"repository_url": "https://github.com/GazzolaLab/PyElastica",
85113
"use_repository_button": True,
86114
}
87115
html_title = "PyElastica"
88116
html_logo = "_static/assets/Logo.png"
89-
#pygments_style = "sphinx"
117+
# pygments_style = "sphinx"
90118

91119
# Add any paths that contain custom static files (such as style sheets) here,
92120
# relative to this directory. They are copied after the builtin static files,
93121
# so a file named "default.css" will overwrite the builtin "default.css".
94-
html_static_path = ['_static']
95-
html_css_files = ['css/*', 'css/logo.css']
122+
html_static_path = ["_static"]
123+
html_css_files = ["css/*", "css/logo.css"]
96124

97125
# -- Options for autodoc ---------------------------------------------------
98-
autodoc_member_order = 'bysource'
126+
autodoc_member_order = "bysource"
99127

100128
# -- Options for numpydoc ---------------------------------------------------
101129
numpydoc_show_class_members = False
102130

103131
# -- Mermaid configuration ---------------------------------------------------
104-
mermaid_params = ['--theme', 'neutral']
132+
mermaid_params = ["--theme", "neutral"]

docs/guide/binder.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)