From fa996de265ca0602146a120b1556797295ebd4d3 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Fri, 10 Mar 2023 11:24:52 -0500 Subject: [PATCH] add docs --- .gitignore | 1 + Project.toml | 1 + docs/make.jl | 5 +++++ docs/src/index.md | 11 +++++++++++ docs/src/modules/Utilities.md | 17 +++++++++++++++++ src/Utilities.jl | 20 +++++++++++++++++--- 6 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 docs/make.jl create mode 100644 docs/src/index.md create mode 100644 docs/src/modules/Utilities.md diff --git a/.gitignore b/.gitignore index 08904b1..b1410dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /Manifest.toml /.direnv/ +docs/build diff --git a/Project.toml b/Project.toml index c9f12ee..01617d7 100644 --- a/Project.toml +++ b/Project.toml @@ -5,6 +5,7 @@ version = "0.1.0" [deps] DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" LanguageServer = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..4de509f --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,5 @@ +push!(LOAD_PATH,"../src/") +using Documenter, Looping + +DocMeta.setdocmeta!(Looping.Utilities, :DocTestSetup, :(using Looping.Utilities); recursive=true) +makedocs(sitename="Looping Documentation", modules=[Looping.Utilities], draft=false, strict=:doctest) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..b4620b3 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,11 @@ +# Looping.jl Documentation + +Some numerical tools and experiments for the fiber loop reservoir +engineering project. + + + +```@contents +Pages = ["modules/Utilities.md"] +Depth = 3 +``` diff --git a/docs/src/modules/Utilities.md b/docs/src/modules/Utilities.md new file mode 100644 index 0000000..f579146 --- /dev/null +++ b/docs/src/modules/Utilities.md @@ -0,0 +1,17 @@ +# Utilities + +```@docs +Looping.Utilities +``` + + +```@meta +CurrentModule = Looping.Utilities +``` + + + +```@docs +periodic_distance +restrict_to_range +``` diff --git a/src/Utilities.jl b/src/Utilities.jl index 5bd3a22..ec42714 100644 --- a/src/Utilities.jl +++ b/src/Utilities.jl @@ -1,3 +1,6 @@ +""" +Some common utilities that haven't yet made it into their own packagage. +""" module Utilities export periodic_distance @@ -11,9 +14,10 @@ conditions for a chain of length `N`. # Examples ```jldoctest -julia> periodic_difference(1,4,5) +julia> periodic_distance(1, 4, 5) 2 -julia> periodic_difference(1,3,5) + +julia> periodic_distance(1, 3, 5) -2 ``` """ @@ -32,7 +36,17 @@ end """ restrict_to_range(x, border) -Returns the value `x` restricted to the range `[-border, border]`. +Returns the value `x` restricted to the range `[-border, border]` by +lettting it roll over to `+-border`. + +# Examples +```jldoctest +julia> restrict_to_range(6, 5) +-4 + +julia> restrict_to_range(5, 5) +5 +``` """ function restrict_to_range(x::Real, border::Real) sign = x ≥ border ? -1 : 1