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

Uploaded Python 3 Windows x86-64

meshkernel-4.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

meshkernel-4.0.1-py3-none-macosx_13_0_arm64.whl (971.2 kB view details)

Uploaded Python 3 macOS 13.0+ ARM64

meshkernel-4.0.1-py3-none-macosx_12_0_x86_64.whl (1.0 MB view details)

Uploaded Python 3 macOS 12.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for meshkernel-4.0.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 1bb54d11cccf89ac2b8db64f226b22b3bb4f1c29233ad8f4a6a12c23ea6f0293
MD5 bdb46c7928f00f607ba8c2bfae195e2a
BLAKE2b-256 06c9bed1702ef5ff0759697cf72c1c8cea1e11167d630eb89f9daef7f9a7d8a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e19b56a4d01cdd6c29d284d8b825f998b641f48a3eac717440e8d3477c7887a
MD5 38b8200e4cc24a5dfecc9bd0c5d1f3d2
BLAKE2b-256 65e4cc860b574d9412f774e808df8a0bcf99f4e4c9286d83247f8aa4fee6690a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.0.1-py3-none-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 d8582ee0af72b0e4e54467e894000658d20942a0811495af06e2cb2d15616631
MD5 18d38395e17a4be669654616ed94f611
BLAKE2b-256 fba3f1d0eca8ccf5fbd098cf2ca85374f015465f506c1ba76050a17c219b9c54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for meshkernel-4.0.1-py3-none-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 f73982915fc3463f7680d494e0aa8f0d1fbb975d6bf748a48895e683ebcc2953
MD5 bacf9a89b3d6a0377462fdf05faf52e2
BLAKE2b-256 e9c17f9f709318b07d09ca025bcae5a658ee66e8c23cbd29c25bd4998b730e1b

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