Skip to content

Commit 552d286

Browse files
authored
Merge pull request #31 from ZenanH/main
🎉 Release new version v0.1.24
2 parents cdb6ea5 + f27c138 commit 552d286

16 files changed

Lines changed: 210 additions & 2046 deletions

CondaPkg.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

Project.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
name = "MaterialPointGenerator"
22
uuid = "18deba1c-5063-41ee-a388-01f264c5a914"
33
authors = ["ZenanH <zenan.huo@outlook.com>"]
4-
version = "0.1.23"
4+
version = "0.1.24"
55

66
[deps]
7-
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
87
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
9-
LibGEOS = "a90b1aa1-3769-5649-ba7e-abc5a9d163eb"
8+
FastPointQuery = "b325ad68-3eea-4afa-b43e-4b8e378fd76d"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1110
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
11+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1212
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
1313
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1414
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
15-
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
16-
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1715

1816
[compat]
19-
CondaPkg = "0.2"
2017
DelimitedFiles = "1"
21-
LibGEOS = "0.9"
18+
FastPointQuery = "0.1"
2219
LiveServer = "1.5"
2320
NearestNeighbors = "0.4"
2421
PrecompileTools = "1.2"
25-
PythonCall = "0.9"
2622
julia = "1.11"
2723

2824
[extras]
2925
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3026

3127
[targets]
32-
test = ["Test"]
28+
test = ["Test"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![CI](https://github.com/LandslideSIM/MaterialPointGenerator.jl/actions/workflows/ci.yml/badge.svg)](https://github.com/LandslideSIM/MaterialPointGenerator.jl/actions/workflows/ci.yml)
44
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg?logo=quicklook)](https://LandslideSIM.github.io/MaterialPointGenerator.jl/stable)
55
[![Dev](https://img.shields.io/badge/docs-dev-red.svg?logo=quicklook)](https://LandslideSIM.github.io/MaterialPointGenerator.jl/dev)
6-
[![Version](https://img.shields.io/badge/version-v0.1.23-pink)]()
6+
[![Version](https://img.shields.io/badge/version-v0.1.24-pink)]()
77

88
During the EGU2023 conference, when I presented a high-performance MPM (Material Point Method) solver, I was asked,
99
"How do you discretize the computational model for the MPM?" I didn't have a clear answer (I didn't even consider it a problem) because the models were relatively simple and could be generated directly using some straightforward functions. However, as computational models gradually became more complex and diverse, I began to realize that this was indeed a very good question. The preprocessing for MPM should not be a computationally intensive task; it should be fast enough. Yet, I couldn't find a "plug-and-play" generalized code for this purpose. Some literatures have contributed to this issue, and I built upon their work to create a comprehensive and refined julia package.

src/MaterialPointGenerator.jl

Lines changed: 13 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -11,88 +11,26 @@
1111

1212
module MaterialPointGenerator
1313

14-
using CondaPkg, DelimitedFiles, LibGEOS, NearestNeighbors, Printf, PythonCall
15-
using LinearAlgebra: mul!, eigen, Symmetric, normalize
16-
using Statistics: mean
14+
using DelimitedFiles, Logging, FastPointQuery, NearestNeighbors, Printf
1715
using LiveServer: serve
1816
using PrecompileTools: @setup_workload, @compile_workload
1917

20-
import LinearAlgebra.LAPACK: syev!
21-
22-
const trimesh = PythonCall.pynew()
23-
const np = PythonCall.pynew()
24-
const rtree = PythonCall.pynew()
25-
const shapely = PythonCall.pynew()
26-
const MultiPolygon = PythonCall.pynew()
27-
const Polygon = PythonCall.pynew()
28-
const Point = PythonCall.pynew()
29-
const mapping = PythonCall.pynew()
30-
const unary_union = PythonCall.pynew()
31-
const rotate = PythonCall.pynew()
32-
const rasterio = PythonCall.pynew()
33-
const rasterize = PythonCall.pynew()
34-
const pygmsh = PythonCall.pynew()
35-
const pyKDTree = PythonCall.pynew()
36-
const pytime = PythonCall.pynew()
37-
const embreex = PythonCall.pynew()
38-
39-
function __init__()
40-
@info "checking environment..."
41-
# import Python modules
42-
PythonCall.pycopy!(trimesh , pyimport("trimesh" ))
43-
PythonCall.pycopy!(np , pyimport("numpy" ))
44-
PythonCall.pycopy!(rtree , pyimport("rtree" ))
45-
PythonCall.pycopy!(shapely , pyimport("shapely" ))
46-
PythonCall.pycopy!(rasterio, pyimport("rasterio"))
47-
PythonCall.pycopy!(pygmsh , pyimport("gmsh" ))
48-
PythonCall.pycopy!(pytime , pyimport("time" ))
49-
# import their submudules
50-
PythonCall.pycopy!(Polygon , pyimport("shapely.geometry" ).Polygon )
51-
PythonCall.pycopy!(Point , pyimport("shapely.geometry" ).Point )
52-
PythonCall.pycopy!(mapping , pyimport("shapely.geometry" ).mapping )
53-
PythonCall.pycopy!(unary_union , pyimport("shapely.ops" ).unary_union )
54-
PythonCall.pycopy!(rotate , pyimport("shapely.affinity" ).rotate )
55-
PythonCall.pycopy!(rasterize , pyimport("rasterio.features" ).rasterize )
56-
PythonCall.pycopy!(pyKDTree , pyimport("scipy.spatial" ).cKDTree )
57-
PythonCall.pycopy!(MultiPolygon, pyimport("shapely.geometry" ).MultiPolygon)
58-
if !Sys.isapple()
59-
try
60-
if !haskey(CondaPkg.current_pip_packages(), "embreex")
61-
CondaPkg.add_pip("embreex")
62-
CondaPkg.resolve()
63-
end
64-
PythonCall.pycopy!(embreex, pyimport("embreex"))
65-
@info "embreex loaded"
66-
catch e
67-
@warn """embreeX - Python Wrapper for Embree
68-
1) cannot find compatible version
69-
2) some features will fall back to native Python code
70-
"""
71-
end
72-
else
73-
@warn """embreeX - Python Wrapper for Embree
74-
1) not supported on MacOS arm and x86
75-
2) some features will fall back to native Python code
76-
"""
77-
end
78-
end
79-
80-
include(joinpath(@__DIR__, "meshgenerator.jl"))
81-
include(joinpath(@__DIR__, "polygon.jl" ))
82-
include(joinpath(@__DIR__, "polyhedron.jl" ))
83-
include(joinpath(@__DIR__, "dem.jl" ))
18+
include(joinpath(@__DIR__, "reexport.jl" ))
19+
include(joinpath(@__DIR__, "polygon.jl" ))
20+
include(joinpath(@__DIR__, "polyhedron.jl"))
21+
include(joinpath(@__DIR__, "utils.jl" ))
22+
include(joinpath(@__DIR__, "dem.jl"))
8423
include(joinpath(@__DIR__, "slbl/slbl.jl" ))
8524
include(joinpath(@__DIR__, "slbl/slbl_gui.jl"))
86-
include(joinpath(@__DIR__, "utils.jl" ))
8725

88-
@setup_workload begin
89-
points = rand(20, 3)
90-
@compile_workload begin
91-
# functions in utils.jl
92-
getnormals(points)
93-
# function in dem.jl
94-
getpolygon(rand(10, 2))
26+
quiet(f) = redirect_stdout(devnull) do
27+
redirect_stderr(devnull) do
28+
with_logger(NullLogger()) do
29+
f()
30+
end
9531
end
9632
end
9733

34+
include(joinpath(@__DIR__, "precompile.jl"))
35+
9836
end

src/_dem/_utils.jl

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)