Skip to content

Commit

Permalink
general cleaning, bump to 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Oct 25, 2020
1 parent f261288 commit 8370b41
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ThermoState"
uuid = "e7b6519d-fdf7-4a33-b544-2b37a9c1234a"
authors = ["Andres Riedemann"]
version = "0.4.1"
version = "0.4.2"

[deps]
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Expand Down
40 changes: 17 additions & 23 deletions src/spec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,8 @@ end

ThermodynamicState(st::Tuple) = ThermodynamicState(st,())


Base.values(s::ThermodynamicState) = s.specs





#reduce-based mass transform, to check properties

_reduce_check_mass(x::Spec) = 0
Expand Down Expand Up @@ -311,20 +306,10 @@ _specs_C(tup::Tuple,kw::Int64)::Int64 = 1
_reduce_mass_spec_p(x::Spec) = 0
_reduce_mass_spec_p(x::Spec{PhaseFractions}) = length(value(x))

function _specs_P(kwargs::NamedTuple,kw::Int64)::Int64
if (kw == 0)
function _specs_P(kw::Int64)::Int64
if iszero(kw)
return 1
elseif kw == 1
return 2
else
return 0
end
end

function _specs_P(tup::Tuple,kw::Int64)::Int64
if (kw == 0)
return 1
elseif kw == 1
elseif isone(kw)
return 2
else
return 0
Expand Down Expand Up @@ -374,10 +359,19 @@ function spec_equal(x1::Spec{T1},x2::Spec{T2})::Bool where {T1,T2}
return false
end
function spec_tuple_unique(a)::Bool
@inbounds for i = 1:length(a)
for j = (i+1):length(a)
if spec_equal(a[i],a[j])
return false
len = length(a)
if len == 1
return true
elseif len == 2
return !spec_equal(a[1],a[2])
elseif len == 3
return !(spec_equal(a[1],a[2]) | spec_equal(a[3],a[2]) | spec_equal(a[3],a[2]))
else
@inbounds for i = 1:len
for j = (i+1):len
if spec_equal(a[i],a[j])
return false
end
end
end
end
Expand All @@ -388,7 +382,7 @@ function check_spec(args)
mass_basis = _specs_components(args)
phase_basis = _specs_phase_basis(args)
C = _specs_C(args,mass_basis)
P = _specs_P(args,phase_basis)
P = _specs_P(phase_basis)
F = _specs_F(args,mass_basis,phase_basis)
DF = C - P + 2 - F#behold, the gibbs phase rule!
if DF<0
Expand Down
4 changes: 0 additions & 4 deletions src/specs_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ a basic thermodynamic model, used to extract thermodynamic specifications from a
struct FromState <: ThermoModel end
const URVec = AbstractVector{T} where T<:Number





moles2(a::ThermodynamicState,mw) = moles3(amount_type(a),a,mw)
mass2(a::ThermodynamicState,mw) = mass3(amount_type(a),a,mw)
kg_per_mol2(a::ThermodynamicState,mw) = kg_per_mol3(amount_type(a),a,mw)
Expand Down

2 comments on commit 8370b41

@longemen3000
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/23624

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.2 -m "<description of version>" 8370b41e78c5e369defc7b84c08982b7094ce27a
git push origin v0.4.2

Please sign in to comment.