Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken URL and add 1D test #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/docs/build/
Manifest.toml
.DS_Store

/_readme/Manifest.toml

/_readme/.vscode/

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ save("images/3d_Fig3.png", fig)

### Animations and interactivity

Finally, by using Makie [Observables](https://makie.juliaplots.org/stable/interaction/nodes.html), we
can create animations or interactive plots. For example, if the nodal field has a time dependence
Finally, by using Makie [Observables](http://makie.juliaplots.org/v0.15.1/documentation/nodes/index.html), we can create animations or interactive plots. For example, if the nodal field has a time dependence

````julia
t = Observable(0.0)
Expand Down
3 changes: 1 addition & 2 deletions _readme/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ save("images/3d_Fig3.png", fig)

# ### Animations and interactivity

# Finally, by using Makie [Observables](https://makie.juliaplots.org/stable/interaction/nodes.html), we
# can create animations or interactive plots. For example, if the nodal field has a time dependence
# Finally, by using Makie [Observables](Observables_url), we can create animations or interactive plots. For example, if the nodal field has a time dependence

t = Observable(0.0)
u = lift(t) do t
Expand Down
Binary file modified _readme/images/2d_Fig13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 23 additions & 2 deletions _readme/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Remove current directories:
rm("images", force=true, recursive=true)
rm("models", force=true, recursive=true)

module README; include("README.jl"); end
using Literate
Literate.markdown("README.jl", "..", documenter=false)

# Create README.md with a preprocessor to update version-dependent url's
using Literate, Makie, Pkg

# Get Makie version:
const Makie_version = Pkg.TOML.parsefile(joinpath(pkgdir(Makie), "Project.toml"))["version"]

# Dictionary of URL's to replace on the go:
const READMETAG2URL = Dict{String, String}(
"Observables_url" => "http://makie.juliaplots.org/v"*Makie_version*"/documentation/nodes/index.html"
)

# Replace README tags by actual url's:
function update_url(content)
for (READMETAG, URL) in READMETAG2URL
content = replace(content, READMETAG=>URL)
end
content
end

Literate.markdown("README.jl", ".."; preprocess=update_url, documenter=false)
49 changes: 41 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,39 @@ function savefig(f, suffix::String)
return true
end

@testset "Tests 1D" begin

domain = (0,1)
cell_nums = 10
model = CartesianDiscreteModel(domain,cell_nums)
Ω = Triangulation(model)
reffe = ReferenceFE(lagrangian,Float64,1)
V = FESpace(model,reffe)
uh = interpolate(x->sin(π*(x[1])),V)
celldata = rand(num_cells(Ω))

@test_broken savefig("1d_Fig1") do
fig = wireframe(Ω, color=:black)
scatter!(Ω, color=:green)
fig
end
@test savefig("1d_Fig11") do
fig, _ , plt = plot(Ω, uh)
Colorbar(fig[1,2], plt)
fig
end
@test savefig("1d_Fig13") do
fig, _ , plt = plot(Ω, color=3*celldata, colormap=:heat)
Colorbar(fig[1,2], plt)
fig
end
@test savefig("1d_fig15") do
fig, _ , plt = plot(uh, colormap=:Spectral)
Colorbar(fig[1,2], plt)
fig
end
end

@testset "Tests 2D" begin

domain = (0,1,0,1)
Expand All @@ -42,13 +75,13 @@ end
fig
end
@test savefig("2d_Fig11") do
fig, _ , sc = plot(Ω, uh)
Colorbar(fig[1,2], sc)
fig, _ , plt = plot(Ω, uh)
Colorbar(fig[1,2], plt)
fig
end
@test savefig("2d_Fig111") do
fig,_,sc = plot(Γ, uh, colormap=:algae, linewidth=10)
Colorbar(fig[1,2],sc)
fig, _ , plt = plot(Γ, uh, colormap=:algae, linewidth=10)
Colorbar(fig[1,2], plt)
fig
end
@test savefig("2d_Fig12") do
Expand Down Expand Up @@ -94,13 +127,13 @@ end
fig
end
@test savefig("3d_Fig11") do
fig, _ , sc = plot(Ω, uh, colorrange=(0,1))
Colorbar(fig[1,2],sc)
fig, _ , plt = plot(Ω, uh, colorrange=(0,1))
Colorbar(fig[1,2], plt)
fig
end
@test savefig("3d_Fig111") do
fig, _ , sc = plot(Γ, uh, colormap=:algae)
Colorbar(fig[1,2],sc)
fig, _ , plt = plot(Γ, uh, colormap=:algae)
Colorbar(fig[1,2], plt)
fig
end
@test savefig("3d_Fig12") do
Expand Down