Skip to content

Commit

Permalink
Merge 2288338 into ea3575a
Browse files Browse the repository at this point in the history
  • Loading branch information
naylor-b committed Mar 27, 2024
2 parents ea3575a + 2288338 commit 06c5ec9
Show file tree
Hide file tree
Showing 6 changed files with 849 additions and 5 deletions.
13 changes: 13 additions & 0 deletions openmdao/core/component.py
Expand Up @@ -1819,6 +1819,19 @@ def _has_fast_rel_lookup(self):
"""
return True

def _get_graph_node_meta(self):
"""
Return metadata to add to this system's graph node.
Returns
-------
dict
Metadata for this system's graph node.
"""
meta = super()._get_graph_node_meta()
meta['base'] = 'ExplicitComponent' if self.is_explicit() else 'ImplicitComponent'
return meta


class _DictValues(object):
"""
Expand Down
17 changes: 16 additions & 1 deletion openmdao/core/group.py
Expand Up @@ -30,7 +30,7 @@
meta2src_iter, get_rev_conns, _contains_all
from openmdao.utils.units import is_compatible, unit_conversion, _has_val_mismatch, _find_unit, \
_is_unitless, simplify_unit
from openmdao.utils.graph_utils import get_sccs_topo, get_out_of_order_nodes
from openmdao.utils.graph_utils import get_out_of_order_nodes
from openmdao.utils.mpi import MPI, check_mpi_exceptions, multi_proc_exception_check
import openmdao.utils.coloring as coloring_mod
from openmdao.utils.indexer import indexer, Indexer
Expand Down Expand Up @@ -5186,3 +5186,18 @@ def _active_responses(self, user_response_names, responses=None):
meta['remote'] = meta['source'] not in self._var_abs2meta['output']

return active_resps

def _get_graph_node_meta(self):
"""
Return metadata to add to this system's graph node.
Returns
-------
dict
Metadata for this system's graph node.
"""
meta = super()._get_graph_node_meta()
# TODO: maybe set 'implicit' based on whether there are any implicit comps anywhere
# inside of the group or its children.
meta['base'] = 'Group'
return meta
14 changes: 14 additions & 0 deletions openmdao/core/system.py
Expand Up @@ -1380,6 +1380,20 @@ def get_source(self, name):

raise KeyError(f"{self.msginfo}: source for '{name}' not found.")

def _get_graph_node_meta(self):
"""
Return metadata to add to this system's graph node.
Returns
-------
dict
Metadata for this system's graph node.
"""
return {
'classname': type(self).__name__,
'implicit': not self.is_explicit(),
}

def _setup_check(self):
"""
Do any error checking on user's setup, before any other recursion happens.
Expand Down
8 changes: 4 additions & 4 deletions openmdao/utils/om.py
Expand Up @@ -61,6 +61,7 @@
_find_repos_setup_parser, _find_repos_exec
from openmdao.utils.reports_system import _list_reports_setup_parser, _list_reports_cmd, \
_view_reports_setup_parser, _view_reports_cmd
from openmdao.visualization.graph_viewer import _graph_setup_parser, _graph_cmd


def _view_connections_setup_parser(parser):
Expand Down Expand Up @@ -538,14 +539,14 @@ def _set_dyn_hook(prob):
'Display connection information for variables across multiple MPI processes.'),
'find_repos': (_find_repos_setup_parser, _find_repos_exec,
'Find repos on github having openmdao topics.'),
'graph': (_graph_setup_parser, _graph_cmd, 'Generate a graph for a group.'),
'iprof': (_iprof_setup_parser, _iprof_exec,
'Profile calls to particular object instances.'),
'iprof_totals': (_iprof_totals_setup_parser, _iprof_totals_exec,
'Generate total timings of calls to particular object instances.'),
'list_installed': (_list_installed_setup_parser, _list_installed_cmd,
'List installed types recognized by OpenMDAO.'),
'list_reports': (_list_reports_setup_parser, _list_reports_cmd,
'List available reports.'),
'list_reports': (_list_reports_setup_parser, _list_reports_cmd, 'List available reports.'),
'mem': (_mem_prof_setup_parser, _mem_prof_exec,
'Profile memory used by OpenMDAO related functions.'),
'mempost': (_mempost_setup_parser, _mempost_exec, 'Post-process memory profile output.'),
Expand All @@ -570,8 +571,7 @@ def _set_dyn_hook(prob):
'view_dyn_shapes': (_view_dyn_shapes_setup_parser, _view_dyn_shapes_cmd,
'View the dynamic shape dependency graph.'),
'view_mm': (_meta_model_parser, _meta_model_cmd, "View a metamodel."),
'view_reports': (_view_reports_setup_parser, _view_reports_cmd,
'View existing reports.'),
'view_reports': (_view_reports_setup_parser, _view_reports_cmd, 'View existing reports.'),
}


Expand Down
7 changes: 7 additions & 0 deletions openmdao/utils/tests/test_cmdline.py
Expand Up @@ -55,6 +55,13 @@ def _test_func_name(func, num, param):
('openmdao comm_info {}'.format(os.path.join(scriptdir, 'circle_opt.py')), {}),
('openmdao cite {}'.format(os.path.join(scriptdir, 'circle_opt.py')), {}),
('openmdao compute_entry_points openmdao', {}),
('openmdao graph --no-display {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --type=tree {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --show-vars {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --show-vars --no-recurse {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --group=circuit {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --group=circuit --show-vars {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao graph --no-display --group=circuit --show-vars --no-recurse {}'.format(os.path.join(scriptdir, 'circuit_analysis.py')), {}),
('openmdao iprof --no_browser {}'.format(os.path.join(scriptdir, 'circle_opt.py')),
{'tornado': tornado}),
('openmdao iprof_totals {}'.format(os.path.join(scriptdir, 'circle_opt.py')), {}),
Expand Down

0 comments on commit 06c5ec9

Please sign in to comment.