Skip to content

Commit 7daa0e2

Browse files
Update unit_check.jl
1 parent 0f602b9 commit 7daa0e2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/systems/unit_check.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ function __get_unit_type(vs′...)
4343
return nothing
4444
end
4545

46+
47+
function screen_unit(result::DQ.AbstractQuantity)
48+
d = DQ.dimension(result)
49+
if d isa DQ.Dimensions
50+
return result
51+
elseif d isa DQ.SymbolicDimensions
52+
return DQ.uexpand(oneunit(result))
53+
else
54+
throw(ValidationError("$result doesn't have a recognized unit"))
55+
end
56+
end
57+
4658
function screen_unit(result)
4759
throw(ValidationError("$result doesn't have any unit."))
4860
end

0 commit comments

Comments
 (0)