Skip to content

Commit bdb24aa

Browse files
committed
speed-up tetra and triangle
1 parent 9901bb1 commit bdb24aa

18 files changed

+241842
-67068
lines changed

data/clean_tetra_file.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Usage:
2+
# julia clean_tetra_file.jl tetra_hook.jl tetra_hook_clean.jl
3+
4+
if length(ARGS) < 2
5+
println("Usage: julia flatten_hook_file.jl input.jl output.jl")
6+
exit(1)
7+
end
8+
9+
input_file = ARGS[1]
10+
output_file = ARGS[2]
11+
12+
# Load data in a temporary module
13+
mod = Module(:Tmp)
14+
Base.include(mod, input_file)
15+
16+
# Get the matrices
17+
_TETS_hook = getfield(mod, :_TETS_hook)
18+
_xe_hook = getfield(mod, :_xe_hook)
19+
20+
# Remove the first column
21+
_TETS_hook = _TETS_hook[:, 2:end]
22+
_xe_hook = _xe_hook[:, 2:end]
23+
24+
# Flatten directly into 1-D arrays
25+
TETS_hook = vec(_TETS_hook)
26+
xe_hook = vec(_xe_hook)
27+
28+
# Write new file
29+
open(output_file, "w") do io
30+
println(io, "# Flattened data extracted from $input_file")
31+
println(io, "# First column removed; already flat vectors\n")
32+
33+
println(io, "const TETS_hook = ", repr(TETS_hook))
34+
println(io, "const xe_hook = ", repr(xe_hook))
35+
end
36+
37+
println("✅ Wrote flattened file to: $output_file")

data/clean_triangle_file.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# flatten_turtle_file.jl
2+
# Usage:
3+
# julia flatten_turtle_file.jl triangle_turtle.jl triangle_turtle_flat.jl
4+
5+
if length(ARGS) < 2
6+
println("Usage: julia flatten_turtle_file.jl input.jl output.jl")
7+
exit(1)
8+
end
9+
10+
input_file = ARGS[1]
11+
output_file = ARGS[2]
12+
13+
# Load data in a temporary module
14+
mod = Module(:Tmp)
15+
Base.include(mod, input_file)
16+
17+
# Get the matrices
18+
_TRIS_turtle = getfield(mod, :_TRIS_turtle)
19+
_xe_turtle = getfield(mod, :_xe_turtle)
20+
21+
# Remove the first column
22+
_TRIS_turtle = _TRIS_turtle[:, 2:end]
23+
_xe_turtle = _xe_turtle[:, 2:end]
24+
25+
# Flatten directly into 1-D arrays
26+
TRIS_turtle = vec(_TRIS_turtle)
27+
xe_turtle = vec(_xe_turtle)
28+
29+
# Write new file
30+
open(output_file, "w") do io
31+
println(io, "# Flattened data extracted from $input_file")
32+
println(io, "# First column removed; already flat vectors\n")
33+
34+
println(io, "const TRIS_turtle = ", repr(TRIS_turtle))
35+
println(io, "const xe_turtle = ", repr(xe_turtle))
36+
end
37+
38+
println("✅ Wrote flattened file to: $output_file")

data/tetra_duct12.jl

Lines changed: 89490 additions & 23428 deletions
Large diffs are not rendered by default.

data/tetra_duct15.jl

Lines changed: 42422 additions & 11146 deletions
Large diffs are not rendered by default.

data/tetra_duct20.jl

Lines changed: 19622 additions & 5178 deletions
Large diffs are not rendered by default.

data/tetra_foam5.jl

Lines changed: 23404 additions & 6191 deletions
Large diffs are not rendered by default.

data/tetra_gear.jl

Lines changed: 15067 additions & 3989 deletions
Large diffs are not rendered by default.

data/tetra_hook.jl

Lines changed: 22276 additions & 5873 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)