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

Uploaded Python 3 Windows x86-64

meshkernel-4.3.0-py3-none-manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded Python 3 manylinux: glibc 2.28+ x86-64

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

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

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

Uploaded Python 3 macOS 13.0+ ARM64

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

File metadata

  • Download URL: meshkernel-4.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 921.7 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.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 966765ca25ef73a7a8a60e9f3bafd57190d610bbbe98f64b5c3adc20867fbdbf
MD5 10d12b96afe2ad8217d3e3a88c082b2a
BLAKE2b-256 9a850e798b0d14a1bf4c790efdc6d720347e6db462cac25287819e733efffaac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b06fd05078e0b67cab0992da15a19b0625c03e91ac14b01d1100cf07fa4b8f2
MD5 c30d4023e70b642ace09affec7e66c7e
BLAKE2b-256 a957b29a85b49ca5e6f2a89a879c79489d52f9e639cfe8eb8051358e9cf53fc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.3.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a5714103c43644a13331b244b7f366485335979bd2d9a5efedf2fd96c32760dc
MD5 25b424eed69ebb1a5d91f357a5bdb1de
BLAKE2b-256 92dd765d8cf75c40081dde3fa2d42a726b523339f036a0955c838524cd5ba842

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.3.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 cf1e502347b799a44af9171e7a265d78c66c4e267cf3f0f8e46f21836b7359d2
MD5 342cba06e2160dfa39e2710c7cb53b2e
BLAKE2b-256 14c46f3db900d695a8fadf4cb41d09c636ce3cd293748c1a98ac500c5d885252

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.3.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 1cbba82d60323317f09118e2be4e6ecffbaeff76bba14925c6d2d77d5b7642de
MD5 e55f3777a60105703f62c779e0f35086
BLAKE2b-256 e0f7b28270c8a8be932976847b496b43e2c49cd17768f9e7d81bb03a78409612

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.3.0-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 76925beed269171be0d3ca089953db9ea472a4c43644d2b843529d21d5faeca4
MD5 9c751eeb29253211f12a75c44931c53d
BLAKE2b-256 77537438ea684904e23f65cdabae05916e47edfdc92db31467af9691e54ac38d

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