Template:CMI Example go CXX: Difference between revisions

From CSDMS
Automated import of articles
 
Automated import of articles *** existing text overwritten ***
 
Line 2: Line 2:
   int bocca_status = 0;
   int bocca_status = 0;


  this->log.info ("Go");
   this->is_driver = TRUE;
   this->is_driver = TRUE;


Line 10: Line 11:
   return bocca_status;
   return bocca_status;


#if 0
  {
    ::sidl::array< ::std::string> properties =
      sidl::array< ::std::string>::create1d(2);
    double duration;
    fprintf (stderr, "Running GO
");
    if (!this->logging_is_initialized)
    {
      fprintf (stderr, "Set up logging
");
      this->log = ::edu::csdms::tools::Verbose::_create ();
      fprintf (stderr, "Logging is set up
");
      this->log.set_log_level (1);
      fprintf (stderr, "Logging level set
");
      this->logging_is_initialized = true;
    }
    PRINT(1, "Read input paramaters");
    { /*  Get site and case prefixes from the GUI */
      string site_prefix = userinput.getString ("/Child/SitePrefix", "");
      string case_prefix = userinput.getString ("/Child/CasePrefix", "");
      duration= userinput.getDouble ("/Child/Input/Var/RunDuration", 0);
      properties.set (0, site_prefix);
      properties.set (1, case_prefix);
    }
    PRINT(1, "Initialize");
    this->initialize_impl (properties);
    PRINT (1, "Run");
    this->run_impl (duration);
    PRINT (1, "Finalize");
    this->finalize_impl ();
  }
  PRINT (1, "Model is complete");
  return bocca_status;
#endif
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 11:52, 6 February 2012

  int bocca_status = 0;

  this->log.info ("Go");
  this->is_driver = TRUE;

  this->CMI_initialize (NULL);
  this->CMI_run (-1);
  this->CMI_finalize ();

  return bocca_status;