GraviDy  1.0
Gravitational Dynamics N-body integrator
OptionsParser.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016
3  *
4  * Cristián Maureira-Fredes <cmaureirafredes@gmail.com>
5  *
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * 3. The name of the author may not be used to endorse or promote
20  * products derived from this software without specific prior written
21  * permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
24  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
27  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
31  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  */
36 #ifndef OPTIONSPARSER_HPP
37 #define OPTIONSPARSER_HPP
38 #include "../common.hpp"
39 #include <boost/program_options.hpp>
40 #include <sys/stat.h>
41 
42 namespace po = boost::program_options;
43 
51  public:
52  OptionsParser(int argc, char *argv[]);
54 
55  std::string input_filename;
56  std::string output_filename;
57  std::string resume_filename;
58  std::string snapshot_filename;
60  int gpus;
62  float softening;
63  float eta;
64  unsigned int snapshot_number;
65  bool resume;
67  po::variables_map vm;
68  po::options_description desc;
69 
70  bool file_exists(std::string filename);
71  bool check_options();
72 
73  private:
74  int argc;
75  char *argv[];
76 
77 };
78 
79 #endif
bool file_exists(std::string filename)
Method that check if a file exist on the system.
Definition: OptionsParser.cpp:96
Options to handling printing options, like printing the snapshot on the screen instead of a file; pri...
Definition: common.hpp:175
options ops
Definition: OptionsParser.hpp:66
bool check_options()
Method in charge to verify all the command-line arguments that where used for the current run...
Definition: OptionsParser.cpp:109
std::string input_filename
Definition: OptionsParser.hpp:55
Class in charge to handle all the command-line parameters.
Definition: OptionsParser.hpp:50
float eta
Definition: OptionsParser.hpp:63
po::variables_map vm
Definition: OptionsParser.hpp:67
po::options_description desc
Definition: OptionsParser.hpp:68
bool resume
Definition: OptionsParser.hpp:65
OptionsParser(int argc, char *argv[])
Constructor which includes the options and requirements for the command line interface.
Definition: OptionsParser.cpp:41
std::string resume_filename
Definition: OptionsParser.hpp:57
float softening
Definition: OptionsParser.hpp:62
~OptionsParser()
Destructor.
Definition: OptionsParser.cpp:90
unsigned int snapshot_number
Definition: OptionsParser.hpp:64
std::string output_filename
Definition: OptionsParser.hpp:56
std::string snapshot_filename
Definition: OptionsParser.hpp:58
float integration_time
Definition: OptionsParser.hpp:59
float snapshot_time
Definition: OptionsParser.hpp:61
int gpus
Definition: OptionsParser.hpp:60