#ifndef __FILE_HABIT_MAIN_MPI_H_SEEN__
#define __FILE_HABIT_MAIN_MPI_H_SEEN__

/* ----------------------------------------------------------------------------

Copyright (C) 2002, 2003, 2006.

A. Ronald Gallant
Post Office Box 659
Chapel Hill NC 27514-0659
USA

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

-----------------------------------------------------------------------------*/

#include "libscl.h"
#include "libmcmc.h"
#include "prop_defs.h"
#include "habit_usrmod.h"

#include <typeinfo>
#include "mpi.h" 

namespace habit_main_mpi {

  const INTEGER prop_def_spec = 0;  //Single move normal

  const std::string pathname("/home/arg/r/bedf/habit/habit_edf_mpi/results/");

  REAL g_range     = 0.001;
  REAL R11_range   = 0.005;
  REAL R12_range   = 0.05;
  REAL R22_range   = 0.05;
  REAL phi_range   = 0.01;
  REAL delta_range = 0.006;
  REAL gamma_range = 1.10;

  REAL g_start     = 2.0528564453125000e-03;
  REAL R11_start   = 3.6621093750000000e-04;
  REAL R12_start   = 7.9345703125000000e-04;
  REAL R22_start   = 7.3242187500000000e-04;
  REAL phi_start   = 9.8947143554687500e-01;
  REAL delta_start = 9.9409484863281250e-01;
  REAL gamma_start = 1.2890625000000000e+00;

  const REAL range_factor = (1.0/16.0);
  const REAL scale_factor = (1.0/16.0);
  const REAL temperature  = 2.0;

  const INTEGER simulation_size = 10000;
  const INTEGER simulation_reps = 5;

  typedef libmcmc::group_move   proposal_type;
  typedef habit_usrmod usrmod_type;
  typedef libmcmc::edf_objfun   objfun_type;

  int my_rank;
  int no_procs;

  scl::LIB_ERROR_HANDLER_PTR previous_error_handler;  
  scl::LIB_WARN_HANDLER_PTR previous_warn_handler;  

  void mpi_error (std::string msg) {
    std::cout << msg << std::endl; MPI_Abort(MPI_COMM_WORLD, my_rank);
  }
  void mpi_warn (std::string msg) {
    std::cout << msg << std::endl; MPI_Abort(MPI_COMM_WORLD, my_rank);
  }

  void simout(INTEGER s, INTEGER i,
       const scl::realmat& theta_sim, const scl::realmat& stats_sim,
       const scl::realmat& pi_sim, REAL reject,
       const scl::realmat& theta_hat, const scl::realmat& V_hat,
       const scl::realmat& inv_J_hat, const scl::realmat& foc_hat);

}

#endif
