Skip to content

Commit 09336a1

Browse files
anslpajazztekkakaszynski
authored
Docs/user guide (#14)
* gitignore updated * user_guide files added * speed -> velocity * solution doc string fix * old user guide index file removed * API files added * doc string stress update * user guide and API references added * fix for get result info * fixes for generation with sphinx * rth files added in user guide * accesing_result .rst file update * misc_results file updated * _plot_chart removed (need to be discussed) * examples order changed * thermal analysis and mechanics analysis * extensions removed * suggested editorial improvements * suggested editorial improvements * suggested editorial improvements (API & index.rst) * cleaned up code docgen * touch log file to avoid tail on non-existing file Co-authored-by: jazztekk <[email protected]> Co-authored-by: Alex Kaszynski <[email protected]>
1 parent 5d5aaca commit 09336a1

31 files changed

+877
-82
lines changed

.ci/azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ jobs:
132132
set -ex
133133
echo $(PAT) | docker login -u $(GH_USERNAME) --password-stdin docker.pkg.github.com
134134
docker pull $(DPF_IMAGE)
135+
touch log.txt
135136
docker run --restart always --name dpf -v `pwd`:/dpf -v /tmp:/dpf/_cache -p $(DPF_PORT):50054 $(DPF_IMAGE) > log.txt &
136137
grep -q 'server started on ip' <(timeout 60 tail -f log.txt)
137138
python -c "from ansys.dpf import core as dpf; dpf.connect_to_server(port=$(DPF_PORT)); print('Python Connected')"

.github/workflows/ci-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
- name: Pull, launch, and validate DPF service
5151
run: |
5252
echo $PAT | docker login -u $GH_USERNAME --password-stdin docker.pkg.github.com
53+
touch log.txt
5354
docker run --restart always --name dpf -v `pwd`:/dpf -v /tmp:/dpf/_cache -p $DPF_PORT:50054 $DPF_IMAGE > log.txt &
5455
grep -q 'server started on ip' <(timeout 60 tail -f log.txt)
5556
python -c "from ansys.dpf.post import examples;from ansys.dpf import core;print(core.Model(examples.simple_bar))"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ __pycache__
2020
#other
2121
/perso
2222
/examples/Jupyter lab/.ipynb_checkpoints
23+
*checkpoint.py
24+
*checkpoint.ipynb
2325

2426
# compiled documentation
2527
docs/_build

ansys/dpf/post/dpf_solution.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,14 @@ def get_result_info(self):
4848
4949
Examples
5050
--------
51-
The following code:
5251
>>> from ansys.dpf import post
5352
>>> result = post.result("file.rst")
54-
>>> print(result.get_result_info())
55-
56-
Will return:
57-
Static analysis
58-
Unit system: Metric (m, kg, N, s, V, A)
59-
Physics Type: Mecanic
60-
Available results:
61-
- displacement
62-
- volume
53+
>>> print(result.get_result_info())
6354
"""
6455
return self._model.metadata.result_info
6556

6657
def __str__(self):
67-
txt = '%s result object.' % self._model.metadata.result_info.analysis_type.capitalize() +\
58+
txt = '%s solution object.' % self._model.metadata.result_info.analysis_type.capitalize() +\
6859
'\n\n\nData Sources\n------------------------------\n'
6960
ds_str = self._data_sources.__str__()
7061
txt += ds_str

ansys/dpf/post/misc_results.py

Lines changed: 71 additions & 1 deletion
Large diffs are not rendered by default.

ansys/dpf/post/result_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def plot_contour(self, display_option: str = "time", option_id=1,
270270
pl.plot_contour(new_fields_container, off_screen=off_screen,
271271
notebook=notebook, **kwargs)
272272

273-
def plot_chart(self):
273+
def _plot_chart(self):
274274
"""Plot the minimum/maximum result values over time.
275275
276276
This method works if the time_freq_support contains

ansys/dpf/post/stress.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class Stress(Tensor):
1515
>>> from ansys.dpf.post import examples
1616
>>> solution = post.load_solution(examples.multishells_rst)
1717
>>> stress = solution.stress(location=post.locations.nodal, time_scoping=[1])
18-
19-
Extract the princ
20-
2118
"""
2219
def __init__(self, **kwargs):
2320
super().__init__(**kwargs)

docs/source/_static/css/ansys.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ h1, h2, h3, h4, h5, h6 {
1414
font-family: 'Source Sans Pro', sans-serif;
1515
}
1616

17+
.navbar-toggler-icon {
18+
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255, 0.9)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E") !important;
19+
}
1720

1821
.sig-prename {
1922
color: var(--ansysBronze);

docs/source/api/index.rst

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,24 @@
1-
.. _ref_api_index:
1+
============
2+
DPF-Post API
3+
============
4+
This guide provides an overview of the DPF-Post API.
25

3-
API Reference
4-
=============
5-
Details of the DPF API.
6+
DPF-Post leverages three main categories of objects:
67

8+
1. **Solution**: it is the entry point to the results file, its
9+
metadata and contents.
710

8-
Solution Object
9-
---------------
10-
The solution object instantiates an object that is built on the result
11-
file. Use the following code to instantiate a solution object.
11+
2. **Result**: it provides access to specific result types, in
12+
accordance with the type of analysis.
1213

13-
.. code:: python
14+
3. **ResultData**: it provides access to the actual data values and
15+
closely relates to the DPF-Core "Fields Container" concept.
1416

15-
>>> from ansys.dpf import post
16-
>>> from ansys.dpf.post import examples
17-
>>> solution = post.load_solution(examples.multishells_rst)
1817

19-
20-
Result Object
21-
-------------
22-
The result object can be manipulated to get different result data.
23-
24-
.. code:: python
25-
26-
>>> from ansys.dpf import post
27-
>>> from ansys.dpf.post import examples
28-
>>> solution = post.load_solution(examples.multishells_rst)
29-
>>> # Displacement result object
30-
>>> displacement = solution.displacement()
31-
>>> # Stress result object
32-
>>> stress = solution.stress()
33-
>>> # Elastic strain result object
34-
>>> elastic_strain = solution.elastic_strain()
35-
36-
37-
ResultData Class
38-
----------------
39-
The ``ResultData`` class is instantiated from a result object. It
40-
enables easy access to the data contained within the result
41-
object. The following example shows how to get an instance of
42-
``ResultData``.
43-
44-
.. code:: python
45-
46-
>>> from ansys.dpf import post
47-
>>> solution = post.load_solution(r'../../../testfiles/tests/model_with_ns.rst')
48-
>>> displacement = solution.displacement()
49-
>>> result = displacement.vector
50-
>>> # access the data
51-
>>> vector.get_data_at_field(0)
52-
53-
.. autoclass:: ansys.dpf.post.result_data.ResultData
54-
:members:
18+
.. toctree::
19+
:maxdepth: 2
20+
:caption: Contents
21+
22+
solution
23+
result_object
24+
result_data

docs/source/api/result_data.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. _ref_api_result_data:
2+
3+
*****************
4+
ResultData object
5+
*****************
6+
7+
The ``ResultData`` object is obtained from a ``Result``. It provides
8+
access to the result values contained within, as shown in the
9+
following example:
10+
11+
.. code:: python
12+
13+
>>> from ansys.dpf import post
14+
>>> from ansys.dpf.post import examples
15+
>>> solution = post.load_solution(examples.multishells_rst)
16+
>>> displacement = solution.displacement()
17+
>>> result = displacement.vector
18+
>>> # access the data
19+
>>> vector.get_data_at_field(0)
20+
21+
.. autoclass:: ansys.dpf.post.result_data.ResultData
22+
:members:

0 commit comments

Comments
 (0)