Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonReinhard committed Sep 2, 2024
1 parent 56c02f8 commit 54cc4e9
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 159 deletions.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
GraphComputing = "62933717-1c9d-4a3f-b06f-7ab7f17ca32d"
QEDFeynman = "e5b388bf-6b77-4673-a798-c68c587e2b22"
QEDbase = "10e22c08-3ccb-4172-bfcf-7d7aa3d04d93"
QEDprocesses = "46de9c38-1bb3-4547-a1ec-da24d767fdad"
49 changes: 21 additions & 28 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
using Pkg

project_path = Base.Filesystem.joinpath(Base.Filesystem.dirname(Base.source_path()), "..")
Pkg.develop(; path=project_path)

using Documenter
using QEDFeynman
using GraphComputing

makedocs(;
#format = Documenter.LaTeX(platform=""),

root="docs",
source="src",
build="build",
warnonly=true,
clean=true,
doctest=true,
modules=Module[QEDFeynman],
remotes=nothing,
modules=[QEDFeynman],
checkdocs=:exports,
authors="Anton Reinhard",
repo=Documenter.Remotes.GitHub("GraphComputing-jl", "QEDFeynman.jl"),
sitename="QEDFeynman.jl",
pages=[
"index.md",
"Manual" => "manual.md",
"Library" => [
"Public" => "lib/public.md",
"Graph" => "lib/internals/graph.md",
"Node" => "lib/internals/node.md",
"Task" => "lib/internals/task.md",
"Operation" => "lib/internals/operation.md",
"Models" => "lib/internals/models.md",
"Diff" => "lib/internals/diff.md",
"Utility" => "lib/internals/utility.md",
"Code Generation" => "lib/internals/code_gen.md",
"Devices" => "lib/internals/devices.md",
],
"Contribution" => "contribution.md",
],
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://graphcomputing.gitlab.io/QEDFeynman.jl",
assets=String[],
size_threshold_ignore=["index.md"],
),
pages=["index.md"],
)
deploydocs(;
repo="github.com/GraphComputing-jl/GraphComputing.jl.git",
push_preview=false,
devbranch="main",
)
24 changes: 21 additions & 3 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# QED Model
# Models

## Interface
```@autodocs
Modules = [QEDFeynman]
Pages = ["QEDFeynman.jl"]
Order = [:module]
```

## Interface and General

The interface that has to be implemented for a model to be usable is defined in `src/interface.jl`.

Expand All @@ -12,7 +18,13 @@ Order = [:type, :constant, :function]

```@autodocs
Modules = [QEDFeynman]
Pages = ["print.jl"]
Pages = ["impl.jl"]
Order = [:function]
```

```@autodocs
Modules = [QEDFeynman]
Pages = ["utility.jl"]
Order = [:function]
```

Expand All @@ -25,6 +37,12 @@ Pages = ["abc/types.jl"]
Order = [:type, :constant]
```

```@autodocs
Modules = [QEDFeynman]
Pages = ["abc/generic_abc_process.jl"]
Order = [:type, :function, :constant]
```

### Particle
```@autodocs
Modules = [QEDFeynman]
Expand Down
2 changes: 1 addition & 1 deletion src/abc/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end
Read an ABC-model process from the given file. If `verbose` is set to true, print some progress information to stdout.
Returns a valid [`DAG`](@ref).
Returns a valid `DAG`.
"""
function parse_dag(filename::AbstractString, proc::GenericABCProcess, verbose::Bool=false)
file = open(filename, "r")
Expand Down
6 changes: 3 additions & 3 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ end
Base type for particle scattering process descriptions. An object of this type of a corresponding [`AbstractPhysicsModel`](@ref) should uniquely identify a scattering process in that model.
See also: [`parse_process`](@ref), [`AbstractProblemInstance`](@ref)
See also: [`parse_process`](@ref)
"""
abstract type AbstractProcessDescription end

Expand Down Expand Up @@ -101,7 +101,7 @@ function model end
"""
type_from_name(model::AbstractModel, name::String)
For a name of a particle in the given [`AbstractModel`](@ref), return the particle's [`Type`] and index as a tuple. The input string can be expetced to be of the form \"<name><index>\".
For a name of a particle in the given `AbstractModel`, return the particle's `Type` and index as a tuple. The input string can be expetced to be of the form \"<name><index>\".
"""
function type_index_from_name end

Expand All @@ -110,7 +110,7 @@ function type_index_from_name end
Return the [`ParticleValue`](@ref) of the given type of particle with the given `index` from the given process input.
Function is wrapped into a [`FunctionCall`](@ref) in [`gen_input_assignment_code`](@ref).
Function is wrapped into a `FunctionCall` in `gen_input_assignment_code`.
"""
part_from_x(type::Type, index::Int, x::AbstractProcessInput) =
ParticleValue{type,ComplexF64}(get_particle(x, type, index), one(ComplexF64))
4 changes: 2 additions & 2 deletions src/qed/create.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
"""
gen_process_input(processDescription::ScatteringProcess)
Return a ProcessInput of randomly generated [`QEDParticle`](@ref)s from a `QEDprocesses.ScatteringProcess`. The process description can be created manually or parsed from a string using [`parse_process`](@ref).
Return a `PhaseSpacePoint` of randomly generated particles from a `QEDprocesses.ScatteringProcess`. The process description can be created manually or parsed from a string using [`parse_process`](@ref).
Note: This uses RAMBO to create a valid process with conservation of momentum and energy.
"""
Expand Down Expand Up @@ -51,7 +51,7 @@ end
"""
gen_graph(process_description::ScatteringProcess)
For a given `QEDprocesses.ScatteringProcess`, return the [`DAG`](@ref) that computes it.
For a given `QEDprocesses.ScatteringProcess`, return the `DAG` that computes it.
"""
function gen_graph(process_description::ScatteringProcess)
initial_diagram = FeynmanDiagram(process_description)
Expand Down
10 changes: 5 additions & 5 deletions src/qed/diagrams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ end
"""
can_tie(p1::Type, p2::Type)
For two given [`QEDParitcle`](@ref) types, return whether they can be tied together.
For two given `QEDParticle` types, return whether they can be tied together.
They can be tied iff one is the [`propagation_result`](@ref) of the other, or if both are photons, in which case their direction does not matter.
They can be tied iff one is the `propagation_result` of the other, or if both are photons, in which case their direction does not matter.
"""
function can_tie(p1::Type, p2::Type)
if p1 == propagation_result(p2)
Expand Down Expand Up @@ -460,7 +460,7 @@ end
"""
gen_compton_diagram_from_order(order::Vector{Int}, inFerm, outFerm, n::Int, m::Int)
Helper function for [`gen_compton_diagrams`](@Ref). Generates a single diagram for the given order and n input and m output photons.
Helper function for [`gen_compton_diagrams`](@ref). Generates a single diagram for the given order and n input and m output photons.
"""
function gen_compton_diagram_from_order(order::Vector{Int}, inFerm, outFerm, n::Int, m::Int)
photons = vcat(
Expand Down Expand Up @@ -523,7 +523,7 @@ end
"""
gen_compton_diagram_from_order_one_side(order::Vector{Int}, inFerm, outFerm, n::Int, m::Int)
Helper function for [`gen_compton_diagrams`](@Ref). Generates a single diagram for the given order and n input and m output photons.
Helper function for [`gen_compton_diagrams`](@ref). Generates a single diagram for the given order and n input and m output photons.
"""
function gen_compton_diagram_from_order_one_side(
order::Vector{Int}, inFerm, outFerm, n::Int, m::Int
Expand Down Expand Up @@ -638,7 +638,7 @@ end
"""
gen_diagrams(fd::FeynmanDiagram)
From a given feynman diagram in its initial state, e.g. when created through the [`FeynmanDiagram(pd::ProcessDescription)`](@ref) constructor, generate and return all possible [`FeynmanDiagram`](@ref)s that describe that process.
From a given feynman diagram in its initial state, e.g. when created through the [`FeynmanDiagram`](@ref)`(pd::ProcessDescription)` constructor, generate and return all possible [`FeynmanDiagram`](@ref)s that describe that process.
"""
function gen_diagrams(fd::FeynmanDiagram)
if is_compton(fd)
Expand Down
2 changes: 1 addition & 1 deletion src/qed/parse.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
parse_process(string::AbstractString, model::QEDModel)
Parse a string representation of a process, such as "ke->ke" into the corresponding [`QEDProcessDescription`](@ref).
Parse a string representation of a process, such as "ke->ke" into the corresponding `QEDProcessDescription`.
"""
function parse_process(
str::AbstractString,
Expand Down
116 changes: 0 additions & 116 deletions src/utility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,122 +6,6 @@ using Random
# TODO: reliably find out how many threads we're running with (nthreads() returns 1 when precompiling :/)
rng = [Random.MersenneTwister(0) for _ in 1:128]

"""
unpack_identity(x::SVector)
Function taking an `SVector`, returning it unpacked.
"""
@inline unpack_identity(x::SVector{1,<:Any}) = x[1]
@inline unpack_identity(x) = x

"""
bytes_to_human_readable(bytes)
Return a human readable string representation of the given number.
```jldoctest
julia> using QEDFeynman
using GraphComputing
julia> bytes_to_human_readable(4096)
"4.0 KiB"
```
"""
function bytes_to_human_readable(bytes)
units = ["B", "KiB", "MiB", "GiB", "TiB"]
unit_index = 1
while bytes >= 1024 && unit_index < length(units)
bytes /= 1024
unit_index += 1
end
return string(round(bytes; sigdigits=4), " ", units[unit_index])
end

"""
lt_nodes(n1::Node, n2::Node)
Less-Than comparison between nodes. Uses the nodes' ids to sort.
"""
function lt_nodes(n1::Node, n2::Node)
return n1.id < n2.id
end

"""
sort_node!(node::Node)
Sort the nodes' parents and children vectors. The vectors are mostly very short so sorting does not take a lot of time.
Sorted nodes are required to make the finding of [`NodeReduction`](@ref)s a lot faster using the [`NodeTrie`](@ref) data structure.
"""
function sort_node!(node::Node)
sort!(children(node); lt=lt_nodes)
return sort!(parents(node); lt=lt_nodes)
end

"""
mem(graph::DAG)
Return the memory footprint of the graph in Byte. Should be the same result as `Base.summarysize(graph)` but a lot faster.
"""
function mem(graph::DAG)
size = 0
size += Base.summarysize(graph.nodes; exclude=Union{Node})
for n in graph.nodes
size += mem(n)
end

size += sizeof(graph.appliedOperations)
size += sizeof(graph.operationsToApply)

size += sizeof(graph.possibleOperations)
for op in graph.possibleOperations.nodeReductions
size += mem(op)
end
for op in graph.possibleOperations.nodeSplits
size += mem(op)
end

size += Base.summarysize(graph.dirtyNodes; exclude=Union{Node})
return size += sizeof(diff)
end

"""
mem(op::Operation)
Return the memory footprint of the operation in Byte. Used in [`mem(graph::DAG)`](@ref). Unlike `Base.summarysize()` this doesn't follow all references which would yield (almost) the size of the entire graph.
"""
function mem(op::Operation)
return Base.summarysize(op; exclude=Union{Node})
end

"""
mem(op::Operation)
Return the memory footprint of the node in Byte. Used in [`mem(graph::DAG)`](@ref). Unlike `Base.summarysize()` this doesn't follow all references which would yield (almost) the size of the entire graph.
"""
function mem(node::Node)
return Base.summarysize(node; exclude=Union{Node,Operation})
end

"""
unroll_symbol_vector(vec::Vector{Symbol})
Return the given vector as single String without quotation marks or brackets.
"""
function unroll_symbol_vector(vec::Vector)
result = ""
for s in vec
if (result != "")
result *= ", "
end
result *= "$s"
end
return result
end

function unroll_symbol_vector(vec::SVector)
return unroll_symbol_vector(Vector(vec))
end

####################
# CODE FROM HERE BORROWED FROM SOURCE: https://codebase.helmholtz.cloud/qedsandbox/QEDphasespaces.jl/
# use qedphasespaces directly once released
Expand Down

0 comments on commit 54cc4e9

Please sign in to comment.