diff --git a/Project.toml b/Project.toml index 76afd8c7..a87bfbf9 100644 --- a/Project.toml +++ b/Project.toml @@ -18,6 +18,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" [weakdeps] diff --git a/docs/Project.toml b/docs/Project.toml index b3e06ef2..31a744c4 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -2,7 +2,12 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" ExtendableGrids = "cfc395e8-590f-11e8-1f13-43a2532b2fa8" +Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" GridVisualize = "5eed8a63-0fb0-45eb-886d-8d5a387d12b8" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" SimplexGridFactory = "57bfcd06-606e-45d6-baf4-4ba06da0efd5" Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344" + +[compat] +Documenter = "1" +julia = "1.9" \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index b497ffde..c78897c8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,40 +1,38 @@ -ENV["MPLBACKEND"]="agg" -using Documenter, ExtendableGrids, Literate, GridVisualize, SimplexGridFactory +ENV["MPLBACKEND"] = "agg" +using Documenter, ExtendableGrids, Literate, GridVisualize, SimplexGridFactory, Gmsh import CairoMakie, Triangulate -CairoMakie.activate!(type="svg",visible=false) +CairoMakie.activate!(; type = "svg", visible = false) -example_md_dir = joinpath(@__DIR__,"src","examples") +example_md_dir = joinpath(@__DIR__, "src", "examples") - - -examples1d=joinpath(@__DIR__,"..","examples","examples1d.jl") +examples1d = joinpath(@__DIR__, "..", "examples", "examples1d.jl") include(examples1d) -examples2d=joinpath(@__DIR__,"..","examples","examples2d.jl") +examples2d = joinpath(@__DIR__, "..", "examples", "examples2d.jl") include(examples2d) -examples3d=joinpath(@__DIR__,"..","examples","examples3d.jl") +examples3d = joinpath(@__DIR__, "..", "examples", "examples3d.jl") include(examples3d) include("makeplots.jl") 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))) - 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, Plotter=CairoMakie) - - makedocs(sitename="ExtendableGrids.jl", - modules = [ExtendableGrids], - clean = false, + makeplots(example_md_dir; Plotter = CairoMakie) + + makedocs(; sitename = "ExtendableGrids.jl", + modules = [ExtendableGrids, Base.get_extension(ExtendableGrids, :ExtendableGridsGmshExt)], + clean = false, + warnonly = true, doctest = true, authors = "J. Fuhrmann, Ch. Merdon", - repo="https://github.com/j-fu/ExtendableGrids.jl", - pages=[ - "Home"=>"index.md", + repo = "https://github.com/j-fu/ExtendableGrids.jl", + pages = [ + "Home" => "index.md", "adjacency.md", "vectorofconstants.md", "typehierarchy.md", @@ -52,12 +50,12 @@ function mkdocs() "refinement.md", "regionedit.md", "tokenstream.md", + "gmsh.md", "allindex.md", - "Examples" => generated_examples + "Examples" => generated_examples, ]) end mkdocs() -deploydocs(repo = "github.com/j-fu/ExtendableGrids.jl.git") - +deploydocs(; repo = "github.com/j-fu/ExtendableGrids.jl.git") diff --git a/ext/ExtendableGridsGmshExt.jl b/ext/ExtendableGridsGmshExt.jl index eec54087..8939f84a 100644 --- a/ext/ExtendableGridsGmshExt.jl +++ b/ext/ExtendableGridsGmshExt.jl @@ -20,6 +20,7 @@ import ExtendableGrids: Edge1D, Triangle2D, Quadrilateral2D, Tetrahedron3D, Hexa #using ExtendableGrids using StatsBase: countmap using Bijections +using UUIDs: uuid1 """ ```` @@ -160,13 +161,15 @@ function simplexgrid_to_gmshfile(grid::ExtendableGrid; filename::String = "") # This possibility is new in 1.9, see # https://github.com/JuliaLang/julia/blob/release-1.9/NEWS.md#new-language-features gmsh.model = simplexgrid_to_mod(grid) + mod = gmsh.model else - simplexgrid_to_mod(grid) + mod = simplexgrid_to_mod(grid) end if filename != "" gmsh.write(filename) end + return mod end """ @@ -186,13 +189,15 @@ function mixedgrid_to_gmshfile(grid::ExtendableGrid; filename::String = "") # This possibility is new in 1.9, see # https://github.com/JuliaLang/julia/blob/release-1.9/NEWS.md#new-language-features gmsh.model = mixedgrid_to_mod(grid) + mod = gmsh.model else - mixedgrid_to_mod(grid) + mod = mixedgrid_to_mod(grid) end if filename != "" gmsh.write(filename) end + return mod end #--------------------------------------------------------------------------------------------- @@ -592,7 +597,7 @@ function simplexgrid_to_mod(grid::ExtendableGrid) # gmsh.initialize() gmsh.option.setNumber("General.Terminal", 1) #(fbase,fext)=splitext(filename) - gmsh.model.add("fbase") + gmsh.model.add("model" * string(uuid1())[1:8]) Tc = typeof(grid[Coordinates][1, 1]) Ti = typeof(grid[CellNodes][1, 1]) @@ -682,7 +687,7 @@ function mixedgrid_to_mod(grid::ExtendableGrid) # gmsh.initialize() gmsh.option.setNumber("General.Terminal", 1) #(fbase,fext)=splitext(filename) - gmsh.model.add("fbase") + gmsh.model.add("model" * string(uuid1())[1:8]) # formatting the coordinates correctly coords = grid[Coordinates] diff --git a/src/ExtendableGrids.jl b/src/ExtendableGrids.jl index cf5f6faf..81075e01 100644 --- a/src/ExtendableGrids.jl +++ b/src/ExtendableGrids.jl @@ -13,16 +13,14 @@ using Random using Dates using LinearAlgebra - -if !isdefined(Base, :get_extension) +if !isdefined(Base, :get_extension) using Requires end - include("adjacency.jl") -export Adjacency,VariableTargetAdjacency,FixedTargetAdjacency -export atranspose,num_targets,num_sources,num_links,append!, max_num_targets_per_source -export asparse,tryfix,makevar +export Adjacency, VariableTargetAdjacency, FixedTargetAdjacency +export atranspose, num_targets, num_sources, num_links, append!, max_num_targets_per_source +export asparse, tryfix, makevar include("serialadjacency.jl") export SerialVariableTargetAdjacency @@ -45,50 +43,45 @@ export AbstractElementGeometry1D export Edge1D export AbstractElementGeometry2D -export Polygon2D,Triangle2D,Quadrilateral2D,Pentagon2D,Hexagon2D,Parallelogram2D,Rectangle2D,Circle2D +export Polygon2D, Triangle2D, Quadrilateral2D, Pentagon2D, Hexagon2D, Parallelogram2D, Rectangle2D, Circle2D export AbstractElementGeometry3D -export Polyhedron3D,Tetrahedron3D, Hexahedron3D,Parallelepiped3D,RectangularCuboid3D,Prism3D,TrianglePrism3D,Sphere3D +export Polyhedron3D, Tetrahedron3D, Hexahedron3D, Parallelepiped3D, RectangularCuboid3D, Prism3D, TrianglePrism3D, Sphere3D export AbstractElementGeometry4D -export Polychoron4D,HyperCube4D +export Polychoron4D, HyperCube4D export dim_element - include("coordinatesystem.jl") -export coordinatesystems,CoordinateSystems +export coordinatesystems, CoordinateSystems export AbstractCoordinateSystem -export Cartesian1D,Cartesian2D,Cartesian3D -export Cylindrical2D,Cylindrical3D -export Polar2D,Polar1D ,Spherical3D,Spherical1D - - +export Cartesian1D, Cartesian2D, Cartesian3D +export Cylindrical2D, Cylindrical3D +export Polar2D, Polar1D, Spherical3D, Spherical1D include("extendablegrid.jl") export ExtendableGrid export instantiate, veryform export AbstractGridComponent -export AbstractGridAdjacency,AbstractElementGeometries,AbstractElementRegions +export AbstractGridAdjacency, AbstractElementGeometries, AbstractElementRegions export Coordinates, CellNodes, BFaceNodes export CellGeometries, BFaceGeometries export CellRegions, BFaceRegions, BEdgeRegions export NumCellRegions, NumBFaceRegions, NumBEdgeRegions export CoordinateSystem -export AbstractGridFloatArray1D,AbstractGridFloatArray2D -export AbstractGridIntegerArray1D,AbstractGridIntegerArray2D +export AbstractGridFloatArray1D, AbstractGridFloatArray2D +export AbstractGridIntegerArray1D, AbstractGridIntegerArray2D export index_type, coord_type export dim_space, dim_grid -export num_nodes, num_cells, num_bfaces, num_bedges +export num_nodes, num_cells, num_bfaces, num_bedges export num_cellregions, num_bfaceregions, num_bedgeregions export gridcomponents -export seemingly_equal +export seemingly_equal include("subgrid.jl") export subgrid - - include("shape_specs.jl") export refcoords_for_geometry export num_nodes @@ -103,7 +96,6 @@ export Tangent4ElemType! export xrefFACE2xrefCELL export xrefFACE2xrefOFACE - include("derived.jl") export Coordinates export CellVolumes, CellFaces, CellEdges, CellFaceSigns, CellFaceOrientations, CellEdgeSigns @@ -126,7 +118,7 @@ include("more.jl") export BFaceCells, BFaceNormals, BFaceEdges, BEdgeNodes include("voronoi.jl") -export tricircumcenter!,VoronoiFaceCenters +export tricircumcenter!, VoronoiFaceCenters include("meshrefinements.jl") export split_grid_into @@ -138,9 +130,7 @@ include("adaptive_meshrefinements.jl") export bulk_mark export RGB_refine - - -include("assemblytypes.jl"); +include("assemblytypes.jl") export AssemblyType export AT_NODES, ON_CELLS, ON_FACES, ON_IFACES, ON_BFACES, ON_EDGES, ON_BEDGES export ItemType4AssemblyType @@ -151,13 +141,12 @@ export GridComponentRegions4AssemblyType export GridComponentUniqueGeometries4AssemblyType export GridComponentAssemblyGroups4AssemblyType -include("l2gtransformations.jl"); +include("l2gtransformations.jl") export L2GTransformer, update_trafo!, eval_trafo!, mapderiv! include("cellfinder.jl") export CellFinder -export gFindLocal!, gFindBruteForce!, interpolate,interpolate! - +export gFindLocal!, gFindBruteForce!, interpolate, interpolate! include("commongrids.jl") export reference_domain @@ -167,13 +156,11 @@ export grid_unitsquare, grid_unitsquare_mixedgeometries export grid_triangle export ringsector - include("regionedit.jl") export cellmask!, bfacemask!, bedgemask!, rect! - include("arraytools.jl") -export glue,geomspace,linspace +export glue, geomspace, linspace include("simplexgrid.jl") export simplexgrid, geomspace, glue @@ -181,22 +168,19 @@ export XCoordinates, YCoordinates, ZCoordinates export writefile include("tokenstream.jl") -export TokenStream, gettoken, expecttoken,trytoken +export TokenStream, gettoken, expecttoken, trytoken include("io.jl") export writeVTK include("seal.jl") - -@static if !isdefined(Base, :get_extension) +@static if !isdefined(Base, :get_extension) function __init__() - @require Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb" begin + @require Gmsh="705231aa-382f-11e9-3f0c-b7cb4346fdeb" begin include("../ext/ExtendableGridsGmshExt.jl") end end end - - end # module diff --git a/src/io.jl b/src/io.jl index 3eae49ec..c12485bf 100644 --- a/src/io.jl +++ b/src/io.jl @@ -189,7 +189,6 @@ function simplexgrid(file::String; format = "") simplexgrid(coord, cells, regions, faces, bregions) end -# Implementations in Gmsh extension function simplexgrid_from_gmsh end function simplexgrid_to_gmsh end