-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathbuild.jl
55 lines (49 loc) · 2 KB
/
build.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using Literate
using Printf
repo_src = joinpath(@__DIR__,"..","src")
notebooks_dir = joinpath(@__DIR__,"..","notebooks")
files = [
"Poisson equation"=>"poisson.jl",
"Code validation"=>"validation.jl",
"Linear elasticity"=>"elasticity.jl",
"p-Laplacian"=>"p_laplacian.jl",
"Hyper-elasticity"=>"hyperelasticity.jl",
"Poisson equation (with DG)"=> "dg_discretization.jl",
"Darcy equation (with RT)"=>"darcy.jl",
"Incompressible Navier-Stokes"=>"inc_navier_stokes.jl",
"Stokes equation" => "stokes.jl",
"Advection-diffusion" => "advection_diffusion.jl",
"Isotropic damage model" => "isotropic_damage.jl",
"Fluid-Structure Interaction"=>"fsi_tutorial.jl",
"Electromagnetic scattering in 2D"=>"emscatter.jl",
"On using DrWatson.jl"=>"validation_DrWatson.jl",
"Interpolation of CellFields"=>"interpolation_fe.jl",
"Poisson equation on parallel distributed-memory computers"=>"poisson_distributed.jl",
"Transient Poisson equation"=>"transient_linear.jl",
"Transient nonlinear equation"=>"transient_nonlinear.jl",
"Topology optimization"=>"TopOptEMFocus.jl",
"Poisson on unfitted meshes"=>"poisson_unfitted.jl",
"Poisson with AMR"=>"poisson_amr.jl",
"Low-level API - Poisson equation"=>"poisson_dev_fe.jl",
"Low-level API - Geometry" => "geometry_dev.jl",
]
Sys.rm(notebooks_dir;recursive=true,force=true)
for (i,(title,filename)) in enumerate(files)
notebook_prefix = string("t",@sprintf "%03d_" i)
notebook = string(notebook_prefix,splitext(filename)[1])
notebook_title = string("# # Tutorial ", i, ": ", title)
function preprocess_notebook(content)
return string(notebook_title, "\n\n", content)
end
Literate.notebook(joinpath(repo_src,filename), notebooks_dir; name=notebook, preprocess=preprocess_notebook, documenter=false, execute=false)
end
deps_jl = joinpath(@__DIR__, "deps.jl")
if isfile(deps_jl)
rm(deps_jl)
end
open(deps_jl,"w") do f
println(f, "# This file is automatically generated")
println(f, "# Do not edit")
println(f)
println(f, :(const files = $files))
end