diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index c409114..606ce32 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-28T21:14:19","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-15T22:16:57","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index de2615d..a1e7b3f 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,14 +1,14 @@ -Library Reference · DiagrammaticEquations.jl

Library Reference

DiagrammaticEquations.QuantityType

DECQuantities in DiagrammaticEquations must be subtypes of Number to integrate with SymbolicUtils. An intermediary type, Quantity, makes it clearer that terms in the theory are "symbolic quantities" which behave like numbers. In the context of SymbolicUtils, a Number is any type that you can do arithmetic operations on.

source
Catlab.WiringDiagrams.WiringDiagramAlgebras.oapplyMethod
function oapply(relation::RelationDiagram, podes::Vector{D}) where {D<:OpenSummationDecapode}

Compose a list of Decapodes as specified by the given relation diagram.

The Decapodes must be given in the same order as they were specified in the relation.

State variables (such as the (C,V) given in the head of the following @relation) do not affect the result of a composition.

Examples

julia> compose_diff_adv = @relation (C,V) begin
+Library Reference · DiagrammaticEquations.jl

Library Reference

DiagrammaticEquations.QuantityType

DECQuantities in DiagrammaticEquations must be subtypes of Number to integrate with SymbolicUtils. An intermediary type, Quantity, makes it clearer that terms in the theory are "symbolic quantities" which behave like numbers. In the context of SymbolicUtils, a Number is any type that you can do arithmetic operations on.

source
Catlab.WiringDiagrams.WiringDiagramAlgebras.oapplyMethod
function oapply(relation::RelationDiagram, podes::Vector{D}) where {D<:OpenSummationDecapode}

Compose a list of Decapodes as specified by the given relation diagram.

The Decapodes must be given in the same order as they were specified in the relation.

State variables (such as the (C,V) given in the head of the following @relation) do not affect the result of a composition.

Examples

julia> compose_diff_adv = @relation (C,V) begin
   diffusion(C, ϕ₁)
   advection(C, ϕ₂, V)
   superposition(ϕ₁, ϕ₂, ϕ, C)
 end;
 
 julia> oapply(compose_diff_adv, [(Diffusion, [:C, :ϕ]),
-  (Advection, [:C, :ϕ, :V]), (Superposition, [:ϕ₁, :ϕ₂, :ϕ, :C])]);
source
DiagrammaticEquations.OpenMethod
Open(d::SummationDecapode{T,U,V}, names::AbstractVector{Symbol}) where {T,U,V}

creates an OpenSummationDecapode based on named variables rather than variable indices. See AlgebraicPetri.jl's Open for the analogous verion for LabelledReactionNetworks.

source
DiagrammaticEquations.collateMethod
function collate(equations, boundaries, uwd, symbols; restrictions::Vector{Symbol})

Create a collage of two Decapodes that simulates with boundary conditions.

Passing a list of symbols into restrictions specifies a list of boundary variables that will be restricted.

source
DiagrammaticEquations.contract_operatorsMethod
function contract_operators(d::SummationDecapode; white_list::Set{Symbol} = Set{Symbol}(), black_list::Set{Symbol} = Set{Symbol}())

Find chains of Op1s in the given Decapode, and replace them with a single Op1 with a vector of function names. After this process, all Vars that are not a part of any computation are removed. If a white list is provided, only chain those operators. If a black list is provided, do not chain those operators.

source
DiagrammaticEquations.default_composition_diagramMethod
function default_composition_diagram(podes::Vector{D}, names::Vector{Symbol}) where {D<:SummationDecapode}

Given a list of Decapodes and their names, return a composition diagram which assumes that variables sharing the same name ought to be composed.

No Literals are exposed. Use unique_lits! after composing.

Throw an error if any individual Decapode already contains a repeated name (except for Literals).

If only_states_terminals is true, only expose state and terminal variables. Defaults to false.

Note that composing immediately with oapply will fail if types do not match (e.g. (:infer, :Form0) or (:Form0, :Form1)).

source
DiagrammaticEquations.dot_rename!Method
dot_rename!(d::AbstractNamedDecapode)

Rename tangent variables by their depending variable appended with a dot. e.g. If D == ∂ₜ(C), then rename D to Ċ.

If a tangent variable updates multiple vars, choose one arbitrarily. e.g. If D == ∂ₜ(C) and D == ∂ₜ(B), then rename D to either Ċ or B ̇.

source
DiagrammaticEquations.fill_names!Method
function fill_names!(d::AbstractNamedDecapode; lead_symbol::Symbol = Symbol("•"))

Provide a variable name to all the variables that don't have names.

source
DiagrammaticEquations.find_chainsMethod
function find_chains(d::SummationDecapode; white_list::Set{Symbol} = Set{Symbol}(), black_list::Set{Symbol} = Set{Symbol}())

Find chains of Op1s in the given Decapode. A chain ends when the target of the last Op1 is part of an Op2 or sum, or is a target of multiple Op1s. If a white list is provided, only chain those operators. If a black list is provided, do not chain those operators.

source
DiagrammaticEquations.find_dep_and_orderMethod
find_dep_and_order(d::AbstractNamedDecapode)

Find the order of each tangent variable in the Decapode, and the index of the variable that it is dependent on. Returns a tuple of (dep, order), both of which respecting the order in which incident(d, :∂ₜ, :op1) returns Vars.

source
DiagrammaticEquations.get_valid_op1sMethod
function get_valid_op1s(deca_source::SummationDecapode, varID)

Searches SummationDecapode, deca_source, at the request varID and returns all op1s which are allowed to be averaged. Returns an array of indices of valid op1 sources.

Namely this is meant to exclude ∂ₜ from being included in an average.

source
DiagrammaticEquations.infer_types!Method
function infer_types!(d::SummationDecapode, op1_rules::Vector{NamedTuple{(:src_type, :tgt_type, :replacement_type, :op), NTuple{4, Symbol}}})

Infer types of Vars given rules wherein one type is known and the other not.

source
DiagrammaticEquations.replace_all_op1s!Method
function replace_all_op1s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode})

Given a Decapode, d, replace all instances of the left-hand-side unary operator with those of the right-hand-side.

Return true if any replacements were made, otherwise false.

See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_all_op2s!Method
function replace_all_op2s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode}, proj1::Int, proj2::Int)

Given a Decapode, d, replace all instances of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return true if any replacements were made, otherwise false.

See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_all_op2s!Method
function replace_all_op2s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode})

Given a Decapode, d, replace all instances of the left-hand-side binary operator with those of the right-hand-side.

Search for distinguished variables "p1" and "p2" to serve as the proj1 and proj2 from RHS.

Return true if any replacements were made, otherwise false.

See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::SummationDecapode, RHS::SummationDecapode)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with those of the right-hand-side.

Return the index of the replaced unary operator, 0 if no match was found. See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::Symbol, RHS::SummationDecapode)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with those of the right-hand-side.

Return the index of the replaced operator, 0 if no match was found.

See also: replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::Symbol, RHS::Symbol)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with that of the right-hand-side.

Return the index of the replaced unary operator, 0 if no match was found. See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::SummationDecapode, RHS::SummationDecapode, proj1::Int, proj2::Int)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return the index of the replaced binary operator, 0 if no match was found. See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::Symbol, RHS::SummationDecapode, proj1::Int, proj2::Int)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return the index of the replaced operator, 0 if no match was found.

See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::Symbol, RHS::Symbol)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with that of the right-hand-side.

Return the index of the replaced binary operator, 0 if no match was found. See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.resolve_overloads!Method
function resolve_overloads!(d::SummationDecapode, op1_rules::Vector{NamedTuple{(:src_type, :tgt_type, :resolved_name, :op), NTuple{4, Symbol}}})

Resolve function overloads based on types of src and tgt.

source
DiagrammaticEquations.safe_modifytypeMethod
safe_modifytype(org_type::Symbol, new_type::Symbol)

This function accepts an original type and a new type and determines if the original type can be safely overwritten by the new type.

source
DiagrammaticEquations.type_check_Decapodes_compositionMethod
function type_check_Decapodes_composition(relation::RelationDiagram, decs::Vector{OpenSummationDecapode})

Check that the types of all Vars connected by the same junction match.

This function only throws an error on the first type mismatch found.

source
DiagrammaticEquations.unique_by!Method
function unique_by!(acset, column_names::Vector{Symbol})

Given column names from the same table, remove duplicate rows.

WARNING: This function does not check if other tables index into the one given. Removal of rows is performed with prejudice.

See also: unique_by.

Examples

julia> unique_by!(parallel_arrows(Graph, 123), :E, [:src,:tgt]) == parallel_arrows(Graph, 1)
-true
source
DiagrammaticEquations.unique_byMethod
function unique_by(acset, column_names::Vector{Symbol})

Given column names from the same table, return a copy of the acset with duplicate rows removed. Removal of rows is performed with prejudice.

WARNING: This function does not check if other tables index into the one given. Removal of rows is performed with prejudice.

See also: unique_by!.

Examples

julia> unique_by(parallel_arrows(Graph, 123), :E, [:src,:tgt]) == parallel_arrows(Graph, 1)
-true
source
DiagrammaticEquations.@aliasMacro

Given a tuple of symbols ("aliases") and their canonical name (or "rep"), produces for each alias typechecking and nameof methods which call those for their rep. Example: @alias (d₀, d₁) => d

source
DiagrammaticEquations.@operatorMacro

Creates an operator foo with arguments which are types in a given Theory. This entails creating (1) a function which performs type construction and (2) a function which consumes BasicSymbolic variables and returns Terms.

@operator foo(S1, S2, ...)::Theory begin
+  (Advection, [:C, :ϕ, :V]), (Superposition, [:ϕ₁, :ϕ₂, :ϕ, :C])]);
source
DiagrammaticEquations.OpenMethod
Open(d::SummationDecapode{T,U,V}, names::AbstractVector{Symbol}) where {T,U,V}

creates an OpenSummationDecapode based on named variables rather than variable indices. See AlgebraicPetri.jl's Open for the analogous verion for LabelledReactionNetworks.

source
DiagrammaticEquations.collateMethod
function collate(equations, boundaries, uwd, symbols; restrictions::Vector{Symbol})

Create a collage of two Decapodes that simulates with boundary conditions.

Passing a list of symbols into restrictions specifies a list of boundary variables that will be restricted.

source
DiagrammaticEquations.contract_operatorsMethod
function contract_operators(d::SummationDecapode; white_list::Set{Symbol} = Set{Symbol}(), black_list::Set{Symbol} = Set{Symbol}())

Find chains of Op1s in the given Decapode, and replace them with a single Op1 with a vector of function names. After this process, all Vars that are not a part of any computation are removed. If a white list is provided, only chain those operators. If a black list is provided, do not chain those operators.

source
DiagrammaticEquations.default_composition_diagramMethod
function default_composition_diagram(podes::Vector{D}, names::Vector{Symbol}) where {D<:SummationDecapode}

Given a list of Decapodes and their names, return a composition diagram which assumes that variables sharing the same name ought to be composed.

No Literals are exposed. Use unique_lits! after composing.

Throw an error if any individual Decapode already contains a repeated name (except for Literals).

If only_states_terminals is true, only expose state and terminal variables. Defaults to false.

Note that composing immediately with oapply will fail if types do not match (e.g. (:infer, :Form0) or (:Form0, :Form1)).

source
DiagrammaticEquations.dot_rename!Method
dot_rename!(d::AbstractNamedDecapode)

Rename tangent variables by their depending variable appended with a dot. e.g. If D == ∂ₜ(C), then rename D to Ċ.

If a tangent variable updates multiple vars, choose one arbitrarily. e.g. If D == ∂ₜ(C) and D == ∂ₜ(B), then rename D to either Ċ or B ̇.

source
DiagrammaticEquations.fill_names!Method
function fill_names!(d::AbstractNamedDecapode; lead_symbol::Symbol = Symbol("•"))

Provide a variable name to all the variables that don't have names.

source
DiagrammaticEquations.find_chainsMethod
function find_chains(d::SummationDecapode; white_list::Set{Symbol} = Set{Symbol}(), black_list::Set{Symbol} = Set{Symbol}())

Find chains of Op1s in the given Decapode. A chain ends when the target of the last Op1 is part of an Op2 or sum, or is a target of multiple Op1s. If a white list is provided, only chain those operators. If a black list is provided, do not chain those operators.

source
DiagrammaticEquations.find_dep_and_orderMethod
find_dep_and_order(d::AbstractNamedDecapode)

Find the order of each tangent variable in the Decapode, and the index of the variable that it is dependent on. Returns a tuple of (dep, order), both of which respecting the order in which incident(d, :∂ₜ, :op1) returns Vars.

source
DiagrammaticEquations.get_valid_op1sMethod
function get_valid_op1s(deca_source::SummationDecapode, varID)

Searches SummationDecapode, deca_source, at the request varID and returns all op1s which are allowed to be averaged. Returns an array of indices of valid op1 sources.

Namely this is meant to exclude ∂ₜ from being included in an average.

source
DiagrammaticEquations.infer_types!Method
function infer_types!(d::SummationDecapode, op1_rules::Vector{NamedTuple{(:src_type, :tgt_type, :replacement_type, :op), NTuple{4, Symbol}}})

Infer types of Vars given rules wherein one type is known and the other not.

source
DiagrammaticEquations.replace_all_op1s!Method
function replace_all_op1s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode})

Given a Decapode, d, replace all instances of the left-hand-side unary operator with those of the right-hand-side.

Return true if any replacements were made, otherwise false.

See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_all_op2s!Method
function replace_all_op2s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode}, proj1::Int, proj2::Int)

Given a Decapode, d, replace all instances of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return true if any replacements were made, otherwise false.

See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_all_op2s!Method
function replace_all_op2s!(d::SummationDecapode, LHS::Union{Symbol, SummationDecapode}, RHS::Union{Symbol, SummationDecapode})

Given a Decapode, d, replace all instances of the left-hand-side binary operator with those of the right-hand-side.

Search for distinguished variables "p1" and "p2" to serve as the proj1 and proj2 from RHS.

Return true if any replacements were made, otherwise false.

See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::SummationDecapode, RHS::SummationDecapode)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with those of the right-hand-side.

Return the index of the replaced unary operator, 0 if no match was found. See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::Symbol, RHS::SummationDecapode)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with those of the right-hand-side.

Return the index of the replaced operator, 0 if no match was found.

See also: replace_all_op1s!

source
DiagrammaticEquations.replace_op1!Method
function replace_op1!(d::SummationDecapode, LHS::Symbol, RHS::Symbol)

Given a Decapode, d, replace at most one instance of the left-hand-side unary operator with that of the right-hand-side.

Return the index of the replaced unary operator, 0 if no match was found. See also: replace_op2!, replace_all_op1s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::SummationDecapode, RHS::SummationDecapode, proj1::Int, proj2::Int)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return the index of the replaced binary operator, 0 if no match was found. See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::Symbol, RHS::SummationDecapode, proj1::Int, proj2::Int)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with those of the right-hand-side.

proj1 and proj2 are the indices of the intended proj1 and proj2 in RHS.

Return the index of the replaced operator, 0 if no match was found.

See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.replace_op2!Method
function replace_op2!(d::SummationDecapode, LHS::Symbol, RHS::Symbol)

Given a Decapode, d, replace at most one instance of the left-hand-side binary operator with that of the right-hand-side.

Return the index of the replaced binary operator, 0 if no match was found. See also: replace_op1!, replace_all_op2s!

source
DiagrammaticEquations.resolve_overloads!Method
function resolve_overloads!(d::SummationDecapode, op1_rules::Vector{NamedTuple{(:src_type, :tgt_type, :resolved_name, :op), NTuple{4, Symbol}}})

Resolve function overloads based on types of src and tgt.

source
DiagrammaticEquations.safe_modifytypeMethod
safe_modifytype(org_type::Symbol, new_type::Symbol)

This function accepts an original type and a new type and determines if the original type can be safely overwritten by the new type.

source
DiagrammaticEquations.type_check_Decapodes_compositionMethod
function type_check_Decapodes_composition(relation::RelationDiagram, decs::Vector{OpenSummationDecapode})

Check that the types of all Vars connected by the same junction match.

This function only throws an error on the first type mismatch found.

source
DiagrammaticEquations.unique_by!Method
function unique_by!(acset, column_names::Vector{Symbol})

Given column names from the same table, remove duplicate rows.

WARNING: This function does not check if other tables index into the one given. Removal of rows is performed with prejudice.

See also: unique_by.

Examples

julia> unique_by!(parallel_arrows(Graph, 123), :E, [:src,:tgt]) == parallel_arrows(Graph, 1)
+true
source
DiagrammaticEquations.unique_byMethod
function unique_by(acset, column_names::Vector{Symbol})

Given column names from the same table, return a copy of the acset with duplicate rows removed. Removal of rows is performed with prejudice.

WARNING: This function does not check if other tables index into the one given. Removal of rows is performed with prejudice.

See also: unique_by!.

Examples

julia> unique_by(parallel_arrows(Graph, 123), :E, [:src,:tgt]) == parallel_arrows(Graph, 1)
+true
source
DiagrammaticEquations.@aliasMacro

Given a tuple of symbols ("aliases") and their canonical name (or "rep"), produces for each alias typechecking and nameof methods which call those for their rep. Example: @alias (d₀, d₁) => d

source
DiagrammaticEquations.@operatorMacro

Creates an operator foo with arguments which are types in a given Theory. This entails creating (1) a function which performs type construction and (2) a function which consumes BasicSymbolic variables and returns Terms.

@operator foo(S1, S2, ...)::Theory begin
     (body of function)
     (@rule expr1)
     ...
@@ -25,4 +25,4 @@
         ::Form => ⋆(d(⋆(d(s))))
     end
     @rule ~s --> ⋆(d(⋆(d(~s))))
-end
source
Catlab.Graphics.GraphvizGraphs.to_graphvizMethod
Graphics.to_graphviz(F::AbstractDecapode; directed = true, kw...)

Visualize the given Decapode through Graphviz. Ensure that you have called using Catlab.Graphics before-hand, and have a way of visualizing SVG files in your current environment.

source
+end
source
Catlab.Graphics.GraphvizGraphs.to_graphvizMethod
Graphics.to_graphviz(F::AbstractDecapode; directed = true, kw...)

Visualize the given Decapode through Graphviz. Ensure that you have called using Catlab.Graphics before-hand, and have a way of visualizing SVG files in your current environment.

source
diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index 82252a1..7d68cd8 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -612,176 +612,194 @@ function worker_function(documenterSearchIndex, documenterBaseURL, filters) { }; } -// `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! -const filters = [ - ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), -]; -const worker_str = - "(" + - worker_function.toString() + - ")(" + - JSON.stringify(documenterSearchIndex["docs"]) + - "," + - JSON.stringify(documenterBaseURL) + - "," + - JSON.stringify(filters) + - ")"; -const worker_blob = new Blob([worker_str], { type: "text/javascript" }); -const worker = new Worker(URL.createObjectURL(worker_blob)); - /////// SEARCH MAIN /////// -// Whether the worker is currently handling a search. This is a boolean -// as the worker only ever handles 1 or 0 searches at a time. -var worker_is_running = false; - -// The last search text that was sent to the worker. This is used to determine -// if the worker should be launched again when it reports back results. -var last_search_text = ""; - -// The results of the last search. This, in combination with the state of the filters -// in the DOM, is used compute the results to display on calls to update_search. -var unfiltered_results = []; - -// Which filter is currently selected -var selected_filter = ""; - -$(document).on("input", ".documenter-search-input", function (event) { - if (!worker_is_running) { - launch_search(); - } -}); - -function launch_search() { - worker_is_running = true; - last_search_text = $(".documenter-search-input").val(); - worker.postMessage(last_search_text); -} - -worker.onmessage = function (e) { - if (last_search_text !== $(".documenter-search-input").val()) { - launch_search(); - } else { - worker_is_running = false; - } - - unfiltered_results = e.data; - update_search(); -}; +function runSearchMainCode() { + // `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! + const filters = [ + ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), + ]; + const worker_str = + "(" + + worker_function.toString() + + ")(" + + JSON.stringify(documenterSearchIndex["docs"]) + + "," + + JSON.stringify(documenterBaseURL) + + "," + + JSON.stringify(filters) + + ")"; + const worker_blob = new Blob([worker_str], { type: "text/javascript" }); + const worker = new Worker(URL.createObjectURL(worker_blob)); + + // Whether the worker is currently handling a search. This is a boolean + // as the worker only ever handles 1 or 0 searches at a time. + var worker_is_running = false; + + // The last search text that was sent to the worker. This is used to determine + // if the worker should be launched again when it reports back results. + var last_search_text = ""; + + // The results of the last search. This, in combination with the state of the filters + // in the DOM, is used compute the results to display on calls to update_search. + var unfiltered_results = []; + + // Which filter is currently selected + var selected_filter = ""; + + $(document).on("input", ".documenter-search-input", function (event) { + if (!worker_is_running) { + launch_search(); + } + }); -$(document).on("click", ".search-filter", function () { - if ($(this).hasClass("search-filter-selected")) { - selected_filter = ""; - } else { - selected_filter = $(this).text().toLowerCase(); + function launch_search() { + worker_is_running = true; + last_search_text = $(".documenter-search-input").val(); + worker.postMessage(last_search_text); } - // This updates search results and toggles classes for UI: - update_search(); -}); + worker.onmessage = function (e) { + if (last_search_text !== $(".documenter-search-input").val()) { + launch_search(); + } else { + worker_is_running = false; + } -/** - * Make/Update the search component - */ -function update_search() { - let querystring = $(".documenter-search-input").val(); + unfiltered_results = e.data; + update_search(); + }; - if (querystring.trim()) { - if (selected_filter == "") { - results = unfiltered_results; + $(document).on("click", ".search-filter", function () { + if ($(this).hasClass("search-filter-selected")) { + selected_filter = ""; } else { - results = unfiltered_results.filter((result) => { - return selected_filter == result.category.toLowerCase(); - }); + selected_filter = $(this).text().toLowerCase(); } - let search_result_container = ``; - let modal_filters = make_modal_body_filters(); - let search_divider = `
`; + // This updates search results and toggles classes for UI: + update_search(); + }); - if (results.length) { - let links = []; - let count = 0; - let search_results = ""; - - for (var i = 0, n = results.length; i < n && count < 200; ++i) { - let result = results[i]; - if (result.location && !links.includes(result.location)) { - search_results += result.div; - count++; - links.push(result.location); - } - } + /** + * Make/Update the search component + */ + function update_search() { + let querystring = $(".documenter-search-input").val(); - if (count == 1) { - count_str = "1 result"; - } else if (count == 200) { - count_str = "200+ results"; + if (querystring.trim()) { + if (selected_filter == "") { + results = unfiltered_results; } else { - count_str = count + " results"; + results = unfiltered_results.filter((result) => { + return selected_filter == result.category.toLowerCase(); + }); } - let result_count = `
${count_str}
`; - search_result_container = ` + let search_result_container = ``; + let modal_filters = make_modal_body_filters(); + let search_divider = `
`; + + if (results.length) { + let links = []; + let count = 0; + let search_results = ""; + + for (var i = 0, n = results.length; i < n && count < 200; ++i) { + let result = results[i]; + if (result.location && !links.includes(result.location)) { + search_results += result.div; + count++; + links.push(result.location); + } + } + + if (count == 1) { + count_str = "1 result"; + } else if (count == 200) { + count_str = "200+ results"; + } else { + count_str = count + " results"; + } + let result_count = `
${count_str}
`; + + search_result_container = ` +
+ ${modal_filters} + ${search_divider} + ${result_count} +
+ ${search_results} +
+
+ `; + } else { + search_result_container = `
${modal_filters} ${search_divider} - ${result_count} -
- ${search_results} -
-
+
0 result(s)
+ +
No result found!
`; - } else { - search_result_container = ` -
- ${modal_filters} - ${search_divider} -
0 result(s)
-
-
No result found!
- `; - } + } - if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").removeClass("is-justify-content-center"); - } + if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").removeClass("is-justify-content-center"); + } - $(".search-modal-card-body").html(search_result_container); - } else { - if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").addClass("is-justify-content-center"); + $(".search-modal-card-body").html(search_result_container); + } else { + if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").addClass("is-justify-content-center"); + } + + $(".search-modal-card-body").html(` +
Type something to get started!
+ `); } + } - $(".search-modal-card-body").html(` -
Type something to get started!
- `); + /** + * Make the modal filter html + * + * @returns string + */ + function make_modal_body_filters() { + let str = filters + .map((val) => { + if (selected_filter == val.toLowerCase()) { + return `${val}`; + } else { + return `${val}`; + } + }) + .join(""); + + return ` +
+ Filters: + ${str} +
`; } } -/** - * Make the modal filter html - * - * @returns string - */ -function make_modal_body_filters() { - let str = filters - .map((val) => { - if (selected_filter == val.toLowerCase()) { - return `${val}`; - } else { - return `${val}`; - } - }) - .join(""); - - return ` -
- Filters: - ${str} -
`; +function waitUntilSearchIndexAvailable() { + // It is possible that the documenter.js script runs before the page + // has finished loading and documenterSearchIndex gets defined. + // So we need to wait until the search index actually loads before setting + // up all the search-related stuff. + if (typeof documenterSearchIndex !== "undefined") { + runSearchMainCode(); + } else { + console.warn("Search Index not available, waiting"); + setTimeout(waitUntilSearchIndexAvailable, 1000); + } } +// The actual entry point to the search code +waitUntilSearchIndexAvailable(); + }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { diff --git a/dev/equations/index.html b/dev/equations/index.html index 051bde5..4fe4277 100644 --- a/dev/equations/index.html +++ b/dev/equations/index.html @@ -991,4 +991,4 @@ -'/>

Often you will have a linear material where you are scaling by a constant, and a nonlinear version of that material where that scaling is replaced by a generic nonlinear function. This is why we allow Decapodes to represent both of these types of equations.

+'/>

Often you will have a linear material where you are scaling by a constant, and a nonlinear version of that material where that scaling is replaced by a generic nonlinear function. This is why we allow Decapodes to represent both of these types of equations.

diff --git a/dev/generated/literate_example/index.html b/dev/generated/literate_example/index.html index f37648e..70eb056 100644 --- a/dev/generated/literate_example/index.html +++ b/dev/generated/literate_example/index.html @@ -1,2 +1,2 @@ -Code Example · DiagrammaticEquations.jl
+Code Example · DiagrammaticEquations.jl
diff --git a/dev/index.html b/dev/index.html index 11c9142..8e7b6d2 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -DiagrammaticEquations.jl · DiagrammaticEquations.jl

DiagrammaticEquations.jl

DiagrammaticEquations.jl is a Julia library implementing category-theoretic reasoning about systems of equations with diagrams. This package was extracted from Decapodes.jl to decouple the representation of systems of equations from the solution of those equations. DiagrammaticEquations will grow to support many flavors of equations, starting with the Discrete Exterior Calculus equations from Decapodes.

+DiagrammaticEquations.jl · DiagrammaticEquations.jl

DiagrammaticEquations.jl

DiagrammaticEquations.jl is a Julia library implementing category-theoretic reasoning about systems of equations with diagrams. This package was extracted from Decapodes.jl to decouple the representation of systems of equations from the solution of those equations. DiagrammaticEquations will grow to support many flavors of equations, starting with the Discrete Exterior Calculus equations from Decapodes.