Skip to content

Commit

Permalink
Changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
JennaPaikowsky committed Jan 9, 2025
1 parent 0f4a510 commit e32c541
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
10 changes: 4 additions & 6 deletions doc/source/user_guide/concepts/waysofusing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ These capabilities can be accessed through client APIs, as shown here:
.. image:: ../../images/drawings/apis_2.png


1. The DPF server application can be accessed using an Ansys product, or DPF Server package (see :ref:`ref_dpf_server`) available on the Customer portal.

2. Several client APIs are available (CPython, IronPython, C++, and so on).

3. Communication in the same process, or through gRPC, allows you to have the client and the servers on different machines.
- The DPF server application can be accessed using an Ansys product, or DPF Server package (see :ref:`ref_dpf_server`) available on the Customer portal.
- Several client APIs are available (CPython, IronPython, C++, and so on).
- Communication in the same process, or through gRPC, allows you to have the client and the servers on different machines.

Note that **IronPython and CPython APIs are different**, each has specific syntax.

The **list of available operators when using DPF is independent from the language or API which is used**, it only depends
on how the DPF application has been initialized.

Most of the DPF capabilities can be accessed using the operators. For more information about the existing operators, see :ref:`ref_dpf_operators_reference`.
Most of the DPF capabilities can be accessed using the operators. For more information on the existing operators, see :ref:`ref_dpf_operators_reference`.

Enhance DPF capabilities
~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
28 changes: 14 additions & 14 deletions doc/source/user_guide/custom_operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ PyDPF-Core or in any supported client API.

With support for custom operators, PyDPF-Core becomes a development tool offering:

- **Accessibility:** A simple script can define a basic operator plug-in.
- **Accessibility:** A simple script can define a basic operator plugin.

- **Componentization:** Operators with similar applications can be grouped in Python plug-in packages.
- **Componentization:** Operators with similar applications can be grouped in Python plugin packages.

- **Easy distribution:** Standard Python tools can be used to package, upload, and download custom operators.

Expand Down Expand Up @@ -61,13 +61,13 @@ Create operators
----------------
You can create a basic operator plugin or a plugin package with multiple operators.

Basic operator plug-in
~~~~~~~~~~~~~~~~~~~~~~
To create a basic operator plug-in, write a simple Python script. An operator implementation
Basic operator plugin
~~~~~~~~~~~~~~~~~~~~~
To create a basic operator plugin, write a simple Python script. An operator implementation
derives from the :class:`ansys.dpf.core.custom_operator.CustomOperatorBase` class and a call to
the :func:`ansys.dpf.core.custom_operator.record_operator` method.

This example script shows how you create a basic operator plug-in:
This example script shows how you create a basic operator plugin:

.. literalinclude:: custom_operator_example.py

Expand All @@ -90,12 +90,12 @@ In the various properties for the class, specify the following:
when running the operator. Set it equal to ``any_dpf_supported_increments`` to allow any license
currently accepted by DPF (see :ref:`here<target_to_ansys_license_increments_list>`)

For comprehensive examples on writing operator plug-ins, see :ref:`python_operators`.
For comprehensive examples on writing operator plugins, see :ref:`python_operators`.


Plug-in package with multiple operators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a plug-in package with multiple operators or with complex routines, write a
Plugin package with multiple operators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To create a plugin package with multiple operators or with complex routines, write a
Python package. The benefits of writing packages rather than simple scripts are:

- **Componentization:** You can split the code into several Python modules or files.
Expand Down Expand Up @@ -149,7 +149,7 @@ Third-party dependencies
.. include:: custom_operators_deps.rst


Assume once again that the name of your plug-in package is ``custom_plugin``.
Assume once again that the name of your plugin package is ``custom_plugin``.
A folder with this name would contain these files:

- ``__init__.py``
Expand Down Expand Up @@ -223,7 +223,7 @@ Once a custom operator is created, you can use the :func:`ansys.dpf.core.core.lo
The first argument is the path to the directory with the plugin. The second argument is ``py_`` plus any name
identifying the plugin. The last argument is the function name for recording operators.

For a plug-in that is a single script, the second argument should be ``py_`` plus the name of the Python file:
For a plugin that is a single script, the second argument should be ``py_`` plus the name of the Python file:

.. code::
Expand All @@ -232,7 +232,7 @@ For a plug-in that is a single script, the second argument should be ``py_`` plu
"py_custom_plugin", #if the load_operators function is defined in path/to/plugins/custom_plugin.py
"load_operators")
For a plug-in package, the second argument should be ``py_`` plus any name:
For a plugin package, the second argument should be ``py_`` plus any name:

.. code::
Expand All @@ -241,7 +241,7 @@ For a plug-in package, the second argument should be ``py_`` plus any name:
"py_my_custom_plugin", #if the load_operators function is defined in path/to/plugins/custom_plugin/__init__.py
"load_operators")
Once the plug-in is loaded, you can instantiate the custom operator:
Once the plugin is loaded, you can instantiate the custom operator:

.. code::
Expand Down
14 changes: 7 additions & 7 deletions doc/source/user_guide/custom_operators_deps.rst
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
To add third-party modules as dependencies to a plug-in package, create
To add third-party modules as dependencies to a plugin package, create
and reference a folder or ZIP file with the sites of the dependencies in an XML file
located next to the folder for the plug-in package. The XML file must have the same
name as the plug-in package plus an ``.xml`` extension.
located next to the folder for the plugin package. The XML file must have the same
name as the plugin package plus an ``.xml`` extension.

When the :py:func:`ansys.dpf.core.core.load_library` method is called, PyDPF-Core uses the
``site`` Python module to add custom sites to the path for the Python interpreter.


To create these custom sites:

#. Install the requirements of the plug-in package in a Python virtual environment.
#. Install the requirements of the plugin package in a Python virtual environment.
#. Remove unnecessary folders from the site packages and compress them into a ZIP file.
#. Place the ZIP file in the plug-in package.
#. Place the ZIP file in the plugin package.
#. Reference the path to the ZIP file in the XML file as indicated above.

To simplify this step, you can add a requirements file in the plug-in package:
To simplify this step, you can add a requirements file in the plugin package:

.. literalinclude:: /examples/07-python-operators/plugins/gltf_plugin/requirements.txt

Expand All @@ -28,7 +28,7 @@ For this approach, do the following:

3. Run the downloaded script with the mandatory arguments:

- ``-pluginpath``: Path to the folder with the plug-in package.
- ``-pluginpath``: Path to the folder with the plugin package.
- ``-zippath``: Path and name for the ZIP file.

Optional arguments are:
Expand Down
4 changes: 2 additions & 2 deletions doc/source/user_guide/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ Operators for importing or reading data
These operators read data from solver files or from standard file types
such as .RST (MAPDL), .D3Plot (LS DYNA), .CAS.H5/.DAT.H5 (Fluent) or .CAS.CFF/.DAT.CFF (CFX).

To read these files, different readers are implemented as plug-ins.
Plug-ins can be loaded on demand in any DPF scripting language with "load library" methods.
To read these files, different readers are implemented as plugins.
Plugins can be loaded on demand in any DPF scripting language with "load library" methods.
File readers can be used generically thanks to the DPF result providers, which means that the same operators can be used for any file types.

This example shows how to read a displacement and a stress for any file:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/xmlfiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ element, for example, would only be used with a debug version of the
The element names for plugins, such as ``<native>`` and ``<fem_utils>``, are used as
**keys** when loading plugins. Each plugin must have a unique key.

The element for each plug-in has child elements:
The element for each plugin has child elements:

- ``<Path>``: Contains the location of the plugin to load. The normal mechanism
that the operating system uses to find a DLL or SO file is used. The DLL
Expand Down

0 comments on commit e32c541

Please sign in to comment.