src/ffs/ffs_inst.c
int ffs_inst_init_from_config(ffs_inst_t * obj, u_config_t * input) {

  u_config_t * config = NULL;
  const char * method;
  const char * sim_name;
  const char * sim_argv;
  const char * sim_lambda;

  dbg_return_if(obj == NULL, -1);
  dbg_return_if(input == NULL, -1);

  /* Parse input */

  config = u_config_get_child(input, FFS_CONFIG_INST);
  dbg_ifm(config == NULL, "No config");
  mpilog_err_if(config == NULL, obj->log, "Config file has no %s section\n",
		FFS_CONFIG_INST);

  /* Set method; default is the test method */

  obj->method = FFS_METHOD_TEST;

  method = u_config_get_subkey_value(config, FFS_CONFIG_INST_METHOD);

  mpilog_if(method == NULL, obj->log, "Must have an %s key in the %s config\n",
	    FFS_CONFIG_INST_METHOD, FFS_CONFIG_INST);
  dbg_err_ifm(method == NULL, "No method");

  if (strcmp(method, FFS_CONFIG_METHOD_TEST) == 0) {
    obj->method = FFS_METHOD_TEST;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_BRANCHED) == 0) {
    obj->method = FFS_METHOD_BRANCHED;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_DIRECT) == 0) {
    obj->method = FFS_METHOD_DIRECT;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_ROSENBLUTH) == 0) {
    obj->method = FFS_METHOD_ROSENBLUTH;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_BRUTE_FORCE) == 0) {
    obj->method = FFS_METHOD_BRUTE_FORCE;
  }
  else {
    /* The requested method was not recognised */
    dbg_err("%s (%s) not recognised in %s\n", FFS_CONFIG_INST_METHOD, method,
	    FFS_CONFIG_INST);
  }

  /* Simulation name, number of instances, and command line */

  u_config_get_subkey_value_i(config, FFS_CONFIG_SIM_MPI_TASKS,
			      FFS_DEFAULT_SIM_MPI_TASKS,
			      &obj->mpi_request);


  sim_name = u_config_get_subkey_value(config, FFS_CONFIG_SIM_NAME);
  if (sim_name == NULL) sim_name = "test";
  
  sim_argv = u_config_get_subkey_value(config, FFS_CONFIG_SIM_ARGV);
  if (sim_argv == NULL) sim_argv = "";

  sim_lambda = u_config_get_subkey_value(config, FFS_CONFIG_SIM_LAMBDA);
  if (sim_lambda == NULL) sim_lambda = "test";

  u_string_create(sim_name, strlen(sim_name), &obj->sim_name);
  u_string_create(sim_argv, strlen(sim_argv), &obj->sim_argv);
  u_string_create(sim_lambda, strlen(sim_lambda), &obj->sim_lambda);

  dbg_err_ifm(obj->sim_name == NULL, "u_string_create(sim_name)");
  dbg_err_ifm(obj->sim_argv == NULL, "u_string_create(sim_argv)");
  dbg_err_ifm(obj->sim_argv == NULL, "u_string_create(sim_lambda)");

  /* Initialisation section */

  dbg_err_if( ffs_inst_read_init(obj, config) );
  dbg_err_if( ffs_inst_read_trial(obj, config) );

  /* Interface section */

  config = u_config_get_child(input, FFS_CONFIG_INTERFACES);
  dbg_ifm(config == NULL, "No interfaces");
  mpilog_err_if(config == NULL, obj->log, "No %s\n", FFS_CONFIG_INTERFACES);

  dbg_err_if( ffs_param_create(obj->log, &obj->param) );
  dbg_err_if( ffs_param_from_config(obj->param, config) );

  /* Report */

  ffs_inst_config(obj);

  return 0;

 err:

  mpilog(obj->log, "Problem parsing the instance config\n");

  return -1;
}
/*****************************************************************************
 *
 *  ffs_inst_init_from_config
 *
 *  Parse the ffs_inst section of the config. It is assumed every
 *  rank receives exactly the same config, so failures are collective.
 *
 *  Also retreive the simulation (proxy) name, and the command
 *  line strings, etc.
 *
 *  Any check of these data is deferred until the relevant time.
 *
 *****************************************************************************/
ffs_inst_init_from_config
Parse the ffs_inst section of the config. It is assumed every
rank receives exactly the same config, so failures are collective.

Also retreive the simulation (proxy) name, and the command
line strings, etc.

Any check of these data is deferred until the relevant time.
ffs_inst_init_from_config Parse the ffs_inst section of the config . It is assumed every rank receives exactly the same config so failures are collective . Also retreive the simulation ( proxy ) name and the command line strings etc . Any check of these data is deferred until the relevant time .
int ffs_inst_init_from_config(ffs_inst_t * obj, u_config_t * input) {
  u_config_t * config = NULL;
  const char * method;
  const char * sim_name;
  const char * sim_argv;
  const char * sim_lambda;
  dbg_return_if(obj == NULL, -1);
  dbg_return_if(input == NULL, -1);
  config = u_config_get_child(input, FFS_CONFIG_INST);
  dbg_ifm(config == NULL, "No config");
  mpilog_err_if(config == NULL, obj->log, "Config file has no %s section\n",
		FFS_CONFIG_INST);
  obj->method = FFS_METHOD_TEST;
  method = u_config_get_subkey_value(config, FFS_CONFIG_INST_METHOD);
  mpilog_if(method == NULL, obj->log, "Must have an %s key in the %s config\n",
	    FFS_CONFIG_INST_METHOD, FFS_CONFIG_INST);
  dbg_err_ifm(method == NULL, "No method");
  if (strcmp(method, FFS_CONFIG_METHOD_TEST) == 0) {
    obj->method = FFS_METHOD_TEST;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_BRANCHED) == 0) {
    obj->method = FFS_METHOD_BRANCHED;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_DIRECT) == 0) {
    obj->method = FFS_METHOD_DIRECT;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_ROSENBLUTH) == 0) {
    obj->method = FFS_METHOD_ROSENBLUTH;
  }
  else if (strcmp(method, FFS_CONFIG_METHOD_BRUTE_FORCE) == 0) {
    obj->method = FFS_METHOD_BRUTE_FORCE;
  }
  else {
    dbg_err("%s (%s) not recognised in %s\n", FFS_CONFIG_INST_METHOD, method,
	    FFS_CONFIG_INST);
  }
  u_config_get_subkey_value_i(config, FFS_CONFIG_SIM_MPI_TASKS,
			      FFS_DEFAULT_SIM_MPI_TASKS,
			      &obj->mpi_request);
  sim_name = u_config_get_subkey_value(config, FFS_CONFIG_SIM_NAME);
  if (sim_name == NULL) sim_name = "test";
  sim_argv = u_config_get_subkey_value(config, FFS_CONFIG_SIM_ARGV);
  if (sim_argv == NULL) sim_argv = "";
  sim_lambda = u_config_get_subkey_value(config, FFS_CONFIG_SIM_LAMBDA);
  if (sim_lambda == NULL) sim_lambda = "test";
  u_string_create(sim_name, strlen(sim_name), &obj->sim_name);
  u_string_create(sim_argv, strlen(sim_argv), &obj->sim_argv);
  u_string_create(sim_lambda, strlen(sim_lambda), &obj->sim_lambda);
  dbg_err_ifm(obj->sim_name == NULL, "u_string_create(sim_name)");
  dbg_err_ifm(obj->sim_argv == NULL, "u_string_create(sim_argv)");
  dbg_err_ifm(obj->sim_argv == NULL, "u_string_create(sim_lambda)");
  dbg_err_if( ffs_inst_read_init(obj, config) );
  dbg_err_if( ffs_inst_read_trial(obj, config) );
  config = u_config_get_child(input, FFS_CONFIG_INTERFACES);
  dbg_ifm(config == NULL, "No interfaces");
  mpilog_err_if(config == NULL, obj->log, "No %s\n", FFS_CONFIG_INTERFACES);
  dbg_err_if( ffs_param_create(obj->log, &obj->param) );
  dbg_err_if( ffs_param_from_config(obj->param, config) );
  ffs_inst_config(obj);
  return 0;
 err:
  mpilog(obj->log, "Problem parsing the instance config\n");
  return -1;
}
int ffs_inst_init_from_config ( ffs_inst_t * obj , u_config_t * input ) { u_config_t * config = NULL ; const char * method ; const char * sim_name ; const char * sim_argv ; const char * sim_lambda ; dbg_return_if ( obj == NULL , -1 ) ; dbg_return_if ( input == NULL , -1 ) ; config = u_config_get_child ( input , FFS_CONFIG_INST ) ; dbg_ifm ( config == NULL , " " ) ; mpilog_err_if ( config == NULL , obj -> log , " \n " , FFS_CONFIG_INST ) ; obj -> method = FFS_METHOD_TEST ; method = u_config_get_subkey_value ( config , FFS_CONFIG_INST_METHOD ) ; mpilog_if ( method == NULL , obj -> log , " \n " , FFS_CONFIG_INST_METHOD , FFS_CONFIG_INST ) ; dbg_err_ifm ( method == NULL , " " ) ; if ( strcmp ( method , FFS_CONFIG_METHOD_TEST ) == 0 ) { obj -> method = FFS_METHOD_TEST ; } else if ( strcmp ( method , FFS_CONFIG_METHOD_BRANCHED ) == 0 ) { obj -> method = FFS_METHOD_BRANCHED ; } else if ( strcmp ( method , FFS_CONFIG_METHOD_DIRECT ) == 0 ) { obj -> method = FFS_METHOD_DIRECT ; } else if ( strcmp ( method , FFS_CONFIG_METHOD_ROSENBLUTH ) == 0 ) { obj -> method = FFS_METHOD_ROSENBLUTH ; } else if ( strcmp ( method , FFS_CONFIG_METHOD_BRUTE_FORCE ) == 0 ) { obj -> method = FFS_METHOD_BRUTE_FORCE ; } else { dbg_err ( " \n " , FFS_CONFIG_INST_METHOD , method , FFS_CONFIG_INST ) ; } u_config_get_subkey_value_i ( config , FFS_CONFIG_SIM_MPI_TASKS , FFS_DEFAULT_SIM_MPI_TASKS , & obj -> mpi_request ) ; sim_name = u_config_get_subkey_value ( config , FFS_CONFIG_SIM_NAME ) ; if ( sim_name == NULL ) sim_name = " " ; sim_argv = u_config_get_subkey_value ( config , FFS_CONFIG_SIM_ARGV ) ; if ( sim_argv == NULL ) sim_argv = " " ; sim_lambda = u_config_get_subkey_value ( config , FFS_CONFIG_SIM_LAMBDA ) ; if ( sim_lambda == NULL ) sim_lambda = " " ; u_string_create ( sim_name , strlen ( sim_name ) , & obj -> sim_name ) ; u_string_create ( sim_argv , strlen ( sim_argv ) , & obj -> sim_argv ) ; u_string_create ( sim_lambda , strlen ( sim_lambda ) , & obj -> sim_lambda ) ; dbg_err_ifm ( obj -> sim_name == NULL , " " ) ; dbg_err_ifm ( obj -> sim_argv == NULL , " " ) ; dbg_err_ifm ( obj -> sim_argv == NULL , " " ) ; dbg_err_if ( ffs_inst_read_init ( obj , config ) ) ; dbg_err_if ( ffs_inst_read_trial ( obj , config ) ) ; config = u_config_get_child ( input , FFS_CONFIG_INTERFACES ) ; dbg_ifm ( config == NULL , " " ) ; mpilog_err_if ( config == NULL , obj -> log , " \n " , FFS_CONFIG_INTERFACES ) ; dbg_err_if ( ffs_param_create ( obj -> log , & obj -> param ) ) ; dbg_err_if ( ffs_param_from_config ( obj -> param , config ) ) ; ffs_inst_config ( obj ) ; return 0 ; err : mpilog ( obj -> log , " \n " ) ; return -1 ; }
ffs_inst_init_from_config
  Parse the ffs_inst section of the config.
ffs_inst_init_from_config Parse the ffs_inst section of the config .
/* Parse input */ /* Set method; default is the test method */ /* The requested method was not recognised */ /* Simulation name, number of instances, and command line */ /* Initialisation section */ /* Interface section */ /* Report */