diff --git a/packages/algjulia-interop/Project.toml b/packages/algjulia-interop/Project.toml index 9e270ce35..bb7ed1342 100644 --- a/packages/algjulia-interop/Project.toml +++ b/packages/algjulia-interop/Project.toml @@ -18,15 +18,14 @@ IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078" +OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d" Preferences = "21216c6a-2e73-6563-6e65-726566657250" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -[weakdeps] -PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d" - [extensions] SysImageExt = "PackageCompiler" @@ -44,6 +43,7 @@ IJulia = "1.26.0" JSON3 = "1" LinearAlgebra = "1" MLStyle = "0.4" +OrderedCollections = "1.8.1" OrdinaryDiffEq = "6.101.0" PackageCompiler = "2.2.1" Preferences = "1.5.0" diff --git a/packages/algjulia-interop/docs/literate/json.jl b/packages/algjulia-interop/docs/literate/json.jl new file mode 100644 index 000000000..9c3849a06 --- /dev/null +++ b/packages/algjulia-interop/docs/literate/json.jl @@ -0,0 +1,5 @@ +using CatColabInterop + +using JSON3 + +json = JSON3.read(read("test/test_jsons/_payload.json")) diff --git a/packages/algjulia-interop/src/CatColabInterop.jl b/packages/algjulia-interop/src/CatColabInterop.jl index a0b0d2320..8cc861886 100644 --- a/packages/algjulia-interop/src/CatColabInterop.jl +++ b/packages/algjulia-interop/src/CatColabInterop.jl @@ -1,5 +1,7 @@ module CatColabInterop +import Base: run +using JSON3 using MLStyle using Reexport @@ -7,80 +9,25 @@ using Reexport # the intent is that this is an interface for AlgebraicJulia code to interoperate with CatColab abstract type AlgebraicJuliaIntegration end -# cells in the JSON are tagged. these are just objects for dispatching `to_model` -@data ModelElementTag begin - ObTag() - HomTag() -end -export ObTag, HomTag - -#= -@active patterns are MLStyle-implementations of F# active patterns that forces us to work in the Maybe/Option pattern. -Practically, yet while a matter of opinion, they make @match statements cleaner; a statement amounts to a helpful pattern -name and the variables we intend to capture. -=# -@active IsObject(x) begin; x[:content][:tag] == "object" ? Some(x[:content]) : nothing end -@active IsMorphism(x) begin; x[:content][:tag] == "morphism" ? Some(x[:content]) : nothing end -export IsObject, IsMorphism - -# Obs, Homs -@data ModelElementValue begin - ObValue() - HomValue(dom,cod) -end -export ObValue, HomValue - -""" -Struct capturing the name of the object and its relevant information. -ModelElementValue may be objects or homs, each of which has different data. -""" -struct ModelElement - name::Union{Symbol, Nothing} - val::Union{<:ModelElementValue, Nothing} - function ModelElement(;name::Symbol=nothing,val::Any=nothing) - new(name, val) - end -end -export ModelElement - -Base.nameof(t::ModelElement) = t.name - -""" Struct wrapping a dictionary """ -struct Model{T<:AlgebraicJuliaIntegration} - data::Dict{String, ModelElement} -end -export Model - -function Model(::T) where T<:AlgebraicJuliaIntegration - Model{T}(Dict{String, ModelElement}()) -end - -Base.values(model::Model) = values(model.data) - -""" -Functions to build a dictionary associating ids in the theory to elements in the model -""" -function to_model end -export to_model - - -# TODO supposes bijection between theories, models, diagrams, etc. -abstract type AbstractDiagram{T<:AlgebraicJuliaIntegration} end - -abstract type AbstractAnalysis{T<:AlgebraicJuliaIntegration} end +#= These files are responsible for parsing the model and diagram in the CCL payload =# +include("qualified_name.jl") +include("model.jl") +include("diagram.jl") +include("payload.jl") # payload and analysis are here struct ImplError <: Exception name::String end export ImplError - Base.showerror(io::IO, e::ImplError) = print(io, "$(e.name) not implemented") -include("result.jl") -include("kernel_management.jl") -include("kernel_support.jl") +# Kernel utilities +include("kernel/KernelUtility.jl") + +#= The Decapodes service contains an analysis =# include("decapodes-service/DecapodesService.jl") +@reexport using .KernelUtility @reexport using .DecapodesService end diff --git a/packages/algjulia-interop/src/decapodes-service/DecapodesService.jl b/packages/algjulia-interop/src/decapodes-service/DecapodesService.jl index 1539cbbfb..c336cd940 100644 --- a/packages/algjulia-interop/src/decapodes-service/DecapodesService.jl +++ b/packages/algjulia-interop/src/decapodes-service/DecapodesService.jl @@ -1,5 +1,7 @@ module DecapodesService +import Base: run + # algebraicjulia dependencies using ACSets using DiagrammaticEquations @@ -17,26 +19,37 @@ using Distributions # for initial conditions # meshing using CoordRefSystems using GeometryBasics: Point2, Point3 -Point3D = Point3{Float64}; +Point3D = Point3{Float64} # simulation using OrdinaryDiffEq using ..CatColabInterop using ..CatColabInterop: AlgebraicJuliaIntegration, AbstractDiagram, AbstractAnalysis -import ..CatColabInterop: Model, to_model +import ..CatColabInterop: Model, ObGenerator, MorGenerator, DiagramObGenerator, DiagramMorGenerator # necessary to export -export infer_types!, evalsim, default_dec_generate, default_dec_matrix_generate, - DiagonalHodge, ComponentArray +export infer_types!, evalsim, default_dec_generate, default_dec_matrix_generate, DiagonalHodge, ComponentArray struct ThDecapode <: AlgebraicJuliaIntegration end export ThDecapode -# funcitons for geometry and initial conditions +# functions for geometry and initial conditions include("geometry.jl") -include("model.jl") ## model-building -include("diagram.jl") ## diagram-building -include("analysis/Analysis.jl") + +# responsible for constructing a valid model +include("model.jl") + +# helper functions for Navier-Stokes +include("ns_helper.jl") + +# constructing initial conditions +include("initial_conditions.jl") + +# parses a payload to a valid analysis +include("parse.jl") + +# executes the analysis +include("execute.jl") end diff --git a/packages/algjulia-interop/src/decapodes-service/analysis/Analysis.jl b/packages/algjulia-interop/src/decapodes-service/analysis/Analysis.jl deleted file mode 100644 index af3f267a3..000000000 --- a/packages/algjulia-interop/src/decapodes-service/analysis/Analysis.jl +++ /dev/null @@ -1,3 +0,0 @@ -include("ns_helper.jl") -include("initial_conditions.jl") -include("simulation.jl") diff --git a/packages/algjulia-interop/src/decapodes-service/analysis/simulation.jl b/packages/algjulia-interop/src/decapodes-service/analysis/simulation.jl deleted file mode 100644 index 044a261d8..000000000 --- a/packages/algjulia-interop/src/decapodes-service/analysis/simulation.jl +++ /dev/null @@ -1,161 +0,0 @@ -""" Constructs an analysis from the diagram of a Decapode Model""" -function Analysis(analysis::JSON3.Object, diagram::DecapodeDiagram, hodge=GeometricHodge()) - - # TODO want a safer way to get this information - id = findfirst(cell -> haskey(cell, :content), analysis[:notebook][:cells]) - content = analysis[:notebook][:cells][id][:content][:content] - - PodeSystem(content, diagram, hodge) -end -export Analysis - -# accepts payload -function Analysis(::ThDecapode, payload::String, args...) - analysis = JSON3.read(payload) - Analysis(ThDecapode(), analysis) -end - -function Analysis(::ThDecapode, analysis::JSON3.Object, args...) - model = Model(ThDecapode(), analysis.model) - diagram = Diagram(analysis.diagram, model) - PodeSystem(analysis, diagram, args...) -end - -struct PodeSystem <: AbstractAnalysis{ThDecapode} - pode::SummationDecapode - plotVars::Dict{String, Bool} - scalars::Dict{Symbol, Any} # closures - geometry::Geometry - init::ComponentArray - generate::Any - uuiddict::Dict{Symbol, String} - duration::Int -end -export PodeSystem - -function Base.show(io::IO, system::PodeSystem) - println(io, system.pode) -end - -# the origin is the SimulationData payload -function PodeSystem(content::JSON3.Object, diagram::DecapodeDiagram, hodge=GeometricHodge()) - - domain = content[:domain] - duration = content[:duration] - initialConditions = content[:initialConditions] - mesh = content[:mesh] - # TODO we need a more principled way of defining this - plotVars = @match content[:plotVariables] begin - vars::AbstractArray => Dict{String, Bool}([ k => k ∈ vars for k in keys(diagram.vars)]) - vars => Dict{String, Bool}([ "$k" => v for (k,v) in vars]) - end - scalars = content[:scalars] - anons = Dict{Symbol, Any}() - - dot_rename!(diagram.pode) - uuid2symb = uuid_to_symb(diagram.pode, diagram.vars) - - geometry = Geometry(content) - - ♭♯_m = ♭♯_mat(geometry.dualmesh) - wedge_dp10 = dec_wedge_product_dp(Tuple{1,0}, geometry.dualmesh) - dual_d1_m = dec_dual_derivative(1, geometry.dualmesh) - star0_inv_m = dec_inv_hodge_star(0, geometry.dualmesh, hodge) - Δ0 = Δ(0,geometry.dualmesh) - #fΔ0 = factorize(Δ0); - function sys_generate(s, my_symbol) - op = @match my_symbol begin - sym && if haskey(diagram.scalars, sym) end => x -> begin - k = scalars[diagram.scalars[sym]] - k * x - end - :♭♯ => x -> ♭♯_m * x - # TODO are we indexing right? - :dpsw => x -> wedge_dp10(x, star0_inv_m*(dual_d1_m*x)) - :Δ⁻¹ => x -> begin - y = Δ0 \ x - y .- minimum(y) - end - _ => default_dec_matrix_generate(s, my_symbol, hodge) - end - return (args...) -> op(args...) - end - - u0 = initial_conditions(initialConditions, geometry, uuid2symb) - - # reversing `uuid2symb` into `symbol => uuid.` we need this to reassociate the var to its UUID - symb2uuid = Dict([v => k for (k,v) in pairs(uuid2symb)]) - - # TODO return the whole system - return PodeSystem(diagram.pode, plotVars, anons, geometry, u0, sys_generate, symb2uuid, duration) -end - -points(system::PodeSystem) = collect(values(system.geometry.dualmesh.subparts.point.m)) -indexing_bounds(system::PodeSystem) = indexing_bounds(system.geometry.domain) - -function run_sim(fm, u0, t0, constparam) - prob = ODEProblem(fm, u0, (0, t0), constparam) - soln = solve(prob, Tsit5(), saveat=0.01) -end -export run_sim - -struct SimResult - time::Vector{Float64} - state::Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - x::Vector{Float64} # axis - y::Vector{Float64} -end -export SimResult - -function SimResult(soln::ODESolution, system::PodeSystem) - idx_bounds = indexing_bounds(system) - state_val_dict = variables_state(soln, system) # Dict("UUID1" => VectorMatrixSVectr...) - SimResult(soln.t, state_val_dict, 0:idx_bounds.x, 0:idx_bounds.y) -end -# TODO generalize to HasDeltaSet - -""" for the variables in a system, associate them to their state values over the duration of the simulation """ -function variables_state(soln::ODESolution, system::PodeSystem) - plottedVars = [ k for (k, v) in system.plotVars if v == true ] - uuid2symb = Dict([ v => k for (k, v) in system.uuiddict]) # TODO why reverse again? - Dict([ String(uuid2symb[var]) => state_entire_sim(soln, system, uuid2symb[var]) for var ∈ plottedVars ]) -end - -""" given a simulation, a domain, and a variable, gets the state values over the duration of a simulation. -Called by `variables_state`[@ref] """ -function state_entire_sim(soln::ODESolution, system::PodeSystem, var::Symbol) - map(1:length(soln.t)) do i - state_at_time(soln, system, var, i) - end -end - -# TODO type `points` -function state_at_time(soln::ODESolution, system::PodeSystem, plotvar::Symbol, t::Int) - @match system.geometry.domain begin - # TODO check time indexing here - domain::Rectangle => state_at_time(soln, domain, plotvar, t) - domain::Sphere => state_at_time(soln, domain, plotvar, t, points(system)) - _ => throw(ImplError("state_at_time function for domain $domain")) - end -end - -function state_at_time(soln::ODESolution, domain::Rectangle, var::Symbol, t::Int) - (x, y) = indexing_bounds(domain) - [SVector(i, j, getproperty(soln.u[t], var)[(x+1)*(i-1) + j]) for i in 1:x+1, j in 1:y+1] -end - -# TODO just separated this from the SimResult function and added type parameters, but need to generalize -function grid(pt3::Point3, grid_size::Vector{Int}) - pt2 = [(pt3[1]+1)/2, (pt3[2]+1)/2] - [round(Int, pt2[1]*grid_size[1]), round(Int, pt2[2]*grid_size[2])] -end - -function state_at_time(soln::ODESolution, domain::Sphere, var::Symbol, t::Int, points) - l , _ = indexing_bounds(domain) # TODO this is hardcoded to return 100, 100 - northern_indices = filter(i -> points[i][3] > 0, keys(points)) - map(northern_indices) do n - i, j = grid(points[n], [l, l]) # TODO - SVector(i, j, getproperty(soln.u[t], var)[n]) - end -end - diff --git a/packages/algjulia-interop/src/decapodes-service/diagram.jl b/packages/algjulia-interop/src/decapodes-service/diagram.jl deleted file mode 100644 index fee454d4e..000000000 --- a/packages/algjulia-interop/src/decapodes-service/diagram.jl +++ /dev/null @@ -1,113 +0,0 @@ -## DIAGRAM BUILDING - - -@kwdef mutable struct DecapodeDiagram <: AbstractDiagram{ThDecapode} - pode::SummationDecapode = SummationDecapode(parse_decapode(quote end)) - scalars::Dict{Symbol, String} = Dict{Symbol, String}() - vars::Dict{String, Int} = Dict{String, Int}() - nc::Dict{Int, String} = Dict{Int, String}() -end - -function Base.nameof(model::Model, content::AbstractDict) - if isnothing(content[:over]) - :no_name - else - Symbol(model.data[content[:over][:content]].name) - end -end - -# endpoint being `dom` or `codom` -function check_endpoint!(diagram::DecapodeDiagram, endpoint) - if haskey(diagram.vars, endpoint) - diagram.vars[endpoint] - else - if endpoint ∉ values(diagram.nc) - id = isempty(keys(diagram.nc)) ? 1 : length(keys(diagram.nc)) + 1 - name = Symbol("•$id") - acset_id = add_part!(diagram.pode, :Var, name=name, type=:infer) - push!(diagram.nc, acset_id => endpoint) - acset_id - else - out = filter(x -> x[2] == endpoint, pairs(diagram.nc)) - first(keys(out)) - end - end -end - -function add_to_pode!(diagram::DecapodeDiagram, - model::Any, - content::AbstractDict, - ::ObTag) - # indexes the model by UUID - model_element = model.data[content[:over][:content]] - # checks if the cell is an anonymous (intermediate) variable. - # if so, we increment the intermediate variable counter and make an intermediate variable name. - # otherwise we use the existing name of the given content. - name = if isempty(content[:name]) - id = isempty(keys(diagram.nc)) ? 1 : maximum(keys(diagram.nc)) + 1 - push!(diagram.nc, id => "") - Symbol("•$id") - else - Symbol(content[:name]) - end - id = add_part!(diagram.pode, :Var, name=name, type=nameof(model_element)) - push!(diagram.vars, content[:id] => id) - return diagram -end -export add_to_pode! - -# TODO we are restricted to Op1 -function add_to_pode!(diagram::DecapodeDiagram, - model::Model{ThDecapode}, - content::AbstractDict, - ::HomTag) - dom = content[:dom][:content] - cod = content[:cod][:content] - - # TODO Simpler to extend the Decapodes Var table by a UUID attribute - dom_id = check_endpoint!(diagram, dom) - cod_id = check_endpoint!(diagram, cod) - - # get the name of the Op1 and add it to the model - op1 = nameof(model, content) - - add_part!(diagram.pode, :Op1, src=dom_id, tgt=cod_id, op1=op1) - # we need to add an inclusion to the TVar table - if op1 == :∂ₜ - add_part!(diagram.pode, :TVar, incl=cod_id) - end - if content[:morType][:content] isa JSON3.Object - scalar = model.data[content[:over][:content]].name - push!(diagram.scalars, scalar => content[:over][:content]) - end - diagram -end - -""" Diagram(diagram::AbstractVector{<:AbstractDict}, model::Model{ThDecapode}) => (::SummationDecapode, ::Dict{Symbol, Any}, ::Dict{String, Int}) - -This returns - 1. a Decapode - 2. a dictionary of symbols mapped to anonymous functions - 3. a dictionary of JSON UUIDs mapped to symbols -""" -function Diagram(json_array::JSON3.Array{T}, model::Model{ThDecapode}; scalars=[]) where T - diagram = DecapodeDiagram() - for cell in json_array - cell = haskey(cell, :content) ? cell[:content] : cell - @match cell begin - content && if haskey(content, :obType) end => add_to_pode!(diagram, model, content, ObTag()) - content && if haskey(content, :morType) end => add_to_pode!(diagram, model, content, HomTag()) - _ => throw(ImplError(cell)) - end - end - return diagram -end -export Diagram - -function Diagram(json_diagram::JSON3.Object, model::Model{ThDecapode}; scalars=[]) - Diagram(json_diagram[:cells], model; scalars) -end - -function uuid_to_symb(decapode::SummationDecapode, vars::Dict{String, Int}) - Dict([key => (subpart(decapode, vars[key], :name)) for key ∈ keys(vars)]) -end diff --git a/packages/algjulia-interop/src/decapodes-service/execute.jl b/packages/algjulia-interop/src/decapodes-service/execute.jl new file mode 100644 index 000000000..11f66427c --- /dev/null +++ b/packages/algjulia-interop/src/decapodes-service/execute.jl @@ -0,0 +1,73 @@ +""" """ +function Base.run(fm, sim::DecapodeSimulation, constparam) + prob = ODEProblem(fm, sim.init, sim.duration, constparam) + soln = solve(prob, Tsit5(), saveat=0.01) + SimResult(soln, sim) +end + +abstract type AbstractResult end + +struct SimResult <: AbstractResult + retcode::Enum{Int32} # ReturnCode + time::Vector{Float64} + state::Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} + x::Vector{Float64} # axis + y::Vector{Float64} +end +export SimResult + +function SimResult(soln::ODESolution, system::DecapodeSimulation) + idx_bounds = indexing_bounds(system) + state_val_dict = variables_state(soln, system) # Dict("UUID1" => VectorMatrixSVectr...) + SimResult(soln.retcode, soln.t, state_val_dict, 0:idx_bounds.x, 0:idx_bounds.y) +end +# TODO generalize to HasDeltaSet + +points(system::DecapodeSimulation) = collect(values(system.geometry.dualmesh.subparts.point.m)) +indexing_bounds(system::DecapodeSimulation) = indexing_bounds(system.geometry.domain) + +""" for the variables in a system, associate them to their state values over the duration of the simulation """ +function variables_state(soln::ODESolution, system::DecapodeSimulation) + plottedVars = [ k for (k, v) in system.plotVariables if v == true ] + uuid2symb = Dict([ v => k for (k, v) in system.uuiddict]) # TODO why reverse again? + Dict([ String(uuid2symb[var]) => state_entire_sim(soln, system, uuid2symb[var]) for var ∈ plottedVars ]) +end + +""" given a simulation, a domain, and a variable, gets the state values over the duration of a simulation. +Called by `variables_state`[@ref] """ +function state_entire_sim(soln::ODESolution, system::DecapodeSimulation, var::Symbol) + map(1:length(soln.t)) do i + state_at_time(soln, system, var, i) + end +end + +# TODO type `points` +function state_at_time(soln::ODESolution, system::DecapodeSimulation, plotvar::Symbol, t::Int) + @match system.geometry.domain begin + # TODO check time indexing here + domain::Rectangle => state_at_time(soln, domain, plotvar, t) + domain::Sphere => state_at_time(soln, domain, plotvar, t, points(system)) + _ => throw(ImplError("state_at_time function for domain $domain")) + end +end + +function state_at_time(soln::ODESolution, domain::Rectangle, var::Symbol, t::Int) + (x, y) = indexing_bounds(domain) + [SVector(i, j, getproperty(soln.u[t], var)[(x+1)*(i-1) + j]) for i in 1:x+1, j in 1:y+1] +end + +# TODO just separated this from the SimResult function and added type parameters, but need to generalize +function grid(pt3::Point3, grid_size::Vector{Int}) + pt2 = [(pt3[1]+1)/2, (pt3[2]+1)/2] + [round(Int, pt2[1]*grid_size[1]), round(Int, pt2[2]*grid_size[2])] +end + +function state_at_time(soln::ODESolution, domain::Sphere, var::Symbol, t::Int, points) + l , _ = indexing_bounds(domain) # TODO this is hardcoded to return 100, 100 + northern_indices = filter(i -> points[i][3] > 0, keys(points)) + map(northern_indices) do n + i, j = grid(points[n], [l, l]) # TODO + SVector(i, j, getproperty(soln.u[t], var)[n]) + end +end + diff --git a/packages/algjulia-interop/src/decapodes-service/geometry.jl b/packages/algjulia-interop/src/decapodes-service/geometry.jl index addb0201c..fefcd5413 100644 --- a/packages/algjulia-interop/src/decapodes-service/geometry.jl +++ b/packages/algjulia-interop/src/decapodes-service/geometry.jl @@ -83,6 +83,11 @@ function Geometry(json_object::AbstractDict) Geometry(domain) end +function Geometry(payload::DiagramPayload{ThDecapode}) + domain = PREDEFINED_MESHES[Symbol(payload.data[:mesh])] + Geometry(domain) +end + # function Geometry(d::Domain, args...) # throw(ImplError("The mesh ($(d)) is")) # end diff --git a/packages/algjulia-interop/src/decapodes-service/analysis/initial_conditions.jl b/packages/algjulia-interop/src/decapodes-service/initial_conditions.jl similarity index 100% rename from packages/algjulia-interop/src/decapodes-service/analysis/initial_conditions.jl rename to packages/algjulia-interop/src/decapodes-service/initial_conditions.jl diff --git a/packages/algjulia-interop/src/decapodes-service/model.jl b/packages/algjulia-interop/src/decapodes-service/model.jl index e1b4bb0c3..17fe741c4 100644 --- a/packages/algjulia-interop/src/decapodes-service/model.jl +++ b/packages/algjulia-interop/src/decapodes-service/model.jl @@ -1,15 +1,15 @@ -# Build the model +#= Build the model -export Model - -""" A model for the Decapodes integration is the same as the default Model method. A dictionary mapping UUID strings with ModelElements is instantiated. -""" -Model(::ThDecapode) = Model{ThDecapode}(Dict{String, ModelElement}()) +=# +function ObGenerator(::ThDecapode, obgen::AbstractDict) + ObGenerator(obgen[:id], ob_name(ThDecapode(), obgen[:label]), obgen[:obType]) +end +export ObGenerator """ Helper function to convert CatColab values (Obs) in Decapodes """ -function to_model(model::ThDecapode, type::ObTag, name::String) +function ob_name(model::ThDecapode, name::String) @match lowercase(name) begin "0-form" => :Form0 "1-form" => :Form1 @@ -23,9 +23,20 @@ function to_model(model::ThDecapode, type::ObTag, name::String) x => throw(ImplError(x)) end end +export ob_name + +ob_name(model::ThDecapode, name::AbstractVector) = ob_name(model, join(String.(name), "")) + +# XXX the use of an `only` here means we're being hostile to multiarrows +function MorGenerator(::ThDecapode, ob_generators::Vector{ObGenerator}, morgen::AbstractDict) + dom = only(filter(ob -> ob.id == morgen[:dom][:content], ob_generators)) + cod = only(filter(ob -> ob.id == morgen[:cod][:content], ob_generators)) + MorGenerator(morgen[:id], mor_name(ThDecapode(), morgen[:label]), morgen[:morType], dom, cod) +end +export MorGenerator """ Helper function to convert CatColab values (Homs) in Decapodes """ -function to_model(model::ThDecapode, type::HomTag, name::String) +function mor_name(model::ThDecapode, name::String) @match replace(name," " => "") begin "∂t" || "∂ₜ" => :∂ₜ "Δ" => :Δ @@ -43,34 +54,10 @@ function to_model(model::ThDecapode, type::HomTag, name::String) x => throw(ImplError(x)) end end +export mor_name -# add_to_model! - -@active IsMorphismNonScalar(x) begin - x[:morType][:content] == "Nonscalar" ? Some(x) : nothing -end - -function add_to_model! end -export add_to_model! +mor_name(model::ThDecapode, name::AbstractVector) = mor_name(model, join(String.(name), "")) -function add_to_model!(model::Model{ThDecapode}, content::AbstractDict, type::ObTag) - push!(model.data, content[:id] => ModelElement(;name=to_model(ThDecapode(), type, content[:name]))) -end - -function add_to_model!(model::Model{ThDecapode}, content::AbstractDict, type::HomTag) - @match content begin - IsMorphismNonScalar(x) => push!(model.data, content[:id] => - ModelElement(;name=to_model(ThDecapode(), type, content[:name]), - val=HomValue(content[:dom][:content], - content[:cod][:content]))) - _ => push!(model.data, content[:id] => - ModelElement(;name=Symbol(content[:name]), - val=HomValue(content[:dom][:content], - content[:cod][:content]))) - end -end - -# TODO generalize function Model(::ThDecapode, path::String) json = JSON3.read(read(path, String)) Model(ThDecapode(), json) @@ -81,27 +68,8 @@ end # ...a morphism, we add it to the modeldict with a field for the ids of its # domain and codomain to its function Model(::ThDecapode, json_model::JSON3.Object) # AbstractDict is the JSON - newmodel = Model(ThDecapode()) - __name = json_model[:name] # TODO unused - for cell in json_model[:notebook][:cells] - @match cell begin - IsObject(content) => add_to_model!(newmodel, content, ObTag()) - IsMorphism(content) => add_to_model!(newmodel, content, HomTag()) - _ => throw(ImplError(cell)) - end - end - return newmodel + ob_generators = ObGenerator.(Ref(ThDecapode()), json_model[:obGenerators]) + mor_generators = MorGenerator.(Ref(ThDecapode()), Ref(ob_generators), json_model[:morGenerators]) + Model(ThDecapode(), ob_generators, mor_generators) end export Model - -function Model(::ThDecapode, json_array::JSON3.Array{T}; name="model") where T - newmodel = Model(ThDecapode()) - for cell in json_array - @match cell begin - content && if haskey(content, :obType) end => add_to_model!(newmodel, content, ObTag()) - content && if haskey(content, :morType) end => add_to_model!(newmodel, content, HomTag()) - _ => throw(ImplError(cell)) - end - end - return newmodel -end diff --git a/packages/algjulia-interop/src/decapodes-service/analysis/ns_helper.jl b/packages/algjulia-interop/src/decapodes-service/ns_helper.jl similarity index 100% rename from packages/algjulia-interop/src/decapodes-service/analysis/ns_helper.jl rename to packages/algjulia-interop/src/decapodes-service/ns_helper.jl diff --git a/packages/algjulia-interop/src/decapodes-service/parse.jl b/packages/algjulia-interop/src/decapodes-service/parse.jl new file mode 100644 index 000000000..2fda460d0 --- /dev/null +++ b/packages/algjulia-interop/src/decapodes-service/parse.jl @@ -0,0 +1,151 @@ +""" DecapodeSimulation + +This analysis contains the data necessary to execute a simulation. +""" +struct DecapodeSimulation <: AbstractAnalysis{ThDecapode} + pode::SummationDecapode + plotVariables::Dict{String, Bool} + scalars::Dict{Symbol, Any} # closures + geometry::Geometry + init::ComponentArray + generate::Any + uuiddict::Dict{Symbol, String} + duration::Int +end +export DecapodeSimulation + +function DecapodeSimulation(path::String; kwargs...) + payload = DiagramPayload(ThDecapode(), path) + DecapodeSimulation(payload; kwargs...) +end + +function DecapodeSimulation(json::AbstractDict; kwargs...) + payload = DiagramPayload(ThDecapode(), json) + DecapodeSimulation(payload; kwargs...) +end + +function DecapodeSimulation(payload::DiagramPayload{ThDecapode}; hodge=GeometricHodge()) + wrapped = DecapodeDiagram(payload) + plotVars = @match payload[:plotVariables] begin + vars::AbstractArray => Dict{String, Bool}(key => key ∈ vars for key ∈ keys(wrapped.vars)) + vars => Dict{String, Bool}( "$key" => var for (key, var) in vars) # TODO + end + dot_rename!(wrapped.pode) + uuid2symb = uuid_to_symb(wrapped.pode, wrapped.vars) + geometry = Geometry(payload) # TODO + ♭♯_m = ♭♯_mat(geometry.dualmesh) + wedge_dp10 = dec_wedge_product_dp(Tuple{1,0}, geometry.dualmesh) + dual_d1_m = dec_dual_derivative(1, geometry.dualmesh) + star0_inv_m = dec_inv_hodge_star(0, geometry.dualmesh, hodge) + Δ0 = Δ(0,geometry.dualmesh) + #fΔ0 = factorize(Δ0); + function sys_generate(s, my_symbol) + op = @match my_symbol begin + sym && if haskey(wrapped.scalars, sym) end => x -> begin + k = scalars[wrapped.scalars[sym]] + k * x + end + :♭♯ => x -> ♭♯_m * x + # TODO are we indexing right? + :dpsw => x -> wedge_dp10(x, star0_inv_m*(dual_d1_m*x)) + :Δ⁻¹ => x -> begin + y = Δ0 \ x + y .- minimum(y) + end + _ => default_dec_matrix_generate(s, my_symbol, hodge) + end + return (args...) -> op(args...) + end + # + u0 = initial_conditions(payload[:initialConditions], geometry, uuid2symb) + + # reversing `uuid2symb` into `symbol => uuid.` we need this to reassociate the var to its UUID + symb2uuid = Dict([v => k for (k,v) in pairs(uuid2symb)]) + + # TODO what is anons doing here? + anons = Dict{Symbol, Any}() + DecapodeSimulation(wrapped.pode, plotVars, wrapped.scalars, geometry, u0, sys_generate, symb2uuid, payload[:duration]) +end + +Base.show(io::IO, system::DecapodeSimulation) = println(io, system.pode) + +# ======================================================================================= + +#= +We produce a ModelDiagramPresentation and Analysis data from the CCL payload. +The Simulation analysis constructs the actual simulation data +=# +@kwdef mutable struct DecapodeDiagram + pode::SummationDecapode = SummationDecapode(parse_decapode(quote end)) + scalars::Dict{Symbol, String} = Dict{Symbol, String}() + vars::Dict{String, Int} = Dict{String, Int}() + nc::Dict{Int, String} = Dict{Int, String}() +end + +function Base.push!(diagram::DecapodeDiagram, payload::DiagramPayload{ThDecapode}, ob::DiagramObGenerator) + model_element = only(filter(x -> x.id == ob.over.content, payload.model.ob_generators)) + name = if isempty(ob.label) + id = isempty(keys(diagram.nc)) ? 1 : maximum(keys(diagram.nc)) + 1 + push!(diagram.nc, id => "") + Symbol("•$id") + else + Symbol(ob.label) + end + id = add_part!(diagram.pode, :Var, name=name, type=nameof(model_element)) + push!(diagram.vars, ob.id => id) + diagram +end + +function Base.push!(diagram::DecapodeDiagram, payload::DiagramPayload{ThDecapode}, mor::DiagramMorGenerator) + # TODO is this the right field to index + dom = mor.dom + cod = mor.cod + dom_id = check_endpoint!(diagram, dom) + cod_id = check_endpoint!(diagram, cod) + # get the name of the Op1 and add it to the model + op1 = nameof(payload.model, mor) + add_part!(diagram.pode, :Op1, src=dom_id, tgt=cod_id, op1=op1) + if op1 == :∂ₜ + add_part!(diagram.pode, :TVar, incl=cod_id) + end + if mor.morType.content isa JSON3.Object + scalar = payload.model.mor_generators[mor.over.content] + push!(diagram.scalars, scalar.label => mor.over.content) + end + diagram +end + +function DecapodeDiagram(payload::DiagramPayload) + diagram = DecapodeDiagram() + for ob in payload.diagram.ob_generators + push!(diagram, payload, ob) + end + for mor in payload.diagram.mor_generators + push!(diagram, payload, mor) + end + return diagram +end + +# endpoint being `dom` or `codom` +function check_endpoint!(diagram::DecapodeDiagram, endpoint::DiagramObGenerator) + if haskey(diagram.vars, endpoint.id) + diagram.vars[endpoint.id] + else + if endpoint.id ∉ values(diagram.nc) + id = isempty(keys(diagram.nc)) ? 1 : length(keys(diagram.nc)) + 1 + name = Symbol("•$id") + acset_id = add_part!(diagram.pode, :Var, name=name, type=:infer) + push!(diagram.nc, acset_id => endpoint.label) + acset_id + else + out = filter(x -> x[2] == endpoint, pairs(diagram.nc)) + first(keys(out)) + end + end +end + +# ======================================================================================= + +function uuid_to_symb(decapode::SummationDecapode, vars::Dict{String, Int}) + Dict([key => (subpart(decapode, vars[key], :name)) for key ∈ keys(vars)]) +end diff --git a/packages/algjulia-interop/src/diagram.jl b/packages/algjulia-interop/src/diagram.jl new file mode 100644 index 000000000..2600ff507 --- /dev/null +++ b/packages/algjulia-interop/src/diagram.jl @@ -0,0 +1,70 @@ +using OrderedCollections + +abstract type AbstractDiagram{T<:AlgebraicJuliaIntegration} end + +""" Struct defining an object generator """ +struct DiagramObGenerator + id::String + label::QualifiedLabel # TODO maybe + obType::AbstractDict + over::AbstractDict +end +export DiagramObGenerator + +# TODO macro +function DiagramObGenerator(data::AbstractDict) + DiagramObGenerator(getindex.(Ref(data), fieldnames(DiagramObGenerator))...) +end + +Base.nameof(ob::DiagramObGenerator) = ob.label +function Base.nameof(model::Model, ob::DiagramObGenerator) + if isnothing(ob.over) + :no_name + else + nameof(model.ob_generators[ob.over.content]) + end +end +Base.getindex(obs::Vector{MorGenerator}, id::String) = only(filter(ob -> ob.id == id, obs)) + +""" Struct defining an morphism generator """ +struct DiagramMorGenerator + id::String + morType::AbstractDict + over::AbstractDict + dom::DiagramObGenerator + cod::DiagramObGenerator +end +export DiagramMorGenerator + +# TODO macro +function DiagramMorGenerator(data::AbstractDict; obs::Vector{DiagramObGenerator}=[]) + fields = OrderedDict(field => data[field] for field in fieldnames(DiagramMorGenerator)) + fields[:dom] = only(filter(ob -> ob.id == data[:dom][:content], obs)) + fields[:cod] = only(filter(ob -> ob.id == data[:cod][:content], obs)) + DiagramMorGenerator(values(fields)...) +end + +Base.nameof(mor::DiagramMorGenerator) = mor.label +function Base.nameof(model::Model, mor::DiagramMorGenerator) + if isnothing(mor.over) + :no_name + else + nameof(model.mor_generators[mor.over.content]) + end +end +Base.getindex(mors::Vector{MorGenerator}, id::String) = only(filter(mor -> mor.id == id, mors)) + +""" Struct wrapping a dictionary """ +struct ModelDiagramPresentation{T<:AlgebraicJuliaIntegration} + ob_generators::Vector{DiagramObGenerator} + mor_generators::Vector{DiagramMorGenerator} + ModelDiagramPresentation(::T, obs, mors) where T = new{T}(obs, mors) + ModelDiagramPresentation(::T) where T = new{T}([], []) +end +export ModelDiagramPresentation + +function ModelDiagramPresentation(::T, data::AbstractDict) where T + ob_generators = DiagramObGenerator.(data[:obGenerators]) + mor_generators = DiagramMorGenerator.(data[:morGenerators]; obs=ob_generators) + ModelDiagramPresentation(T(), ob_generators, mor_generators) +end diff --git a/packages/algjulia-interop/src/kernel/KernelUtility.jl b/packages/algjulia-interop/src/kernel/KernelUtility.jl new file mode 100644 index 000000000..555f73add --- /dev/null +++ b/packages/algjulia-interop/src/kernel/KernelUtility.jl @@ -0,0 +1,40 @@ +module KernelUtility + +using MLStyle +import JSON3 + +export JsonValue + +# NOTE: JsonValue should not be used for returning large amounts of data (Anything over 1kb? +# Whatever the size is for "trivially readable by humans"), there is a catastrophic performance +# dropoff as payload size increases. Performance of JsonValue vs +# display(MIME"application/json"(), JSON3.write()) has not been studied in detail, both have bad +# performance, but one might be worse than the other. Whether or not the performance is different might +# help inform a future investigation. +# +# NOTE: the use of the `show` methods is the only way I was able to get the contents of the message +# (`content["data"]?.["application/json"]`) to be interpreted as JSON in the browser. using something +# like `display(MIME"application/json"(), JSON3.write(...))` caused the +# content to be the JSON in string form, even though the mime type was "application/json" +# +# NOTE: It looks like IJulia is delivering payloads for each mime type available according to this +# docstring https://github.com/JuliaLang/IJulia.jl/blob/master/src/display.jl +# +# NOTE: Jason is not 100% confident that these show methods do what it looks like they're doing. +# +# NOTE: Sometime the Jupyter server needs to be restarted. Do not trust performance tests are run twice +# back to back right after server startup. + +""" Container for an arbitrary JSON value. """ +struct JsonValue + value::Any +end + +function Base.show(io::IO, ::MIME"application/json", json::JsonValue) + JSON3.write(io, json.value) +end + +include("result.jl") +include("kernel_management.jl") + +end diff --git a/packages/algjulia-interop/src/kernel_management.jl b/packages/algjulia-interop/src/kernel/kernel_management.jl similarity index 100% rename from packages/algjulia-interop/src/kernel_management.jl rename to packages/algjulia-interop/src/kernel/kernel_management.jl diff --git a/packages/algjulia-interop/src/kernel_support.jl b/packages/algjulia-interop/src/kernel/kernel_support.jl similarity index 94% rename from packages/algjulia-interop/src/kernel_support.jl rename to packages/algjulia-interop/src/kernel/kernel_support.jl index 15bfde4da..3182f3bb7 100644 --- a/packages/algjulia-interop/src/kernel_support.jl +++ b/packages/algjulia-interop/src/kernel/kernel_support.jl @@ -1,3 +1,5 @@ +module KernelUtility + import JSON3 export JsonValue @@ -30,3 +32,8 @@ end function Base.show(io::IO, ::MIME"application/json", json::JsonValue) JSON3.write(io, json.value) end + +include("result.jl") +include("kernel_management.jl") + +end diff --git a/packages/algjulia-interop/src/result.jl b/packages/algjulia-interop/src/kernel/result.jl similarity index 100% rename from packages/algjulia-interop/src/result.jl rename to packages/algjulia-interop/src/kernel/result.jl diff --git a/packages/algjulia-interop/src/model.jl b/packages/algjulia-interop/src/model.jl new file mode 100644 index 000000000..32a5044c2 --- /dev/null +++ b/packages/algjulia-interop/src/model.jl @@ -0,0 +1,39 @@ +struct ObGenerator + id::String + label::Symbol # TODO maybe + obType::Any # TODO concretize +end + +# TODO macro +ObGenerator(data::AbstractDict) = ObGenerator(getindex.(Ref(data), fieldnames(ObGenerator))...) + +Base.nameof(ob::ObGenerator) = Symbol(ob.label) +Base.getindex(obs::Vector{ObGenerator}, id::String) = only(filter(ob -> ob.id == id, obs)) + +struct MorGenerator + id::String + label::Symbol # TODO maybe + morType::Any # TODO concretize + dom::ObGenerator + cod::ObGenerator +end + +# TODO macro +MorGenerator(data::AbstractDict) = MorGenerator(getindex.(Ref(data), fieldnames(MorGenerator))...) + +Base.nameof(mor::MorGenerator) = Symbol(mor.label) +Base.getindex(obs::Vector{MorGenerator}, id::String) = only(filter(mor -> mor.id == id, mors)) + +struct Model{T<:AlgebraicJuliaIntegration} + ob_generators::Vector{ObGenerator} + mor_generators::Vector{MorGenerator} + Model(::T) where T = Model(T(), ObGenerator[], MorGenerator[]) + Model(::T, obs, mors) where T = new{T}(obs, mors) +end + +function Model(::T, data::AbstractDict) where T <: AlgebraicJuliaIntegration + ob_generators = ObGenerator.(Ref(T()), data[:obGenerators]) + mor_generators = MorGenerator.(Ref(T()), data[:morGenerators]) + Model(T(), ob_generators, mor_generators) +end + diff --git a/packages/algjulia-interop/src/payload.jl b/packages/algjulia-interop/src/payload.jl new file mode 100644 index 000000000..818a51125 --- /dev/null +++ b/packages/algjulia-interop/src/payload.jl @@ -0,0 +1,55 @@ +abstract type AbstractPayload end + +Base.getindex(payload::AbstractPayload, field::Symbol) = payload.data[field] + +""" +""" +struct ModelPayload{T<:AlgebraicJuliaIntegration} <: AbstractPayload + model::Model{T} + data::AbstractDict +end +export ModelPayload + +ModelPayload(model::Model{T}, data) where T = ModelPayload{T}(model, data) + +function ModelPayload(::T, json_str::String) where T <: AlgebraicJuliaIntegration + json = JSON3.read(json_str) + ModelPayload(T(), json) +end + +function ModelPayload(::T, json::AbstractDict) where T <: AlgebraicJuliaIntegration + model = Model(T(), json[:model]) + data = Dict(k => json[k] for k in keys(json) if k ∉ [:model, :diagram]) + ModelPayload(model, data) +end + +""" +CatColab will send a Payload to CatColabInterop. It should consist of a diagram, its model, and incidental data necessary for its analysis' execution. +""" +struct DiagramPayload{T<:AlgebraicJuliaIntegration} <: AbstractPayload + diagram::ModelDiagramPresentation{T} + model::Model{T} + data::AbstractDict +end +export DiagramPayload + +DiagramPayload(diagram::ModelDiagramPresentation{T}, model::Model{T}, data) where T = DiagramPayload{T}(diagram, model, data) + +function DiagramPayload(::T, json_str::String) where T <: AlgebraicJuliaIntegration + json = JSON3.read(json_str) + DiagramPayload(T(), json) +end + +function DiagramPayload(::T, json::AbstractDict) where T <: AlgebraicJuliaIntegration + diagram = ModelDiagramPresentation(T(), json[:diagram]) + model = Model(T(), json[:model]) + data = Dict(k => json[k] for k in keys(json) if k ∉ [:model, :diagram]) + DiagramPayload(diagram, model, data) +end + +""" An analysis is a functor out of a model or its diagram which must simply implement `run` """ +abstract type AbstractAnalysis{T<:AlgebraicJuliaIntegration} end + +# an analysis is something that we run +function run(::AbstractAnalysis{T}) where T end +export run diff --git a/packages/algjulia-interop/src/qualified_name.jl b/packages/algjulia-interop/src/qualified_name.jl new file mode 100644 index 000000000..6b88c9090 --- /dev/null +++ b/packages/algjulia-interop/src/qualified_name.jl @@ -0,0 +1,31 @@ +struct QualifiedName + segments::Vector{String} + QualifiedName() = new([]) + QualifiedName(str::String) = new([str]) +end + +Base.isempty(name::QualifiedName) = isempty(name.segments) +Base.join(name::QualifiedName) = join(name.segments, ".") +Base.convert(::Type{QualifiedName}, str::String) = QualifiedName(str) + +Core.Symbol(name::QualifiedName) = Symbol("$(String(name))") + +struct QualifiedLabel + segments::Vector{String} + QualifiedLabel() = new([]) + QualifiedLabel(str::String) = new([str]) + QualifiedLabel(segments::Vector{String}) = new(segments) +end + +# I want to promote the qualified label to Maybe +Core.String(name::QualifiedLabel) = join(name) +Core.Symbol(name::QualifiedLabel) = Symbol("$(String(name))") + +Base.isempty(name::QualifiedLabel) = isempty(name.segments) +Base.join(name::QualifiedLabel) = join(name.segments, ".") + +Base.convert(::Type{String}, name::QualifiedLabel) = join(name) + +function Base.convert(::Type{QualifiedLabel}, data::T) where T<:AbstractVector + QualifiedLabel([x isa Int ? "•$x" : String(x) for x in data]) +end diff --git a/packages/algjulia-interop/test/model_verification.jl b/packages/algjulia-interop/test/model_verification.jl new file mode 100644 index 000000000..897d37555 --- /dev/null +++ b/packages/algjulia-interop/test/model_verification.jl @@ -0,0 +1,87 @@ +@testset "Text-to-Pode" begin + @test ob_name(ThDecapode(), "0-form") == :Form0 + @test ob_name(ThDecapode(), "1-form") == :Form1 + @test ob_name(ThDecapode(), "2-form") == :Form2 + @test ob_name(ThDecapode(), "dual 0-form") == :DualForm0 + @test ob_name(ThDecapode(), "dual 1-form") == :DualForm1 + @test ob_name(ThDecapode(), "dual 2-form") == :DualForm2 + @test_throws CatColabInterop.ImplError ob_name(ThDecapode(), "Form3") + @test mor_name(ThDecapode(), "∂t") == :∂ₜ + @test mor_name(ThDecapode(), "Δ") == :Δ + @test_throws CatColabInterop.ImplError mor_name(ThDecapode(), "∧") +end + +@testset "Validate model" begin + + # Let's grab a model from one of our examples + payload = JSON3.read(read("test/test_jsons/diagrams/inverse_laplacian_longtrip/analysis.json", String)) + model = Model(ThDecapode(), payload["model"]) + + # The types available to objects and morphisms in this model. + @test Set(nameof.(model.ob_generators)) == Set([:Form0, :Form1, :DualForm1, :DualForm2]) + @test Set(nameof.(model.mor_generators)) == Set([:⋆₀⁻¹, :Δ⁻¹, :d₀, :⋆₁, :dpsw, :♭♯, :dual_d₁, :∂ₜ, :neg]) + +end + +@testset "Analysis - Inverse Laplacian" begin + handcrafted_pode = SummationDecapode(parse_decapode(quote end)) + add_part!(handcrafted_pode, :Var, name=:u, type=:Form0) + add_part!(handcrafted_pode, :Var, name=Symbol("du/dt"), type=:Form0) + add_part!(handcrafted_pode, :Op1, src=1, tgt=2, op1=:Δ⁻¹) + simulation = DecapodeSimulation(read("test/test_jsons/diagrams/inverse_laplacian_longtrip/analysis.json", String)) + @test simulation.pode == handcrafted_pode +end + +@testset "Analysis - Inverse Laplacian, Long trip" begin + handcrafted_pode = SummationDecapode(parse_decapode(quote end)) + add_part!(handcrafted_pode, :Var, name=:u, type=:DualForm2) + add_part!(handcrafted_pode, :Var, name=:u̇, type=:DualForm2) + add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form0) + add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:Form1) + add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:DualForm1) + add_part!(handcrafted_pode, :TVar, incl=2) + add_part!(handcrafted_pode, :Op1, src=1, tgt=2, op1=:∂ₜ) + add_part!(handcrafted_pode, :Op1, src=1, tgt=3, op1=:⋆₀⁻¹) + add_part!(handcrafted_pode, :Op1, src=3, tgt=4, op1=:d₀) + add_part!(handcrafted_pode, :Op1, src=4, tgt=5, op1=:⋆₁) + add_part!(handcrafted_pode, :Op1, src=5, tgt=2, op1=:dual_d₁) + # + simulation = DecapodeSimulation(read("test/test_jsons/diagrams/inverse_laplacian_longtrip/analysis.json", String)) + @test simulation.pode == handcrafted_pode +end + +@testset "Analysis - Laplacian, Scalar" begin end + +#= Vorticity =# +@testset "Analysis - NS Vorticity" begin + + handcrafted_pode = SummationDecapode(parse_decapode(quote end)) + add_part!(handcrafted_pode, :Var, name=:v, type=:DualForm1) + add_part!(handcrafted_pode, :Var, name=:dv, type=:DualForm2) + add_part!(handcrafted_pode, :Var, name=:ψ, type=:Form0) + # infer + add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form0) + add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:Form1) + add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:infer) + add_part!(handcrafted_pode, :Var, name=Symbol("•4"), type=:infer) + add_part!(handcrafted_pode, :Var, name=Symbol("•5"), type=:infer) + add_part!(handcrafted_pode, :Var, name=Symbol("•6"), type=:infer) + add_part!(handcrafted_pode, :Var, name=Symbol("•7"), type=:infer) + # tvar + add_part!(handcrafted_pode, :TVar, incl=9) + # op1 + add_part!(handcrafted_pode, :Op1, src=2, tgt=4, op1=:⋆₀⁻¹) + add_part!(handcrafted_pode, :Op1, src=3, tgt=5, op1=:d₀) # simulation has this wrong + add_part!(handcrafted_pode, :Op1, src=5, tgt=1, op1=:⋆₁) + add_part!(handcrafted_pode, :Op1, src=1, tgt=6, op1=:dpsw) # TODO breaks infer_types + add_part!(handcrafted_pode, :Op1, src=6, tgt=7, op1=:♭♯) + add_part!(handcrafted_pode, :Op1, src=7, tgt=8, op1=:⋆₁) + add_part!(handcrafted_pode, :Op1, src=2, tgt=9, op1=:∂ₜ) + add_part!(handcrafted_pode, :Op1, src=8, tgt=10, op1=:dual_d₁) + add_part!(handcrafted_pode, :Op1, src=10, tgt=9, op1=:neg) + infer_types!(handcrafted_pode) + + simulation = DecapodeSimulation(read("test/test_jsons/diagrams/ns_vort/analysis.json", String)) + @test_broken simulation.pode == handcrafted_pode + +end diff --git a/packages/algjulia-interop/test/runtests.jl b/packages/algjulia-interop/test/runtests.jl index 4688b379c..f1f5c4474 100644 --- a/packages/algjulia-interop/test/runtests.jl +++ b/packages/algjulia-interop/test/runtests.jl @@ -15,225 +15,10 @@ import OrdinaryDiffEq: ReturnCode const KEYS = Set([:mesh, :plotVariables, :initialConditions, :domain, :diagram, :model, :scalars, :duration]) -@testset "Text-to-Pode" begin - @test to_model(ThDecapode(), ObTag(), "0-form") == :Form0 - @test to_model(ThDecapode(), ObTag(), "1-form") == :Form1 - @test to_model(ThDecapode(), ObTag(), "2-form") == :Form2 - @test to_model(ThDecapode(), ObTag(), "dual 0-form") == :DualForm0 - @test to_model(ThDecapode(), ObTag(), "dual 1-form") == :DualForm1 - @test to_model(ThDecapode(), ObTag(), "dual 2-form") == :DualForm2 - @test_throws CatColabInterop.ImplError to_model(ThDecapode(), ObTag(), "Form3") - @test to_model(ThDecapode(), HomTag(), "∂t") == :∂ₜ - @test to_model(ThDecapode(), HomTag(), "Δ") == :Δ - @test_throws CatColabInterop.ImplError to_model(ThDecapode(), HomTag(), "∧") +@testset "Model Verification" begin + include("model_verification.jl") end -modeljson = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "models", "model_dec.json"), "r") -model_dec = Model(ThDecapode(), modeljson) -@testset "Validating the JSON object" begin - # validate the JSON - @test keys(modeljson) == Set([:name, :notebook, :theory, :type]) - cells = modeljson[:notebook][:cells] - @test @match cells[1] begin - IsObject(_) => true - _ => false - end - @test @match cells[5] begin - IsMorphism(_) => true - _ => false - end - model = Model(ThDecapode()) - @match cells[1] begin - IsObject(content) => add_to_model!(model, content, ObTag()) - _ => nothing - end -end -@testset "Validate model" begin - # caveat: \star and \bigstar are different, but indistinguishable in some fonts - @test Set(nameof.(values(model_dec))) == Set([:DualForm1, :⋆₀⁻¹, :dual_d₁, :dpsw, :Form1, :neg, :⋆₁, :DualForm2, :Form0, :Δ⁻¹, :♭♯, :∂ₜ, :d₀]) -end - -# ## load diagram -diagram_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "inverse_laplacian", "diagram.json"), "r") -diagram = Diagram(diagram_json[:notebook], model_dec) -@testset "Diagram - Inverse Laplacian" begin - handcrafted_pode = SummationDecapode(parse_decapode(quote end)) - add_part!(handcrafted_pode, :Var, name=:A, type=:Form0) - add_part!(handcrafted_pode, :Var, name=:B, type=:Form0) - add_part!(handcrafted_pode, :Op1, src=1, tgt=2, op1=:Δ⁻¹) - @test diagram.pode == handcrafted_pode -end - -# TODO not specifying initial boundary conditions for `B` on the front-end -# means that it will be automatically specified -@testset "Analysis - Inverse Laplacian" begin - analysis_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "inverse_laplacian", "analysis.json"), "r") - system = Analysis(analysis_json, diagram) - simulator = evalsim(system.pode) - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()) - soln = run_sim(f, system.init, 50.0, ComponentArray(k=0.5,)) - @test soln.retcode == ReturnCode.Success - result = SimResult(soln, system) - @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - jv = JsonValue(result) -end - -# ## load diagram -diagram_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "inverse_laplacian_longtrip", "diagram.json"), "r") -diagram = Diagram(diagram_json[:notebook], model_dec) -infer_types!(diagram.pode) -@testset "Diagram - Inverse Laplacian - Longtrip" begin - handcrafted_pode = SummationDecapode(parse_decapode(quote end)) - add_part!(handcrafted_pode, :Var, name=:u, type=:Form0) - add_part!(handcrafted_pode, :Var, name=:Δu, type=:Form0) - add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form1) - add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:DualForm1) - add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:DualForm2) - add_part!(handcrafted_pode, :Op1, src=1, tgt=3, op1=:d₀) - add_part!(handcrafted_pode, :Op1, src=3, tgt=4, op1=:⋆₁) - add_part!(handcrafted_pode, :Op1, src=4, tgt=5, op1=:dual_d₁) - add_part!(handcrafted_pode, :Op1, src=5, tgt=2, op1=:⋆₀⁻¹) - add_part!(handcrafted_pode, :Op1, src=1, tgt=2, op1=:Δ⁻¹) - @test diagram.pode == handcrafted_pode -end -# TODO not specifying initial boundary conditions for `B` on the front-end means that it will be automatically specified -@testset "Analysis - Inverse Laplacian - Longtrip" begin - analysis_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "inverse_laplacian_longtrip", "analysis.json"), "r") - system = Analysis(analysis_json, diagram) - simulator = evalsim(system.pode) - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()) - soln = run_sim(f, system.init, 50.0, ComponentArray(k=0.5,)) - @test soln.retcode == ReturnCode.Success - result = SimResult(soln, system) - @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - jv = JsonValue(result) -end - -# ## load diagram -diagram_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "ns_vort", "diagram.json"), "r") -diagram = Diagram(diagram_json[:notebook], model_dec) -infer_types!(diagram.pode) -@testset "Diagram - NS Vorticity" begin - # construct a decapode - handcrafted_pode = SummationDecapode(parse_decapode(quote end)) - add_part!(handcrafted_pode, :Var, name=:v, type=:DualForm1) - add_part!(handcrafted_pode, :Var, name=:dv, type=:DualForm2) - add_part!(handcrafted_pode, :Var, name=:ψ, type=:Form0) - # infer - add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form0) - add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:Form1) - add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:infer) - add_part!(handcrafted_pode, :Var, name=Symbol("•4"), type=:infer) - add_part!(handcrafted_pode, :Var, name=Symbol("•5"), type=:infer) - add_part!(handcrafted_pode, :Var, name=Symbol("•6"), type=:infer) - add_part!(handcrafted_pode, :Var, name=Symbol("•7"), type=:infer) - # tvar - add_part!(handcrafted_pode, :TVar, incl=9) - # op1 - add_part!(handcrafted_pode, :Op1, src=2, tgt=4, op1=:⋆₀⁻¹) - add_part!(handcrafted_pode, :Op1, src=3, tgt=5, op1=:d₀) - add_part!(handcrafted_pode, :Op1, src=5, tgt=1, op1=:⋆₁) - add_part!(handcrafted_pode, :Op1, src=1, tgt=6, op1=:dpsw) # TODO breaks infer_types - add_part!(handcrafted_pode, :Op1, src=6, tgt=7, op1=:♭♯) - add_part!(handcrafted_pode, :Op1, src=7, tgt=8, op1=:⋆₁) - add_part!(handcrafted_pode, :Op1, src=2, tgt=9, op1=:∂ₜ) - add_part!(handcrafted_pode, :Op1, src=8, tgt=10, op1=:dual_d₁) - add_part!(handcrafted_pode, :Op1, src=10, tgt=9, op1=:neg) - infer_types!(handcrafted_pode) - @test diagram.pode == handcrafted_pode -end -# TODO not specifying initial boundary conditions for `B` on the front-end -# means that it will be automatically specified -@testset "Analysis - Navier-Stokes Vorticity" begin - analysis_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "ns_vort", "analysis.json"), "r") - system = Analysis(analysis_json, diagram) - simulator = evalsim(system.pode) - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()) - soln = run_sim(f, system.init, system.duration, ComponentArray(k=0.5,)) - @test soln.retcode == ReturnCode.Success - result = SimResult(soln, system) - @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - jv = JsonValue(result) -end - -## load diagram -modeljson = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "models", "model_dec_scalar.json"), "r") -model_dec_scalar = Model(ThDecapode(), modeljson) -diagram_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "diffusivity_constant", "diagram.json"), "r") -diagram = Diagram(diagram_json[:notebook], model_dec_scalar) -infer_types!(diagram.pode) -@testset "Diagram - Diffusivity Constant" begin - # construct a decapode - handcrafted_pode = SummationDecapode(parse_decapode(quote end)) - add_part!(handcrafted_pode, :Var, name=:u, type=:DualForm2) - add_part!(handcrafted_pode, :Var, name=Symbol("du/dt"), type=:DualForm2) - add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form0) - add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:Form1) - add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:DualForm1) - add_part!(handcrafted_pode, :Var, name=Symbol("•4"), type=:DualForm2) - add_part!(handcrafted_pode, :TVar, incl=2) - add_part!(handcrafted_pode, :Op1, src=1, tgt=3, op1=:⋆₀⁻¹) - add_part!(handcrafted_pode, :Op1, src=3, tgt=4, op1=:d₀) - add_part!(handcrafted_pode, :Op1, src=4, tgt=5, op1=:⋆₁) - add_part!(handcrafted_pode, :Op1, src=5, tgt=6, op1=:dual_d₁) - add_part!(handcrafted_pode, :Op1, src=6, tgt=2, op1=:any_scalar) - add_part!(handcrafted_pode, :Op1, src=1, tgt=2, op1=:∂ₜ) - @test diagram.pode == handcrafted_pode -end -# TODO not specifying initial boundary conditions for `B` on the front-end -# means that it will be automatically specified -@testset "Analysis - Diffusivity Constant" begin - analysis_json = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "diagrams", "diffusivity_constant", "analysis.json"), "r") - system = Analysis(analysis_json, diagram) - simulator = evalsim(system.pode) - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()) - soln = run_sim(f, system.init, system.duration, ComponentArray(k=0.5,)) - @test soln.retcode == ReturnCode.Success - result = SimResult(soln, system) - @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - jv = JsonValue(result) -end - - -# Payload -payloadjson = open(JSON3.read, joinpath(@__DIR__, "test_jsons", "payload.json")) -model = Model(ThDecapode(), payloadjson.model) -diagram = Diagram(payloadjson.diagram, model) -infer_types!(diagram.pode) -# TODO need to verify -@testset "(Payload) Diagram - Diffusivity Constant" begin - # construct a decapode - handcrafted_pode = SummationDecapode(parse_decapode(quote end)) - add_part!(handcrafted_pode, :Var, name=Symbol("dv/dt"), type=:DualForm2) - add_part!(handcrafted_pode, :Var, name=Symbol("•1"), type=:Form0) - add_part!(handcrafted_pode, :Var, name=Symbol("•2"), type=:Form1) - add_part!(handcrafted_pode, :Var, name=Symbol("•3"), type=:DualForm1) - add_part!(handcrafted_pode, :Var, name=Symbol("•4"), type=:DualForm2) - add_part!(handcrafted_pode, :Var, name=:v, type=:DualForm2) - add_part!(handcrafted_pode, :TVar, incl=1) - add_part!(handcrafted_pode, :Op1, src=6, tgt=2, op1=:⋆₀⁻¹) - add_part!(handcrafted_pode, :Op1, src=3, tgt=4, op1=:⋆₁) - add_part!(handcrafted_pode, :Op1, src=5, tgt=1, op1=:any_scalar) - add_part!(handcrafted_pode, :Op1, src=6, tgt=1, op1=:∂ₜ) - add_part!(handcrafted_pode, :Op1, src=4, tgt=5, op1=:dual_d₁) - add_part!(handcrafted_pode, :Op1, src=2, tgt=3, op1=:d₀) - @test diagram.pode == handcrafted_pode -end -# TODO not specifying initial boundary conditions for `B` on the front-end -# means that it will be automatically specified -@testset "Analysis - Diffusivity Constant" begin - system = Analysis(ThDecapode(), payloadjson) - simulator = evalsim(system.pode) - # DEBUGGING SNIPPET: - # path = joinpath(@__DIR__, "testsim.jl") - # open(path, "w") do f - # write(f, string(gensim(system.pode))) - # end - # simulator = include(path) - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()) - soln = run_sim(f, system.init, system.duration, ComponentArray(k=0.5,)) - @test soln.retcode == ReturnCode.Success - result = SimResult(soln, system) - @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} - jv = JsonValue(result) +@testset "Analysis" begin + include("simulation.jl") end diff --git a/packages/algjulia-interop/test/simulation.jl b/packages/algjulia-interop/test/simulation.jl new file mode 100644 index 000000000..61df34c91 --- /dev/null +++ b/packages/algjulia-interop/test/simulation.jl @@ -0,0 +1,29 @@ +@testset "Simulation - ..." begin + payload = read("test/test_jsons/_payload.json", String) + simulation = DecapodeSimulation(payload) + sim = evalsim(simulation.pode) + f = sim(simulation.geometry.dualmesh, simulation.generate, DiagonalHodge()) + result = run(f, simulation, ComponentArray(k=0.5,)) + @test result.retcode == ReturnCode.Success +end + +@testset "Simulation - Inverse Laplacian Longtrip" begin + payload = read("test/test_jsons/inverse_laplacian_longtrip/diagram_analysis.json") + simulation = DecapodeSimulation(payload) + sim = evalsim(simulation.pode) + f = sim(simulation.geometry.dualmesh, simulation.generate, DiagonalHodge()) + result = run(f, simulation, ComponentArray(k=0.5,)) + @test result.retcode == ReturnCode.Success +end + +# TODO not specifying initial boundary conditions for `B` on the front-end +# means that it will be automatically specified +@testset "Simulation - Navier-Stokes Vorticity" begin + payload = read("test/test_jsons/diagrams/ns_vort/analysis.json", String) + simulation = DecapodeSimulation(payload) + sim = evalsim(simulation.pode) + f = sim(simulation.geometry.dualmesh, simulation.generate, DiagonalHodge()) + result = run(f, simulation, ComponentArray(k=0.5,)) + @test result.retcode == ReturnCode.Success + @test typeof(result.state) == Dict{String, Vector{AbstractArray{SVector{3, Float64}}}} +end diff --git a/packages/algjulia-interop/test/test_jsons/diagrams/_diagram_dec.json b/packages/algjulia-interop/test/test_jsons/diagrams/_diagram_dec.json new file mode 100644 index 000000000..7995f5c2a --- /dev/null +++ b/packages/algjulia-interop/test/test_jsons/diagrams/_diagram_dec.json @@ -0,0 +1,79 @@ +{ + "diagramIn": { + "_id": "019a4be7-f557-7181-b642-d4c54bcf4f6f", + "_server": "backend-next.catcolab.org", + "_version": null, + "type": "diagram-in" + }, + "name": "", + "notebook": { + "cellContents": { + "019a4be8-3d0f-747e-b791-546c731fcbf1": { + "tag": "formal", + "id": "019a4be8-3d0f-747e-b791-546c731fcbf1", + "content": { + "tag": "object", + "id": "019a4be8-3d0f-747e-b791-50a7dd0418fa", + "name": "A", + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + } + }, + "019a4be8-502f-7777-a0dd-a9265a951830": { + "tag": "formal", + "id": "019a4be8-502f-7777-a0dd-a9265a951830", + "content": { + "tag": "object", + "id": "019a4be8-502f-7777-a0dd-a6684ff2a6ce", + "name": "B", + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + } + }, + "019a4be8-616f-77ae-80a4-1f9e462b2c91": { + "tag": "formal", + "id": "019a4be8-616f-77ae-80a4-1f9e462b2c91", + "content": { + "tag": "morphism", + "id": "019a4be8-616f-77ae-80a4-18f9eb06e548", + "name": "", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-6084-7537-aec1-caf560ba416b" + }, + "dom": { + "tag": "Basic", + "content": "019a4be8-3d0f-747e-b791-50a7dd0418fa" + }, + "cod": { + "tag": "Basic", + "content": "019a4be8-502f-7777-a0dd-a6684ff2a6ce" + } + } + } + }, + "cellOrder": [ + "019a4be8-3d0f-747e-b791-546c731fcbf1", + "019a4be8-502f-7777-a0dd-a9265a951830", + "019a4be8-616f-77ae-80a4-1f9e462b2c91" + ] + }, + "type": "diagram", + "version": "1" +} diff --git a/packages/algjulia-interop/test/test_jsons/diagrams/inverse_laplacian_longtrip/diagram_analysis.json b/packages/algjulia-interop/test/test_jsons/diagrams/inverse_laplacian_longtrip/diagram_analysis.json new file mode 100644 index 000000000..ebb5612d8 --- /dev/null +++ b/packages/algjulia-interop/test/test_jsons/diagrams/inverse_laplacian_longtrip/diagram_analysis.json @@ -0,0 +1,391 @@ +{ + "diagram": { + "obGenerators": [ + { + "id": "019a5ace-3497-71db-a8f9-c2d02e5e7182", + "label": [ + "u" + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "019a5ace-4426-77a8-8242-7930b07560fe", + "label": [ + "du/dt" + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "019a5ace-7078-7799-babf-1b3d8043759f", + "label": [ + 1 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "019a5ace-a18b-71b3-9aa1-7948b0ad138f", + "label": [ + 2 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "019a5acf-10cb-7083-84aa-191fa52123ae", + "label": [ + 3 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + } + ], + "morGenerators": [ + { + "id": "019a5ace-ea37-70a5-ab29-74183295ba2e", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39c-622d-7599-bc5c-e7e8208d6cdd" + }, + "dom": { + "tag": "Basic", + "content": "019a5ace-3497-71db-a8f9-c2d02e5e7182" + }, + "cod": { + "tag": "Basic", + "content": "019a5ace-4426-77a8-8242-7930b07560fe" + } + }, + { + "id": "019a5ace-5fd7-708e-813e-a4e9201ee874", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d399-34f3-773c-91b9-857da9c4311f" + }, + "dom": { + "tag": "Basic", + "content": "019a5ace-3497-71db-a8f9-c2d02e5e7182" + }, + "cod": { + "tag": "Basic", + "content": "019a5ace-7078-7799-babf-1b3d8043759f" + } + }, + { + "id": "019a5ace-9226-73aa-a51a-1b88a752d247", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-6084-7537-aec1-caf560ba416b" + }, + "dom": { + "tag": "Basic", + "content": "019a5ace-7078-7799-babf-1b3d8043759f" + }, + "cod": { + "tag": "Basic", + "content": "019a5ace-a18b-71b3-9aa1-7948b0ad138f" + } + }, + { + "id": "019a5ace-beb6-71fa-8efa-3585825be090", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-ed25-710f-b53f-89541021281f" + }, + "dom": { + "tag": "Basic", + "content": "019a5ace-a18b-71b3-9aa1-7948b0ad138f" + }, + "cod": { + "tag": "Basic", + "content": "019a5acf-10cb-7083-84aa-191fa52123ae" + } + }, + { + "id": "019a5acf-193d-720c-96b4-42680fe15ab6", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39d-d297-77a9-95a2-6ed7105fdca3" + }, + "dom": { + "tag": "Basic", + "content": "019a5acf-10cb-7083-84aa-191fa52123ae" + }, + "cod": { + "tag": "Basic", + "content": "019a5ace-4426-77a8-8242-7930b07560fe" + } + } + ] + }, + "model": { + "obGenerators": [ + { + "id": "0194d398-a28e-7433-89f8-563bae6e6875", + "label": [ + "0-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d398-b3ef-728d-bd88-60b48fd7349a", + "label": [ + "Dual 1-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d398-d0cb-7308-b7e0-eace5b21af24", + "label": [ + "Dual 2-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", + "label": [ + "Primal 1-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + } + ], + "morGenerators": [ + { + "id": "0194d399-34f3-773c-91b9-857da9c4311f", + "label": [ + " ⋆₀⁻¹" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "0194d399-b2a2-73ff-aece-cb0f26644045", + "label": [ + "Δ⁻¹" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "0194d39a-6084-7537-aec1-caf560ba416b", + "label": [ + "d₀" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + }, + "cod": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "0194d39a-ed25-710f-b53f-89541021281f", + "label": [ + "⋆₁" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "0194d39b-587f-7559-a1ff-b6ed58899461", + "label": [ + "lamb" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "0194d39b-a70a-77d5-8e89-66f0e767a9da", + "label": [ + " ♭♯" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", + "label": [ + "d̃₁" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", + "label": [ + "∂ₜ" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "0194d39e-5d44-77cd-bc5e-156c5c56ae85", + "label": [ + "-" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + } + ] + }, + "domain": "Plane", + "mesh": "Rectangle", + "initialConditions": { + "019a5ace-3497-71db-a8f9-c2d02e5e7182": "Gaussian" + }, + "plotVariables": [ + "019a5ace-3497-71db-a8f9-c2d02e5e7182" + ], + "scalars": {}, + "duration": 10 +} diff --git a/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/analysis.json b/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/analysis.json index 8838d4941..912e83afd 100644 --- a/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/analysis.json +++ b/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/analysis.json @@ -1 +1,557 @@ -{"analysisOf":{"_id":"0195ecc4-4c4d-70e2-bee7-18221e6c42e7","_server":"backend.catcolab.org","_version":null,"type":"analysis-of"},"analysisType":"diagram","name":"","notebook":{"cells":[{"content":{"content":{"domain":"Sphere","duration":1,"initialConditions":{"0195ecc5-9eaf-71dd-a9c8-621d888e2add":"TaylorVortex","0195ecc5-b1b0-746e-8a04-ebd359da2bfd":"TaylorVortex","0195ecc5-d39a-72bf-8cd3-236d5211e122":"TaylorVortex"},"mesh":"Icosphere6","plotVariables":{"0195ecc5-9eaf-71dd-a9c8-621d888e2add":true},"scalars":{}},"id":"decapodes"},"id":"0195ecca-f11e-74c8-8fa4-fb8b03a93274","tag":"formal"}]},"type":"analysis"} +{ + "diagram": { + "obGenerators": [ + { + "id": "019a57e3-4df4-7399-b7ed-0cd4d7522ddb", + "label": [ + "v" + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "019a57e3-5f93-71d8-8dc5-1c9e62a5a072", + "label": [ + "dv" + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "019a57e3-795f-770b-9c97-417b08162302", + "label": [ + "ψ" + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "019a57e3-ba4f-76ea-bb74-089679300d6e", + "label": [ + 1 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "019a57e4-07f9-728f-abf2-fb904a25947a", + "label": [ + 2 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "019a57e4-4416-76aa-a619-a2751769ce55", + "label": [ + 3 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "019a57e4-6e30-701d-8ebf-5cfa1694d240", + "label": [ + 4 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "019a57e4-8cac-72ae-8a61-ae889c4cab82", + "label": [ + 5 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "019a57e4-ba19-72fb-a891-78a28a81042c", + "label": [ + 6 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "019a57f2-c8f8-70b0-9868-baff77d2ba3a", + "label": [ + 7 + ], + "obType": { + "tag": "Basic", + "content": "Object" + }, + "over": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + } + ], + "morGenerators": [ + { + "id": "019a57e3-a85a-7369-92e2-ae06706cd003", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d399-34f3-773c-91b9-857da9c4311f" + }, + "dom": { + "tag": "Basic", + "content": "019a57e3-5f93-71d8-8dc5-1c9e62a5a072" + }, + "cod": { + "tag": "Basic", + "content": "019a57e3-ba4f-76ea-bb74-089679300d6e" + } + }, + { + "id": "019a57e3-c2f3-765e-9114-8bd4c87f0ae9", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d399-b2a2-73ff-aece-cb0f26644045" + }, + "dom": { + "tag": "Basic", + "content": "019a57e3-ba4f-76ea-bb74-089679300d6e" + }, + "cod": { + "tag": "Basic", + "content": "019a57e3-795f-770b-9c97-417b08162302" + } + }, + { + "id": "019a57e3-e94e-775e-98e9-c99c2d94e97b", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-6084-7537-aec1-caf560ba416b" + }, + "dom": { + "tag": "Basic", + "content": "019a57e3-795f-770b-9c97-417b08162302" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-07f9-728f-abf2-fb904a25947a" + } + }, + { + "id": "019a57e4-1014-72ac-b068-0174b22e7526", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-ed25-710f-b53f-89541021281f" + }, + "dom": { + "tag": "Basic", + "content": "019a57e4-07f9-728f-abf2-fb904a25947a" + }, + "cod": { + "tag": "Basic", + "content": "019a57e3-4df4-7399-b7ed-0cd4d7522ddb" + } + }, + { + "id": "019a57e4-354a-7722-a6d5-db01ce3eed64", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39b-587f-7559-a1ff-b6ed58899461" + }, + "dom": { + "tag": "Basic", + "content": "019a57e3-4df4-7399-b7ed-0cd4d7522ddb" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-4416-76aa-a619-a2751769ce55" + } + }, + { + "id": "019a57e4-4c71-76f2-936b-4862c73cf167", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39b-a70a-77d5-8e89-66f0e767a9da" + }, + "dom": { + "tag": "Basic", + "content": "019a57e4-4416-76aa-a619-a2751769ce55" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-6e30-701d-8ebf-5cfa1694d240" + } + }, + { + "id": "019a57e4-758a-71df-89db-56ef0d89048d", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39a-ed25-710f-b53f-89541021281f" + }, + "dom": { + "tag": "Basic", + "content": "019a57e4-6e30-701d-8ebf-5cfa1694d240" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-8cac-72ae-8a61-ae889c4cab82" + } + }, + { + "id": "019a57e4-a86a-76ab-804d-26c74ccd887a", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39c-622d-7599-bc5c-e7e8208d6cdd" + }, + "dom": { + "tag": "Basic", + "content": "019a57e3-5f93-71d8-8dc5-1c9e62a5a072" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-ba19-72fb-a891-78a28a81042c" + } + }, + { + "id": "019a57f2-a590-743b-99aa-debd43ba9b19", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39d-d297-77a9-95a2-6ed7105fdca3" + }, + "dom": { + "tag": "Basic", + "content": "019a57e4-8cac-72ae-8a61-ae889c4cab82" + }, + "cod": { + "tag": "Basic", + "content": "019a57f2-c8f8-70b0-9868-baff77d2ba3a" + } + }, + { + "id": "019a57f2-d229-74bd-a923-838743189fa3", + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "over": { + "tag": "Basic", + "content": "0194d39e-5d44-77cd-bc5e-156c5c56ae85" + }, + "dom": { + "tag": "Basic", + "content": "019a57f2-c8f8-70b0-9868-baff77d2ba3a" + }, + "cod": { + "tag": "Basic", + "content": "019a57e4-ba19-72fb-a891-78a28a81042c" + } + } + ] + }, + "model": { + "obGenerators": [ + { + "id": "0194d398-a28e-7433-89f8-563bae6e6875", + "label": [ + "0-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d398-b3ef-728d-bd88-60b48fd7349a", + "label": [ + "Dual 1-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d398-d0cb-7308-b7e0-eace5b21af24", + "label": [ + "Dual 2-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + }, + { + "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", + "label": [ + "Primal 1-form" + ], + "obType": { + "tag": "Basic", + "content": "Object" + } + } + ], + "morGenerators": [ + { + "id": "0194d399-34f3-773c-91b9-857da9c4311f", + "label": [ + " ⋆₀⁻¹" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "0194d399-b2a2-73ff-aece-cb0f26644045", + "label": [ + "Δ⁻¹" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + } + }, + { + "id": "0194d39a-6084-7537-aec1-caf560ba416b", + "label": [ + "d₀" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-a28e-7433-89f8-563bae6e6875" + }, + "cod": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "0194d39a-ed25-710f-b53f-89541021281f", + "label": [ + "⋆₁" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "0194d39b-587f-7559-a1ff-b6ed58899461", + "label": [ + "lamb" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + } + }, + { + "id": "0194d39b-a70a-77d5-8e89-66f0e767a9da", + "label": [ + " ♭♯" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" + } + }, + { + "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", + "label": [ + "d̃₁" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", + "label": [ + "∂ₜ" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + }, + { + "id": "0194d39e-5d44-77cd-bc5e-156c5c56ae85", + "label": [ + "-" + ], + "morType": { + "tag": "Basic", + "content": "Nonscalar" + }, + "dom": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + }, + "cod": { + "tag": "Basic", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" + } + } + ] + }, + "domain": "Sphere", + "mesh": "Icosphere6", + "initialConditions": { + "019a57e3-4df4-7399-b7ed-0cd4d7522ddb": "TaylorVortex", + "019a57e3-5f93-71d8-8dc5-1c9e62a5a072": "TaylorVortex" + }, + "plotVariables": [ + "019a57e3-5f93-71d8-8dc5-1c9e62a5a072" + ], + "scalars": {}, + "duration": 10 +} diff --git a/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/diagram.json b/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/diagram.json deleted file mode 100644 index 4e0f694ed..000000000 --- a/packages/algjulia-interop/test/test_jsons/diagrams/ns_vort/diagram.json +++ /dev/null @@ -1 +0,0 @@ -{"diagramIn":{"_id":"0195ecc4-309b-7742-b7d7-35f8ba9021f9","_server":"backend.catcolab.org","_version":null,"type":"diagram-in"},"name":"","notebook":{"cells":[{"content":{"id":"0195ecc5-9eaf-71dd-a9c8-621d888e2add","name":"v","obType":{"content":"Object","tag":"Basic"},"over":{"content":"0194d398-b3ef-728d-bd88-60b48fd7349a","tag":"Basic"},"tag":"object"},"id":"0195ecc5-9eb0-70f9-b2c0-36f0f3d4cd28","tag":"formal"},{"content":{"id":"0195ecc5-b1b0-746e-8a04-ebd359da2bfd","name":"dv","obType":{"content":"Object","tag":"Basic"},"over":{"content":"0194d398-d0cb-7308-b7e0-eace5b21af24","tag":"Basic"},"tag":"object"},"id":"0195ecc5-b1b0-746e-8a04-ef250a7afe00","tag":"formal"},{"content":{"id":"0195ecc5-d39a-72bf-8cd3-236d5211e122","name":"ψ","obType":{"content":"Object","tag":"Basic"},"over":{"content":"0194d398-a28e-7433-89f8-563bae6e6875","tag":"Basic"},"tag":"object"},"id":"0195ecc5-d39a-72bf-8cd3-26a9e71b49bf","tag":"formal"},{"content":{"cod":{"content":"0195ecc6-f2ab-719c-844b-b8413517e269","tag":"Basic"},"dom":{"content":"0195ecc5-b1b0-746e-8a04-ebd359da2bfd","tag":"Basic"},"id":"0195ecc6-ce3f-7607-bce9-cb3fa3ddb4a6","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d399-34f3-773c-91b9-857da9c4311f","tag":"Basic"},"tag":"morphism"},"id":"0195ecc6-ce3f-7607-bce9-cf213389bf95","tag":"formal"},{"content":{"cod":{"content":"0195ecc7-388f-72c0-a4f1-3b89ed8aa6e0","tag":"Basic"},"dom":{"content":"0195ecc5-d39a-72bf-8cd3-236d5211e122","tag":"Basic"},"id":"0195ecc7-10a4-755e-8cc7-a3900d37dc93","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39a-6084-7537-aec1-caf560ba416b","tag":"Basic"},"tag":"morphism"},"id":"0195ecc7-10a4-755e-8cc7-a45b6cbd1cb8","tag":"formal"},{"content":{"cod":{"content":"0195ecc5-9eaf-71dd-a9c8-621d888e2add","tag":"Basic"},"dom":{"content":"0195ecc7-388f-72c0-a4f1-3b89ed8aa6e0","tag":"Basic"},"id":"0195ecc7-4faa-751f-951d-4d854f43a59d","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39a-ed25-710f-b53f-89541021281f","tag":"Basic"},"tag":"morphism"},"id":"0195ecc7-4faa-751f-951d-50a87eb7eb09","tag":"formal"},{"content":{"cod":{"content":"0195ecc7-8f7f-720e-b1ef-befd8deb0e78","tag":"Basic"},"dom":{"content":"0195ecc5-9eaf-71dd-a9c8-621d888e2add","tag":"Basic"},"id":"0195ecc7-7698-70a8-8847-3b021b1f48fa","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39b-587f-7559-a1ff-b6ed58899461","tag":"Basic"},"tag":"morphism"},"id":"0195ecc7-7698-70a8-8847-3d286c36d0e8","tag":"formal"},{"content":{"cod":{"content":"0195ecc7-c18e-7632-990d-33dd4afe1f87","tag":"Basic"},"dom":{"content":"0195ecc7-8f7f-720e-b1ef-befd8deb0e78","tag":"Basic"},"id":"0195ecc7-9a27-77fd-bbe3-320fa00047ed","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39b-a70a-77d5-8e89-66f0e767a9da","tag":"Basic"},"tag":"morphism"},"id":"0195ecc7-9a27-77fd-bbe3-36268ee77145","tag":"formal"},{"content":{"cod":{"content":"0195ecc7-f8e6-761b-a52e-3ecbe49ddaa1","tag":"Basic"},"dom":{"content":"0195ecc7-c18e-7632-990d-33dd4afe1f87","tag":"Basic"},"id":"0195ecc7-c925-74fb-9fa4-b172831ead97","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39a-ed25-710f-b53f-89541021281f","tag":"Basic"},"tag":"morphism"},"id":"0195ecc7-c925-74fb-9fa4-b74dfa39bba8","tag":"formal"},{"content":{"cod":{"content":"0195ecca-5a2c-71cd-998d-d0f25a79a266","tag":"Basic"},"dom":{"content":"0195ecc5-b1b0-746e-8a04-ebd359da2bfd","tag":"Basic"},"id":"0195ecc9-bcfd-7689-bc42-75a237fe9c2c","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39c-622d-7599-bc5c-e7e8208d6cdd","tag":"Basic"},"tag":"morphism"},"id":"0195ecc9-bcfd-7689-bc42-7a6c6e84d4f3","tag":"formal"},{"content":{"cod":{"content":"0195ecca-8dd0-7735-9d74-c73dc1c8eb9e","tag":"Basic"},"dom":{"content":"0195ecc7-f8e6-761b-a52e-3ecbe49ddaa1","tag":"Basic"},"id":"0195ecca-64d2-71e7-9f79-31cb7d8cb95e","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39d-d297-77a9-95a2-6ed7105fdca3","tag":"Basic"},"tag":"morphism"},"id":"0195ecca-64d2-71e7-9f79-3708a3062d71","tag":"formal"},{"content":{"cod":{"content":"0195ecca-5a2c-71cd-998d-d0f25a79a266","tag":"Basic"},"dom":{"content":"0195ecca-8dd0-7735-9d74-c73dc1c8eb9e","tag":"Basic"},"id":"0195ecca-98d7-73f7-9297-b8b693434f99","morType":{"content":"Nonscalar","tag":"Basic"},"name":"","over":{"content":"0194d39e-5d44-77cd-bc5e-156c5c56ae85","tag":"Basic"},"tag":"morphism"},"id":"0195ecca-98d7-73f7-9297-be3feb46d9b9","tag":"formal"}]},"type":"diagram"} diff --git a/packages/algjulia-interop/test/test_jsons/diffconst_payload1.json b/packages/algjulia-interop/test/test_jsons/diffconst_payload1.json deleted file mode 100644 index 1a0039420..000000000 --- a/packages/algjulia-interop/test/test_jsons/diffconst_payload1.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "diagram": [ - { - "tag": "object", - "name": "du/dt", - "id": "0196021d-1aa4-776d-b4fb-05d24d0c6de4", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021e-9635-74de-845a-cee56d3e5cc5", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-a28e-7433-89f8-563bae6e6875" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021e-e55e-764e-85c8-827f94d7f3bd", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021f-0a11-7443-b5da-31175c628e3c", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021f-4c93-70dc-8e61-24459f79f837", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "object", - "name": "u", - "id": "0196021c-f5fe-70f3-ac68-89ae212970ea", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-848d-704c-a45c-a325b63951e6", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d399-34f3-773c-91b9-857da9c4311f" - }, - "dom": { - "tag": "Basic", - "content": "0196021c-f5fe-70f3-ac68-89ae212970ea" - }, - "cod": { - "tag": "Basic", - "content": "0196021e-9635-74de-845a-cee56d3e5cc5" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-ecf9-7408-b881-d981c4e85222", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-ed25-710f-b53f-89541021281f" - }, - "dom": { - "tag": "Basic", - "content": "0196021e-e55e-764e-85c8-827f94d7f3bd" - }, - "cod": { - "tag": "Basic", - "content": "0196021f-0a11-7443-b5da-31175c628e3c" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021f-6b45-751e-8313-df1024cd9fa0", - "morType": { - "tag": "Hom", - "content": { - "tag": "Basic", - "content": "Object" - } - }, - "over": { - "tag": "Basic", - "content": "01960dde-1193-7132-b662-9bf24ed05264" - }, - "dom": { - "tag": "Basic", - "content": "0196021f-4c93-70dc-8e61-24459f79f837" - }, - "cod": { - "tag": "Basic", - "content": "0196021d-1aa4-776d-b4fb-05d24d0c6de4" - } - }, - { - "tag": "morphism", - "name": "", - "id": "01960df4-b95f-7660-90b6-aaf1dc940a15", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39c-622d-7599-bc5c-e7e8208d6cdd" - }, - "dom": { - "tag": "Basic", - "content": "0196021c-f5fe-70f3-ac68-89ae212970ea" - }, - "cod": { - "tag": "Basic", - "content": "0196021d-1aa4-776d-b4fb-05d24d0c6de4" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021f-1ba8-77a5-a635-8b3ca32ae99c", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39d-d297-77a9-95a2-6ed7105fdca3" - }, - "dom": { - "tag": "Basic", - "content": "0196021f-0a11-7443-b5da-31175c628e3c" - }, - "cod": { - "tag": "Basic", - "content": "0196021f-4c93-70dc-8e61-24459f79f837" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-c8a6-74df-8194-3ec769ba3d1d", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-6084-7537-aec1-caf560ba416b" - }, - "dom": { - "tag": "Basic", - "content": "0196021e-9635-74de-845a-cee56d3e5cc5" - }, - "cod": { - "tag": "Basic", - "content": "0196021e-e55e-764e-85c8-827f94d7f3bd" - } - } - ], - "model": [ - { - "id": "0194d398-a28e-7433-89f8-563bae6e6875", - "name": "0-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "name": "Dual 1-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "name": "Dual 2-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "name": "Primal 1-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "cod": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d399-34f3-773c-91b9-857da9c4311f", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": " ⋆₀⁻¹", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "id": "0194d399-b2a2-73ff-aece-cb0f26644045", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "Δ⁻¹", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "id": "0194d39a-6084-7537-aec1-caf560ba416b", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "d₀", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "dom": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "id": "0194d39a-ed25-710f-b53f-89541021281f", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "⋆₁", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39b-587f-7559-a1ff-b6ed58899461", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "lamb", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39b-a70a-77d5-8e89-66f0e767a9da", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": " ♭♯", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "d̃₁", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "∂ₜ", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d39e-5d44-77cd-bc5e-156c5c56ae85", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "-", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "01960dde-1193-7132-b662-9bf24ed05264", - "morType": { - "content": { - "content": "Object", - "tag": "Basic" - }, - "tag": "Hom" - }, - "name": "any_scalar", - "tag": "morphism" - } - ], - "domain": "Plane", - "mesh": "Rectangle", - "initialConditions": { - "0196021c-f5fe-70f3-ac68-89ae212970ea": "Gaussian", - "0196021d-1aa4-776d-b4fb-05d24d0c6de4": "Gaussian" - }, - "plotVariables": [ - "0196021c-f5fe-70f3-ac68-89ae212970ea" - ], - "scalars": { - "01960dde-1193-7132-b662-9bf24ed05264": 0.5 - }, - "duration": 10 -} diff --git a/packages/algjulia-interop/test/test_jsons/models/model_dec.json b/packages/algjulia-interop/test/test_jsons/models/model_dec.json index f7053967f..1096c3af6 100644 --- a/packages/algjulia-interop/test/test_jsons/models/model_dec.json +++ b/packages/algjulia-interop/test/test_jsons/models/model_dec.json @@ -1,8 +1,8 @@ { "name": "DEC for vorticity", "notebook": { - "cells": [ - { + "cellContents": { + "0194d398-a28e-7433-89f8-5a563b37d845": { "content": { "id": "0194d398-a28e-7433-89f8-563bae6e6875", "name": "0-form", @@ -15,7 +15,7 @@ "id": "0194d398-a28e-7433-89f8-5a563b37d845", "tag": "formal" }, - { + "0194d398-b3ef-728d-bd88-64aa410935d0": { "content": { "id": "0194d398-b3ef-728d-bd88-60b48fd7349a", "name": "Dual 1-form", @@ -28,7 +28,7 @@ "id": "0194d398-b3ef-728d-bd88-64aa410935d0", "tag": "formal" }, - { + "0194d398-d0cb-7308-b7e0-ed7c6bca5073": { "content": { "id": "0194d398-d0cb-7308-b7e0-eace5b21af24", "name": "Dual 2-form", @@ -41,20 +41,7 @@ "id": "0194d398-d0cb-7308-b7e0-ed7c6bca5073", "tag": "formal" }, - { - "content": { - "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "name": "Primal 1-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - "id": "0194d39a-89cf-762b-9d2a-58435e3f239e", - "tag": "formal" - }, - { + "0194d399-34f3-773c-91b9-8ba5ecdb1ae3": { "content": { "cod": { "content": "0194d398-a28e-7433-89f8-563bae6e6875", @@ -75,7 +62,7 @@ "id": "0194d399-34f3-773c-91b9-8ba5ecdb1ae3", "tag": "formal" }, - { + "0194d399-b2a2-73ff-aece-ccafcd2f4901": { "content": { "cod": { "content": "0194d398-a28e-7433-89f8-563bae6e6875", @@ -96,7 +83,7 @@ "id": "0194d399-b2a2-73ff-aece-ccafcd2f4901", "tag": "formal" }, - { + "0194d39a-6084-7537-aec1-cf63f29c9a9f": { "content": { "cod": { "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", @@ -117,7 +104,20 @@ "id": "0194d39a-6084-7537-aec1-cf63f29c9a9f", "tag": "formal" }, - { + "0194d39a-89cf-762b-9d2a-58435e3f239e": { + "content": { + "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", + "name": "Primal 1-form", + "obType": { + "content": "Object", + "tag": "Basic" + }, + "tag": "object" + }, + "id": "0194d39a-89cf-762b-9d2a-58435e3f239e", + "tag": "formal" + }, + "0194d39a-ed25-710f-b53f-8dfad8f332aa": { "content": { "cod": { "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", @@ -138,7 +138,7 @@ "id": "0194d39a-ed25-710f-b53f-8dfad8f332aa", "tag": "formal" }, - { + "0194d39b-587f-7559-a1ff-b9a4cc198cff": { "content": { "cod": { "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", @@ -159,7 +159,7 @@ "id": "0194d39b-587f-7559-a1ff-b9a4cc198cff", "tag": "formal" }, - { + "0194d39b-a70a-77d5-8e89-6a34504e2754": { "content": { "cod": { "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", @@ -180,49 +180,49 @@ "id": "0194d39b-a70a-77d5-8e89-6a34504e2754", "tag": "formal" }, - { + "0194d39c-622d-7599-bc5c-e86b88f88031": { "content": { "cod": { "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", "tag": "Basic" }, "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", + "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", "tag": "Basic" }, - "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", + "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", "morType": { "content": "Nonscalar", "tag": "Basic" }, - "name": "d̃₁", + "name": "∂ₜ", "tag": "morphism" }, - "id": "0194d39d-d297-77a9-95a2-71f5210cecf2", + "id": "0194d39c-622d-7599-bc5c-e86b88f88031", "tag": "formal" }, - { + "0194d39d-d297-77a9-95a2-71f5210cecf2": { "content": { "cod": { "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", "tag": "Basic" }, "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", + "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", "tag": "Basic" }, - "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", + "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", "morType": { "content": "Nonscalar", "tag": "Basic" }, - "name": "∂ₜ", + "name": "d̃₁", "tag": "morphism" }, - "id": "0194d39c-622d-7599-bc5c-e86b88f88031", + "id": "0194d39d-d297-77a9-95a2-71f5210cecf2", "tag": "formal" }, - { + "0194d39e-5d44-77cd-bc5e-1aa6b0a2d8d4": { "content": { "cod": { "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", @@ -243,8 +243,24 @@ "id": "0194d39e-5d44-77cd-bc5e-1aa6b0a2d8d4", "tag": "formal" } + }, + "cellOrder": [ + "0194d398-a28e-7433-89f8-5a563b37d845", + "0194d398-b3ef-728d-bd88-64aa410935d0", + "0194d398-d0cb-7308-b7e0-ed7c6bca5073", + "0194d39a-89cf-762b-9d2a-58435e3f239e", + "0194d399-34f3-773c-91b9-8ba5ecdb1ae3", + "0194d399-b2a2-73ff-aece-ccafcd2f4901", + "0194d39a-6084-7537-aec1-cf63f29c9a9f", + "0194d39a-ed25-710f-b53f-8dfad8f332aa", + "0194d39b-587f-7559-a1ff-b9a4cc198cff", + "0194d39b-a70a-77d5-8e89-6a34504e2754", + "0194d39d-d297-77a9-95a2-71f5210cecf2", + "0194d39c-622d-7599-bc5c-e86b88f88031", + "0194d39e-5d44-77cd-bc5e-1aa6b0a2d8d4" ] }, "theory": "unary-dec", - "type": "model" -} \ No newline at end of file + "type": "model", + "version": "1" +} diff --git a/packages/algjulia-interop/test/test_jsons/payload.json b/packages/algjulia-interop/test/test_jsons/payload.json deleted file mode 100644 index a8d46701e..000000000 --- a/packages/algjulia-interop/test/test_jsons/payload.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "diagram": [ - { - "tag": "object", - "name": "dv/dt", - "id": "0196021d-1aa4-776d-b4fb-05d24d0c6de4", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021e-9635-74de-845a-cee56d3e5cc5", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-a28e-7433-89f8-563bae6e6875" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021e-e55e-764e-85c8-827f94d7f3bd", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021f-0a11-7443-b5da-31175c628e3c", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a" - } - }, - { - "tag": "object", - "name": "", - "id": "0196021f-4c93-70dc-8e61-24459f79f837", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "object", - "name": "v", - "id": "0196021c-f5fe-70f3-ac68-89ae212970ea", - "obType": { - "tag": "Basic", - "content": "Object" - }, - "over": { - "tag": "Basic", - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-848d-704c-a45c-a325b63951e6", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d399-34f3-773c-91b9-857da9c4311f" - }, - "dom": { - "tag": "Basic", - "content": "0196021c-f5fe-70f3-ac68-89ae212970ea" - }, - "cod": { - "tag": "Basic", - "content": "0196021e-9635-74de-845a-cee56d3e5cc5" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-ecf9-7408-b881-d981c4e85222", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-ed25-710f-b53f-89541021281f" - }, - "dom": { - "tag": "Basic", - "content": "0196021e-e55e-764e-85c8-827f94d7f3bd" - }, - "cod": { - "tag": "Basic", - "content": "0196021f-0a11-7443-b5da-31175c628e3c" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021f-6b45-751e-8313-df1024cd9fa0", - "morType": { - "tag": "Hom", - "content": { - "tag": "Basic", - "content": "Object" - } - }, - "over": { - "tag": "Basic", - "content": "01960dde-1193-7132-b662-9bf24ed05264" - }, - "dom": { - "tag": "Basic", - "content": "0196021f-4c93-70dc-8e61-24459f79f837" - }, - "cod": { - "tag": "Basic", - "content": "0196021d-1aa4-776d-b4fb-05d24d0c6de4" - } - }, - { - "tag": "morphism", - "name": "", - "id": "01960df4-b95f-7660-90b6-aaf1dc940a15", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39c-622d-7599-bc5c-e7e8208d6cdd" - }, - "dom": { - "tag": "Basic", - "content": "0196021c-f5fe-70f3-ac68-89ae212970ea" - }, - "cod": { - "tag": "Basic", - "content": "0196021d-1aa4-776d-b4fb-05d24d0c6de4" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021f-1ba8-77a5-a635-8b3ca32ae99c", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39d-d297-77a9-95a2-6ed7105fdca3" - }, - "dom": { - "tag": "Basic", - "content": "0196021f-0a11-7443-b5da-31175c628e3c" - }, - "cod": { - "tag": "Basic", - "content": "0196021f-4c93-70dc-8e61-24459f79f837" - } - }, - { - "tag": "morphism", - "name": "", - "id": "0196021e-c8a6-74df-8194-3ec769ba3d1d", - "morType": { - "tag": "Basic", - "content": "Nonscalar" - }, - "over": { - "tag": "Basic", - "content": "0194d39a-6084-7537-aec1-caf560ba416b" - }, - "dom": { - "tag": "Basic", - "content": "0196021e-9635-74de-845a-cee56d3e5cc5" - }, - "cod": { - "tag": "Basic", - "content": "0196021e-e55e-764e-85c8-827f94d7f3bd" - } - } - ], - "model": [ - { - "id": "0194d398-a28e-7433-89f8-563bae6e6875", - "name": "0-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "name": "Dual 1-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "name": "Dual 2-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "id": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "name": "Primal 1-form", - "obType": { - "content": "Object", - "tag": "Basic" - }, - "tag": "object" - }, - { - "cod": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d399-34f3-773c-91b9-857da9c4311f", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": " ⋆₀⁻¹", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "id": "0194d399-b2a2-73ff-aece-cb0f26644045", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "Δ⁻¹", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-a28e-7433-89f8-563bae6e6875", - "tag": "Basic" - }, - "id": "0194d39a-6084-7537-aec1-caf560ba416b", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "d₀", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "dom": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "id": "0194d39a-ed25-710f-b53f-89541021281f", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "⋆₁", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39b-587f-7559-a1ff-b6ed58899461", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "lamb", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d39a-89cf-762b-9d2a-5678b878d6c7", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39b-a70a-77d5-8e89-66f0e767a9da", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": " ♭♯", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-b3ef-728d-bd88-60b48fd7349a", - "tag": "Basic" - }, - "id": "0194d39d-d297-77a9-95a2-6ed7105fdca3", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "d̃₁", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d39c-622d-7599-bc5c-e7e8208d6cdd", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "∂ₜ", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "0194d39e-5d44-77cd-bc5e-156c5c56ae85", - "morType": { - "content": "Nonscalar", - "tag": "Basic" - }, - "name": "-", - "tag": "morphism" - }, - { - "cod": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "dom": { - "content": "0194d398-d0cb-7308-b7e0-eace5b21af24", - "tag": "Basic" - }, - "id": "01960dde-1193-7132-b662-9bf24ed05264", - "morType": { - "content": { - "content": "Object", - "tag": "Basic" - }, - "tag": "Hom" - }, - "name": "any_scalar", - "tag": "morphism" - } - ], - "domain": "Plane", - "mesh": "Rectangle", - "initialConditions": { - "0196021c-f5fe-70f3-ac68-89ae212970ea": "Gaussian", - "0196021d-1aa4-776d-b4fb-05d24d0c6de4": "Gaussian" - }, - "plotVariables": [ - "0196021c-f5fe-70f3-ac68-89ae212970ea" - ], - "scalars": { - "01960dde-1193-7132-b662-9bf24ed05264": 1 - }, - "duration": 10 -} diff --git a/packages/frontend/src/stdlib/analyses/decapodes.tsx b/packages/frontend/src/stdlib/analyses/decapodes.tsx index 3907929a7..d8114591a 100644 --- a/packages/frontend/src/stdlib/analyses/decapodes.tsx +++ b/packages/frontend/src/stdlib/analyses/decapodes.tsx @@ -314,14 +314,14 @@ const makeSimulationCode = (data: SimulationData) => # needed for returning large amounts of data, should be paired with a similar setting on the jupyter server IJulia.set_max_stdio(1_000_000_000) - system = Analysis(ThDecapode(), raw"""${JSON.stringify(data)}"""); - simulator = evalsim(system.pode); + simulation = DecapodeSimulation(raw"""${JSON.stringify(data)}"""); + simulator = evalsim(simulation.pode); - f = simulator(system.geometry.dualmesh, system.generate, DiagonalHodge()); + f = simulator(simulation.geometry.dualmesh, simulation.generate, DiagonalHodge()); - soln = run_sim(f, system.init, system.duration, ComponentArray(k=0.5,)); + result = run(f, simulation, ComponentArray(k=0.5,)) - JSON3.write(stdout, SimResult(soln, system)) + JSON3.write(stdout, result) `; /** Create data to send to the Julia kernel. */