Skip to main content

`meshkernel` is a library which can be used to manipulate meshes.

Project description

MeshKernelPy

Quality Gate Status PyPI version

MeshKernelPy is a library for creating and editing meshes. It supports 1D and 2D unstructured meshes. The underlying C++ library MeshKernel can be found here.

Installation

The library can be installed from PyPI by executing

pip install meshkernel

Under Windows, If you encounter any issues importing the pip wheels, you may need to install the Visual C++ Redistributable for Visual Studio 2019.

Examples

Creating a triangular mesh inside a polygon

In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.

Mesh orthogonalization

Finite volume staggered flow solvers require the mesh to be as orthogonal as possible. MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.

Mesh refinement

A mesh can be refined in areas based on samples or polygon selections.

Contributing

In order to install MeshKernelPy locally, please execute the following line inside your virtual environment

pip install -e ".[tests, lint, docs]"

Then add a compiled MeshKernelApi.dll into your src folder.

Also make sure that your editor is configured to format the code with black and isort. When modifying Jupyter notebooks, the jupyterlab-code-formatter can be used.

Building and installing the wheel

Platform-specific build

A setup script is provided for building the wheel. The script is known to work under Windows, Linux and macOS.

To install the dependencies, use

python -m pip install --upgrade pip
python -m pip install wheel numpy matplotlib pytest

The environment variable BACK_END_BRANCH must be set prior to building the wheel. It specifies which MeshKernel branch should be built during the generation of the wheel. If one is on the main branch of MeshKernelPy, BACK_END_BRANCH must be either set to master. If one is an a release branch, BACK_END_BRANCH should be set to release. The version of the MeshKernel release branch is hardcoded in meshkernel/version.py.

While in the project's root directory, to build the wheel use

python setup.py build_ext
python setup.py sdist bdist_wheel

To install use: The wheel is installed

python -m pip install <meshkernel_wheel_name>

where <meshkernel_wheel_name> is the name of the generated wheel.

To test, simply run pytest.

Manylinux Docker image

To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64. This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++). To build the Docker image, use:

docker build --progress=plain ./scripts -t build_linux_library

Once the Docker image has been built, build the manylinux wheel using the following command:

docker run -e BACK_END_BRANCH=<meshkernel_back_end_branch_name> -v $(pwd):/root --rm build_linux_library

where <meshkernel_back_end_branch_name> is either master or release, as described in Platform-specific build.

The deployable manylinux wheels will be located in dist/wheelhouse.

License

MeshKernelPy uses the MIT license. However, the wheels on PyPI bundle the LGPL licensed MeshKernel. Please make sure that this fits your needs before depending on it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

meshkernel-4.1.0-py3-none-win_amd64.whl (845.3 kB view details)

Uploaded Python 3 Windows x86-64

meshkernel-4.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

meshkernel-4.1.0-py3-none-macosx_14_0_arm64.whl (971.6 kB view details)

Uploaded Python 3 macOS 14.0+ ARM64

meshkernel-4.1.0-py3-none-macosx_12_0_x86_64.whl (1.0 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

Details for the file meshkernel-4.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: meshkernel-4.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 845.3 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for meshkernel-4.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 11f16785aeb95b7ca3ad77a2111033c381cc3c5f4bf4d864c76d7201b615ef1a
MD5 5268e29dcf2ebd5ef65f877b80e85333
BLAKE2b-256 e802f1d63cfba4ed401826a32a9edea7ac2b7bd22b968740af04d34d07da2519

See more details on using hashes here.

File details

Details for the file meshkernel-4.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for meshkernel-4.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c446c72cffd35cd4b8ab507eb2576b4d22cc7a3e9cc5b54a288b0364dbac879
MD5 8dbb490a6267e02547b7b45a091d8717
BLAKE2b-256 493296036e0dfcf4383755c85da6f25114f2a1c01966406a3c3878c3113b06bf

See more details on using hashes here.

File details

Details for the file meshkernel-4.1.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for meshkernel-4.1.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4c6b83ef767d4f2a4dbfb0810d8b17e2cbb123d6730a77f6334ea6252c2b898e
MD5 d4e5fff706c91c17e2305bb9b6f85671
BLAKE2b-256 c52722c0601105fb43cb7f84b494269471c847a260e2dc22bc088b64e45c9b7b

See more details on using hashes here.

File details

Details for the file meshkernel-4.1.0-py3-none-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for meshkernel-4.1.0-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 200c52ca54c139bf7c87a3848622675cb6154499053c535659185b0078b60411
MD5 38f1a74b50270b251518966bbaec100c
BLAKE2b-256 a3144aacab9f8df27db311191441233dd81b667b18e6fa473673b31ae6a20a9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page