Skip to content

Commit

Permalink
Manage array init value from a scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
relf committed Mar 19, 2023
1 parent efc8cf0 commit 1bfc635
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/lib/whats_opt/openmdao_variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def default_py_value
end
end

def ones_py_value
default_py_value
end

def lower_py_value
"-inf"
end
Expand Down
7 changes: 6 additions & 1 deletion app/models/variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ def init_py_value
default_py_value
end
else
self.parameter.init
is_num = true if Float(self.parameter.init) rescue false
if is_num && self.ndim > 0
ones_py_value + " * #{self.parameter.init}"
else
self.parameter.init
end
end
end

Expand Down

0 comments on commit 1bfc635

Please sign in to comment.