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.2.0-py3-none-win_amd64.whl (921.9 kB view details)

Uploaded Python 3 Windows x86-64

meshkernel-4.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

meshkernel-4.2.0-py3-none-macosx_14_0_arm64.whl (1.1 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

meshkernel-4.2.0-py3-none-macosx_13_0_arm64.whl (1.1 MB view details)

Uploaded Python 3 macOS 13.0+ ARM64

meshkernel-4.2.0-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-4.2.0-py3-none-win_amd64.whl.

File metadata

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

File hashes

Hashes for meshkernel-4.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5dd569a4922671300cdbdf51e41217b96438d516cbd3420d88942827f1efb353
MD5 c48f6f564e09cd3e22c4df8ae4469d9a
BLAKE2b-256 7696341e49917839383df16e3643143327d4724c60fac1c2948514acb7049b97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.2.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 945c0ae203b84c6a36d1d9c1a1269aa79090f8db23ee486c7e14445e0a72d6bb
MD5 3becd184df615513d324854a6158e3a7
BLAKE2b-256 3961011b91ae81b864c4a4241d5f82ab30536943e0f32d2c2235ffab4a3bab69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.2.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fa971d4dbe60f56e87a48ee1d94392af9f74482613188adcb4323ae5ec221acf
MD5 d69e6701866697ee9287b4f8b9c490e5
BLAKE2b-256 a5062f70caa4d63d83647498dc1350981c97c5bb8f20382b8c4b757f52e95df6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.2.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 e2a706da2606ca3eadc5ec08f0eefb7752f0c6b190419e373c289be7c106402b
MD5 1c38f7147db79b398226404b665a7e08
BLAKE2b-256 68162ddaa39e27e9e4b015e5e2761f262243c9929a1839d403b644e566bca86e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.2.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 1270d7b1fef971f2dc00ad9e35383c5fdbb3ff59739bfec6c72e9e4263fc77ba
MD5 5b53d97023e0287a196e956114d30b5c
BLAKE2b-256 3f671ab7e855d85c0b495b0cc3b1fa3d0fe93a04b966b2bd3b72460154e35c6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.2.0-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 4649159a6105bce6156f726b8b37226dc4156a11f2dc13d8a81cb265f447d6d2
MD5 26e0cd800ce87b357f6e21e0d440c178
BLAKE2b-256 c202f7915f4154a3b2ad4f3d854591fb84d68c1900b747f5e0e5480574e80c6c

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