当前位置: 首页>>代码示例>>C++>>正文


C++ MooseApp::setRecover方法代码示例

本文整理汇总了C++中MooseApp::setRecover方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseApp::setRecover方法的具体用法?C++ MooseApp::setRecover怎么用?C++ MooseApp::setRecover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MooseApp的用法示例。


在下文中一共展示了MooseApp::setRecover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: name

void
MultiApp::createApp(unsigned int i, Real start_time)
{

  // Define the app name
  std::ostringstream multiapp_name;
  std::string full_name;
  multiapp_name << name() <<  std::setw(std::ceil(std::log10(_total_num_apps)))
           << std::setprecision(0) << std::setfill('0') << std::right << _first_local_app + i;

  // Only add parent name if it the parent is not the main app
  if (_app.multiAppLevel() > 0)
    full_name = _app.name() + "_" + multiapp_name.str();
  else
    full_name = multiapp_name.str();

  InputParameters app_params = AppFactory::instance().getValidParams(_app_type);
  app_params.set<FEProblem *>("_parent_fep") = &_fe_problem;
  app_params.set<MooseSharedPointer<CommandLine> >("_command_line") = _app.commandLine();
  MooseApp * app = AppFactory::instance().create(_app_type, full_name, app_params, _my_comm);
  _apps[i] = app;

  std::string input_file = "";
  if (_input_files.size() == 1) // If only one input file was provided, use it for all the solves
    input_file = _input_files[0];
  else
    input_file = _input_files[_first_local_app+i];

  std::ostringstream output_base;

  // Create an output base by taking the output base of the master problem and appending
  // the name of the multiapp + a number to it
  if (!_app.getOutputFileBase().empty())
    output_base << _app.getOutputFileBase() + "_";
  else
  {
    std::string base = _app.getFileName();
    size_t pos = base.find_last_of('.');
    output_base << base.substr(0, pos) + "_out_";
  }

  // Append the sub app name to the output file base
  output_base << multiapp_name.str();
  app->setGlobalTimeOffset(start_time);
  app->setInputFileName(input_file);
  app->setOutputFileBase(output_base.str());
  app->setOutputFileNumbers(_app.getOutputWarehouse().getFileNumbers());
  app->setRestart(_app.isRestarting());
  app->setRecover(_app.isRecovering());

  // This means we have a backup of this app that we need to give to it
  // Note: This won't do the restoration immediately.  The Backup
  // will be cached by the MooseApp object so that it can be used
  // during FEProblem::initialSetup() during runInputFile()
  if (_app.isRestarting() || _app.isRecovering())
    app->restore(_backups[i]);

  if (getParam<bool>("output_in_position"))
    app->setOutputPosition(_app.getOutputPosition() + _positions[_first_local_app + i]);

  // Update the MultiApp level for the app that was just created
  app->setMultiAppLevel(_app.multiAppLevel() + 1);
  app->setupOptions();
  preRunInputFile();
  app->runInputFile();
}
开发者ID:Biyss,项目名称:moose,代码行数:66,代码来源:MultiApp.C


注:本文中的MooseApp::setRecover方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。