Skip to content

Commit

Permalink
added descriptive error for vars/params when no descriptor defined
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsignorelli committed May 15, 2024
1 parent 9c6668c commit 763f784
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ctors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Default value is `GTPSA.desc_current`.
- `x` -- `Vector` containing unit `TPS`s corresponding to each variable
"""
function vars(use::Union{Descriptor,TPS,ComplexTPS}=GTPSA.desc_current)::Vector{TPS}
getdesc(use).desc != C_NULL || error("Descriptor not defined!")
nv = numvars(use)
x = Vector{TPS}(undef, nv)
for i=1:nv
Expand All @@ -38,6 +39,7 @@ Default value is `GTPSA.desc_current`.
- `k` -- `Vector` containing unit `TPS`s corresponding to each parameter
"""
function params(use::Union{Descriptor,TPS,ComplexTPS}=GTPSA.desc_current)::Vector{TPS}
getdesc(use).desc != C_NULL || error("Descriptor not defined!")
nv = numvars(use)
np = numparams(use)
k = Vector{TPS}(undef, np)
Expand All @@ -63,6 +65,7 @@ Default value is `GTPSA.desc_current`.
- `x` -- `Vector` containing unit `ComplexTPS`s corresponding to each variable
"""
function complexvars(use::Union{Descriptor,TPS,ComplexTPS}=GTPSA.desc_current)::Vector{ComplexTPS}
getdesc(use).desc != C_NULL || error("Descriptor not defined!")
nv = numvars(use)
x = Vector{ComplexTPS}(undef, nv)
for i=1:nv
Expand All @@ -86,6 +89,7 @@ Default value is `GTPSA.desc_current`.
- `k` -- `Vector` containing unit `ComplexTPS`s corresponding to each parameter
"""
function complexparams(use::Union{Descriptor,TPS,ComplexTPS}=GTPSA.desc_current)::Vector{ComplexTPS}
getdesc(use).desc != C_NULL || error("Descriptor not defined!")
nv = numvars(use)
np = numparams(use)
k = Vector{ComplexTPS}(undef, np)
Expand Down

0 comments on commit 763f784

Please sign in to comment.