本文整理汇总了C++中SignalArgs::map方法的典型用法代码示例。如果您正苦于以下问题:C++ SignalArgs::map方法的具体用法?C++ SignalArgs::map怎么用?C++ SignalArgs::map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SignalArgs
的用法示例。
在下文中一共展示了SignalArgs::map方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void C3DViewBuilder::signature_create_3dview(SignalArgs &args)
{
SignalFrame& options = args.map( Protocol::Tags::key_options() );
options.set_option("3DView name", common::class_name<std::string>(), std::string(), "Name for the new 3DView");
options.set_option("Parent", common::class_name<URI>(), Core::instance().root().uri().path(), "Parent of the new component");
}
示例2: signature_create_model
void ShockTube::signature_create_model( SignalArgs& args )
{
SignalFrame& p = args.map( Protocol::Tags::key_options() );
p.set_option<std::string>("model_name", "shocktube" , "Name for created model" );
p.set_option<Uint>("nb_cells", 100u , "Number of Cells to be generated");
p.set_option<Uint>("dimension", 1u , "Dimension of the problem");
}
示例3:
void N3DView::launch_pvserver( SignalArgs& node ){
SignalFrame& options = node.map( Protocol::Tags::key_options() );
std::vector<std::string> data = options.get_array<std::string>("infoServer");
std::string host = data[0];
std::string port = data[1];
TabBuilder::instance()->getWidget<Widget3D>(as_ptr<CNode>())
->connectToServer(host.c_str(), port.c_str());
}
示例4: QString
void N3DView::send_server_info_to_client( SignalArgs& node ){
SignalFrame& options = node.map( Protocol::Tags::key_options() );
std::vector<std::string> data = options.get_array<std::string>("pathinfo");
std::string path = data[0];
std::string name = data[1];
std::vector<QString> path_list(1);
path_list[0] = QString(path.c_str());
std::vector<QString> name_list(1);
name_list[0] = QString(name.c_str());
TabBuilder::instance()->getWidget<Widget3D>(as_ptr<CNode>())
->loadPaths(path_list, name_list);
}
示例5: convergence_history
void NPlotXY::convergence_history ( SignalArgs& node )
{
SignalFrame& options = node.map( Protocol::Tags::key_options() );
PlotDataPtr array( new PlotData() );
std::vector<std::string> labels;
get_multi_array(options.main_map, "Table", *array, labels);
int nbRows = array->size();
int nbCols = (*array)[0].size();
std::vector<QString> fct_label(labels.size() + 1);
fct_label[0] = "#";
for(int i = 0 ; i < labels.size() ; ++i)
fct_label[i+1] = labels[i].c_str();
// Store last dimension, then first, then middle
PlotData::size_type ordering[] = {0, 1};
// Store the first dimension(dimension 0) in descending order
bool ascending[] = {true, true};
PlotDataPtr plot( new PlotData(boost::extents[nbRows][nbCols+1],
boost::general_storage_order<2>(ordering, ascending)) );
for(PlotData::index row = 0;row<nbRows;++row)
{
(*plot)[row][0] = row;
}
for(PlotData::index row = 0; row != nbRows; ++row)
{
for(PlotData::index col = 0; col != nbCols; ++col)
(*plot)[row][col+1] = (*array)[row][col];
}
TabBuilder::instance()->widget<Graph>(handle<CNode>())->set_xy_data(plot, fct_label);
}
示例6: signalSignature
void SignalManager::signalSignature(SignalArgs & args)
{
if(m_waitingForSignature)
{
URI path = m_node->realComponent()->uri();
ActionInfo & info = m_signals[m_currentAction];
const char * tag = Protocol::Tags::key_options();
m_frame = SignalFrame(info.name.toStdString(), path, path);
SignalFrame& options = m_frame.map( Protocol::Tags::key_options() );
if( args.has_map(tag) )
args.map(tag).main_map.content.deep_copy( options.main_map.content );
try
{
SignatureDialog * sg = new SignatureDialog();
connect(sg, SIGNAL(finished(int)), this, SLOT(dialogFinished(int)));
sg->show(options.main_map.content, m_currentAction->text());
}
catch( Exception & e)
{
NLog::globalLog()->addException(e.what());
}
catch( ... )
{
NLog::globalLog()->addException("Unknown exception caught");
}
m_waitingForSignature = false;
}
}
示例7: signal_create_model
void ShockTube::signal_create_model ( SignalArgs& args )
{
SignalFrame& p = args.map( Protocol::Tags::key_options() );
////////////////////////////////////////////////////////////////////////////////
// Create Model
////////////////////////////////////////////////////////////////////////////////
std::string name = p.get_option<std::string>("model_name");
CFinfo << "Creating model " << name << CFendl;
CModelUnsteady& model = *Common::Core::instance().root().create_component_ptr<CModelUnsteady>( name );
////////////////////////////////////////////////////////////////////////////////
// Create Physics
////////////////////////////////////////////////////////////////////////////////
CFinfo << "Creating physics" << CFendl;
Physics::PhysModel& physics = model.create_physics("physics");
physics.configure_option( "Dimensions", p.get_option<Uint>("dimension") );
////////////////////////////////////////////////////////////////////////////////
// Create tools
////////////////////////////////////////////////////////////////////////////////
CMeshTransformer& finite_volume_transformer = model.tools().create_component<CMeshTransformer>("FiniteVolumeTransformer");
finite_volume_transformer.create_component_ptr<CBuildFaces> ("1_build_faces")->mark_basic();
finite_volume_transformer.create_component_ptr<BuildGhostStates>("2_build_ghoststates")->mark_basic();
finite_volume_transformer.create_component_ptr<CreateSpaceP0> ("3_create_space_P0")->mark_basic();
finite_volume_transformer.create_component_ptr<CBuildVolume> ("4_build_volume_field")->mark_basic();
////////////////////////////////////////////////////////////////////////////////
// Generate mesh
////////////////////////////////////////////////////////////////////////////////
CFinfo << "Creating domain" << CFendl;
CDomain& domain = model.create_domain("domain");
CMesh::Ptr mesh_ptr;
CFinfo << " Generating mesh with " << p.get_option<Uint>("nb_cells") << " cells per dimension" <<CFendl;
switch (p.get_option<Uint>("dimension"))
{
case 1:
mesh_ptr = domain.create_component_ptr<CMesh>("line");
CSimpleMeshGenerator::create_line(*mesh_ptr, 10. , p.get_option<Uint>("nb_cells"));
break;
case 2:
mesh_ptr = domain.create_component_ptr<CMesh>("square");
CSimpleMeshGenerator::create_rectangle(*mesh_ptr, 10. , 10. , p.get_option<Uint>("nb_cells"), p.get_option<Uint>("nb_cells"));
break;
default:
throw NotSupported(FromHere(),"Only 1D or 2D dimension supported");
}
CMesh& mesh = *mesh_ptr;
CFinfo << " Transforming mesh for finite volume: " << finite_volume_transformer.tree();
finite_volume_transformer.transform(mesh);
////////////////////////////////////////////////////////////////////////////////
// Create Solver / Discretization
////////////////////////////////////////////////////////////////////////////////
CFinfo << "Creating FiniteVolumeSolver" << CFendl;
FiniteVolumeSolver& solver = model.create_solver("CF.FVM.Core.FiniteVolumeSolver").as_type<FiniteVolumeSolver>();
solver.configure_option("physical_model",physics.uri());
solver.configure_option("domain",domain.uri());
solver.configure_option_recursively("ctime",model.as_type<CModelUnsteady>().time().uri());
solver.configure_option_recursively("time_accurate",true);
////////////////////////////////////////////////////////////////////////////////
// Initial condition
////////////////////////////////////////////////////////////////////////////////
CFinfo << "Setting initial condition" << CFendl;
CInitFieldFunction& init_solution = model.tools().create_component<CInitFieldFunction>("init_solution");
init_solution.configure_option("field",find_component_with_tag(mesh,"solution").uri());
const Real r_L = 4.696; const Real r_R = 1.408;
const Real p_L = 404400; const Real p_R = 101100;
const Real u_L = 0.; const Real u_R = 0.;
const Real v_L = 0.; const Real v_R = 0.;
const Real g=1.4;
if (physics.ndim() == 1)
{
RealVector3 left, right;
left << r_L , r_L*u_L , p_L/(g-1) + 0.5*r_L*u_L*u_L;
right << r_R , r_R*u_R , p_R/(g-1) + 0.5*r_R*u_R*u_R;
std::vector<std::string> function(3);
for (Uint i=0; i<function.size(); ++i)
function[i]="if(x<=5,"+to_str(left[i])+","+to_str(right[i])+")";
init_solution.configure_option("functions",function);
}
else if (physics.ndim() == 2)
{
RealVector4 left, right;
left << r_L , r_L*u_L , r_L*v_L, p_L/(g-1) + 0.5*r_L*(u_L*u_L+v_L*v_L);
right << r_R , r_R*u_R , r_R*v_R, p_R/(g-1) + 0.5*r_R*(u_R*u_R+v_R*v_R);
std::vector<std::string> function(4);
for (Uint i=0; i<function.size(); ++i)
function[i]="if(x<=5&y<=5,"+to_str(left[i])+","+to_str(right[i])+")";
init_solution.configure_option("functions",function);
}
//.........这里部分代码省略.........