From 2e65fe794f05a7722cd2d927828ad666bd454832 Mon Sep 17 00:00:00 2001 From: Alexander Fleming Date: Mon, 4 Nov 2024 17:15:31 +0100 Subject: [PATCH] fix PrimitiveProps constructor, change my name --- Project.toml | 4 ++-- src/cpg.jl | 2 +- test/runtests.jl | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 72e911b..9ec02f5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ShockwaveProperties" uuid = "77d2bf28-a3e9-4b9c-9fcf-b85f74cc8a50" -authors = ["Alex Fleming and contributors"] -version = "0.2.5" +authors = ["Sasha Fleming "] +version = "0.2.6" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/cpg.jl b/src/cpg.jl index da255f4..aba87ac 100644 --- a/src/cpg.jl +++ b/src/cpg.jl @@ -136,7 +136,7 @@ end Construct a PrimitiveProps from a vector and assign default units. """ function PrimitiveProps(s::AbstractVector) - N = length(u) + N = length(s) idcs = SVector{N - 2}(ntuple(i -> i + 1, N - 2)) return PrimitiveProps(Quantity(s[1], _units_ρ), s[idcs], Quantity(s[end], _units_T)) end diff --git a/test/runtests.jl b/test/runtests.jl index 269d1ea..be24e9e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,6 +5,14 @@ using Test using Unitful @testset verbose = true "ShockwaveProperties.jl" begin + + @testset "Construct from Containers" begin + s1 = PrimitiveProps(SVector(1.225, 2.0, 0.0, 300.0)) + s2 = PrimitiveProps([1.225, 2.0, 0.0, 300.0]) + # just use some garbage numbers here + u1 = ConservedProps(SVector(1.225, 1.0, 1.0, 2.0)) + u2 = ConservedProps([1.225, 1.0, 1.0, 2.0]) + end @testset "Dimensional Analysis" begin # giving different units shouldn't mess with the actual results # these are the same state