Beispiel #1
0
int main()
{
  int err = 0 ;

  // reroute stdout for regressions: TODO remove when logger mechanism
  // is used inside masa; these tests currently just verify functions
  // run successfully.

  freopen("/dev/null","w",stdout);

  // list all currently initialized mms
  masa_list_mms();

  // initalize two different functions
  masa_init("euler-test","euler_1d");
  masa_init_param();
  masa_init("euler-test2","euler_2d");
  masa_init_param();

  masa_list_mms();

  // display parameters @ default values
  err = masa_display_param();
  if(err != 0)
    {
      return 1;
    }
  
  //change parameter
  masa_set_param("u_0",2.3);

  // display again
  masa_display_param();

  //switch to original function
  masa_select_mms("euler-test");
  masa_display_param();

  //tests passed
  return 0;

}
Beispiel #2
0
int main()
{
  double sol=0;
  double q=0;
  double x  = 1.2;
  double x2 = 2.2;
  char* a= "A_x";
  
  sol = 0;

  // init
  masa_init("nick","heateq_1d_steady_const");
  masa_init("bob","heateq_1d_steady_const");

  // reroute stdout: comment to display to screen
  freopen("/dev/null","w",stdout);
  
  // we can list initialized mms with 
   masa_list_mms();

  // switch
  masa_select_mms("nick");
  
  // we can display the parameter list with
  masa_display_param();

  // lets examine a particular parameter 
  q=masa_get_param(a);

  // now lets change that parameters value to something else.
  masa_set_param(a,1.984);
  q=masa_get_param(a);

  //check all initialized properly
  masa_sanity_check();
  sol = masa_eval_1d_source_t(x);
  
  masa_select_mms("bob");
  sol = masa_eval_1d_source_t(x2);
  return 0; // done
}