本文整理汇总了Python中openmdao.recorders.recording_manager.RecordingManager.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Python RecordingManager.shutdown方法的具体用法?Python RecordingManager.shutdown怎么用?Python RecordingManager.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openmdao.recorders.recording_manager.RecordingManager
的用法示例。
在下文中一共展示了RecordingManager.shutdown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Solver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import shutdown [as 别名]
#.........这里部分代码省略.........
Return a string representation of the solver.
Returns
-------
str
String representation of the solver.
"""
return self.SOLVER
def record_iteration(self, **kwargs):
"""
Record an iteration of the current Solver.
Parameters
----------
**kwargs : dict
Keyword arguments (used for abs and rel error).
"""
if not self._rec_mgr._recorders:
return
metadata = create_local_meta(self.SOLVER)
# Get the data
data = {}
if self.recording_options['record_abs_error']:
data['abs'] = kwargs.get('abs')
else:
data['abs'] = None
if self.recording_options['record_rel_error']:
data['rel'] = kwargs.get('rel')
else:
data['rel'] = None
system = self._system
if isinstance(self, NonlinearSolver):
outputs = system._outputs
inputs = system._inputs
residuals = system._residuals
else: # it's a LinearSolver
outputs = system._vectors['output']['linear']
inputs = system._vectors['input']['linear']
residuals = system._vectors['residual']['linear']
if self.recording_options['record_outputs']:
data['o'] = {}
if 'out' in self._filtered_vars_to_record:
for out in self._filtered_vars_to_record['out']:
if out in outputs._names:
data['o'][out] = outputs._views[out]
else:
data['o'] = outputs
else:
data['o'] = None
if self.recording_options['record_inputs']:
data['i'] = {}
if 'in' in self._filtered_vars_to_record:
for inp in self._filtered_vars_to_record['in']:
if inp in inputs._names:
data['i'][inp] = inputs._views[inp]
else:
data['i'] = inputs
else:
data['i'] = None
if self.recording_options['record_solver_residuals']:
data['r'] = {}
if 'res' in self._filtered_vars_to_record:
for res in self._filtered_vars_to_record['res']:
if res in residuals._names:
data['r'][res] = residuals._views[res]
else:
data['r'] = residuals
else:
data['r'] = None
self._rec_mgr.record_iteration(self, data, metadata)
def cleanup(self):
"""
Clean up resources prior to exit.
"""
# shut down all recorders
self._rec_mgr.shutdown()
def _set_complex_step_mode(self, active):
"""
Turn on or off complex stepping mode.
Recurses to turn on or off complex stepping mode in all subsystems and their vectors.
Parameters
----------
active : bool
Complex mode flag; set to True prior to commencing complex step.
"""
pass
示例2: Driver
# 需要导入模块: from openmdao.recorders.recording_manager import RecordingManager [as 别名]
# 或者: from openmdao.recorders.recording_manager.RecordingManager import shutdown [as 别名]
#.........这里部分代码省略.........
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
def _setup_driver(self, problem):
"""
Prepare the driver for execution.
This is the final thing to run during setup.
Parameters