本文整理汇总了C++中MooseApp::setMultiAppLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseApp::setMultiAppLevel方法的具体用法?C++ MooseApp::setMultiAppLevel怎么用?C++ MooseApp::setMultiAppLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseApp
的用法示例。
在下文中一共展示了MooseApp::setMultiAppLevel方法的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());
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();
app->runInputFile();
}