From e4af515eb0aaac9797174d8e92d55ead1dcf5019 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 5 Dec 2024 23:14:03 -0500 Subject: [PATCH] BUG: fixing indexing error in state_at_time + removing some comments --- .../src/decapodes-service/DecapodesService.jl | 5 ++--- packages/algjulia-service/src/decapodes-service/geometry.jl | 1 - .../src/decapodes-service/initial_conditions.jl | 3 +-- packages/algjulia-service/test/runtests.jl | 5 ----- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/algjulia-service/src/decapodes-service/DecapodesService.jl b/packages/algjulia-service/src/decapodes-service/DecapodesService.jl index 311785f6..5e9712b8 100644 --- a/packages/algjulia-service/src/decapodes-service/DecapodesService.jl +++ b/packages/algjulia-service/src/decapodes-service/DecapodesService.jl @@ -56,8 +56,7 @@ end Construct a `PodeSystem` object from a JSON string. """ function PodeSystem(json_object::AbstractDict, hodge=GeometricHodge()) - # converts the JSON of (the fragment of) the theory - # into theory of the DEC, valued in Julia + # make a theory of the DEC, valued in Julia theory = Theory(json_object[:model]) # this is a diagram in the model of the DEC. it wants to be a decapode! @@ -160,7 +159,7 @@ end function state_at_time(soln::ODESolution, domain::Rectangle, var::Symbol, t::Int) # last two args can be one Point2 (x, y) = indexing_bounds(domain) - [SVector(i, j, getproperty(soln.u[t], var)[x*(i-1) + j]) for i in 1:x+1, j in 1:y+1] + [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 diff --git a/packages/algjulia-service/src/decapodes-service/geometry.jl b/packages/algjulia-service/src/decapodes-service/geometry.jl index 0fef00b8..329abdec 100644 --- a/packages/algjulia-service/src/decapodes-service/geometry.jl +++ b/packages/algjulia-service/src/decapodes-service/geometry.jl @@ -79,7 +79,6 @@ function Geometry(json_object::AbstractDict) domain = PREDEFINED_MESHES[mesh_name] Geometry(domain) end -# TODO PREDEFINED_MESHES is a dictionary of default methods # function Geometry(d::Domain, args...) # throw(ImplError("The mesh ($(d)) is")) diff --git a/packages/algjulia-service/src/decapodes-service/initial_conditions.jl b/packages/algjulia-service/src/decapodes-service/initial_conditions.jl index dcd3251e..40e8ee7a 100644 --- a/packages/algjulia-service/src/decapodes-service/initial_conditions.jl +++ b/packages/algjulia-service/src/decapodes-service/initial_conditions.jl @@ -14,7 +14,7 @@ function GaussianData(μ::Vector{Float64}, Σ::Vector{Float64}) GaussianData(μ, LinearAlgebra.Diagonal(abs.(Σ))) end -# DEFAULT METHOD. A Moshi-like Default impl. would be nice! +# default method function GaussianData(r::Rectangle) μ = middle(r) GaussianData(μ, μ/10) @@ -42,7 +42,6 @@ end GaussianIC(r::Rectangle) = GaussianIC(r, GaussianData(r)) TaylorVortexIC(d::Sphere) = TaylorVortexIC(d, TaylorVortexData()) - function initial_conditions(json_object::AbstractDict, geometry::Geometry, uuid2symb::Dict{String, Symbol}) ic_specs = json_object[:initialConditions] # this is "C" dict = Dict([uuid2symb[string(uuid)] => ic_specs[string(uuid)] for uuid ∈ keys(ic_specs)]...) diff --git a/packages/algjulia-service/test/runtests.jl b/packages/algjulia-service/test/runtests.jl index c50bf13c..76f00592 100644 --- a/packages/algjulia-service/test/runtests.jl +++ b/packages/algjulia-service/test/runtests.jl @@ -93,11 +93,6 @@ end f = simulator(system.geometry.dualmesh, default_dec_generate, DiagonalHodge()) soln = run_sim(f, system.init, 50.0, ComponentArray(k=0.5,)); - # returns ::ODESolution - # - retcode - # - interpolation - # - t - # - u::Vector{ComponentVector} @test soln.retcode == ReturnCode.Success