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 manylinux_2_28_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-5.0.1-py3-none-win_amd64.whl (965.9 kB view details)

Uploaded Python 3 Windows x86-64

meshkernel-5.0.1-py3-none-manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.28+ x86-64

meshkernel-5.0.1-py3-none-macosx_14_0_arm64.whl (1.2 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

meshkernel-5.0.1-py3-none-macosx_13_0_x86_64.whl (1.2 MB view details)

Uploaded Python 3 macOS 13.0+ x86-64

meshkernel-5.0.1-py3-none-macosx_13_0_arm64.whl (1.2 MB view details)

Uploaded Python 3 macOS 13.0+ ARM64

meshkernel-5.0.1-py3-none-macosx_12_0_x86_64.whl (1.2 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for meshkernel-5.0.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 54d42ee009d212369f082449d1b19f10703c3469a52e39f7f3874d78ae67f8ab
MD5 4454832399a31a1405697aea5f08c452
BLAKE2b-256 ca2a61350e72414ab406636f1a3da173773c11aa2506d4d31ac195fe6e6638d5

See more details on using hashes here.

File details

Details for the file meshkernel-5.0.1-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for meshkernel-5.0.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dc42e3168456fabeaa86d4fe18efdc88a29b8dc8d92d27faffe48071e5c69285
MD5 cf4d4fc39cebb42d4009d2e7e0e5d178
BLAKE2b-256 cfc907ec05d188fd48dc4e4e2147c23741090df7baf83476bb410526d51ae4c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 818c4bfa3cb935ef9bc571623cd84ea118f06ab043c4a350cf70424a4952db69
MD5 398d7d8a72f2d2f3b372f1f233e777fe
BLAKE2b-256 4e68afe8c2e9df59ad5e6f8d49af78ced2a6f8472d34f152ac8a44cc26eeb7f7

See more details on using hashes here.

File details

Details for the file meshkernel-5.0.1-py3-none-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for meshkernel-5.0.1-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 98c17301f146989355085e1e558ded4d0ee98f8bcc48bb9ec111681bb26d9ac5
MD5 a31cce6219be2e1fafec90ce6b1cdf99
BLAKE2b-256 74aa27a7119b49a202bb61ef2a818eeba60849e40c35f49345af0e493c9b3790

See more details on using hashes here.

File details

Details for the file meshkernel-5.0.1-py3-none-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for meshkernel-5.0.1-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 c0bb6648839e657b1ea96b0459fe2a6a3e70a6b48b8f3b71e1750f24d0e8a379
MD5 ab32c72f525439aeac8bde479af66d03
BLAKE2b-256 aed0818afe314cef31e9fbb5d3e690ff3b57f4486b686a66dc56850ea299a237

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.1-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 551f816f699603d98ab9e639101505149ca43fb027f960b0c4c835414fe2b76f
MD5 6c9c6a07b9943d9409cecd037bbe246e
BLAKE2b-256 7a980978fe0766d246c6bc045b6db62938a63afb35e9bd6cdb9c56af18f8fe84

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