ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
model17.cpp
Go to the documentation of this file.
1 
5 #include <admodel.h>
6 
16  const adstring& input_file,
17  const streampos& offset)
18 {
19  streampos tmp = 0;
21  {
22  tmp = ad_comm::global_datafile->tellg();
25  }
26  adstring tmpstring;
27  if (ad_comm::wd_flag)
28  tmpstring += ad_comm::working_directory_path + input_file;
29  else
30  tmpstring = input_file;
31  global_datafile = new cifstream(tmpstring);
32  if (!(global_datafile && global_datafile->good()))
33  {
34  cerr << "Error trying to open data input file " << input_file << endl;
35  delete global_datafile;
36  global_datafile = NULL;
37  ad_exit(1);
38  }
39  if (offset)
40  {
41  ad_comm::global_datafile->seekg(offset);
42  }
43  return tmp;
44 }
54  const adstring& input_file,
55  const streampos& offset)
56 {
57  streampos tmp = 0;
59  {
60  tmp = ad_comm::global_parfile->tellg();
63  }
64  global_parfile = new cifstream(input_file);
65  if (!(global_parfile && global_parfile->good()))
66  {
67  cerr << "Error trying to open parameter input file " << input_file << endl;
68 
69  delete global_parfile;
70  global_parfile = NULL;
71  ad_exit(1);
72  }
73  if (offset)
74  {
75  ad_comm::global_parfile->seekg(offset);
76  }
77  return tmp;
78 }
static streampos change_pinfile_name(const adstring &s, const streampos &off=0)
Change the global_parfile stream using input_file.
Definition: model17.cpp:53
static adstring working_directory_path
Definition: fvar.hpp:8861
exitptr ad_exit
Definition: gradstrc.cpp:53
prnstream & endl(prnstream &)
Description not yet available.
static cifstream * global_datafile
Definition: fvar.hpp:8856
static streampos change_datafile_name(const adstring &s, const streampos &off=0)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: model17.cpp:15
static cifstream * global_parfile
Definition: fvar.hpp:8857
static unsigned int wd_flag
Definition: fvar.hpp:8864