本文整理汇总了C++中MooseSharedPointer::getControllableParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseSharedPointer::getControllableParameters方法的具体用法?C++ MooseSharedPointer::getControllableParameters怎么用?C++ MooseSharedPointer::getControllableParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseSharedPointer
的用法示例。
在下文中一共展示了MooseSharedPointer::getControllableParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ControlOutput::outputControls()
{
// Extract InputParameter objects from warehouse
InputParameterWarehouse & wh = _app.getInputParameterWarehouse();
const std::multimap<MooseObjectName, MooseSharedPointer<InputParameters> > & params = wh.getInputParameters();
// The stream to build
std::stringstream oss;
oss << std::left;
// Populate a map based on unique InputParameter objects
std::map<MooseSharedPointer<InputParameters>, std::set<MooseObjectName> > objects;
for (std::multimap<MooseObjectName, MooseSharedPointer<InputParameters> >::const_iterator iter = params.begin(); iter != params.end(); ++iter)
objects[iter->second].insert(iter->first);
// Produce the control information
oss << "Controls:\n";
for (std::map<MooseSharedPointer<InputParameters>, std::set<MooseObjectName> >::const_iterator iter = objects.begin(); iter != objects.end(); ++iter)
{
MooseSharedPointer<InputParameters> ptr = iter->first;
const std::set<std::string> & names = ptr->getControllableParameters();
if (!names.empty())
{
oss << ConsoleUtils::indent(2) << COLOR_YELLOW << ptr->get<std::string>("_object_name") << COLOR_DEFAULT << '\n';
// Full names(s)
oss << ConsoleUtils::indent(4) << "Name(s): ";
for (std::set<MooseObjectName>::const_iterator it = iter->second.begin(); it != iter->second.end(); ++it)
oss << (*it) << " ";
oss << '\n';
// Tag(s)
const std::vector<std::string> & tags = ptr->get<std::vector<std::string> >("control_tags");
if (!tags.empty())
{
oss << ConsoleUtils::indent(4) << "Tag(s): ";
for (std::vector<std::string>::const_iterator it = tags.begin(); it != tags.end(); ++it)
oss << *it << " ";
oss << '\n';
}
oss << ConsoleUtils::indent(4) << "Parameter(s):\n";
for (std::set<std::string>::const_iterator it = names.begin(); it != names.end(); ++it)
oss << ConsoleUtils::indent(6) << std::setw(ConsoleUtils::console_field_width) << *it << ptr->type(*it) << '\n';
}
}
_console << oss.str() << std::endl;
}