Skip to content

Commit

Permalink
BUG: fixing indexing error in state_at_time + removing some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
quffaro authored and epatters committed Dec 6, 2024
1 parent 14856bc commit e4af515
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)]...)
Expand Down
5 changes: 0 additions & 5 deletions packages/algjulia-service/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e4af515

Please sign in to comment.