changeset 858:5088de9b6d65

Merge feature/setup_documenter
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 19 Jan 2022 07:24:36 +0100
parents 3c1dd7692797 (current diff) 276c7ca9b2a9 (diff)
children 336e8d1a553c 9a2776352c2a
files
diffstat 19 files changed, 446 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,3 @@
+syntax: glob
+docs/build/
+docs/build-local/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,54 @@
+JULIA_DEFAULT=julia --startup-file=no
+JULIA?=$(JULIA_DEFAULT)
+
+# Set the default browser
+WHICH_XDG_OPEN=$(shell which xdg-open)
+WHICH_OPEN=$(shell which open)
+BROWSER_DEFAULT  = $(if $(WHICH_XDG_OPEN), xdg-open)
+BROWSER_DEFAULT := $(if $(BROWSER_DEFAULT), $(BROWSER_DEFAULT), open)
+BROWSER?=$(BROWSER_DEFAULT)
+
+help:
+	@echo 'Targets:'
+	@echo '    help        - Show this help.'
+	@echo '    docs        - Generate docs for webserver deployment.'
+	@echo '    localdocs   - Generate docs for local viewing.'
+	@echo '    opendocs    - Open documentation in the browser remaking it if necessary.'
+	@echo ''
+	@echo 'Variables:'
+	@echo '    JULIA       - Controls which command is used to run julia'
+	@echo '                  Default $(JULIA_DEFAULT)'
+	@echo '    BROWSER     - Sets the command for how to open html files'
+	@echo '                  Default: xdg-open if it exists otherwise open'
+	@echo ''
+	@echo 'Variables can be set on the commandline using the -e flag for make, e.g.'
+	@echo '    make localdocs -e JULIA=path/to/julia'
+	@echo 'or as shell environment variables.'
+
+docs: docs/build
+
+localdocs: docs/build-local
+
+opendocs: localdocs
+	$(BROWSER) docs/build-local/index.html
+
+clean:
+	rm -rf docs/build
+	rm -rf docs/build-local
+
+.PHONY: help docs localdocs opendocs clean
+
+SRC_DIRS = src docs/src
+SRC_FILES_AND_DIRS = $(foreach dir,$(SRC_DIRS),$(shell find $(dir)))
+DEP_IGNORE = %/.DS_Store
+DOCS_DEPENDENCIES = docs/make.jl $(filter-out $(DEP_IGNORE),$(SRC_FILES_AND_DIRS))
+docs/build: $(DOCS_DEPENDENCIES)
+	$(JULIA) --project=docs docs/make.jl --build-dir build --prettyurls
+
+docs/build-local: $(DOCS_DEPENDENCIES)
+	$(JULIA) --project=docs docs/make.jl --build-dir build-local
+
+
+.PHONY: temp
+temp:
+	@echo $(SRC_FILES_AND_DIRS)
--- a/README.md	Thu Jan 13 12:43:10 2022 +0100
+++ b/README.md	Wed Jan 19 07:24:36 2022 +0100
@@ -27,3 +27,23 @@
 Pkg.test(test_args=["*/lazy_tensor_operations_test.jl", "Grids/*"])
 ```
 will run any file named `lazy_tensor_operations_test.jl` and all the files in the `Grids` folder.
+
+
+## Generating and using the documentation
+Generating the documentation can be done using either `make` or through activating the `docs` environment and including the script `docs/make.jl` at the REPL.
+
+Using `make` there are three targets
+```shell
+make docs
+make localdocs
+make opendocs
+make help
+```
+The first variant generates files suitable for webserver deployment, i.e with `prettyurls=true`. The second generates files sutible for local viewing in a web browser, i.e `prettyurls=false`. To view the documentation locally simply open `docs/build/index.html` in your web browser. The documentation can be automatically built and opened using
+```shell
+make opendocs
+```
+
+When including the `docs/make.jl` script `prettyurls` is set to `false` by default.
+
+Including `docs/make.jl` from the REPL may be preferable when repeatadely building the documentation since this avoids compilation latency.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/Manifest.toml	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,145 @@
+# This file is machine-generated - editing it directly is not advised
+
+julia_version = "1.7.1"
+manifest_format = "2.0"
+
+[[deps.ANSIColoredPrinters]]
+git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
+uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
+version = "0.0.1"
+
+[[deps.Adapt]]
+deps = ["LinearAlgebra"]
+git-tree-sha1 = "af92965fb30777147966f58acb05da51c5616b5f"
+uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
+version = "3.3.3"
+
+[[deps.Artifacts]]
+uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
+
+[[deps.Base64]]
+uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
+
+[[deps.CompilerSupportLibraries_jll]]
+deps = ["Artifacts", "Libdl"]
+uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
+
+[[deps.Dates]]
+deps = ["Printf"]
+uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
+
+[[deps.DocStringExtensions]]
+deps = ["LibGit2"]
+git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
+uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
+version = "0.8.6"
+
+[[deps.Documenter]]
+deps = ["ANSIColoredPrinters", "Base64", "Dates", "DocStringExtensions", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "REPL", "Test", "Unicode"]
+git-tree-sha1 = "f425293f7e0acaf9144de6d731772de156676233"
+uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+version = "0.27.10"
+
+[[deps.IOCapture]]
+deps = ["Logging", "Random"]
+git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
+uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
+version = "0.2.2"
+
+[[deps.InteractiveUtils]]
+deps = ["Markdown"]
+uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
+
+[[deps.JSON]]
+deps = ["Dates", "Mmap", "Parsers", "Unicode"]
+git-tree-sha1 = "8076680b162ada2a031f707ac7b4953e30667a37"
+uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
+version = "0.21.2"
+
+[[deps.LibGit2]]
+deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
+uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
+
+[[deps.Libdl]]
+uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
+
+[[deps.LinearAlgebra]]
+deps = ["Libdl", "libblastrampoline_jll"]
+uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
+
+[[deps.Logging]]
+uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
+
+[[deps.Markdown]]
+deps = ["Base64"]
+uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
+
+[[deps.Mmap]]
+uuid = "a63ad114-7e13-5084-954f-fe012c677804"
+
+[[deps.NetworkOptions]]
+uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
+
+[[deps.OffsetArrays]]
+deps = ["Adapt"]
+git-tree-sha1 = "043017e0bdeff61cfbb7afeb558ab29536bbb5ed"
+uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
+version = "1.10.8"
+
+[[deps.OpenBLAS_jll]]
+deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
+uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
+
+[[deps.Parsers]]
+deps = ["Dates"]
+git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
+uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
+version = "2.1.3"
+
+[[deps.Printf]]
+deps = ["Unicode"]
+uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
+
+[[deps.REPL]]
+deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
+uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
+
+[[deps.Random]]
+deps = ["SHA", "Serialization"]
+uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
+
+[[deps.SHA]]
+uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
+
+[[deps.Sbplib]]
+deps = ["TOML", "TiledIteration"]
+path = ".."
+uuid = "5a373a26-915f-4769-bcab-bf03835de17b"
+version = "0.1.0"
+
+[[deps.Serialization]]
+uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
+
+[[deps.Sockets]]
+uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
+
+[[deps.TOML]]
+deps = ["Dates"]
+uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
+
+[[deps.Test]]
+deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
+uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
+
+[[deps.TiledIteration]]
+deps = ["OffsetArrays"]
+git-tree-sha1 = "5683455224ba92ef59db72d10690690f4a8dc297"
+uuid = "06e1c1a7-607b-532d-9fad-de7d9aa2abac"
+version = "0.3.1"
+
+[[deps.Unicode]]
+uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
+
+[[deps.libblastrampoline_jll]]
+deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
+uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/Project.toml	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,3 @@
+[deps]
+Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
+Sbplib = "5a373a26-915f-4769-bcab-bf03835de17b"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/make.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,41 @@
+using Documenter
+using Sbplib
+
+using Sbplib.DiffOps
+using Sbplib.Grids
+using Sbplib.LazyTensors
+using Sbplib.RegionIndices
+using Sbplib.SbpOperators
+using Sbplib.StaticDicts
+
+sitename = "Sbplib.jl"
+
+if "--prettyurls" ∈ ARGS
+    prettyurls = true
+else
+    prettyurls = false
+end
+
+if "--build-dir" ∈ ARGS
+    i = findlast(==("--build-dir"), ARGS)
+    build = ARGS[i+1]
+else
+    build = "build-local"
+end
+
+pages = [
+    "Home" => "index.md",
+    "Submodules" => [
+        "submodules/grids.md",
+        "submodules/diff_ops.md",
+        "submodules/lazy_tensors.md",
+        "submodules/region_indices.md",
+        "submodules/sbp_operators.md",
+        "submodules/static_dicts.md",
+    ],
+    "doc_index.md",
+]
+# This ordering is not respected by @contents. See https://github.com/JuliaDocs/Documenter.jl/issues/936
+
+format=Documenter.HTML(;prettyurls)
+makedocs(;sitename, pages, format, build)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/doc_index.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,4 @@
+# Interface index
+
+```@index
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/index.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,9 @@
+# Sbplib.jl
+
+```@contents
+Depth = 1
+```
+
+> Matrix free finite differences methods for all!
+>
+>  -- The mighty Trocatron, ruler of errors and grids
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/diff_ops.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# DiffOps
+
+## Contents
+```@contents
+Pages = ["diff_ops.md"]
+```
+
+## Index
+```@index
+Pages = ["diff_ops.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [DiffOps]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [DiffOps]
+Public = false # Hide exported objects
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/grids.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# Grids
+
+## Contents
+```@contents
+Pages = ["grids.md"]
+```
+
+## Index
+```@index
+Pages = ["grids.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [Grids]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [Grids]
+Public = false # Hide exported objects
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/lazy_tensors.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# LazyTensors
+
+## Contents
+```@contents
+Pages = ["lazy_tensors.md"]
+```
+
+## Index
+```@index
+Pages = ["lazy_tensors.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [LazyTensors]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [LazyTensors]
+Public = false # Hide exported objects
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/region_indices.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# RegionIndices
+
+## Contents
+```@contents
+Pages = ["region_indices.md"]
+```
+
+## Index
+```@index
+Pages = ["region_indices.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [RegionIndices]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [RegionIndices]
+Public = false # Hide exported objects
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/sbp_operators.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# SbpOperators
+
+## Contents
+```@contents
+Pages = ["sbp_operators.md"]
+```
+
+## Index
+```@index
+Pages = ["sbp_operators.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [SbpOperators]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [SbpOperators]
+Public = false # Hide exported objects
+```
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/src/submodules/static_dicts.md	Wed Jan 19 07:24:36 2022 +0100
@@ -0,0 +1,23 @@
+# StaticDicts
+
+## Contents
+```@contents
+Pages = ["static_dicts.md"]
+```
+
+## Index
+```@index
+Pages = ["static_dicts.md"]
+```
+
+## Public interface
+```@autodocs
+Modules = [StaticDicts]
+Private = false # Hide unexported objects
+```
+
+## Internal interface
+```@autodocs
+Modules = [StaticDicts]
+Public = false # Hide exported objects
+```
--- a/src/DiffOps/DiffOps.jl	Thu Jan 13 12:43:10 2022 +0100
+++ b/src/DiffOps/DiffOps.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -93,6 +93,7 @@
 
 
 """
+    BoundaryCondition
 A BoundaryCondition should implement the method
     sat(::DiffOp, v::AbstractArray, data::AbstractArray, ...)
 """
--- a/src/LazyTensors/lazy_array.jl	Thu Jan 13 12:43:10 2022 +0100
+++ b/src/LazyTensors/lazy_array.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -42,10 +42,10 @@
 
 """
     LazyElementwiseOperation{T,D,Op} <: LazyArray{T,D}
-Struct allowing for lazy evaluation of elementwise operations on AbstractArrays.
+Struct allowing for lazy evaluation of elementwise operations on `AbstractArray`s.
 
-A LazyElementwiseOperation contains two arrays together with an operation.
-The operations are carried out when the LazyElementwiseOperation is indexed.
+A `LazyElementwiseOperation` contains two arrays together with an operation.
+The operations are carried out when the `LazyElementwiseOperation` is indexed.
 """
 struct LazyElementwiseOperation{T,D,Op,T1<:AbstractArray{T,D},T2<:AbstractArray{T,D}} <: LazyArray{T,D}
     a::T1
--- a/src/LazyTensors/lazy_tensor_operations.jl	Thu Jan 13 12:43:10 2022 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -76,7 +76,7 @@
 """
     TensorMappingComposition{T,R,K,D}
 
-Lazily compose two TensorMappings, so that they can be handled as a single TensorMapping.
+Lazily compose two `TensorMapping`s, so that they can be handled as a single `TensorMapping`.
 """
 struct TensorMappingComposition{T,R,K,D, TM1<:TensorMapping{T,R,K}, TM2<:TensorMapping{T,K,D}} <: TensorMapping{T,R,D}
     t1::TM1
@@ -165,8 +165,8 @@
 apply_transpose(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...]
 
 """
-Base.:∘(tm, tmi)
-Base.:∘(tmi, tm)
+    Base.:∘(tm, tmi)
+    Base.:∘(tmi, tm)
 
 Composes a `Tensormapping` `tm` with an `IdentityMapping` `tmi`, by returning `tm`
 """
@@ -316,7 +316,7 @@
     slice_tuple(t, Val(l), Val(u))
 
 Get a slice of a tuple in a type stable way.
-Equivalent to t[l:u] but type stable.
+Equivalent to `t[l:u]` but type stable.
 """
 function slice_tuple(t,::Val{L},::Val{U}) where {L,U}
     return ntuple(i->t[i+L-1], U-L+1)
@@ -327,7 +327,7 @@
 
 Split the tuple `t` into two parts. the first part is `M` long.
 E.g
-```
+```julia
 split_tuple((1,2,3,4),Val(3)) -> (1,2,3), (4,)
 ```
 """
@@ -357,17 +357,19 @@
 flatten_tuple(t::Tuple) = ((flatten_tuple.(t)...)...,) # simplify?
 flatten_tuple(ts::Vararg) = flatten_tuple(ts)
 
-"""
-   LazyOuterProduct(tms...)
+@doc raw"""
+    LazyOuterProduct(tms...)
 
 Creates a `TensorMappingComposition` for the outerproduct of `tms...`.
 This is done by separating the outer product into regular products of outer products involving only identity mappings and one non-identity mapping.
 
 First let
 ```math
-A = A_{I,J}
-B = B_{M,N}
-C = C_{P,Q}
+\begin{aligned}
+A &= A_{I,J} \\
+B &= B_{M,N} \\
+C &= C_{P,Q} \\
+\end{aligned}
 ```
 
 where ``I``, ``M``, ``P`` are  multi-indexes for the ranges of ``A``, ``B``, ``C``, and ``J``, ``N``, ``Q`` are multi-indexes of the domains.
@@ -385,10 +387,12 @@
 ```math
 A⊗B⊗C = (A⊗I_{|M|}⊗I_{|P|})(I_{|J|}⊗B⊗I_{|P|})(I_{|J|}⊗I_{|N|}⊗C)
 ```
-where |.| of a multi-index is a vector of sizes for each dimension. ``I_v`` denotes the identity tensor of size ``v[i]`` in each direction
+where ``|⋅|`` of a multi-index is a vector of sizes for each dimension. ``I_v`` denotes the identity tensor of size ``v[i]`` in each direction
 To apply ``A⊗B⊗C`` we evaluate
 
+```math
 (A⊗B⊗C)v = [(A⊗I_{|M|}⊗I_{|P|})  [(I_{|J|}⊗B⊗I_{|P|}) [(I_{|J|}⊗I_{|N|}⊗C)v]]]
+```
 """
 function LazyOuterProduct end
 export LazyOuterProduct
--- a/src/LazyTensors/tensor_mapping.jl	Thu Jan 13 12:43:10 2022 +0100
+++ b/src/LazyTensors/tensor_mapping.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -1,21 +1,24 @@
 """
     TensorMapping{T,R,D}
 
-Describes a mapping of a D dimension tensor to an R dimension tensor.
+Describes a mapping of a `D` dimension tensor to an `R` dimension tensor.
 The action of the mapping is implemented through the method
-
+```julia
     apply(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T}
+```
 
 The size of the range and domain that the operator works with should be returned by
 the functions
-
+```julia
     range_size(::TensorMapping)
     domain_size(::TensorMapping)
-
+```
 to allow querying for one or the other.
 
 Optionally the action of the transpose may be defined through
+```julia
     apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T}
+```
 """
 abstract type TensorMapping{T,R,D} end
 export TensorMapping
@@ -37,11 +40,13 @@
 export apply_transpose
 
 """
+    range_dim(::TensorMapping)
 Return the dimension of the range space of a given mapping
 """
 range_dim(::TensorMapping{T,R,D}) where {T,R,D} = R
 
 """
+    domain_dim(::TensorMapping)
 Return the dimension of the domain space of a given mapping
 """
 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D
--- a/src/StaticDicts/StaticDicts.jl	Thu Jan 13 12:43:10 2022 +0100
+++ b/src/StaticDicts/StaticDicts.jl	Wed Jan 19 07:24:36 2022 +0100
@@ -10,7 +10,7 @@
 
 The immutable nature means that `StaticDict` can be compared with `===`, in
 constrast to regular `Dict` or `ImmutableDict` which can not. (See
-https://github.com/JuliaLang/julia/issues/4648 for details) One important
+<https://github.com/JuliaLang/julia/issues/4648> for details) One important
 aspect of this is that `StaticDict` can be used in a struct while still
 allowing the struct to be comared using the default implementation of `==` for
 structs.