Commit 66ed8c84 authored by Amira Abdel-Rahman's avatar Amira Abdel-Rahman
Browse files

change name jupyter notebooks, 3d top library

parent 2d559619
Pipeline #19743 passed with stage
in 35 seconds
......@@ -23,3 +23,5 @@ res3d
*new_face_75.3dm
*.gcode
objs
library_vol_0.25_ratio_0.0
obj
%% Cell type:code id:528f1d14 tags:
 
``` julia
# Amira Abdel-Rahman
# (c) Massachusetts Institute of Technology 2022
```
 
%% Cell type:code id:6ebdf23c tags:
 
``` julia
Threads.nthreads()
```
 
%% Output
 
4
1
 
%% Cell type:code id:94b86d5d tags:
 
``` julia
include("./julia/include/_topologyOptimization.jl")
Makie.inline!(true)
# using Folds
```
 
%% Output
 
Loaded Topology Optimization Library!
 
%% Cell type:markdown id:c4f9e685 tags:
 
# Tutorial
 
%% Cell type:code id:122d8e09 tags:
 
``` julia
a=1:10
function x(i)
return a[i]*2
end
```
 
%% Output
 
x (generic function with 1 method)
 
%% Cell type:code id:9ce4628e tags:
 
``` julia
collatz(x) =
if iseven(x)
x ÷ 2
else
3x + 1
end
function collatz_stopping_time(x)
n = 0
while true
x == 1 && return n
n += 1
x = collatz(x)
end
end
```
 
%% Output
 
collatz_stopping_time (generic function with 1 method)
 
%% Cell type:code id:8f5cac2e tags:
 
``` julia
@btime map(collatz_stopping_time, 1:100_000);
```
 
%% Output
 
18.212 ms (2 allocations: 781.33 KiB)
 
%% Cell type:code id:98a69ab7 tags:
 
``` julia
@btime Folds.map(collatz_stopping_time, 1:100_000);
```
 
%% Output
 
5.263 ms (86 allocations: 4.00 MiB)
 
%% Cell type:code id:3a2cc7d4 tags:
 
``` julia
map(x, 1:9);
```
 
%% Cell type:code id:3d717e9b tags:
 
``` julia
Folds.map(x, 1:9);
```
 
%% Cell type:code id:915546f3 tags:
 
``` julia
map(string, 1:9, 'a':'i');
```
 
%% Cell type:code id:3030f83e tags:
 
``` julia
a = zeros(10)
m=@timed begin
Threads.@threads for i = 1:10
a[i] = Threads.threadid()
end
end
println(m[2])
a;
```
 
%% Output
 
0.0493541
 
%% Cell type:code id:ad61ca8b tags:
 
``` julia
a = zeros(10,10)
inds=findall(a.>-100)
m=@timed begin
Threads.@threads for i = 1:length(inds)
a[inds[i][1],inds[i][2]] = Threads.threadid()
end
end
println(m[2])
a;
```
 
%% Output
 
0.033717
 
%% Cell type:markdown id:b8b53b13 tags:
 
# Slices Trial
 
%% Cell type:code id:a4b717b6 tags:
 
``` julia
include("./julia/include/_topologyOptimization.jl")
Macro_struct = [10.0, 6.0, 4., 10, 6, 4, [0.5,0.5],1.5,0.2];
Macro_struct = [6.0, 3.0, 2., 6, 3, 2, [0.5,0.5],1.5,0.2];
Micro_struct = [0.1, 0.1, 0.1, 100, 100, 100, 0.25,2,0.1];
penal = 3;
saveItr=5;
θ=3
maxloop=20
 
prob=Canteliver3D
fabric=true
mgcg=[false,true]
voxels=1
 
ratioD=0.0;Micro_Vol=0.25;num=5;
library=[ratioD,Micro_Vol,num]
verbose=true
parallel=true
 
Macro_xPhys2,Micro_xPhys2,DHs2,a2,aYX,aYZ,aXZ=Uclustering3DStrainLibrary(Macro_struct, Micro_struct,prob,library,verbose);
```
 
%% Output
 
 
 
 
 
 
 
 
 
 
Loaded Topology Optimization Library!
counter[Thread 1]: 1,
[Thread 1]: 2,
[Thread 1]: 3,
[Thread 1]: 4,
[Thread 1]: 6,
[Thread 1]: 7,
[Thread 1]: 8,
[Thread 1]: 9,
[Thread 1]: 10,
[Thread 1]: 11,
[Thread 1]: 12,
[Thread 1]: 13,
[Thread 1]: 14,
[Thread 1]: 15,
[Thread 1]: 16,
[Thread 1]: 17,
[Thread 1]: 18,
[Thread 1]: 19,
[Thread 1]: 20,
[Thread 1]: 21,
[Thread 1]: 22,
[Thread 1]: 24,
[Thread 1]: 25,
[Thread 1]: 26,
[Thread 1]: 27,
[Thread 1]: 28,
[Thread 1]: 29,
[Thread 1]: 31,
[Thread 1]: 32,
[Thread 1]: 34,
[Thread 1]: 35,
 
 
 
[Thread 1]: 36,
 
%% Cell type:code id:51096156 tags:
 
``` julia
include("./julia/include/_topologyOptimization.jl")
Macro_struct = [10.0, 6.0, 4., 10, 6, 4, [0.5,0.5],1.5,0.2];
Macro_struct = [6.0, 3.0, 2., 6, 3, 2, [0.5,0.5],1.5,0.2];
Micro_struct = [0.1, 0.1, 0.1, 100, 100, 100, 0.25,2,0.1];
penal = 3;
saveItr=5;
θ=3
maxloop=20
 
prob=Canteliver3D
fabric=true
mgcg=[false,true]
voxels=1
 
ratioD=0.0;Micro_Vol=0.25;num=5;
library=[ratioD,Micro_Vol,num]
verbose=true
parallel=true
 
Macro_xPhys2,Micro_xPhys2,DHs2,a2,aYX,aYZ,aXZ=Uclustering3DStrainLibrary(Macro_struct, Micro_struct,prob,library,verbose);
```
 
%% Output
 
 
 
 
 
 
 
 
 
 
 
Loaded Topology Optimization Library!
 
 
 
%% Cell type:markdown id:75dcb22d tags:
 
## Full 3D
 
%% Cell type:code id:6de7625d tags:
 
``` julia
Makie.inline!(true)
 
include("./julia/include/_topologyOptimization.jl")
Macro_struct = [10.0, 6.0, 4., 10, 6, 4, [0.5,0.5],1.5,0.2];
Macro_struct = [6.0, 3.0, 2., 6, 3, 2, [0.5,0.5],1.5,0.2];
Micro_struct = [1.0, 1.0, 1.0, 20, 20, 20, 0.3,2,0.2];
penal = 3;
saveItr=5;
θ=4
maxloop=30
 
prob=Canteliver3D
fabric=true
mgcg=[false,true]
voxels=1
concurrent=false
Macro_xPhys,Micro_xPhys,Macro_masks,Micro_Vol,DHs=MultiConTop3DU(θ,Macro_struct, Micro_struct,prob, penal,saveItr,maxloop ,fabric,mgcg,voxels)
```
 
%% Output