mGFD 0.9.1__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.
Files changed (49) hide show
  1. mgfd-0.9.1/LICENSE +21 -0
  2. mgfd-0.9.1/PKG-INFO +250 -0
  3. mgfd-0.9.1/README.md +199 -0
  4. mgfd-0.9.1/pyproject.toml +53 -0
  5. mgfd-0.9.1/setup.cfg +4 -0
  6. mgfd-0.9.1/src/mGFD/__init__.py +73 -0
  7. mgfd-0.9.1/src/mGFD/cloud_generator/__init__.py +47 -0
  8. mgfd-0.9.1/src/mGFD/cloud_generator/cli/__init__.py +33 -0
  9. mgfd-0.9.1/src/mGFD/cloud_generator/cli/cli.py +261 -0
  10. mgfd-0.9.1/src/mGFD/cloud_generator/core/__init__.py +33 -0
  11. mgfd-0.9.1/src/mGFD/cloud_generator/core/classification.py +237 -0
  12. mgfd-0.9.1/src/mGFD/cloud_generator/core/generator.py +245 -0
  13. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/__init__.py +73 -0
  14. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/boundary.py +82 -0
  15. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/geometry.py +63 -0
  16. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/poisson_generation.py +379 -0
  17. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/regular_generation.py +313 -0
  18. mgfd-0.9.1/src/mGFD/cloud_generator/core/point_generation/relaxation.py +117 -0
  19. mgfd-0.9.1/src/mGFD/cloud_generator/core/reduction.py +323 -0
  20. mgfd-0.9.1/src/mGFD/cloud_generator/io/__init__.py +33 -0
  21. mgfd-0.9.1/src/mGFD/cloud_generator/io/data_processing.py +128 -0
  22. mgfd-0.9.1/src/mGFD/cloud_generator/io/export.py +128 -0
  23. mgfd-0.9.1/src/mGFD/cloud_generator/utils/__init__.py +33 -0
  24. mgfd-0.9.1/src/mGFD/cloud_generator/utils/utils.py +195 -0
  25. mgfd-0.9.1/src/mGFD/cloud_generator/viz/__init__.py +33 -0
  26. mgfd-0.9.1/src/mGFD/cloud_generator/viz/visualization.py +245 -0
  27. mgfd-0.9.1/src/mGFD/core/__init__.py +33 -0
  28. mgfd-0.9.1/src/mGFD/core/gammas.py +415 -0
  29. mgfd-0.9.1/src/mGFD/core/neighbors.py +325 -0
  30. mgfd-0.9.1/src/mGFD/core/utils.py +207 -0
  31. mgfd-0.9.1/src/mGFD/io/__init__.py +33 -0
  32. mgfd-0.9.1/src/mGFD/io/export_vtk.py +184 -0
  33. mgfd-0.9.1/src/mGFD/io/io.py +93 -0
  34. mgfd-0.9.1/src/mGFD/solvers/__init__.py +33 -0
  35. mgfd-0.9.1/src/mGFD/solvers/stationary.py +126 -0
  36. mgfd-0.9.1/src/mGFD/solvers/time_derivative1.py +157 -0
  37. mgfd-0.9.1/src/mGFD/solvers/time_derivative2.py +178 -0
  38. mgfd-0.9.1/src/mGFD/viz/__init__.py +33 -0
  39. mgfd-0.9.1/src/mGFD/viz/graph.py +413 -0
  40. mgfd-0.9.1/src/mGFD.egg-info/PKG-INFO +250 -0
  41. mgfd-0.9.1/src/mGFD.egg-info/SOURCES.txt +47 -0
  42. mgfd-0.9.1/src/mGFD.egg-info/dependency_links.txt +1 -0
  43. mgfd-0.9.1/src/mGFD.egg-info/entry_points.txt +2 -0
  44. mgfd-0.9.1/src/mGFD.egg-info/requires.txt +13 -0
  45. mgfd-0.9.1/src/mGFD.egg-info/top_level.txt +1 -0
  46. mgfd-0.9.1/tests/test_cloud_generator.py +14 -0
  47. mgfd-0.9.1/tests/test_stationary.py +44 -0
  48. mgfd-0.9.1/tests/test_time_derivative1.py +47 -0
  49. mgfd-0.9.1/tests/test_time_derivative2.py +48 -0
mgfd-0.9.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Gerardo Tinoco-Guerrero
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.
mgfd-0.9.1/PKG-INFO ADDED
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.4
2
+ Name: mGFD
3
+ Version: 0.9.1
4
+ Summary: mGFD (Meshless Generalized Finite Differences) is a high-performance Python ecosystem designed to solve Partial Differential Equations (PDEs) directly on unstructured point clouds, bypassing traditional mesh generation.
5
+ Author: Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota, José Alberto Guzmán-Torres
6
+ Author-email: gerardo.tinoco@umich.mx
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 Gerardo Tinoco-Guerrero
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://github.com/gstinoco/mGFD
30
+ Project-URL: Repository, https://github.com/gstinoco/mGFD.git
31
+ Project-URL: Issues, https://github.com/gstinoco/mGFD/issues
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
36
+ Requires-Python: >=3.8
37
+ Description-Content-Type: text/markdown
38
+ License-File: LICENSE
39
+ Requires-Dist: numpy
40
+ Requires-Dist: scipy
41
+ Requires-Dist: matplotlib
42
+ Requires-Dist: pyvista
43
+ Requires-Dist: shapely
44
+ Requires-Dist: opencv-python-headless
45
+ Provides-Extra: test
46
+ Requires-Dist: pytest; extra == "test"
47
+ Provides-Extra: benchmark
48
+ Requires-Dist: psutil; extra == "benchmark"
49
+ Requires-Dist: pandas; extra == "benchmark"
50
+ Dynamic: license-file
51
+
52
+ # mGFD: Meshless Generalized Finite Differences 📐☁️
53
+
54
+ <div align="center">
55
+
56
+ <img src="docs/logo/logo.png" alt="mGFD logo" width="680" style="margin: 20px 0; border-radius: 8px;">
57
+
58
+ [![GitHub](https://img.shields.io/badge/GitHub-Repository-black.svg?style=for-the-badge)](https://github.com/gstinoco/mGFD)
59
+ [![Python](https://img.shields.io/badge/Python-3.8+-blue.svg?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/downloads/)
60
+ [![NumPy](https://img.shields.io/badge/NumPy-Scientific%20Computing-013243.svg?style=for-the-badge&logo=numpy)](https://numpy.org/)
61
+ [![SciPy](https://img.shields.io/badge/SciPy-Numerical%20Algorithms-8CAAE6.svg?style=for-the-badge&logo=scipy&logoColor=white)](https://scipy.org/)
62
+ [![CI Tests](https://img.shields.io/github/actions/workflow/status/gstinoco/mGFD/python-tests.yml?style=for-the-badge&label=CI%20Tests)](https://github.com/gstinoco/mGFD/actions/workflows/python-tests.yml)
63
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
64
+
65
+ **A high-performance Python ecosystem for Point Cloud Generation and PDE solving on highly irregular domains using Generalized Finite Differences.**
66
+
67
+ </div>
68
+
69
+ ---
70
+
71
+ ## 📑 Table of Contents
72
+ - [🌟 Overview](#-overview)
73
+ - [📦 Installation](#-installation)
74
+ - [🛠️ Quick Start](#️-quick-start)
75
+ - [🔬 Research & Datasets](#-research--datasets)
76
+ - [📜 Citation & Credits](#-citation--credits)
77
+
78
+ ---
79
+
80
+ ## 🌟 Overview
81
+
82
+ **mGFD** is a complete meshless computational suite. Traditional methods (like Finite Elements or Finite Volumes) require complex and restrictive mesh generation. **mGFD** completely bypasses this limitation by solving Partial Differential Equations (PDEs) directly on **unstructured point clouds**.
83
+
84
+ This makes it exceptionally powerful for modeling physics in complex, real-world geometries such as natural lakes, islands, or custom engineering domains.
85
+
86
+ ### 🚀 Key Features
87
+
88
+ * **☁️ Integrated Cloud Generator:** A powerful engine to automatically generate 2D point clouds from geographic contour boundaries (supports Poisson-Disk sampling, Lloyd relaxation, and grid-based methods).
89
+ * **📐 Pure Meshless Solvers:** Discretize and solve PDEs using only local neighbor stencils. No mesh required!
90
+ * **⚡ Stationary Solvers:** Out-of-the-box support for Poisson-type equations and generalized stationary problems.
91
+ * **🔥 Transient Solvers:** First-order (Heat, Advection-Diffusion) and Second-order (Wave) time integrations.
92
+ * **🧩 Modular Architecture:** Highly professional PEP-8 compliant sub-package architecture. Logically separated domains (`mGFD.solvers`, `mGFD.core`) and specialized pipelines (e.g. `mGFD.cloud_generator.core.point_generation`).
93
+
94
+ ---
95
+
96
+ ## 📦 Installation
97
+
98
+ **mGFD** relies on a robust scientific stack (`numpy`, `scipy`, `shapely`, `opencv-python-headless`).
99
+
100
+ To install the package from source (useful for development):
101
+
102
+ ```bash
103
+ git clone https://github.com/gstinoco/mGFD.git
104
+ cd mGFD
105
+ pip install -e .
106
+ ```
107
+
108
+ This will automatically install both the Python API and the `mgfd-cloud` command-line interface.
109
+
110
+ ---
111
+
112
+ ## 🛠️ Quick Start
113
+
114
+ The true power of `mGFD` lies in its ability to go from raw geographic contours to a solved PDE in just two steps.
115
+
116
+ ### Step 1: Generate a Point Cloud
117
+
118
+ The `mgfd-cloud` CLI tool automates the process of converting geometric boundaries into valid computational domains.
119
+
120
+ > [!TIP]
121
+ > **Visual Contour Generator**
122
+ > If you don't have a geographic dataset, you can visually draw and export your own contour boundaries using our [mGFD CloudGenerator Web Tool](https://malla.umich.mx/CloudGenerator/).
123
+
124
+ <details open>
125
+ <summary><b>View available CLI commands</b></summary>
126
+
127
+ ```bash
128
+ # General help
129
+ mgfd-cloud --help
130
+
131
+ # Generate a point cloud with natural (Poisson-Disk) distribution and interior islands (holes)
132
+ mgfd-cloud generate --input contours.csv --output my_cloud.csv --method natural --density 0.5 --inside-regions
133
+
134
+ # Generate a point cloud with regular (Grid-based) distribution
135
+ mgfd-cloud generate --input contours.csv --output my_cloud_grid.csv --method regular
136
+
137
+ # Reduce the density of an existing cloud silently (multiplier=2 means ~75% reduction)
138
+ mgfd-cloud -q reduce --input high_density.csv --output low_density.csv --multiplier 2
139
+ ```
140
+ </details>
141
+
142
+ ### Step 2: Solve a PDE
143
+
144
+ Use the Python API to load your cloud and run a meshless solver.
145
+
146
+ <details open>
147
+ <summary><b>Stationary Equation (e.g. Poisson)</b></summary>
148
+
149
+ ```python
150
+ import numpy as np
151
+ from mGFD.io.io import load_points
152
+ from mGFD import Stationary
153
+
154
+ # 1. Load the generated point cloud
155
+ p = load_points("my_cloud.csv")
156
+
157
+ # 2. Define the analytical boundary condition
158
+ phi = lambda x, y: np.exp(x + y)
159
+
160
+ # 3. Define the right-hand side forcing function
161
+ f_stat = lambda x, y: 2 * np.exp(x + y)
162
+
163
+ # 4. Define the differential operator [D, E, A, B, C, F]
164
+ L_stat = np.vstack([[0], [0], [2], [0], [2], [0]])
165
+
166
+ # 5. Solve the equation! (Verbose mode on by default in scripts, but off in the core library)
167
+ u_ap, vec = Stationary(p, phi, f_stat, operator=L_stat, verbose=True)
168
+ ```
169
+ </details>
170
+
171
+ <details>
172
+ <summary><b>First-Order Transient Equation (e.g. Heat)</b></summary>
173
+
174
+ ```python
175
+ import numpy as np
176
+ from mGFD.io.io import load_points
177
+ from mGFD import TimeDerivative1
178
+
179
+ p = load_points("my_cloud.csv")
180
+ v, t1 = 0.01, 100
181
+
182
+ f_heat = lambda x, y, t, coef: np.exp(-2 * np.pi**2 * coef[0] * t) * np.cos(np.pi * x) * np.cos(np.pi * y)
183
+ L_heat = np.vstack([[0], [0], [2*v], [0], [2*v], [0]])
184
+
185
+ u_ap, vec = TimeDerivative1(p, f_heat, t1, [v], operator=L_heat, implicit=True, lam=0.5, verbose=True)
186
+ ```
187
+ </details>
188
+
189
+ <details>
190
+ <summary><b>Second-Order Transient Equation (e.g. Wave)</b></summary>
191
+
192
+ ```python
193
+ import numpy as np
194
+ from mGFD.io.io import load_points
195
+ from mGFD import TimeDerivative2
196
+
197
+ p = load_points("my_cloud.csv")
198
+ c, t2 = 0.5, 50
199
+
200
+ f_wave = lambda x, y, t, coef: np.cos(np.sqrt(2) * np.pi * coef[0] * t) * np.sin(np.pi * x) * np.sin(np.pi * y)
201
+ g_wave = lambda x, y, t, coef: 0.0 * x # Initial velocity
202
+ L_wave = np.vstack([[0], [0], [2*c**2], [0], [2*c**2], [0]])
203
+
204
+ u_ap, vec = TimeDerivative2(p, f_wave, g_wave, t2, [c], operator=L_wave, implicit=True, lam=0.5, verbose=True)
205
+ ```
206
+ </details>
207
+
208
+ ---
209
+
210
+ ## 🔬 Research & Datasets
211
+
212
+ Looking for the **mathematical formulation**, **real-world geographic lake datasets** (Lake Patzcuaro, Caspian Sea, etc.), or reproducible **benchmarking scripts**?
213
+
214
+ 👉 **[Explore the Research Laboratory (`/research/README.md`)](./research/README.md)**
215
+
216
+ The `research/` directory contains our complete academic suite, including experimental data, geographic boundary files, VTK results, and the exact theoretical explanations associated with our scientific publications.
217
+
218
+ ---
219
+
220
+ ## 📜 Citation & Credits
221
+
222
+ This project is open-sourced under the **MIT License**.
223
+
224
+ If you use this library or the core mathematical methodology in your research, please cite our reference paper:
225
+
226
+ ```bibtex
227
+ @article{tinoco2025mgfd,
228
+ title={mGFD: A meshless generalized finite difference method},
229
+ author={Tinoco-Guerrero, Gerardo and Domínguez-Mota, Francisco Javier and Guzmán-Torres, José Alberto and Pedraza-Jiménez, Gabriela and Tinoco-Ruiz, José Gerardo},
230
+ journal={Computers & Mathematics with Applications},
231
+ volume={195},
232
+ pages={396--418},
233
+ year={2025},
234
+ publisher={Elsevier},
235
+ doi={10.1016/j.camwa.2025.07.034}
236
+ }
237
+ ```
238
+
239
+ <div align="center">
240
+ <br/>
241
+ <i>Developed for the advancement of meshless numerical methods and scientific computing.</i>
242
+ <br/><br/>
243
+ <b>Dr. Gerardo Tinoco-Guerrero</b><br/>
244
+ <b>Dr. Francisco Javier Domínguez-Mota</b><br/>
245
+ <b>Dr. José Alberto Guzmán-Torres</b><br/>
246
+ Universidad Michoacana de San Nicolás de Hidalgo<br/>
247
+ gerardo.tinoco@umich.mx
248
+ <br/><br/>
249
+ <a href="https://github.com/gstinoco/mGFD/issues">Report a Bug</a> | <a href="mailto:gerardo.tinoco@umich.mx">Contact Author</a>
250
+ </div>
mgfd-0.9.1/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # mGFD: Meshless Generalized Finite Differences 📐☁️
2
+
3
+ <div align="center">
4
+
5
+ <img src="docs/logo/logo.png" alt="mGFD logo" width="680" style="margin: 20px 0; border-radius: 8px;">
6
+
7
+ [![GitHub](https://img.shields.io/badge/GitHub-Repository-black.svg?style=for-the-badge)](https://github.com/gstinoco/mGFD)
8
+ [![Python](https://img.shields.io/badge/Python-3.8+-blue.svg?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/downloads/)
9
+ [![NumPy](https://img.shields.io/badge/NumPy-Scientific%20Computing-013243.svg?style=for-the-badge&logo=numpy)](https://numpy.org/)
10
+ [![SciPy](https://img.shields.io/badge/SciPy-Numerical%20Algorithms-8CAAE6.svg?style=for-the-badge&logo=scipy&logoColor=white)](https://scipy.org/)
11
+ [![CI Tests](https://img.shields.io/github/actions/workflow/status/gstinoco/mGFD/python-tests.yml?style=for-the-badge&label=CI%20Tests)](https://github.com/gstinoco/mGFD/actions/workflows/python-tests.yml)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
13
+
14
+ **A high-performance Python ecosystem for Point Cloud Generation and PDE solving on highly irregular domains using Generalized Finite Differences.**
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## 📑 Table of Contents
21
+ - [🌟 Overview](#-overview)
22
+ - [📦 Installation](#-installation)
23
+ - [🛠️ Quick Start](#️-quick-start)
24
+ - [🔬 Research & Datasets](#-research--datasets)
25
+ - [📜 Citation & Credits](#-citation--credits)
26
+
27
+ ---
28
+
29
+ ## 🌟 Overview
30
+
31
+ **mGFD** is a complete meshless computational suite. Traditional methods (like Finite Elements or Finite Volumes) require complex and restrictive mesh generation. **mGFD** completely bypasses this limitation by solving Partial Differential Equations (PDEs) directly on **unstructured point clouds**.
32
+
33
+ This makes it exceptionally powerful for modeling physics in complex, real-world geometries such as natural lakes, islands, or custom engineering domains.
34
+
35
+ ### 🚀 Key Features
36
+
37
+ * **☁️ Integrated Cloud Generator:** A powerful engine to automatically generate 2D point clouds from geographic contour boundaries (supports Poisson-Disk sampling, Lloyd relaxation, and grid-based methods).
38
+ * **📐 Pure Meshless Solvers:** Discretize and solve PDEs using only local neighbor stencils. No mesh required!
39
+ * **⚡ Stationary Solvers:** Out-of-the-box support for Poisson-type equations and generalized stationary problems.
40
+ * **🔥 Transient Solvers:** First-order (Heat, Advection-Diffusion) and Second-order (Wave) time integrations.
41
+ * **🧩 Modular Architecture:** Highly professional PEP-8 compliant sub-package architecture. Logically separated domains (`mGFD.solvers`, `mGFD.core`) and specialized pipelines (e.g. `mGFD.cloud_generator.core.point_generation`).
42
+
43
+ ---
44
+
45
+ ## 📦 Installation
46
+
47
+ **mGFD** relies on a robust scientific stack (`numpy`, `scipy`, `shapely`, `opencv-python-headless`).
48
+
49
+ To install the package from source (useful for development):
50
+
51
+ ```bash
52
+ git clone https://github.com/gstinoco/mGFD.git
53
+ cd mGFD
54
+ pip install -e .
55
+ ```
56
+
57
+ This will automatically install both the Python API and the `mgfd-cloud` command-line interface.
58
+
59
+ ---
60
+
61
+ ## 🛠️ Quick Start
62
+
63
+ The true power of `mGFD` lies in its ability to go from raw geographic contours to a solved PDE in just two steps.
64
+
65
+ ### Step 1: Generate a Point Cloud
66
+
67
+ The `mgfd-cloud` CLI tool automates the process of converting geometric boundaries into valid computational domains.
68
+
69
+ > [!TIP]
70
+ > **Visual Contour Generator**
71
+ > If you don't have a geographic dataset, you can visually draw and export your own contour boundaries using our [mGFD CloudGenerator Web Tool](https://malla.umich.mx/CloudGenerator/).
72
+
73
+ <details open>
74
+ <summary><b>View available CLI commands</b></summary>
75
+
76
+ ```bash
77
+ # General help
78
+ mgfd-cloud --help
79
+
80
+ # Generate a point cloud with natural (Poisson-Disk) distribution and interior islands (holes)
81
+ mgfd-cloud generate --input contours.csv --output my_cloud.csv --method natural --density 0.5 --inside-regions
82
+
83
+ # Generate a point cloud with regular (Grid-based) distribution
84
+ mgfd-cloud generate --input contours.csv --output my_cloud_grid.csv --method regular
85
+
86
+ # Reduce the density of an existing cloud silently (multiplier=2 means ~75% reduction)
87
+ mgfd-cloud -q reduce --input high_density.csv --output low_density.csv --multiplier 2
88
+ ```
89
+ </details>
90
+
91
+ ### Step 2: Solve a PDE
92
+
93
+ Use the Python API to load your cloud and run a meshless solver.
94
+
95
+ <details open>
96
+ <summary><b>Stationary Equation (e.g. Poisson)</b></summary>
97
+
98
+ ```python
99
+ import numpy as np
100
+ from mGFD.io.io import load_points
101
+ from mGFD import Stationary
102
+
103
+ # 1. Load the generated point cloud
104
+ p = load_points("my_cloud.csv")
105
+
106
+ # 2. Define the analytical boundary condition
107
+ phi = lambda x, y: np.exp(x + y)
108
+
109
+ # 3. Define the right-hand side forcing function
110
+ f_stat = lambda x, y: 2 * np.exp(x + y)
111
+
112
+ # 4. Define the differential operator [D, E, A, B, C, F]
113
+ L_stat = np.vstack([[0], [0], [2], [0], [2], [0]])
114
+
115
+ # 5. Solve the equation! (Verbose mode on by default in scripts, but off in the core library)
116
+ u_ap, vec = Stationary(p, phi, f_stat, operator=L_stat, verbose=True)
117
+ ```
118
+ </details>
119
+
120
+ <details>
121
+ <summary><b>First-Order Transient Equation (e.g. Heat)</b></summary>
122
+
123
+ ```python
124
+ import numpy as np
125
+ from mGFD.io.io import load_points
126
+ from mGFD import TimeDerivative1
127
+
128
+ p = load_points("my_cloud.csv")
129
+ v, t1 = 0.01, 100
130
+
131
+ f_heat = lambda x, y, t, coef: np.exp(-2 * np.pi**2 * coef[0] * t) * np.cos(np.pi * x) * np.cos(np.pi * y)
132
+ L_heat = np.vstack([[0], [0], [2*v], [0], [2*v], [0]])
133
+
134
+ u_ap, vec = TimeDerivative1(p, f_heat, t1, [v], operator=L_heat, implicit=True, lam=0.5, verbose=True)
135
+ ```
136
+ </details>
137
+
138
+ <details>
139
+ <summary><b>Second-Order Transient Equation (e.g. Wave)</b></summary>
140
+
141
+ ```python
142
+ import numpy as np
143
+ from mGFD.io.io import load_points
144
+ from mGFD import TimeDerivative2
145
+
146
+ p = load_points("my_cloud.csv")
147
+ c, t2 = 0.5, 50
148
+
149
+ f_wave = lambda x, y, t, coef: np.cos(np.sqrt(2) * np.pi * coef[0] * t) * np.sin(np.pi * x) * np.sin(np.pi * y)
150
+ g_wave = lambda x, y, t, coef: 0.0 * x # Initial velocity
151
+ L_wave = np.vstack([[0], [0], [2*c**2], [0], [2*c**2], [0]])
152
+
153
+ u_ap, vec = TimeDerivative2(p, f_wave, g_wave, t2, [c], operator=L_wave, implicit=True, lam=0.5, verbose=True)
154
+ ```
155
+ </details>
156
+
157
+ ---
158
+
159
+ ## 🔬 Research & Datasets
160
+
161
+ Looking for the **mathematical formulation**, **real-world geographic lake datasets** (Lake Patzcuaro, Caspian Sea, etc.), or reproducible **benchmarking scripts**?
162
+
163
+ 👉 **[Explore the Research Laboratory (`/research/README.md`)](./research/README.md)**
164
+
165
+ The `research/` directory contains our complete academic suite, including experimental data, geographic boundary files, VTK results, and the exact theoretical explanations associated with our scientific publications.
166
+
167
+ ---
168
+
169
+ ## 📜 Citation & Credits
170
+
171
+ This project is open-sourced under the **MIT License**.
172
+
173
+ If you use this library or the core mathematical methodology in your research, please cite our reference paper:
174
+
175
+ ```bibtex
176
+ @article{tinoco2025mgfd,
177
+ title={mGFD: A meshless generalized finite difference method},
178
+ author={Tinoco-Guerrero, Gerardo and Domínguez-Mota, Francisco Javier and Guzmán-Torres, José Alberto and Pedraza-Jiménez, Gabriela and Tinoco-Ruiz, José Gerardo},
179
+ journal={Computers & Mathematics with Applications},
180
+ volume={195},
181
+ pages={396--418},
182
+ year={2025},
183
+ publisher={Elsevier},
184
+ doi={10.1016/j.camwa.2025.07.034}
185
+ }
186
+ ```
187
+
188
+ <div align="center">
189
+ <br/>
190
+ <i>Developed for the advancement of meshless numerical methods and scientific computing.</i>
191
+ <br/><br/>
192
+ <b>Dr. Gerardo Tinoco-Guerrero</b><br/>
193
+ <b>Dr. Francisco Javier Domínguez-Mota</b><br/>
194
+ <b>Dr. José Alberto Guzmán-Torres</b><br/>
195
+ Universidad Michoacana de San Nicolás de Hidalgo<br/>
196
+ gerardo.tinoco@umich.mx
197
+ <br/><br/>
198
+ <a href="https://github.com/gstinoco/mGFD/issues">Report a Bug</a> | <a href="mailto:gerardo.tinoco@umich.mx">Contact Author</a>
199
+ </div>
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mGFD"
7
+ version = "0.9.1"
8
+ description = "mGFD (Meshless Generalized Finite Differences) is a high-performance Python ecosystem designed to solve Partial Differential Equations (PDEs) directly on unstructured point clouds, bypassing traditional mesh generation."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { file = "LICENSE" }
12
+ authors = [
13
+ { name = "Gerardo Tinoco-Guerrero" },
14
+ { name = "Francisco Javier Domínguez-Mota" },
15
+ { name = "José Alberto Guzmán-Torres" },
16
+ { email = "gerardo.tinoco@umich.mx"},
17
+ ]
18
+
19
+
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ "Topic :: Scientific/Engineering :: Mathematics",
25
+ ]
26
+ dependencies = [
27
+ "numpy",
28
+ "scipy",
29
+ "matplotlib",
30
+ "pyvista",
31
+ "shapely",
32
+ "opencv-python-headless",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/gstinoco/mGFD"
37
+ Repository = "https://github.com/gstinoco/mGFD.git"
38
+ Issues = "https://github.com/gstinoco/mGFD/issues"
39
+
40
+ [project.optional-dependencies]
41
+ test = [
42
+ "pytest",
43
+ ]
44
+ benchmark = [
45
+ "psutil",
46
+ "pandas",
47
+ ]
48
+
49
+ [project.scripts]
50
+ mgfd-cloud = "mGFD.cloud_generator.cli.cli:main"
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["src"]
mgfd-0.9.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,73 @@
1
+ """
2
+ mGFD — Meshless Generalized Finite Differences
3
+
4
+ Overview:
5
+ Meshless solvers for 2D stationary and transient PDEs using generalized finite differences (GFD).
6
+ Spatial derivatives are approximated using local reconstructions over a node neighborhood (nvec).
7
+
8
+ Public API:
9
+ Stationary Stationary problems with Dirichlet boundary conditions.
10
+ TimeDerivative1 First-order-in-time problems (heat / advection-diffusion family).
11
+ TimeDerivative2 Second-order-in-time problems (wave family).
12
+
13
+ Data conventions:
14
+ p (m, 3) ndarray
15
+ Point cloud with columns [x, y, flag]. flag = 0 for interior; flag = 1/2 for boundary.
16
+ vec (m, nvec) ndarray[int]
17
+ Neighbor list. Each row contains neighbor indices; unused slots are padded with -1.
18
+ If vec is not provided, it is computed from p using Neighbors.compute_neighbors / Neighbors.compute_upwind_neighbors.
19
+
20
+ Operator conventions:
21
+ operator array-like
22
+ A 6-coefficient vector [D, E, A, B, C, F] (shape (6,) or (6, 1)).
23
+ The spatial stencil is built with L = operator[:5] = [D, E, A, B, C], interpreted as:
24
+ D*u_x + E*u_y + A*u_xx + B*u_xy + C*u_yy
25
+ The reaction term F*u is reserved in the last coefficient, but it is not applied by the
26
+ current implementation. For the Laplacian, use [0, 0, 2, 0, 2, 0].
27
+ When upwind=True, neighbor selection is upwind-biased using velocities (D, E).
28
+
29
+ Notes:
30
+ NumPy is required. SciPy is optional, but implicit schemes require SciPy for sparse linear algebra.
31
+ Transient solvers use a normalized time grid T = linspace(0, 1, t).
32
+ When instability is detected, the solver may retry with expanded neighborhoods (8→12→16→20→30).
33
+
34
+ Credits:
35
+ All the codes presented below were developed by:
36
+ Dr. Gerardo Tinoco-Guerrero
37
+ Dr. Francisco Javier Domínguez-Mota
38
+ Dr. José Alberto Guzmán-Torres
39
+ Universidad Michoacana de San Nicolás de Hidalgo
40
+ gerardo.tinoco@umich.mx
41
+ With the funding of:
42
+ Secretary of Science, Humanities, Technology and Innovation, SECIHTI (Secretaria de Ciencia, Humanidades, Tecnología e Innovación). México.
43
+ Coordination of Scientific Research, CIC-UMSNH (Coordinación de la Investigación Científica de la Universidad Michoacana de San Nicolás de Hidalgo, CIC-UMSNH). México.
44
+ Aula CIMNE-Morelia. México.
45
+ SIIIA-MATH: Soluciones de Ingeniería. México.
46
+
47
+ Based on the theoretical concepts presented in:
48
+ "mGFD: A meshless generalized finite difference method",
49
+ Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota, José Alberto Guzmán-Torres,
50
+ Gabriela Pedraza-Jiménez, José Gerardo Tinoco-Ruiz,
51
+ Computers & Mathematics with Applications, Volume 195 (2025) 396-418.
52
+ https://doi.org/10.1016/j.camwa.2025.07.034
53
+
54
+
55
+ Date:
56
+ May, 2024.
57
+ Last Modification:
58
+ August, 2026.
59
+ """
60
+
61
+ ## Library importation.
62
+ from mGFD.solvers.stationary import Stationary
63
+ from mGFD.solvers.time_derivative1 import TimeDerivative1
64
+ from mGFD.solvers.time_derivative2 import TimeDerivative2
65
+ from mGFD.core.neighbors import compute_neighbors
66
+ from mGFD.core.gammas import compute_sparse_matrix, Cloud
67
+ from mGFD.cloud_generator import generate_cloud_natural, generate_cloud_regular, reduce_points_by_region
68
+
69
+ __all__ = [
70
+ 'Stationary', 'TimeDerivative1', 'TimeDerivative2',
71
+ 'compute_neighbors', 'compute_sparse_matrix', 'Cloud',
72
+ 'generate_cloud_natural', 'generate_cloud_regular', 'reduce_points_by_region'
73
+ ]
@@ -0,0 +1,47 @@
1
+ """
2
+ CloudGenerator — Point Cloud Generation System for mGFD
3
+
4
+ Overview:
5
+ This package contains the core modular components for the Cloud Generation system.
6
+ It is organized into specialized modules to separate concerns and improve maintainability.
7
+
8
+ Public API:
9
+ generate_cloud_natural
10
+ generate_cloud_regular
11
+ reduce_points_by_region
12
+
13
+ Credits:
14
+ All the codes presented below were developed by:
15
+ Dr. Gerardo Tinoco-Guerrero
16
+ Dr. Francisco Javier Domínguez-Mota
17
+ Dr. José Alberto Guzmán-Torres
18
+ Universidad Michoacana de San Nicolás de Hidalgo
19
+ gerardo.tinoco@umich.mx
20
+
21
+ With the funding of:
22
+ Secretary of Science, Humanities, Technology and Innovation, SECIHTI (Secretaria de Ciencia, Humanidades, Tecnología e Innovación). México.
23
+ Coordination of Scientific Research, CIC-UMSNH (Coordinación de la Investigación Científica de la Universidad Michoacana de San Nicolás de Hidalgo, CIC-UMSNH). México.
24
+ Aula CIMNE-Morelia. México.
25
+ SIIIA-MATH: Soluciones de Ingeniería. México.
26
+
27
+ Based on the theoretical concepts presented in:
28
+ "mGFD: A meshless generalized finite difference method",
29
+ Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota, José Alberto Guzmán-Torres,
30
+ Gabriela Pedraza-Jiménez, José Gerardo Tinoco-Ruiz,
31
+ Computers & Mathematics with Applications, Volume 195 (2025) 396-418.
32
+ https://doi.org/10.1016/j.camwa.2025.07.034
33
+
34
+ Date:
35
+ March, 2026.
36
+ Last Modification:
37
+ August, 2026.
38
+ """
39
+
40
+ from .core.generator import generate_cloud_natural, generate_cloud_regular
41
+ from .core.reduction import reduce_points_by_region
42
+
43
+ __all__ = [
44
+ "generate_cloud_natural",
45
+ "generate_cloud_regular",
46
+ "reduce_points_by_region",
47
+ ]
@@ -0,0 +1,33 @@
1
+ """
2
+ CloudGenerator.cli — Command Line Interface
3
+
4
+ Overview:
5
+ This module provides the Command Line Interface (CLI) for the Cloud Generator,
6
+ allowing users to operate the point cloud generation directly from the terminal.
7
+
8
+ Credits:
9
+ All the codes presented below were developed by:
10
+ Dr. Gerardo Tinoco-Guerrero
11
+ Dr. Francisco Javier Domínguez-Mota
12
+ Dr. José Alberto Guzmán-Torres
13
+ Universidad Michoacana de San Nicolás de Hidalgo
14
+ gerardo.tinoco@umich.mx
15
+
16
+ With the funding of:
17
+ Secretary of Science, Humanities, Technology and Innovation, SECIHTI (Secretaria de Ciencia, Humanidades, Tecnología e Innovación). México.
18
+ Coordination of Scientific Research, CIC-UMSNH (Coordinación de la Investigación Científica de la Universidad Michoacana de San Nicolás de Hidalgo, CIC-UMSNH). México.
19
+ Aula CIMNE-Morelia. México.
20
+ SIIIA-MATH: Soluciones de Ingeniería. México.
21
+
22
+ Based on the theoretical concepts presented in:
23
+ "mGFD: A meshless generalized finite difference method",
24
+ Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota, José Alberto Guzmán-Torres,
25
+ Gabriela Pedraza-Jiménez, José Gerardo Tinoco-Ruiz,
26
+ Computers & Mathematics with Applications, Volume 195 (2025) 396-418.
27
+ https://doi.org/10.1016/j.camwa.2025.07.034
28
+
29
+ Date:
30
+ March, 2026.
31
+ Last Modification:
32
+ August, 2026.
33
+ """