Skip to content

Commit

Permalink
documentation overhaul, fixed simplexgrid bug
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Dec 24, 2020
1 parent e07df20 commit c283b3b
Show file tree
Hide file tree
Showing 22 changed files with 240 additions and 310 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ jobs:
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
env:
PYTHON: ""
# - run: |
# julia --project=docs -e '
# using Documenter: doctest
# using MYPACKAGE
# doctest(MYPACKAGE)'
- run: julia --project=docs docs/make.jl
env:
PYTHON: ""
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ docs/build
docs/src/examples
*~
Manifest.toml
.repl_history.jl

2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ExtendableGrids"
uuid = "cfc395e8-590f-11e8-1f13-43a2532b2fa8"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>"]
version = "0.5.8"
version = "0.6.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ExtendableGrids = "cfc395e8-590f-11e8-1f13-43a2532b2fa8"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
69 changes: 37 additions & 32 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
push!(LOAD_PATH,"../src/")
using Documenter, ExtendableGrids, Literate
ENV["MPLBACKEND"]="agg"
using Documenter, ExtendableGrids, Literate, PyPlot


example_md_dir = joinpath(@__DIR__,"src","examples")

#
# Replace SOURCE_URL marker with github url of source
#
function replace_source_url(input,source_url)
lines_in = collect(eachline(IOBuffer(input)))
lines_out=IOBuffer()
for line in lines_in
println(lines_out,replace(line,"SOURCE_URL" => source_url))
end
return String(take!(lines_out))
end
examples1d=joinpath(@__DIR__,"..","examples","examples1d.jl")
include(examples1d)
examples2d=joinpath(@__DIR__,"..","examples","examples2d.jl")
include(examples2d)
examples3d=joinpath(@__DIR__,"..","examples","examples3d.jl")
include(examples3d)




function mkdocs()
example_jl_dir = joinpath(@__DIR__,"..","examples")
example_md_dir = joinpath(@__DIR__,"src","examples")

for example_source in readdir(example_jl_dir)
base,ext=splitext(example_source)
if ext==".jl" && occursin("Example",base)
source_url="https://github.com/j-fu/ExtendableGrids.jl/raw/master/examples/"*example_source
preprocess(buffer)=replace_source_url(buffer,source_url)
Literate.markdown(joinpath(@__DIR__,"..","examples",example_source),
example_md_dir,
documenter=false,
info=false,
preprocess=preprocess)
end
function makeplots(picdir)
function makeplot(func)
clf()
f=getfield(Main,Symbol(func))
ExtendableGrids.plot(f(), Plotter=PyPlot)
savefig(joinpath(picdir,func*".svg"))
end
generated_examples=joinpath.("examples",readdir(example_md_dir))
makeplot("interval_from_vector")
makeplot("interval_localref")
makeplot("interval_multiregion")
makeplot("interval_subgrid")
makeplot("rectangle")
makeplot("rectangle_localref")
makeplot("rectangle_multiregion")
makeplot("rectangle_subgrid")
makeplot("quadrilateral")
end


function mkdocs()

Literate.markdown(examples1d, example_md_dir, documenter=false,info=false)
Literate.markdown(examples2d, example_md_dir, documenter=false,info=false)
Literate.markdown(examples3d, example_md_dir, documenter=false,info=false)

generated_examples=joinpath.("examples",filter(x->endswith(x, ".md"),readdir(example_md_dir)))

makeplots(example_md_dir)

makedocs(sitename="ExtendableGrids.jl",
modules = [ExtendableGrids],
doctest = true,
clean = true,
modules = [ExtendableGrids],
doctest = false,
clean = true,
authors = "J. Fuhrmann, Ch. Merdon",
repo="https://github.com/j-fu/ExtendableGrids.jl",
pages=[
Expand Down
21 changes: 0 additions & 21 deletions examples/Example101_Interval.jl

This file was deleted.

23 changes: 0 additions & 23 deletions examples/Example102_IntervalLocalRef.jl

This file was deleted.

22 changes: 0 additions & 22 deletions examples/Example103_IntervalMultiRegion.jl

This file was deleted.

21 changes: 0 additions & 21 deletions examples/Example201_Rectangle.jl

This file was deleted.

25 changes: 0 additions & 25 deletions examples/Example202_RectangleLocalRef.jl

This file was deleted.

25 changes: 0 additions & 25 deletions examples/Example203_RectangleMultiRegion.jl

This file was deleted.

39 changes: 0 additions & 39 deletions examples/Example401_RegionEdit_Subgrid.jl

This file was deleted.

49 changes: 49 additions & 0 deletions examples/examples1d.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 1D Grid examples
# ===============
using ExtendableGrids

# ## Interval from vector
#
function interval_from_vector()
X=collect(0:0.05:1)
grid=simplexgrid(X)
end
# ![](interval_from_vector.svg)

#
# ##Interval with local refinement
#
function interval_localref()

XLeft=geomspace(0.0,0.5,0.1, 0.01)
XRight=geomspace(0.5,1.0,0.01,0.1)
X=glue(XLeft, XRight)
grid=simplexgrid(X)
end
# ![](interval_localref.svg)


#
# ## Interval with multiple regions
#
function interval_multiregion()

X=collect(0:0.05:1)
grid=simplexgrid(X)
cellmask!(grid,[0.0],[0.5],3)
bfacemask!(grid,[0.5], [0.5],4)
grid
end
# ![](interval_multiregion.svg)
#
# ## Multiple regions and subgrid
#
function interval_subgrid()
X=collect(0:0.01:1)
grid=simplexgrid(X)
bfacemask!(grid,[0.5],[0.5],3)
cellmask!(grid,[0.0],[0.25],2)
cellmask!(grid,[0.20],[0.5],3)
subgrid(grid,[2,3])
end
# ![](interval_subgrid.svg)
Loading

2 comments on commit c283b3b

@j-fu
Copy link
Owner Author

@j-fu j-fu commented on c283b3b Dec 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/26862

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" c283b3bb9be197d5365543a5a98bd963ff5f3d08
git push origin v0.6.0

Please sign in to comment.