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

Uploaded Python 3 Windows x86-64

meshkernel-5.0.0-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.0-py3-none-macosx_14_0_arm64.whl (1.2 MB view details)

Uploaded Python 3 macOS 14.0+ ARM64

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

Uploaded Python 3 macOS 13.0+ x86-64

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

Uploaded Python 3 macOS 13.0+ ARM64

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

File metadata

  • Download URL: meshkernel-5.0.0-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.14

File hashes

Hashes for meshkernel-5.0.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 6e3eaa929a65dfba2d6b27bcde483e7cdc3a8746c29de7a58df23e090eb80580
MD5 cefa258c3e9e0951828fe580fe5bd0a0
BLAKE2b-256 e1eb7421c0cd5f3ad9bd18f489eaee731040bada14fd6392853354f90ed84b1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 680a4a160ad6c763d84e1ac37087de3e4aedec52ed25e14bb3c6217618aa1969
MD5 6b0b35bb1c7c67dd5f9e094ccd88a0a7
BLAKE2b-256 bf38277fda0feb4a3edb5bd1d458f3eb315d0191280a5ed7630f6e1bbb016c32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 a91ace1c688b42bfbee6513abc80b46fe9558348ad55142f5ee45b3f3bbe6242
MD5 5098363fe7b7d76aa97521b4ff773dcf
BLAKE2b-256 e728fcfa56601a701ea6bf433e3689fbe3b02b4ad766cc669103317773c28998

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.0-py3-none-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 d52be90ccd2ee14316d7662d1edf92db198897990401cdce3e752bd3d8811ab6
MD5 450bcdf6c08f44d05f2540921883f4b2
BLAKE2b-256 417f6563802c8c85b5c1730321d5158e2db155a87dc4046f7e04146730229bf7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.0-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 5909064e266a045ee7c98507b9db8dc4a23d52e46d5314137553148d05f8d5b5
MD5 4e6d9e2db8ef797fd2c6a9f2ba9d02bc
BLAKE2b-256 e89b5d103cb7cb9b7dc0b247700ac7cfa0af108a9948c32d048f938599845888

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-5.0.0-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 521a517a0e720dfc0310a79e7a7369e60e422948184ac1668c33d76489867c2d
MD5 be965a04fb2e5b7ac0ca24e338142b7e
BLAKE2b-256 a71b4a9b3cc16f9c46ba4f157b05da885c5ba4cc9e934488677b2eba405401f5

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