diff --git a/docs/src/lib/internals/models.md b/docs/src/lib/internals/models.md index 6921e78..d28254d 100644 --- a/docs/src/lib/internals/models.md +++ b/docs/src/lib/internals/models.md @@ -5,8 +5,8 @@ ### Types ```@autodocs Modules = [MetagraphOptimization] -Pages = ["model/abc/types.jl"] -Order = [:type] +Pages = ["models/abc/types.jl"] +Order = [:type, :constant] ``` ### Parse diff --git a/docs/src/lib/internals/task.md b/docs/src/lib/internals/task.md index 512eb88..e7debbb 100644 --- a/docs/src/lib/internals/task.md +++ b/docs/src/lib/internals/task.md @@ -7,6 +7,13 @@ Pages = ["task/type.jl"] Order = [:type] ``` +## Create +```@autodocs +Modules = [MetagraphOptimization] +Pages = ["task/create.jl"] +Order = [:function] +``` + ## Compare ```@autodocs Modules = [MetagraphOptimization] diff --git a/docs/src/lib/public.md b/docs/src/lib/public.md index b73c320..2157e07 100644 --- a/docs/src/lib/public.md +++ b/docs/src/lib/public.md @@ -4,6 +4,12 @@ Documentation for `MetagraphOptimization.jl`'s public interface. See the Internals section of the manual for documentation of everything else. +```@autodocs +Modules = [MetagraphOptimization] +Pages = ["MetagraphOptimization.jl"] +Order = [:module] +``` + ## Contents ```@contents diff --git a/src/graph/mute.jl b/src/graph/mute.jl index 1f71f3a..e030fbd 100644 --- a/src/graph/mute.jl +++ b/src/graph/mute.jl @@ -184,7 +184,7 @@ end Return the graph's [`Diff`](@ref) since last time this function was called. -See also: [`revert_diff`](@ref), [`AppliedOperation`](@ref) and [`revert_operation`](@ref) +See also: [`revert_diff!`](@ref), [`AppliedOperation`](@ref) and [`revert_operation!`](@ref) """ function get_snapshot_diff(graph::DAG) return swapfield!(graph, :diff, Diff()) diff --git a/src/operation/apply.jl b/src/operation/apply.jl index 71bf183..6230322 100644 --- a/src/operation/apply.jl +++ b/src/operation/apply.jl @@ -109,7 +109,7 @@ end """ revert_diff!(graph::DAG, diff::Diff) -Revert the given diff on the graph. Used to revert the individual [`ApplieOperation`](@ref)s with [`revert_operation`](@ref). +Revert the given diff on the graph. Used to revert the individual [`AppliedOperation`](@ref)s with [`revert_operation!`](@ref). """ function revert_diff!(graph::DAG, diff::Diff) # add removed nodes, remove added nodes, same for edges diff --git a/src/operation/get.jl b/src/operation/get.jl index 764bb7f..bb8653a 100644 --- a/src/operation/get.jl +++ b/src/operation/get.jl @@ -2,6 +2,11 @@ using Base.Threads +""" + get_operations(graph::DAG) + +Return the [`PossibleOperations`](@ref) of the graph at the current state. +""" function get_operations(graph::DAG) apply_all!(graph) diff --git a/src/operation/type.jl b/src/operation/type.jl index c609b3b..edc67c3 100644 --- a/src/operation/type.jl +++ b/src/operation/type.jl @@ -5,7 +5,7 @@ An abstract base class for operations. An operation can be applied to a [`DAG`]( Possible operations on a [`DAG`](@ref) can be retrieved using [`get_operations`](@ref). -See also: [`push_operation`](@ref), [`pop_operation`](@ref) +See also: [`push_operation!`](@ref), [`pop_operation!`](@ref) """ abstract type Operation end @@ -16,7 +16,7 @@ An abstract base class for already applied operations. An applied operation can be reversed iff it is the last applied operation on the DAG. Every applied operation stores a [`Diff`](@ref) from when it was initially applied to be able to revert the operation. -See also: [`revert_operation`](@ref). +See also: [`revert_operation!`](@ref). """ abstract type AppliedOperation end diff --git a/src/task/create.jl b/src/task/create.jl new file mode 100644 index 0000000..9124984 --- /dev/null +++ b/src/task/create.jl @@ -0,0 +1,14 @@ +""" + copy(t::AbstractDataTask) + +Fallback implementation of the copy of an abstract data task, throwing an error. +""" +copy(t::AbstractDataTask) = + error("Need to implement copying for your data tasks!") + +""" + copy(t::AbstractComputeTask) + +Return a copy of the given compute task. +""" +copy(t::AbstractComputeTask) = typeof(t)() diff --git a/src/task/properties.jl b/src/task/properties.jl index 4a35af2..dd120e9 100644 --- a/src/task/properties.jl +++ b/src/task/properties.jl @@ -66,3 +66,10 @@ end # actual compute functions for the tasks can stay undefined for now # compute(t::ComputeTaskU, data::Any) = mycomputation(data) + +""" + get_types(::FusedComputeTask{T1, T2}) + +Return a tuple of a the fused compute task's components' types. +""" +get_types(::FusedComputeTask{T1, T2}) where {T1, T2} = (T1, T2) diff --git a/src/task/type.jl b/src/task/type.jl index 9d0f4d2..5d5e329 100644 --- a/src/task/type.jl +++ b/src/task/type.jl @@ -28,25 +28,3 @@ Also see: [`get_types`](@ref). """ struct FusedComputeTask{T1 <: AbstractComputeTask, T2 <: AbstractComputeTask} <: AbstractComputeTask end - -""" - get_types(::FusedComputeTask{T1, T2}) - -Return a tuple of a the fused compute task's components' types. -""" -get_types(::FusedComputeTask{T1, T2}) where {T1, T2} = (T1, T2) - -""" - copy(t::AbstractDataTask) - -Fallback implementation of the copy of an abstract data task, throwing an error. -""" -copy(t::AbstractDataTask) = - error("Need to implement copying for your data tasks!") - -""" - copy(t::AbstractComputeTask) - -Return a copy of the given compute task. -""" -copy(t::AbstractComputeTask) = typeof(t)() diff --git a/src/trie.jl b/src/trie.jl index 22f869b..7637e19 100644 --- a/src/trie.jl +++ b/src/trie.jl @@ -12,7 +12,7 @@ end NodeTrie Trie data structure for node reduction, inserts nodes by children. -Assumes that given nodes have ordered vectors of children (see [`sort_node`](@ref)). +Assumes that given nodes have ordered vectors of children (see [`sort_node!`](@ref)). First insertion level is the node's own task type and thus does not have a value (every node has a task type). See also: [`insert!`](@ref) and [`collect`](@ref) diff --git a/src/utility.jl b/src/utility.jl index e148e1b..2d4b39e 100644 --- a/src/utility.jl +++ b/src/utility.jl @@ -33,7 +33,7 @@ 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 [`Trie`](@ref) data structure. +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!(node.children, lt = lt_nodes)