meshkernel 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Deltares
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.1
2
+ Name: meshkernel
3
+ Version: 2.0.2
4
+ Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
+ Home-page: https://github.com/Deltares/MeshKernelPy
6
+ Author: Julian Hofer, Prisca van der Sluis, Luca Carniato
7
+ Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl, luca.carniato@deltares.nl
8
+ License: MIT
9
+ Platform: Windows
10
+ Platform: Linux
11
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ Provides-Extra: tests
15
+ Provides-Extra: lint
16
+ Provides-Extra: docs
17
+ License-File: LICENSE
18
+
19
+ # MeshKernelPy
20
+
21
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares_MeshKernelPy&metric=alert_status)](https://sonarcloud.io/dashboard?id=Deltares_MeshKernelPy)
22
+ [![PyPI version](https://badge.fury.io/py/meshkernel.svg)](https://badge.fury.io/py/meshkernel)
23
+
24
+ `MeshKernelPy` is a library for creating and editing meshes.
25
+ It supports 1D and 2D unstructured meshes.
26
+ Support for curvilinear meshes is planned.
27
+ The underlying C++ library `MeshKernel` can be found [here](https://github.com/Deltares/MeshKernel).
28
+
29
+ # Installation
30
+
31
+ ## Windows
32
+
33
+ The library can be installed from PyPI by executing
34
+
35
+ ```bash
36
+ pip install meshkernel
37
+ ```
38
+
39
+ If you encounter any issues importing the pip wheels on Windows, you may need to install the [Visual C++ Redistributable for Visual Studio 2019](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
40
+
41
+ ## Linux
42
+
43
+ Currently, we only offer wheels specific to Deltares' CentOS machines.
44
+ We plan to release a manylinux wheel at PyPI in the future.
45
+
46
+ # Examples
47
+
48
+ ## Creating a triangular mesh inside a polygon
49
+
50
+ In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.
51
+
52
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/TriangularMeshInPolygon.jpg)
53
+
54
+ ## Mesh orthogonalization
55
+
56
+ Finite volume staggered flow solvers require the mesh to be as much orthogonal as possible.
57
+ MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.
58
+
59
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/MeshOrthogonalization.jpg)
60
+
61
+ ## Mesh refinement
62
+
63
+ A mesh can be refined in areas based on samples or polygon selections.
64
+
65
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/GridRefinement.jpg)
66
+
67
+ # License
68
+
69
+ `MeshKernelPy` uses the MIT license.
70
+ However, the wheels on PyPI bundle the LGPL licensed [MeshKernel](https://github.com/Deltares/MeshKernel).
71
+ Please make sure that this fits your needs before depending on it.
72
+
73
+
74
+ # Contributing
75
+
76
+ In order to install `MeshKernelPy` locally, please execute the following line inside your virtual environment
77
+
78
+ ```bash
79
+ pip install -e ".[tests, lint, docs]"
80
+ ```
81
+
82
+ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
83
+
84
+ Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
85
+ When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
86
+
87
+ # Building linux wheels
88
+
89
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
90
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
91
+ To build the Docker image, please follow these steps:
92
+
93
+ ```powershell
94
+ cd scripts
95
+ docker build --progress=plain ./scripts -t build_linux_library
96
+ cd ..
97
+ ```
98
+
99
+ Once the Docker image has been built, build the linux wheels using the following command:
100
+
101
+ ```powershell
102
+ docker run -v %cd%:/root --rm build_linux_library
103
+ ```
104
+
105
+ The deployable linux wheels will be located in dist/wheelhouse
106
+
107
+
108
+
@@ -65,3 +65,24 @@ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
65
65
 
66
66
  Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
67
67
  When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
68
+
69
+ # Building linux wheels
70
+
71
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
72
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
73
+ To build the Docker image, please follow these steps:
74
+
75
+ ```powershell
76
+ cd scripts
77
+ docker build --progress=plain ./scripts -t build_linux_library
78
+ cd ..
79
+ ```
80
+
81
+ Once the Docker image has been built, build the linux wheels using the following command:
82
+
83
+ ```powershell
84
+ docker run -v %cd%:/root --rm build_linux_library
85
+ ```
86
+
87
+ The deployable linux wheels will be located in dist/wheelhouse
88
+
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import os
2
3
  import platform
3
4
  from ctypes import CDLL, byref, c_char_p, c_double, c_int, c_size_t
4
5
  from enum import IntEnum, unique
@@ -66,13 +67,15 @@ class MeshKernel:
66
67
 
67
68
  # Determine OS
68
69
  system = platform.system()
70
+
71
+ file_path = Path(__file__).parent
69
72
  if system == "Windows":
70
- lib_path = Path(__file__).parent / "MeshKernelApi.dll"
73
+ lib_path = os.path.join(file_path, "MeshKernelApi.dll")
71
74
  elif system == "Linux":
72
- lib_path = Path(__file__).parent / "libMeshKernelApi.so"
73
- elif system == "Darwin":
74
- lib_path = Path(__file__).parent / "libMeshKernelApi.dylib"
75
+ lib_path = os.path.join(file_path, "libMeshKernelApi.so")
75
76
  else:
77
+ if not str:
78
+ system = "Unknown OS"
76
79
  raise OSError(f"Unsupported operating system: {system}")
77
80
 
78
81
  self.lib = CDLL(str(lib_path))
@@ -1421,8 +1424,8 @@ class MeshKernel:
1421
1424
  self._execute_function(
1422
1425
  self.lib.mkernel_curvilinear_make_uniform,
1423
1426
  self._meshkernelid,
1424
- c_make_grid_parameters,
1425
- c_geometry_list,
1427
+ byref(c_make_grid_parameters),
1428
+ byref(c_geometry_list),
1426
1429
  )
1427
1430
 
1428
1431
  def curvilinear_refine(
@@ -1504,7 +1507,7 @@ class MeshKernel:
1504
1507
  self._execute_function(
1505
1508
  self.lib.mkernel_curvilinear_compute_transfinite_from_polygon,
1506
1509
  self._meshkernelid,
1507
- c_geometry_list,
1510
+ byref(c_geometry_list),
1508
1511
  c_int(first_node),
1509
1512
  c_int(second_node),
1510
1513
  c_int(third_node),
@@ -1532,7 +1535,7 @@ class MeshKernel:
1532
1535
  self._execute_function(
1533
1536
  self.lib.mkernel_curvilinear_compute_transfinite_from_polygon,
1534
1537
  self._meshkernelid,
1535
- c_geometry_list,
1538
+ byref(c_geometry_list),
1536
1539
  c_int(first_node),
1537
1540
  c_int(second_node),
1538
1541
  c_int(third_node),
@@ -1556,7 +1559,7 @@ class MeshKernel:
1556
1559
  self._execute_function(
1557
1560
  self.lib.mkernel_curvilinear_initialize_orthogonalize,
1558
1561
  self._meshkernelid,
1559
- c_orthogonalization_parameters,
1562
+ byref(c_orthogonalization_parameters),
1560
1563
  )
1561
1564
 
1562
1565
  def curvilinear_set_block_orthogonalize(
@@ -0,0 +1 @@
1
+ __version__ = "2.0.2"
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.1
2
+ Name: meshkernel
3
+ Version: 2.0.2
4
+ Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
+ Home-page: https://github.com/Deltares/MeshKernelPy
6
+ Author: Julian Hofer, Prisca van der Sluis, Luca Carniato
7
+ Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl, luca.carniato@deltares.nl
8
+ License: MIT
9
+ Platform: Windows
10
+ Platform: Linux
11
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ Provides-Extra: tests
15
+ Provides-Extra: lint
16
+ Provides-Extra: docs
17
+ License-File: LICENSE
18
+
19
+ # MeshKernelPy
20
+
21
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares_MeshKernelPy&metric=alert_status)](https://sonarcloud.io/dashboard?id=Deltares_MeshKernelPy)
22
+ [![PyPI version](https://badge.fury.io/py/meshkernel.svg)](https://badge.fury.io/py/meshkernel)
23
+
24
+ `MeshKernelPy` is a library for creating and editing meshes.
25
+ It supports 1D and 2D unstructured meshes.
26
+ Support for curvilinear meshes is planned.
27
+ The underlying C++ library `MeshKernel` can be found [here](https://github.com/Deltares/MeshKernel).
28
+
29
+ # Installation
30
+
31
+ ## Windows
32
+
33
+ The library can be installed from PyPI by executing
34
+
35
+ ```bash
36
+ pip install meshkernel
37
+ ```
38
+
39
+ If you encounter any issues importing the pip wheels on Windows, you may need to install the [Visual C++ Redistributable for Visual Studio 2019](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
40
+
41
+ ## Linux
42
+
43
+ Currently, we only offer wheels specific to Deltares' CentOS machines.
44
+ We plan to release a manylinux wheel at PyPI in the future.
45
+
46
+ # Examples
47
+
48
+ ## Creating a triangular mesh inside a polygon
49
+
50
+ In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.
51
+
52
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/TriangularMeshInPolygon.jpg)
53
+
54
+ ## Mesh orthogonalization
55
+
56
+ Finite volume staggered flow solvers require the mesh to be as much orthogonal as possible.
57
+ MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.
58
+
59
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/MeshOrthogonalization.jpg)
60
+
61
+ ## Mesh refinement
62
+
63
+ A mesh can be refined in areas based on samples or polygon selections.
64
+
65
+ ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/GridRefinement.jpg)
66
+
67
+ # License
68
+
69
+ `MeshKernelPy` uses the MIT license.
70
+ However, the wheels on PyPI bundle the LGPL licensed [MeshKernel](https://github.com/Deltares/MeshKernel).
71
+ Please make sure that this fits your needs before depending on it.
72
+
73
+
74
+ # Contributing
75
+
76
+ In order to install `MeshKernelPy` locally, please execute the following line inside your virtual environment
77
+
78
+ ```bash
79
+ pip install -e ".[tests, lint, docs]"
80
+ ```
81
+
82
+ Then add a compiled `MeshKernelApi.dll` into your `src` folder.
83
+
84
+ Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
85
+ When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
86
+
87
+ # Building linux wheels
88
+
89
+ To deploy Linux wheels to PyPI, we provide a Docker image that is based on manylinux2014_x86_64.
90
+ This image includes cmake and boost, which are necessary for compiling the native MeshKernel library (written in C++).
91
+ To build the Docker image, please follow these steps:
92
+
93
+ ```powershell
94
+ cd scripts
95
+ docker build --progress=plain ./scripts -t build_linux_library
96
+ cd ..
97
+ ```
98
+
99
+ Once the Docker image has been built, build the linux wheels using the following command:
100
+
101
+ ```powershell
102
+ docker run -v %cd%:/root --rm build_linux_library
103
+ ```
104
+
105
+ The deployable linux wheels will be located in dist/wheelhouse
106
+
107
+
108
+
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  pyproject.toml
3
4
  setup.py
@@ -1 +1,2 @@
1
+ MeshKernel
1
2
  meshkernel
@@ -0,0 +1,228 @@
1
+ import codecs
2
+ import os
3
+ import pathlib
4
+ import platform
5
+ import shutil
6
+
7
+ from setuptools import Extension, find_packages, setup
8
+ from setuptools.command.build_ext import build_ext as build_ext_orig
9
+
10
+ author_dict = {
11
+ "Julian Hofer": "julian.hofer@deltares.nl",
12
+ "Prisca van der Sluis": "prisca.vandersluis@deltares.nl",
13
+ "Luca Carniato": "luca.carniato@deltares.nl",
14
+ }
15
+ __author__ = ", ".join(author_dict.keys())
16
+ __author_email__ = ", ".join(s for _, s in author_dict.items())
17
+
18
+
19
+ def read(rel_path: str) -> str:
20
+ """Used to read a text file
21
+
22
+ Args:
23
+ rel_path (str): Relative path to the file
24
+
25
+ Returns:
26
+ str: File content
27
+ """
28
+ here = os.path.abspath(os.path.dirname(__file__))
29
+ with codecs.open(os.path.join(here, rel_path), "r") as fp:
30
+ return fp.read()
31
+
32
+
33
+ def get_version(rel_path: str) -> str:
34
+ """Get the version string
35
+
36
+ Args:
37
+ rel_path (str): Relative path to the file
38
+
39
+ Raises:
40
+ RuntimeError: Raised if the version string could not be found
41
+
42
+ Returns:
43
+ str: The version string
44
+ """
45
+ for line in read(rel_path).splitlines():
46
+ if line.startswith("__version__"):
47
+ delim = '"' if '"' in line else "'"
48
+ return line.split(delim)[1]
49
+
50
+ raise RuntimeError("Unable to find version string.")
51
+
52
+
53
+ def get_library_name() -> str:
54
+ """Get the filename of the MeshKernel library
55
+
56
+ Raises:
57
+ OSError: If the operating system is not supported
58
+
59
+ Returns:
60
+ str: Filename of the MeshKernel library
61
+ """
62
+ system = platform.system()
63
+ if system == "Windows":
64
+ return "MeshKernelApi.dll"
65
+ elif system == "Linux":
66
+ return "libMeshKernelApi.so"
67
+ else:
68
+ if not str:
69
+ system = "Unknown OS"
70
+ raise OSError(f"Unsupported operating system: {system}")
71
+
72
+
73
+ try:
74
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
75
+
76
+ class bdist_wheel(_bdist_wheel):
77
+ """Class describing our wheel.
78
+ Basically it says that it is not a pure Python package,
79
+ but it also does not contain any Python source and
80
+ therefore works for all Python versions
81
+ """
82
+
83
+ def finalize_options(self):
84
+ _bdist_wheel.finalize_options(self)
85
+ # Mark us as not a pure python package
86
+ self.root_is_pure = False
87
+
88
+ def get_tag(self):
89
+ # We don't contain any python source
90
+ return "py3", "none", _bdist_wheel.get_tag(self)[2]
91
+
92
+ except ImportError:
93
+ bdist_wheel = None
94
+
95
+
96
+ class CMakeExtension(Extension):
97
+ """Class for building a native cmake extension (C++)"""
98
+
99
+ def __init__(self, repository):
100
+ """Constructor of CMakeExtension class
101
+
102
+ Args:
103
+ repository (str): The git repository of the extension to build
104
+ """
105
+
106
+ name = repository.split("/")[-1]
107
+ super().__init__(name, sources=[])
108
+ self.repository = repository
109
+
110
+
111
+ class build_ext(build_ext_orig):
112
+ """Class for building an extension using cmake"""
113
+
114
+ def run(self):
115
+ for ext in self.extensions:
116
+ self.build_cmake(ext)
117
+ super().run()
118
+
119
+ def build_cmake(self, ext):
120
+ cwd = str(pathlib.Path().absolute())
121
+ build_temp = pathlib.Path(self.build_temp)
122
+
123
+ build_temp.mkdir(parents=True, exist_ok=True)
124
+ extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
125
+ extdir.mkdir(parents=True, exist_ok=True)
126
+
127
+ os.chdir(str(build_temp))
128
+ if not os.path.isdir(ext.name):
129
+ self.spawn(["git", "clone", ext.repository])
130
+
131
+ os.chdir(ext.name)
132
+
133
+ if not self.dry_run:
134
+ library_name = get_library_name()
135
+ system = platform.system()
136
+ if system == "Linux":
137
+ self.spawn(
138
+ [
139
+ "cmake",
140
+ "-S",
141
+ ".",
142
+ "-B",
143
+ "build",
144
+ "-DCMAKE_BUILD_TYPE=Release",
145
+ "-DADD_UNIT_TESTS_PROJECTS=OFF",
146
+ ]
147
+ )
148
+ self.spawn(["cmake", "--build", "build", "--config", "Release", "-j4"])
149
+ meshkernel_path = str(
150
+ os.path.join(
151
+ *[
152
+ pathlib.Path().absolute(),
153
+ "build",
154
+ "src",
155
+ "MeshKernelApi",
156
+ library_name,
157
+ ]
158
+ )
159
+ )
160
+ self.spawn(["strip", "--strip-unneeded", meshkernel_path])
161
+ elif system == "Windows":
162
+ self.spawn(
163
+ [
164
+ "cmake",
165
+ "-S",
166
+ ".",
167
+ "-B",
168
+ "build",
169
+ "-G",
170
+ "Visual Studio 16 2019",
171
+ "-DCMAKE_BUILD_TYPE=Release",
172
+ "-DADD_UNIT_TESTS_PROJECTS=OFF",
173
+ ]
174
+ )
175
+ self.spawn(["cmake", "--build", "build", "--config", "Release", "-j4"])
176
+ meshkernel_path = str(
177
+ os.path.join(
178
+ *[
179
+ pathlib.Path().absolute(),
180
+ "build",
181
+ "src",
182
+ "MeshKernelApi",
183
+ "Release",
184
+ library_name,
185
+ ]
186
+ )
187
+ )
188
+ else:
189
+ if not str:
190
+ system = "Unknown OS"
191
+ raise OSError(f"Unsupported operating system: {system}")
192
+
193
+ destination = os.path.join(*[cwd, "meshkernel", library_name])
194
+ shutil.copyfile(meshkernel_path, destination)
195
+
196
+ os.chdir(cwd)
197
+
198
+
199
+ long_description = read("README.md")
200
+
201
+ setup(
202
+ name="meshkernel",
203
+ description="`meshkernel` is a library which can be used to manipulate meshes.",
204
+ long_description=long_description,
205
+ long_description_content_type="text/markdown",
206
+ author=__author__,
207
+ author_email=__author_email__,
208
+ url="https://github.com/Deltares/MeshKernelPy",
209
+ license="MIT",
210
+ platforms="Windows, Linux",
211
+ install_requires=["numpy"],
212
+ extras_require={
213
+ "tests": ["pytest", "pytest-cov", "nbval", "matplotlib"],
214
+ "lint": [
215
+ "flake8",
216
+ "black",
217
+ "isort",
218
+ ],
219
+ "docs": ["sphinx", "sphinx_book_theme", "myst_nb"],
220
+ },
221
+ python_requires=">=3.8",
222
+ package_data={"meshkernel": [get_library_name()]},
223
+ packages=find_packages(),
224
+ ext_modules=[CMakeExtension("https://github.com/Deltares/MeshKernel")],
225
+ cmdclass={"build_ext": build_ext, "bdist_wheel": bdist_wheel},
226
+ version=get_version("meshkernel/version.py"),
227
+ classifiers=["Topic :: Scientific/Engineering :: Mathematics"],
228
+ )
meshkernel-2.0.0/PKG-INFO DELETED
@@ -1,84 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: meshkernel
3
- Version: 2.0.0
4
- Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
- Home-page: https://github.com/Deltares/MeshKernelPy
6
- Author: Julian Hofer, Prisca van der Sluis
7
- Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl
8
- License: MIT
9
- Description: # MeshKernelPy
10
-
11
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares_MeshKernelPy&metric=alert_status)](https://sonarcloud.io/dashboard?id=Deltares_MeshKernelPy)
12
- [![PyPI version](https://badge.fury.io/py/meshkernel.svg)](https://badge.fury.io/py/meshkernel)
13
-
14
- `MeshKernelPy` is a library for creating and editing meshes.
15
- It supports 1D and 2D unstructured meshes.
16
- Support for curvilinear meshes is planned.
17
- The underlying C++ library `MeshKernel` can be found [here](https://github.com/Deltares/MeshKernel).
18
-
19
- # Installation
20
-
21
- ## Windows
22
-
23
- The library can be installed from PyPI by executing
24
-
25
- ```bash
26
- pip install meshkernel
27
- ```
28
-
29
- If you encounter any issues importing the pip wheels on Windows, you may need to install the [Visual C++ Redistributable for Visual Studio 2019](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
30
-
31
- ## Linux
32
-
33
- Currently, we only offer wheels specific to Deltares' CentOS machines.
34
- We plan to release a manylinux wheel at PyPI in the future.
35
-
36
- # Examples
37
-
38
- ## Creating a triangular mesh inside a polygon
39
-
40
- In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.
41
-
42
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/TriangularMeshInPolygon.jpg)
43
-
44
- ## Mesh orthogonalization
45
-
46
- Finite volume staggered flow solvers require the mesh to be as much orthogonal as possible.
47
- MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.
48
-
49
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/MeshOrthogonalization.jpg)
50
-
51
- ## Mesh refinement
52
-
53
- A mesh can be refined in areas based on samples or polygon selections.
54
-
55
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/GridRefinement.jpg)
56
-
57
- # License
58
-
59
- `MeshKernelPy` uses the MIT license.
60
- However, the wheels on PyPI bundle the LGPL licensed [MeshKernel](https://github.com/Deltares/MeshKernel).
61
- Please make sure that this fits your needs before depending on it.
62
-
63
-
64
- # Contributing
65
-
66
- In order to install `MeshKernelPy` locally, please execute the following line inside your virtual environment
67
-
68
- ```bash
69
- pip install -e ".[tests, lint, docs]"
70
- ```
71
-
72
- Then add a compiled `MeshKernelApi.dll` into your `src` folder.
73
-
74
- Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
75
- When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
76
-
77
- Platform: Windows
78
- Platform: Linux
79
- Classifier: Topic :: Scientific/Engineering :: Mathematics
80
- Requires-Python: >=3.8
81
- Description-Content-Type: text/markdown
82
- Provides-Extra: tests
83
- Provides-Extra: lint
84
- Provides-Extra: docs
@@ -1 +0,0 @@
1
- __version__ = "2.0.0"
@@ -1,84 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: meshkernel
3
- Version: 2.0.0
4
- Summary: `meshkernel` is a library which can be used to manipulate meshes.
5
- Home-page: https://github.com/Deltares/MeshKernelPy
6
- Author: Julian Hofer, Prisca van der Sluis
7
- Author-email: julian.hofer@deltares.nl, prisca.vandersluis@deltares.nl
8
- License: MIT
9
- Description: # MeshKernelPy
10
-
11
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Deltares_MeshKernelPy&metric=alert_status)](https://sonarcloud.io/dashboard?id=Deltares_MeshKernelPy)
12
- [![PyPI version](https://badge.fury.io/py/meshkernel.svg)](https://badge.fury.io/py/meshkernel)
13
-
14
- `MeshKernelPy` is a library for creating and editing meshes.
15
- It supports 1D and 2D unstructured meshes.
16
- Support for curvilinear meshes is planned.
17
- The underlying C++ library `MeshKernel` can be found [here](https://github.com/Deltares/MeshKernel).
18
-
19
- # Installation
20
-
21
- ## Windows
22
-
23
- The library can be installed from PyPI by executing
24
-
25
- ```bash
26
- pip install meshkernel
27
- ```
28
-
29
- If you encounter any issues importing the pip wheels on Windows, you may need to install the [Visual C++ Redistributable for Visual Studio 2019](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
30
-
31
- ## Linux
32
-
33
- Currently, we only offer wheels specific to Deltares' CentOS machines.
34
- We plan to release a manylinux wheel at PyPI in the future.
35
-
36
- # Examples
37
-
38
- ## Creating a triangular mesh inside a polygon
39
-
40
- In this example a mesh is created by discretizing the polygon perimeter with the desired edge length.
41
-
42
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/TriangularMeshInPolygon.jpg)
43
-
44
- ## Mesh orthogonalization
45
-
46
- Finite volume staggered flow solvers require the mesh to be as much orthogonal as possible.
47
- MeshKernel provides an algorithm to adapt the mesh and achieve a good balance between mesh orthogonality and smoothness.
48
-
49
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/MeshOrthogonalization.jpg)
50
-
51
- ## Mesh refinement
52
-
53
- A mesh can be refined in areas based on samples or polygon selections.
54
-
55
- ![](https://raw.githubusercontent.com/Deltares/MeshKernelPy/main/docs/images/GridRefinement.jpg)
56
-
57
- # License
58
-
59
- `MeshKernelPy` uses the MIT license.
60
- However, the wheels on PyPI bundle the LGPL licensed [MeshKernel](https://github.com/Deltares/MeshKernel).
61
- Please make sure that this fits your needs before depending on it.
62
-
63
-
64
- # Contributing
65
-
66
- In order to install `MeshKernelPy` locally, please execute the following line inside your virtual environment
67
-
68
- ```bash
69
- pip install -e ".[tests, lint, docs]"
70
- ```
71
-
72
- Then add a compiled `MeshKernelApi.dll` into your `src` folder.
73
-
74
- Also make sure that your editor is configured to format the code with [`black`](https://black.readthedocs.io/en/stable/) and [`isort`](https://pycqa.github.io/isort/).
75
- When modifying `Jupyter` notebooks, the [`jupyterlab-code-formatter`](https://jupyterlab-code-formatter.readthedocs.io/en/latest/installation.html) can be used.
76
-
77
- Platform: Windows
78
- Platform: Linux
79
- Classifier: Topic :: Scientific/Engineering :: Mathematics
80
- Requires-Python: >=3.8
81
- Description-Content-Type: text/markdown
82
- Provides-Extra: tests
83
- Provides-Extra: lint
84
- Provides-Extra: docs
meshkernel-2.0.0/setup.py DELETED
@@ -1,124 +0,0 @@
1
- import codecs
2
- import os.path
3
- import platform
4
-
5
- from setuptools import setup
6
-
7
- author_dict = {
8
- "Julian Hofer": "julian.hofer@deltares.nl",
9
- "Prisca van der Sluis": "prisca.vandersluis@deltares.nl",
10
- }
11
- __author__ = ", ".join(author_dict.keys())
12
- __author_email__ = ", ".join(s for _, s in author_dict.items())
13
-
14
-
15
- def read(rel_path: str) -> str:
16
- """Used to read a text file
17
-
18
- Args:
19
- rel_path (str): Relative path to the file
20
-
21
- Returns:
22
- str: File content
23
- """
24
- here = os.path.abspath(os.path.dirname(__file__))
25
- with codecs.open(os.path.join(here, rel_path), "r") as fp:
26
- return fp.read()
27
-
28
-
29
- def get_version(rel_path: str) -> str:
30
- """Get the version string
31
-
32
- Args:
33
- rel_path (str): Relative path to the file
34
-
35
- Raises:
36
- RuntimeError: Raised if the version string could not be found
37
-
38
- Returns:
39
- str: The version string
40
- """
41
- for line in read(rel_path).splitlines():
42
- if line.startswith("__version__"):
43
- delim = '"' if '"' in line else "'"
44
- return line.split(delim)[1]
45
-
46
- raise RuntimeError("Unable to find version string.")
47
-
48
-
49
- def get_meshkernel_name() -> str:
50
- """Get the filename of the MeshKernel library
51
-
52
- Raises:
53
- OSError: If the operating system is not supported
54
-
55
- Returns:
56
- str: Filename of the MeshKernel library
57
- """
58
- system = platform.system()
59
- if system == "Windows":
60
- return "MeshKernelApi.dll"
61
- elif system == "Linux":
62
- return "libMeshKernelApi.so"
63
- elif system == "Darwin":
64
- return "libMeshKernelApi.dylib"
65
- else:
66
- raise OSError(f"Unsupported operating system: {system}")
67
-
68
-
69
- try:
70
- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
71
-
72
- class bdist_wheel(_bdist_wheel):
73
- """Class describing our wheel.
74
- Basically it says that it is not a pure Python package,
75
- but it also does not contain any Python source and
76
- therefore works for all Python versions
77
- """
78
-
79
- def finalize_options(self):
80
- _bdist_wheel.finalize_options(self)
81
- # Mark us as not a pure python package
82
- self.root_is_pure = False
83
-
84
- def get_tag(self):
85
- python, abi, plat = _bdist_wheel.get_tag(self)
86
- # We don't contain any python source
87
- python, abi = "py3", "none"
88
- return python, abi, plat
89
-
90
- except ImportError:
91
- bdist_wheel = None
92
-
93
-
94
- long_description = read("README.md")
95
-
96
- setup(
97
- name="meshkernel",
98
- description="`meshkernel` is a library which can be used to manipulate meshes.",
99
- long_description=long_description,
100
- long_description_content_type="text/markdown",
101
- author=__author__,
102
- author_email=__author_email__,
103
- url="https://github.com/Deltares/MeshKernelPy",
104
- license="MIT",
105
- platforms="Windows, Linux",
106
- install_requires=["numpy"],
107
- extras_require={
108
- "tests": ["pytest", "pytest-cov", "nbval", "matplotlib"],
109
- "lint": [
110
- "flake8",
111
- "black",
112
- "isort",
113
- ],
114
- "docs": ["sphinx", "sphinx_book_theme", "myst_nb"],
115
- },
116
- python_requires=">=3.8",
117
- packages=["meshkernel"],
118
- package_data={
119
- "meshkernel": [get_meshkernel_name()],
120
- },
121
- cmdclass={"bdist_wheel": bdist_wheel},
122
- version=get_version("meshkernel/version.py"),
123
- classifiers=["Topic :: Scientific/Engineering :: Mathematics"],
124
- )
File without changes
File without changes