diff --git a/openmdao/visualization/n2_viewer/n2_viewer.py b/openmdao/visualization/n2_viewer/n2_viewer.py index 4c45dde44..3cd1c825f 100644 --- a/openmdao/visualization/n2_viewer/n2_viewer.py +++ b/openmdao/visualization/n2_viewer/n2_viewer.py @@ -746,6 +746,8 @@ def _n2_setup_parser(parser): action='store', dest='title', help='diagram title.') parser.add_argument('--path', default=None, action='store', dest='path', help='initial path to zoom into.') + parser.add_argument('--problem', default=None, + action='store', dest='problem', help='problem name to display N2 for.') def _n2_cmd(options, user_args): @@ -762,20 +764,26 @@ def _n2_cmd(options, user_args): filename = _to_filename(options.file[0]) if filename.endswith('.py'): + problem_name = options.problem # Get the --problem argument, or None + def _view_model_w_errors(prob): errs = prob._metadata['saved_errors'] if errs: # only run the n2 here if we've had setup errors. Normally we'd wait until # after final_setup in order to have correct values for all of the I/O variables. - n2(prob, outfile=options.outfile, show_browser=not options.no_browser, - values=not options.no_values, title=options.title, path=options.path, - embeddable=options.embeddable) + # If --problem is specified, only display N2 for that problem + if problem_name is None or prob._name == problem_name: + n2(prob, outfile=options.outfile, show_browser=not options.no_browser, + values=not options.no_values, title=options.title, path=options.path, + embeddable=options.embeddable) # errors will result in exit at the end of the _check_collected_errors method def _view_model_no_errors(prob): - n2(prob, outfile=options.outfile, show_browser=not options.no_browser, - values=not options.no_values, title=options.title, path=options.path, - embeddable=options.embeddable) + # If --problem is specified, only display N2 for that problem + if problem_name is None or prob._name == problem_name: + n2(prob, outfile=options.outfile, show_browser=not options.no_browser, + values=not options.no_values, title=options.title, path=options.path, + embeddable=options.embeddable) hooks._register_hook('_check_collected_errors', 'Problem', pre=_view_model_w_errors) hooks._register_hook('final_setup', 'Problem', post=_view_model_no_errors, exit=True) diff --git a/reports/top/inputs.html b/reports/top/inputs.html new file mode 100644 index 000000000..0331bbdc5 --- /dev/null +++ b/reports/top/inputs.html @@ -0,0 +1,68 @@ + + + +
+ + + + + +