Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Dec 23, 2024
1 parent 82c48c2 commit 34ad401
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 51 deletions.
6 changes: 3 additions & 3 deletions src/vfvm_geometryitems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Structure holding local boundary node information.
$(TYPEDFIELDS)
"""
mutable struct BNode{Td, Tc, Tp, Ti} <: AbstractNode{Tc, Tp, Ti}
mutable struct BNode{Td, Tc, Tp, Ti} <: AbstractNode{Tc, Tp, Ti}
"""
Index in grid
"""
Expand Down Expand Up @@ -272,7 +272,7 @@ mutable struct BNode{Td, Tc, Tp, Ti} <: AbstractNode{Tc, Tp, Ti}
function BNode{Td, Tc, Tp, Ti}(
sys::Ts, time, embedparam,
params::Vector{Tp}
) where {Td, Tc, Tp, Ti, Ts<:AbstractSystem}
) where {Td, Tc, Tp, Ti, Ts <: AbstractSystem}
return new(
0, 0, 0, 0, zeros(Ti, 2),
num_species(sys),
Expand All @@ -290,7 +290,7 @@ end
# JF: We need to be able to distinguish bwetween dirichlet type and value type.
# So far we will use Tp for the dirichlet type instead of the valuetype.
# Maybe this even allows derivatives wrt. Dirichlet data.
function BNode(sys::AbstractSystem{Tv, Tc, Ti, Tm}, time, embedparam, params::Vector{Tp}) where {Tv,Tc, Tp, Ti, Tm}
function BNode(sys::AbstractSystem{Tv, Tc, Ti, Tm}, time, embedparam, params::Vector{Tp}) where {Tv, Tc, Tp, Ti, Tm}
return BNode{Tp, Tc, Tp, Ti}(sys, time, embedparam, params)
end
BNode(sys) = BNode(sys, 0, 0, zeros(0))
Expand Down
95 changes: 47 additions & 48 deletions test/test_geomitems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,72 +9,71 @@ const Dual64 = ForwardDiff.Dual{Float64, Float64, 1}
flux(y, u, edge, data) = y[1] = u[1, 1] - u[1, 2]


function main(;n=3)
function main(; n = 3)
g = simplexgrid(0:0.1:1)
sys = VoronoiFVM.System(g; flux,species = 1:n)
time=0.0
λ=0.0
params=zeros(3)
sys = VoronoiFVM.System(g; flux, species = 1:n)
time = 0.0
λ = 0.0
params = zeros(3)

utest=zeros(Dual64,2*n)
utest = zeros(Dual64, 2 * n)
node = VoronoiFVM.Node(sys, time, λ, params)
u=unknowns(node,utest)
@test typeof(u[1])==eltype(u)
@test typeof(copy(u)[1])==eltype(u)
@test length(u)==n
@test size(u)==(n,)
u = unknowns(node, utest)
@test typeof(u[1]) == eltype(u)
@test typeof(copy(u)[1]) == eltype(u)
@test length(u) == n
@test size(u) == (n,)

bnode = VoronoiFVM.BNode(sys, time, λ, params)
u=unknowns(bnode,utest)
@test typeof(u[1])==eltype(u)
@test typeof(copy(u)[1])==eltype(u)
@test length(u)==n
@test size(u)==(n,)
u = unknowns(bnode, utest)
@test typeof(u[1]) == eltype(u)
@test typeof(copy(u)[1]) == eltype(u)
@test length(u) == n
@test size(u) == (n,)

edge = VoronoiFVM.Edge(sys, time, λ, params)
u=unknowns(edge,utest)
@test typeof(u[1])==eltype(u)
@test typeof(copy(u)[1])==eltype(u)
@test length(u)==2*n
@test size(u)==(n,2)
u = unknowns(edge, utest)
@test typeof(u[1]) == eltype(u)
@test typeof(copy(u)[1]) == eltype(u)
@test length(u) == 2 * n
@test size(u) == (n, 2)

bedge = VoronoiFVM.BEdge(sys, time, λ, params)
u=unknowns(bedge,utest)
@test typeof(u[1])==eltype(u)
@test typeof(copy(u)[1])==eltype(u)
@test length(u)==2*n
@test size(u)==(n,2)
u = unknowns(bedge, utest)
@test typeof(u[1]) == eltype(u)
@test typeof(copy(u)[1]) == eltype(u)
@test length(u) == 2 * n
@test size(u) == (n, 2)



ftest=zeros(Dual64,2*n)
ftest = zeros(Dual64, 2 * n)
node = VoronoiFVM.Node(sys, time, λ, params)
f=VoronoiFVM.rhs(node,ftest)
@test typeof(f[1])==eltype(f)
@test typeof(copy(f)[1])==eltype(f)
@test length(f)==n
@test size(f)==(n,)
f = VoronoiFVM.rhs(node, ftest)
@test typeof(f[1]) == eltype(f)
@test typeof(copy(f)[1]) == eltype(f)
@test length(f) == n
@test size(f) == (n,)

bnode = VoronoiFVM.BNode(sys, time, λ, params)
f=VoronoiFVM.rhs(bnode,ftest)
@test typeof(f[1])==eltype(f)
@test typeof(copy(f)[1])==eltype(f)
@test length(f)==n
@test size(f)==(n,)
f = VoronoiFVM.rhs(bnode, ftest)
@test typeof(f[1]) == eltype(f)
@test typeof(copy(f)[1]) == eltype(f)
@test length(f) == n
@test size(f) == (n,)

edge = VoronoiFVM.Edge(sys, time, λ, params)
f=VoronoiFVM.rhs(edge,ftest)
@test typeof(f[1])==eltype(f)
@test typeof(copy(f)[1])==eltype(f)
@test length(f)==n
@test size(f)==(n,)
f = VoronoiFVM.rhs(edge, ftest)
@test typeof(f[1]) == eltype(f)
@test typeof(copy(f)[1]) == eltype(f)
@test length(f) == n
@test size(f) == (n,)

bedge = VoronoiFVM.BEdge(sys, time, λ, params)
f=VoronoiFVM.rhs(bedge,ftest)
@test typeof(f[1])==eltype(f)
@test typeof(copy(f)[1])==eltype(f)
@test length(f)==n
@test size(f)==(n,)
f = VoronoiFVM.rhs(bedge, ftest)
@test typeof(f[1]) == eltype(f)
@test typeof(copy(f)[1]) == eltype(f)
@test length(f) == n
return @test size(f) == (n,)


end
Expand Down

0 comments on commit 34ad401

Please sign in to comment.