GPLIB++
CalcRecConf.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright (C) 2007 - 2009 Max Moorkamp
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18  ***************************************************************************/
19 
20 #include <fstream>
21 #include <algorithm>
22 #include <iostream>
23 #include <FatalException.h>
24 #include <boost/program_options.hpp>
25 #include "CalcRecConf.h"
26 
27 namespace gplib
28  {
29  using namespace std;
30  namespace po = boost::program_options;
31 
32  void CalcRecConf::GetData(string filename)
33  {
34  ifstream infile;
35  infile.open(filename.c_str());
36  infile.peek();
37  if (!infile)
38  throw gplib::FatalException("No Configurationfile found !");
39 
40  GetData(infile);
41  infile.close();
42  }
43 
44  void CalcRecConf::GetData(std::ifstream &instream)
45  {
46 
47  po::options_description desc("Receiver function calculation options");
48  desc.add_options()("cc", po::value<double>(&cc),
49  "The waterlevel for the deconvolution")("shift",
50  po::value<int>(&shift)->default_value(0),
51  "The shift in s of the initial correlation peak")("sigma",
52  po::value<double>(&sigma)->default_value(1.0),
53  "The bandwidth of the receiver function")("recmethod",
54  po::value<std::string>(&recmethod), "The deconvolution method")("normalize",
55  po::value<bool>(&normalize), "Normalize the receiver function")("upperfreq",
56  po::value<double>(&upperfreq)->default_value(-1.0), "")("lowerfreq",
57  po::value<double>(&lowerfreq)->default_value(-1.0), "")("rotate",
58  po::value<bool>(&rotate)->default_value(false))("prec",
59  po::value<bool>(&prec)->default_value(true))("beta",
60  po::value<double>(&beta)->default_value(3.5))("p",
61  po::value<double>(&p)->default_value(-1));
62 
63  po::variables_map vm;
64  po::store(po::parse_config_file(instream, desc), vm);
65  po::store(po::parse_command_line(argc, argv, desc), vm);
66  po::notify(vm);
67 
68  }
69  }
void GetData(std::string filename)
Definition: CalcRecConf.cpp:32
The basic exception class for all errors that arise in gplib.