Ejemplo n.º 1
0
void PDE::signal_add_bc( common::SignalArgs& args )
{
  common::XML::SignalOptions opts(args);

  Handle<solver::BC> bc = add_bc( opts.value<std::string>("name"),
                                  opts.value<std::string>("type"),
                                  opts.value< std::vector< Handle<Component> > >("regions"));

  common::XML::SignalFrame reply = args.create_reply(uri());
  SignalOptions reply_options(reply);
  reply_options.add("created_component",bc->uri());

}
Ejemplo n.º 2
0
void PDE::signal_add_term( common::SignalArgs& args )
{
  common::XML::SignalOptions opts(args);

  Handle<solver::Term> term = add_term( opts.value<std::string>("name"),
                                        opts.value<std::string>("type"),
                                        opts.value<std::string>("computer"));

  common::XML::SignalFrame reply = args.create_reply(uri());
  SignalOptions reply_options(reply);
  reply_options.add("created_component",term->uri());

}
Ejemplo n.º 3
0
void VolumeIntegral::signal_integrate ( common::SignalArgs& node )
{
  common::XML::SignalOptions options( node );

  Field& field = *options.value< Handle<Field> >("field");
  std::vector< Handle<Region> > regions = options.value< std::vector<Handle<Region> > >("regions");

  Real integral = integrate(field,regions);

  SignalFrame reply = node.create_reply(uri());
  SignalOptions reply_options(reply);
  reply_options.add("return_value", integral);
}
Ejemplo n.º 4
0
void NetworkQueue::signal_ack ( common::SignalArgs & args )
{
//  if( isRunning() )
  {
    SignalOptions & options = args.options();
    std::string frameid = options.value<std::string>( "frameid" );

//    if( m_currentFrameID == frameid )
    {
      bool success = options.value<bool>( "success" );

      if( !success )
      {
        std::string message = options.value<std::string>( "message" );
        QString msg("Error while running the script.\n\nThe following error occured:\n %1"
                    "\n\nWhen executing the signal:\n\n%2");

        XML::SignalFrame f = m_transactions[m_current_index]->actions[0].node;

        NLog::global()->add_exception( msg.arg(message.c_str()).arg(f.to_script().c_str()) );

        // if the signal was comming from a script, we close the script file
        if ( m_transactions[m_current_index]->from_script )
          m_script_file->close();

        m_transactions.removeAt( m_current_index );

        if( m_transactions.isEmpty() )
          m_current_index = -1;
      }
      else
      {
        m_transactions.removeAt( m_current_index );

        if( m_transactions.isEmpty() )
          m_current_index = -1;

        if( !m_transactions.isEmpty() )
          send_next_frame();
        else if( m_script_file->isOpen() )
          send_next_command();
      }
    }
//    else
//      NLog::global()->addWarning(QString("Bad uuid! Received \"%1\" but \"%2\" was excpeted")
//                                    .arg(frameid.c_str()).arg(m_currentFrameID.c_str()));
  }
//  else
//    NLog::global()->addWarning(QString("Received ACK while not running."));

}
Ejemplo n.º 5
0
void Domain::signal_create_mesh ( common::SignalArgs& node )
{
  SignalOptions options( node );

  std::string name ("mesh");
  if( options.check("name") )
    name = options.value<std::string>("name");

  Mesh& created_component = *create_component<Mesh>(name);

  SignalFrame reply = node.create_reply(uri());
  SignalOptions reply_options(reply);
  reply_options.add("created_component", created_component.uri());
}
Ejemplo n.º 6
0
void TimeStepComputer::signal_max_cfl( common::SignalArgs& node )
{
  SignalFrame reply = node.create_reply(uri());
  SignalOptions reply_options(reply);
  reply_options.add( "return_value", max_cfl() );
}