本文整理汇总了Python中openmdao.recorders.recording_manager.RecordingManager.append方法的典型用法代码示例。如果您正苦于以下问题:Python RecordingManager.append方法的具体用法?Python RecordingManager.append怎么用?Python RecordingManager.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openmdao.recorders.recording_manager.RecordingManager
的用法示例。
在下文中一共展示了RecordingManager.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Driver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import append [as 别名]
#.........这里部分代码省略.........
-------
tuple
A tuple of the form (min_procs, max_procs), indicating the
min and max processors usable by this `Driver`.
"""
return self.root.get_req_procs()
def cleanup(self):
""" Clean up resources prior to exit. """
self.recorders.close()
def _map_voi_indices(self):
poi_indices = OrderedDict()
qoi_indices = OrderedDict()
for name, meta in chain(iteritems(self._cons), iteritems(self._objs)):
# set indices of interest
if 'indices' in meta:
qoi_indices[name] = meta['indices']
for name, meta in iteritems(self._desvars):
# set indices of interest
if 'indices' in meta:
poi_indices[name] = meta['indices']
return poi_indices, qoi_indices
def _of_interest(self, voi_list):
"""Return a list of tuples, with the given voi_list organized
into tuples based on the previously defined grouping of VOIs.
"""
vois = []
remaining = set(voi_list)
for voi_set in self._voi_sets:
vois.append([])
for i, voi_set in enumerate(self._voi_sets):
for v in voi_list:
if v in voi_set:
vois[i].append(v)
remaining.remove(v)
vois = [tuple(x) for x in vois if x]
for v in voi_list:
if v in remaining:
vois.append((v,))
return vois
def desvars_of_interest(self):
"""
Returns
-------
list of tuples of str
The list of design vars, organized into tuples according to
previously defined VOI groups.
"""
return self._of_interest(self._desvars)
def outputs_of_interest(self):
"""
Returns
-------
list of tuples of str
The list of constraints and objectives, organized into tuples
according to previously defined VOI groups.
示例2: Solver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import append [as 别名]
#.........这里部分代码省略.........
self._norm0 = 0.0
# What the solver supports.
self.supports = OptionsDictionary()
self.supports.declare('gradients', types=bool, default=False)
self.supports.declare('implicit_components', types=bool, default=False)
self._declare_options()
self.options.update(kwargs)
self._rec_mgr = RecordingManager()
self.cite = ""
def _assembled_jac_solver_iter(self):
"""
Return an empty generator of lin solvers using assembled jacs.
"""
for i in ():
yield
def add_recorder(self, recorder):
"""
Add a recorder to the solver's RecordingManager.
Parameters
----------
recorder : <CaseRecorder>
A recorder instance to be added to RecManager.
"""
if MPI:
raise RuntimeError(
"Recording of Solvers when running parallel code is not supported yet")
self._rec_mgr.append(recorder)
def _declare_options(self):
"""
Declare options before kwargs are processed in the init method.
This is optionally implemented by subclasses of Solver.
"""
pass
def _setup_solvers(self, system, depth):
"""
Assign system instance, set depth, and optionally perform setup.
Parameters
----------
system : <System>
pointer to the owning system.
depth : int
depth of the current system (already incremented).
"""
self._system = system
self._depth = depth
self._solver_info = system._solver_info
self._recording_iter = system._recording_iter
if isinstance(self, LinearSolver) and not system._use_derivatives:
return
self._rec_mgr.startup(self)
self._rec_mgr.record_metadata(self)
myoutputs = myresiduals = myinputs = set()
示例3: Driver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import append [as 别名]
#.........这里部分代码省略.........
if "indices" in meta:
meta["size"] = len(meta["indices"])
else:
meta["size"] = rootmeta["size"]
newitem[name] = meta
self._desvars = desvars
self._objs = objs
self._cons = cons
def _map_voi_indices(self):
poi_indices = {}
qoi_indices = {}
for name, meta in chain(iteritems(self._cons), iteritems(self._objs)):
# set indices of interest
if "indices" in meta:
qoi_indices[name] = meta["indices"]
for name, meta in iteritems(self._desvars):
# set indices of interest
if "indices" in meta:
poi_indices[name] = meta["indices"]
return poi_indices, qoi_indices
def _of_interest(self, voi_list):
"""Return a list of tuples, with the given voi_list organized
into tuples based on the previously defined grouping of VOIs.
"""
vois = []
remaining = set(voi_list)
for voi_set in self._voi_sets:
vois.append([])
for i, voi_set in enumerate(self._voi_sets):
for v in voi_list:
if v in voi_set:
vois[i].append(v)
remaining.remove(v)
vois = [tuple(x) for x in vois if x]
for v in voi_list:
if v in remaining:
vois.append((v,))
return vois
def desvars_of_interest(self):
"""
Returns
-------
list of tuples of str
The list of design vars, organized into tuples according to
previously defined VOI groups.
"""
return self._of_interest(self._desvars)
def outputs_of_interest(self):
"""
Returns
-------
list of tuples of str
The list of constraints and objectives, organized into tuples
according to previously defined VOI groups.
示例4: Driver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import append [as 别名]
#.........这里部分代码省略.........
self.debug_print.declare('debug_print', types=bool, default=False,
desc='Overall option to turn on Driver debug printing')
self.debug_print.declare('debug_print_desvars', types=bool, default=False,
desc='Print design variables')
self.debug_print.declare('debug_print_nl_con', types=bool, default=False,
desc='Print nonlinear constraints')
self.debug_print.declare('debug_print_ln_con', types=bool, default=False,
desc='Print linear constraints')
self.debug_print.declare('debug_print_objective', types=bool, default=False,
desc='Print objectives')
self.iter_count = 0
self.metadata = None
self._model_viewer_data = None
self.cite = ""
# TODO, support these in OpenMDAO
self.supports.declare('integer_design_vars', types=bool, default=False)
self._simul_coloring_info = None
self._res_jacs = {}
self.fail = False
def add_recorder(self, recorder):
"""
Add a recorder to the driver.
Parameters
----------
recorder : BaseRecorder
A recorder instance.
"""
self._rec_mgr.append(recorder)
def cleanup(self):
"""
Clean up resources prior to exit.
"""
self._rec_mgr.close()
def _setup_driver(self, problem):
"""
Prepare the driver for execution.
This is the final thing to run during setup.
Parameters
----------
problem : <Problem>
Pointer to the containing problem.
"""
self._problem = problem
model = problem.model
self._objs = objs = OrderedDict()
self._cons = cons = OrderedDict()
self._responses = model.get_responses(recurse=True)
response_size = 0
for name, data in iteritems(self._responses):
if data['type'] == 'con':
cons[name] = data
else:
objs[name] = data
response_size += data['size']
示例5: Driver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import append [as 别名]
#.........这里部分代码省略.........
self.supports.declare('equality_constraints', types=bool, default=False)
self.supports.declare('linear_constraints', types=bool, default=False)
self.supports.declare('two_sided_constraints', types=bool, default=False)
self.supports.declare('multiple_objectives', types=bool, default=False)
self.supports.declare('integer_design_vars', types=bool, default=False)
self.supports.declare('gradients', types=bool, default=False)
self.supports.declare('active_set', types=bool, default=False)
self.supports.declare('simultaneous_derivatives', types=bool, default=False)
self.supports.declare('total_jac_sparsity', types=bool, default=False)
self.iter_count = 0
self._model_viewer_data = None
self.cite = ""
self._simul_coloring_info = None
self._total_jac_sparsity = None
self._res_jacs = {}
self._total_jac = None
self.fail = False
self._declare_options()
self.options.update(kwargs)
def add_recorder(self, recorder):
"""
Add a recorder to the driver.
Parameters
----------
recorder : CaseRecorder
A recorder instance.
"""
self._rec_mgr.append(recorder)
def cleanup(self):
"""
Clean up resources prior to exit.
"""
# shut down all recorders
self._rec_mgr.shutdown()
def _declare_options(self):
"""
Declare options before kwargs are processed in the init method.
This is optionally implemented by subclasses of Driver.
"""
pass
def _setup_comm(self, comm):
"""
Perform any driver-specific setup of communicators for the model.
Parameters
----------
comm : MPI.Comm or <FakeComm> or None
The communicator for the Problem.
Returns
-------
MPI.Comm or <FakeComm> or None
The communicator for the Problem model.
"""
return comm