`meshkernel` is a library which can be used to manipulate meshes.
Project description
MeshKernelPy
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file meshkernel-5.0.2-py3-none-win_amd64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c194facea0dd69d5d7ea3fa4d375042140204b80428add03df14cf4c1efd5e4b |
|
MD5 | 4f47564f00b538e04b80c7921df00e53 |
|
BLAKE2b-256 | 444db63860412f3034e9b161f1fa12d052ca331fe26347ac0390d1521ddb39b7 |
File details
Details for the file meshkernel-5.0.2-py3-none-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 023d8fee8a63235185807bb258f7002222224c97566add7d9aaeaed9df0095ac |
|
MD5 | 17c8e138bf436521165ab2ae543c59b0 |
|
BLAKE2b-256 | b02db3b96ae9bf9a398a45edc4f29528cde7894f25a4f10f77a53c09c1c54f84 |
File details
Details for the file meshkernel-5.0.2-py3-none-macosx_14_0_arm64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-py3-none-macosx_14_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 004c96520dba0f8e2f9431938b736ed22d56e46892fed1dbd40ff5939bdd85f0 |
|
MD5 | 76d324c04439556995e7f5f8e572c98e |
|
BLAKE2b-256 | 0457a46766c7b2fcf55405891675d12e60d7238eb12ceea7e419a6c6af30c1ea |
File details
Details for the file meshkernel-5.0.2-py3-none-macosx_13_0_x86_64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 053ef3e015045b11de429b643e3f27aa0989936655176a59471ec9f9a0499f96 |
|
MD5 | cb70dc86c4dbcf5fe99c144303c5fc5a |
|
BLAKE2b-256 | 43b4e3c0dafc5c59d610036d6f9a936ee65e5c6c6b739e2f910b5306d90aaf3c |
File details
Details for the file meshkernel-5.0.2-py3-none-macosx_13_0_arm64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-py3-none-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ad39987781f70e90aa7d2bf395dbf3174af6bbbcf44c3dfbe741b914cbee45 |
|
MD5 | 4e382b104806aa4286d31f15c8590fda |
|
BLAKE2b-256 | 17b3932217970a958d716c0f4c3ca4f4037b28001946b509c0bc3b6cff8e4053 |
File details
Details for the file meshkernel-5.0.2-py3-none-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: meshkernel-5.0.2-py3-none-macosx_12_0_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf1d2038c98e57b912307d886d1647ef067e1330e321ec476dd2ce602846e62a |
|
MD5 | 2cd12ce25254e7c05c2a1073d3a3559c |
|
BLAKE2b-256 | b8c4a0199b19ce1f062097deeaf1eb33de080d99cb65a21291c78a1df09f3e64 |