Skip to content

Commit

Permalink
Included Gmsh in package dependencies, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippMetsch committed Aug 19, 2020
1 parent 76f1778 commit 5a7f71e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 50 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ of Gmsh within a nice and easy to use environment such as Python.
Installation
************
GmshModel is available from the `Python Package Index <https://pypi.org/project/gmshModel/>`_ and
can be installed using the following command:
can be installed using the following command: ::

$ python3 -m pip install gmshModel

The integration of gmshModel into the `conda-forge <https://anaconda.org/conda-forge/gmshmodel>`_
channel allows to use a similar procedure for Conda users:
channel allows to use a similar procedure for Conda users: ::

$ conda install -c conda-forge gmshModel

Expand Down
77 changes: 30 additions & 47 deletions docs/gettingStarted/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,50 @@
Installation
============
As most Python packages, gmshModel can be installed in more than one way. Here,
the two most common ways of the package installation will be pointed out: the
installation via the `Python Package Index <https://pypi.org/>`_ and a manual
installation using the source code.
the two common ways of the package installation will be pointed out: the
installation via the `Conda <https://anaconda.org/>`_ and `PyPi <https://pypi.org/>`_
package managers.


Dependencies
************
GmshModel is an interface tool and makes use of many great contributions of other
people. To experience the full functionality of gmshModel, several software packages
are required.

The most important software for the use of gmshModel is `Gmsh <https://gmsh.info/>`_
with an activated `Gmsh-Python-API <https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/api/gmsh.py/>`_.
The compilation of Gmsh from source is described
`here <https://gitlab.onelab.info/gmsh/gmsh/-/wikis/Gmsh-compilation/>`_. While
following the installation instructions, make sure that `FLTK <https://www.fltk.org/>`_
is configured using the ``--enable-shared`` flag and Gmsh uses the
``-DENABLE_BUILD_DYNAMIC=1`` flag when `cmake <https://cmake.org/>`_ is called.
An easier way of installing Gmsh is provided using the existing `PyPi package <https://pypi.org/project/gmsh/>`_
which can be installed typing

.. code-block:: python
people. To experience the full functionality of Gmsh model, the following (non-standard)
software packages are required:

python3 -m pip install gmsh
Independent of which way you choose, please make sure that the Gmsh-Python-API is
working for you by checking its import:
1. a `dynamically built Gmsh <https://gitlab.onelab.info/gmsh/gmsh/-/wikis/Gmsh-compilation/>`_ to use the Gmsh-Python-API
2. `meshio <https://github.com/nschloe/meshio/>`_ for the conversion of meshes to various output formats
3. `pyvista <https://www.pyvista.org/>`_ for the visualization of meshes
4. `pythonocc-core <https://github.com/tpaviot/pythonocc-core/>`_ for the visualization of the model geometry

.. code-block:: python
Using the supported PyPi and Conda package managers, all dependencies that
are necessary to run gmshModel will be automatically installed. Since the ``pythonocc-core``
package does not provide an installation for PyPi, the geometry visualization feature
will not be available for it.

python3 -c "import gmsh; gmsh.initialize(['', '--help'])"
The gmshModel package itself depends on `numpy <https://numpy.org/>`_. For advanced
features, the following packages are required as well:

1. `meshio <https://github.com/nschloe/meshio/>`_ for the conversion of meshes to various output formats
2. `pyvista <https://www.pyvista.org/>`_ for the visualization of meshes
3. `pythonocc <https://github.com/tpaviot/pythonocc-core/>`_ for the visualization of the model geometry
Installation using Conda
************************
The availability of gmshModel in the `conda-forge channel <https://anaconda.org/conda-forge/gmshmodel>`_
allows a straightforward installation of the package using the following command: ::

If ``pip`` is used for the package installation, numpy as well as meshio and pyvista
will be installed automatically. However, pythonocc is not available at PyPi and
therefore has to be `compiled from source <https://github.com/tpaviot/pythonocc-core/blob/master/INSTALL.md/>`_.
$ conda install -c conda-forge gmshModel


Installation using PyPi
***********************
Since gmshModel is available from the `Python Package Index <https://pypi.org/>`_,
it can simply be installed using the following command:

.. code-block:: python
python3 -m pip install gmshModel
Since gmshModel is also available from the `Python Package Index <https://pypi.org/project/gmshModel/>`_,
PyPi users can simply install it using the following command: ::

Manual installation
*******************
For a manual installation of gmshModel, the source code has to be downloaded from
`Github <https://github.com/NEFM-TUDresden/gmshModel/>`_ or `PyPi <https://pypi.org/project/gmshModel/>`_.
Once this is done, the installation from within the downloaded source code is as
easy as using the command:
$ python3 -m pip install gmshModel

.. code-block:: python
If the package does not work after the installation due to an import error of
the Gmsh-Python-API, your system probably cannot find the file ``gmsh.py``. In order
to fix this, a symbolic link from its installation location into the ``site-packages``
directory of your Python installation can be created: ::

pip install .
# example for linux users:
$ ln -s <PATH TO GMSH>/lib/gmsh.py $HOME/.local/lib/<PYTHON VERSION>/site-packages/gmsh.py

If you also want to have a working geometry visualization, you can
`compile pythonocc-core from source <https://github.com/tpaviot/pythonocc-core/blob/master/INSTALL.md/>`_.
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ and its features: ::

$ python3 -m pip install gmshModel

For ``conda`` users, the installation command is straightforward, too:

$ conda install -c conda-forge gmshModel

.. image:: images/RVE200SpheresGeo.png
:width: 49%
:alt: 200SpheresGeo
Expand Down
2 changes: 1 addition & 1 deletion gmshModel/_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Version information for GmshModel"""
# versioning scheme: major, minor, patch
versionInfo= 1, 0, 8
versionInfo= 1, 0, 9

__version__= ".".join(map(str, versionInfo))
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

# set install_requires
installRequires=["numpy",
"gmsh",
"meshio>=4",
"pyvista>=0.24.1"]

Expand Down

0 comments on commit 5a7f71e

Please sign in to comment.