Revision 752 branches/threaded2/src/nh99/mod_mc.cpp

mod_mc.cpp (revision 752)
4 4
 * Author: David Fournier
5 5
 * Copyright (c) 2008-2012 Regents of the University of California 
6 6
 */
7
#include <thread>
8
#include <sstream>
9
#include <cassert>
7 10
#include <admodel.h>
8 11

  
9 12
#ifdef __GNUDOS__
......
52 55
    dvector v(1,nvar);  // need to read in v from model.rep
53 56
    dmatrix S(1,nvar,1,nvar);
54 57
    {
55
      adstring tmpstring="admodel.cov";
56
      if (ad_comm::wd_flag)
57
        tmpstring = ad_comm::adprogram_name + ".cov";
58
      uistream cif((char*)tmpstring);
59
      if (!cif)
60
      {
61
        cerr << "Error trying to open file " << tmpstring
62
	    << " for reading" << endl;
63
      }
58
      std::thread::id this_thread_id = std::this_thread::get_id();
59
      std::ostringstream oss2;
60
      oss2 << *ad_comm::adprogram_name << this_thread_id << ".cov";
61
      uistream  cif(oss2.str().c_str());
62
      assert(cif.is_open());
63

  
64 64
      int tmp_nvar;
65 65
      cif >> tmp_nvar;
66
      if (nvar !=tmp_nvar)
67
      {
68
        cerr << "Incorrect number of independent variables in file"
69
            << tmpstring  << endl;
70
        exit(1);
71
      }
66
      assert(nvar == tmp_nvar);
67

  
72 68
      cif >> S;
73
      if (!cif)
74
      {
75
        cerr << "error reading covariance matrix from "
76
	     <<   tmpstring << endl;
77
        exit(1);
78
      }
69
      assert(cif);
79 70

  
80 71
      initial_params::mc_phase=0;
81 72
      /*int check=*/initial_params::stddev_scale(scale,x);

Also available in: Unified diff