Skip to content

Commit

Permalink
Merge 30fc836 into 676e377
Browse files Browse the repository at this point in the history
  • Loading branch information
naylor-b committed Aug 21, 2020
2 parents 676e377 + 30fc836 commit e7144cc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openmdao/core/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ def update_src_indices(name, key):
(self.msginfo, name, str(src_indices),
str(meta['src_indices'])))
if 'flat_src_indices' in meta and meta['flat_src_indices'] is not None:
if not meta['flat_src_indices'] == src_indices:
if not meta['flat_src_indices'] == flat_src_indices:
raise RuntimeError("%s: Trying to promote input '%s' with flat_src_indices"
"=%s but flat_src_indices has already been specified as"
" %s." %
Expand Down
31 changes: 31 additions & 0 deletions openmdao/core/tests/test_auto_ivc.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,34 @@ def test_mixed_src_indices_no_src_indices(self):
prob.setup()

prob.run_model()

def test_flat_src_inds_2_levels(self):
# this test passes if it doesn't raise an exception.
class Burn1(om.Group):
def setup(self):
self.add_subsystem('comp1', om.ExecComp(['y1=x*2'], y1=np.ones(4), x=np.ones(4)),
promotes_outputs=['*'])

self.add_subsystem('comp2', om.ExecComp(['y2=x*2'], y2=np.ones(4), x=np.ones(4)),
promotes_outputs=['*'])

def configure(self):
self.promotes('comp1', inputs=[('x', 'design:x')],
src_indices=[0, 0, 0, 0], flat_src_indices=True)

self.set_input_defaults('design:x', 75.3)


class Traj(om.Group):
def setup(self):
self.add_subsystem('burn1', Burn1(),
promotes_outputs=['*'])

def configure(self):
self.promotes('burn1', inputs=['design:x'],
src_indices=[0, 0, 0, 0], flat_src_indices=True)

prob = om.Problem(model=Traj())

prob.setup()
prob.run_model()

0 comments on commit e7144cc

Please sign in to comment.