@@ -26,8 +26,7 @@ PyAnsys libraries are intended to extend and interface with existing
26
26
products of Ansys services **outside ** of the application itself, and
27
27
in some cases permitting remote execution. As such, this requires
28
28
that you have a working installation of Python, and ideally a Python
29
- distribution like the `Anaconda Distribution
30
- <https://www.anaconda.com/products/individual> `_. For existing users
29
+ distribution like the `Anaconda Distribution `_. For existing users
31
30
of Ansys who are not used to working with Python outside of the
32
31
product, this may seem to be an unnecessary step, but what this
33
32
approach provides is:
@@ -51,9 +50,9 @@ approach provides is:
51
50
52
51
* Customization of your entire Python environment on the OS of your
53
52
choosing. For the applications that support it, you can even
54
- remotely connect with and manage the application via `gRPC
55
- <https://grpc.io/> `_. For those that don't, you can still customize
56
- the version of Python and its packages.
53
+ remotely connect with and manage the application via `gRPC `_. For
54
+ those that don't, you can still customize the version of Python and
55
+ its packages.
57
56
58
57
* Create applications or pipelines that utilize Ansys products and
59
58
expose features as a web-page, standalone application, or script to
@@ -64,7 +63,7 @@ approach provides is:
64
63
PyAnsys Project Structure
65
64
=========================
66
65
The PyAnsys project hosted on GitHub at `PyAnsys
67
- <https://github.com/pyansys> `_ contains several repositories that provide:
66
+ <https://github.com/pyansys> `_ contains repositories that provide:
68
67
69
68
* Interfaces to Ansys products or services:
70
69
@@ -76,7 +75,7 @@ The PyAnsys project hosted on GitHub at `PyAnsys
76
75
77
76
* Documentation and Examples
78
77
79
- * `about <https://github.com/pyansys/about >`_
78
+ * `Project Overview <https://github.com/pyansys/about >`_
80
79
* `pyansys-sphinx-theme <https://github.com/pyansys/pyansys-sphinx-theme >`_
81
80
* `pyansys_landing <https://github.com/pyansys/pyansys_landing >`_
82
81
* `pyansys-helloworld <https://github.com/pyansys/pyansys-helloworld >`_
@@ -88,6 +87,9 @@ The PyAnsys project hosted on GitHub at `PyAnsys
88
87
* `example-coverage <https://github.com/pyansys/example-coverage >`_
89
88
* `system-reporting-tool <https://github.com/pyansys/system-reporting-tool >`_
90
89
90
+ For details regarding each project, visit the repository and either
91
+ view the README or visit the documentation linked to the repository.
92
+
91
93
92
94
PyAnsys Library Overview
93
95
========================
@@ -115,9 +117,48 @@ general pattern in the following figure:
115
117
:width: 400
116
118
:alt: Overview Diagram
117
119
120
+ In this overview, the product or service exposes an interface that is
121
+ either locally acessible (in the case of .NET using `pythoncom `_,
122
+ `SWIG `_, or `C extensions `_) or a service that is locally and
123
+ remotably acessible (`REST `_ or `gRPC `_). This will be reffered to as
124
+ the program API. While this API can be directly accessed
125
+
126
+
127
+ +-----------------------------------------------------------------------------------------------------+-----------------------------------------+
128
+ | Using gRPC Autogenerated Interface | Using PyMapdl Library |
129
+ +-----------------------------------------------------------------------------------------------------+-----------------------------------------+
130
+ | import grpc | from ansys.mapdl import core as pymapdl |
131
+ | | |
132
+ | from ansys.api.mapdl.v0 import mapdl_pb2 as pb_types | # start mapdl |
133
+ | from ansys.api.mapdl.v0 import mapdl_pb2_grpc as mapdl_grpc | mapdl = pymapdl.launch_mapdl() |
134
+ | from ansys.api.mapdl.v0 import kernel_pb2 as anskernel | output = mapdl.input('ds.dat') |
135
+ | from grpc_interceptor_headers.header_manipulator_client_interceptor import header_adder_interceptor | |
136
+ | from ansys.client.servicemanager.client import ServiceManagerClient as service_manager | |
137
+ | sm = service_manager() | |
138
+ | | |
139
+ | # start MAPDL | |
140
+ | job = sm.create_job_by_name("mapdl-212") | |
141
+ | service_name = f"grpc-{job.name}" | |
142
+ | mapdl_service = sm.get_service(name=service_name) | |
143
+ | | |
144
+ | # create a gRPC channel | |
145
+ | channel_str = '%s:%d' % (mapdl_service.host, mapdl_service.port) | |
146
+ | channel = grpc.insecure_channel(channel_str) | |
147
+ | header_adder = header_adder_interceptor('service-name', service_name) | |
148
+ | stub = mapdl_grpc.MapdlServiceStub(channel) | |
149
+ | | |
150
+ | # send the input file | |
151
+ | request = pb_types.InputFileRequest(filename='ds.dat')) | |
152
+ | metadata = (('time-step-stream', '200'), ('chunk-size', '512'),) | |
153
+ | response = stub.InputFileS(request, metadata=metadata) | |
154
+ | # need additional code to parse file... | |
155
+ +-----------------------------------------------------------------------------------------------------+-----------------------------------------+
156
+
157
+
158
+
118
159
119
160
PyAnsys Package Basic Structure
120
- -------------------------------
161
+ ===============================
121
162
122
163
ansys/<product>/<service>/my_module.py
123
164
ansys/<product>/<service>/my_other_module.py
@@ -158,3 +199,11 @@ Python Modules
158
199
159
200
Documentation Directory `doc `
160
201
- Use `pyansys-sphinx-theme <https://sphinxdocs.pyansys.com/ >`_
202
+
203
+
204
+ .. _gRPC : https://grpc.io/
205
+ .. _pythoncom : http://timgolden.me.uk/pywin32-docs/pythoncom.html
206
+ .. _SWIG : http://www.swig.org/
207
+ .. _C extensions : https://docs.python.org/3/extending/extending.html
208
+ .. _Anaconda Distribution : https://www.anaconda.com/products/individual
209
+ .. _REST : https://en.wikipedia.org/wiki/Representational_state_transfer
0 commit comments