Skip to main content

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

Project description

MeshKernelPy

PyPI version Quality Gate Status Coverage Downloads

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

If you're not sure about the file name format, learn more about wheel file names.

meshkernel-8.3.0-py3-none-win_amd64.whl (1.1 MB view details)

Uploaded Python 3Windows x86-64

meshkernel-8.3.0-py3-none-manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

meshkernel-8.3.0-py3-none-macosx_26_0_arm64.whl (1.1 MB view details)

Uploaded Python 3macOS 26.0+ ARM64

meshkernel-8.3.0-py3-none-macosx_15_0_x86_64.whl (1.2 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

meshkernel-8.3.0-py3-none-macosx_15_0_arm64.whl (1.1 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

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

Uploaded Python 3macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: meshkernel-8.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for meshkernel-8.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1368811493affb5f84c6d1547b8e83dc4bb6d159b12b203a2916a2a891d12637
MD5 cba1891bf448304e95185bea3ee9aeed
BLAKE2b-256 001804ea74843dca6f281d30b1b39e6548ea4396c36bf663d506013c8ce5d61d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-8.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3a34e62c6c3c003df8c2dca319543edaf29968791790da5c34d012c4ea8d01e
MD5 21c07fa11c81e6b439d7f654e31f3673
BLAKE2b-256 e357371ed4d8f165ba3033905683a8216b6c4f06d745cf4fd2aacb6df264a918

See more details on using hashes here.

File details

Details for the file meshkernel-8.3.0-py3-none-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for meshkernel-8.3.0-py3-none-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 03370a45b3c64134536429eb6ea0083780c9b88e598ac513092404c758efb2ad
MD5 fbd724dcb5f4e90c72741a4b5c666bd5
BLAKE2b-256 c88901512be1edec75320963cb7f940d52150358a8217f99d5d5ba38f53670f5

See more details on using hashes here.

File details

Details for the file meshkernel-8.3.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for meshkernel-8.3.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 f1c231535fa73dded23cca0882a2299f67edd112e36ee876b7ae5ad245bac4ad
MD5 d2c3cc11d40fd4ba7e6e588ac7f58d3d
BLAKE2b-256 76a4cc7e6442e3e5266d4defb041636bbe1df1e4f3b38729bb085d7b211fc2ef

See more details on using hashes here.

File details

Details for the file meshkernel-8.3.0-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for meshkernel-8.3.0-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 90771f4d789e3b7656f55cfe7b08f61345bfa4fd390b0227b4f57ace281d51f8
MD5 cd1a7a4d76af4746badd0bbc4018149a
BLAKE2b-256 b0122ea069a98fc1b6d775dbfca1733122c1e2a83c865746d1177d027b99089b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-8.3.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 52e0179503b1c630c1d8a5e66d9a758e8f130dcd8300ac2bf8cdebf1ddc82e5e
MD5 f2b945ead49b90236954994f2605a208
BLAKE2b-256 9682fad42ce5a336f1195bed651ba899ede758f6840d2a17df6b1fec4cfcb7eb

See more details on using hashes here.

Supported by

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