Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 0 additions & 7 deletions .JuliaFormatter.toml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/format_check.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://WIAS-PDELib.github.io/SimplexGridFactory.jl/stable)
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://WIAS-PDELib.github.io/SimplexGridFactory.jl/dev)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
[![code style: runic](https://img.shields.io/badge/code_style-%E1%9A%B1%E1%9A%A2%E1%9A%BE%E1%9B%81%E1%9A%B2-black)](https://github.com/fredrikekre/Runic.jl)


SimplexGridFactory
Expand Down
53 changes: 27 additions & 26 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
using Documenter, SimplexGridFactory, ExtendableGrids
import PlutoSliderServer
using GridVisualize, ExampleJuggler
ENV["MPLBACKEND"]= "agg"
ENV["MPLBACKEND"] = "agg"
import CairoMakie, PyPlot
ExampleJuggler.verbose!(true)



###zzaccessing

function mkdocs()
cleanexamples()
exampledir = joinpath(@__DIR__, "..", "examples")
notebookdir = joinpath(@__DIR__, "..", "notebooks")
cairo_examples = @docscripts(exampledir,["examples2d.jl"], Plotter=CairoMakie)
pyplot_examples = @docscripts(exampledir,["examples3d.jl"], Plotter=PyPlot)

generated_examples=[cairo_examples..., pyplot_examples...]
notebook_examples = @docplutonotebooks(notebookdir, ["gridgenvis.jl","cylinder.jl"], iframe=true, iframe_height="2000px")


makedocs(; sitename = "SimplexGridFactory.jl",
modules = [SimplexGridFactory],
doctest = false,
clean = false,
authors = "J. Fuhrmann, Ch. Merdon",
repo = "https://github.com/WIAS-PDELib/SimplexGridFactory.jl",
pages = [
"Home" => "index.md",
"Changes" => "changes.md",
"API" => "api.md",
"Examples" => generated_examples,
"Notebooks" => notebook_examples,
"Internals" => "internals.md",
"allindex.md",
])

cleanexamples()
cairo_examples = @docscripts(exampledir, ["examples2d.jl"], Plotter = CairoMakie)
pyplot_examples = @docscripts(exampledir, ["examples3d.jl"], Plotter = PyPlot)

generated_examples = [cairo_examples..., pyplot_examples...]
notebook_examples = @docplutonotebooks(notebookdir, ["gridgenvis.jl", "cylinder.jl"], iframe = true, iframe_height = "2000px")


makedocs(;
sitename = "SimplexGridFactory.jl",
modules = [SimplexGridFactory],
doctest = false,
clean = false,
authors = "J. Fuhrmann, Ch. Merdon",
repo = "https://github.com/WIAS-PDELib/SimplexGridFactory.jl",
pages = [
"Home" => "index.md",
"Changes" => "changes.md",
"API" => "api.md",
"Examples" => generated_examples,
"Notebooks" => notebook_examples,
"Internals" => "internals.md",
"allindex.md",
]
)

return cleanexamples()

end

Expand Down
119 changes: 61 additions & 58 deletions examples/examples2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function triangulation_of_domain()
facet!(builder, p4, p5)
facet!(builder, p5, p1)

builder
return builder
end

#
Expand All @@ -56,7 +56,7 @@ end
# We miss:
# - size control for the triangles
# - differently marking of boundary parts
#
#
function nicer_triangulation_of_domain()
builder = SimplexGridBuilder(; Generator = Triangulate)

Expand All @@ -77,7 +77,7 @@ function nicer_triangulation_of_domain()

options!(builder; maxvolume = 0.01)

builder
return builder
end
#
# ![](nicer_triangulation_of_domain.png)
Expand Down Expand Up @@ -117,7 +117,7 @@ function triangulation_of_domain_with_subregions()
maxvolume!(builder, 0.01)
regionpoint!(builder, 0.2, 0.2)

builder
return builder
end
#
# ![](triangulation_of_domain_with_subregions.png)
Expand All @@ -129,13 +129,15 @@ end
# the tedious and error prone counting connected
# with this approach.
function direct_square(Generator = Triangulate)
simplexgrid(Generator;
points = [0 0; 0 1; 1 1; 1 0]',
bfaces = [1 2; 2 3; 3 4; 4 1]',
bfaceregions = [1, 2, 3, 4],
regionpoints = [0.5 0.5;]',
regionnumbers = [1],
regionvolumes = [0.01])
return simplexgrid(
Generator;
points = [0 0; 0 1; 1 1; 1 0]',
bfaces = [1 2; 2 3; 3 4; 4 1]',
bfaceregions = [1, 2, 3, 4],
regionpoints = [0.5 0.5;]',
regionnumbers = [1],
regionvolumes = [0.01]
)
end
#
# ![](direct_square.png)
Expand Down Expand Up @@ -176,26 +178,26 @@ function square_localref()
end
end
options!(builder; unsuitable = unsuitable)
builder
return builder
end
#
# ![](square_localref.png)
#

# ## Domain with holes
# We can generate domains with holes.
# This at once shall demonstrate how the chosen
# This at once shall demonstrate how the chosen
# API approach eases bookkeeping of features added to the
# geometry description
#
function swiss_cheese_2d()
function circlehole!(builder, center, radius; n = 20)
points = [point!(builder, center[1] + radius * sin(t), center[2] + radius * cos(t)) for t in range(0, 2π; length = n)]
for i = 1:(n - 1)
for i in 1:(n - 1)
facet!(builder, points[i], points[i + 1])
end
facet!(builder, points[end], points[1])
holepoint!(builder, center)
return holepoint!(builder, center)
end

builder = SimplexGridBuilder(; Generator = Triangulate)
Expand All @@ -214,35 +216,37 @@ function swiss_cheese_2d()
facet!(builder, p3, p4)
facet!(builder, p4, p1)

holes = [8.0 4.0;
1.0 2.0;
8.0 9.0;
3.0 4.0;
4.0 6.0;
7.0 9.0;
4.0 7.0;
7.0 5.0;
2.0 1.0;
4.0 1.0;
4.0 8.0;
2.0 8.0;
3.0 6.0;
4.0 9.0;
9.0 1.0;
9.0 1.0;
6.0 9.0;
8.0 9.0;
3.0 5.0;
1.0 4.0]'
holes = [
8.0 4.0;
1.0 2.0;
8.0 9.0;
3.0 4.0;
4.0 6.0;
7.0 9.0;
4.0 7.0;
7.0 5.0;
2.0 1.0;
4.0 1.0;
4.0 8.0;
2.0 8.0;
3.0 6.0;
4.0 9.0;
9.0 1.0;
9.0 1.0;
6.0 9.0;
8.0 9.0;
3.0 5.0;
1.0 4.0
]'

radii = [0.15, 0.15, 0.1, 0.35, 0.2, 0.3, 0.1, 0.4, 0.1, 0.4, 0.4, 0.15, 0.2, 0.2, 0.2, 0.35, 0.15, 0.25, 0.15, 0.25]

for i = 1:length(radii)
for i in 1:length(radii)
facetregion!(builder, i + 1)
circlehole!(builder, holes[:, i], radii[i])
end

builder
return builder
end
#
# ![](swiss_cheese_2d.png)
Expand All @@ -252,13 +256,13 @@ end
# ## Remeshing another grid
#
# The `bregions!` method allows to use another grid as geometry description
#
#
function remesh_2d()
b = SimplexGridBuilder(; Generator = Triangulate)
X=0:0.1:1
X = 0:0.1:1
grid1 = simplexgrid(X, X)
bregions!(b,grid1)
simplexgrid(b,maxvolume=0.01)
bregions!(b, grid1)
return simplexgrid(b, maxvolume = 0.01)
end
#
# ![](remesh_2d.png)
Expand All @@ -268,7 +272,7 @@ end
#
# The `bregions!` method allows to extract parts of the geometry description from
# an already existing grid.
#
#
function glue_2d()
b = SimplexGridBuilder(; Generator = Triangulate)

Expand Down Expand Up @@ -310,43 +314,42 @@ function glue_2d()

bregions!(b, grid1, 1:6)
grid2 = simplexgrid(b; maxvolume = 0.6)
grid2 = glue(grid1, grid2)
return grid2 = glue(grid1, grid2)
end
#
# ![](glue_2d.png)
#



# Plot generation
using GridVisualize
function generateplots(picdir; Plotter = nothing)
if isdefined(Plotter, :Makie)
return if isdefined(Plotter, :Makie)
size = (600, 300)
Plotter.activate!(; type = "png", visible = false)

p = builderplot(triangulation_of_domain(); Plotter, size)
Plotter.save(joinpath(picdir, "triangulation_of_domain.png"),p)
Plotter.save(joinpath(picdir, "triangulation_of_domain.png"), p)

p = builderplot(nicer_triangulation_of_domain(); Plotter, size)
Plotter.save(joinpath(picdir, "nicer_triangulation_of_domain.png"),p)
Plotter.save(joinpath(picdir, "nicer_triangulation_of_domain.png"), p)

p = builderplot(triangulation_of_domain_with_subregions(); Plotter, size)
Plotter.save(joinpath(picdir, "triangulation_of_domain_with_subregions.png"),p)
Plotter.save(joinpath(picdir, "triangulation_of_domain_with_subregions.png"), p)

p = builderplot(square_localref(); Plotter, size)
Plotter.save(joinpath(picdir, "square_localref.png"),p)
Plotter.save(joinpath(picdir, "square_localref.png"), p)

p = gridplot(direct_square(); Plotter, size)
Plotter.save(joinpath(picdir, "direct_square.png"),p)
Plotter.save(joinpath(picdir, "direct_square.png"), p)

p = builderplot(swiss_cheese_2d(); Plotter, size)
Plotter.save(joinpath(picdir, "swiss_cheese_2d.png"),p)
Plotter.save(joinpath(picdir, "swiss_cheese_2d.png"), p)

p = gridplot(remesh_2d(); Plotter, size)
Plotter.save(joinpath(picdir, "remesh_2d.png"),p)
Plotter.save(joinpath(picdir, "remesh_2d.png"), p)

p = gridplot(glue_2d(); Plotter, size)
Plotter.save(joinpath(picdir, "glue_2d.png"),p)
Plotter.save(joinpath(picdir, "glue_2d.png"), p)
end
end
Loading
Loading