Jpp
JEigenValues2D.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <fstream>
4 #include <iomanip>
5 #include <vector>
6 
9 
10 #include "Jeep/JPrint.hh"
11 #include "Jeep/JParser.hh"
12 #include "Jeep/JMessage.hh"
13 
14 
15 /**
16  * \file
17  *
18  * Example program to print eigen values in 2D.
19  * \author mdejong
20  */
21 int main(int argc, char **argv)
22 {
23  using namespace std;
24 
25  string inputFile;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Example program to print eigen values in 2D.");
31 
32  zap['f'] = make_field(inputFile);
33  zap['d'] = make_field(debug) = 1;
34 
35  zap(argc, argv);
36  }
37  catch(const exception& error) {
38  FATAL(error.what() << endl);
39  }
40 
41 
42  using namespace JPP;
43 
44  cout.tie(&cerr);
45 
46 
47  vector<JVector2D> buffer;
48 
49  if (inputFile != "") {
50 
51  ifstream in(inputFile.c_str());
52 
53  for (double x, y; in >> x >> y; ) {
54 
55  buffer.push_back(JVector2D(x,y));
56  }
57 
58  in.close();
59  }
60 
61  JEigenValues2D eigen(buffer.begin(), buffer.end());
62 
63  cout << "Number of eigen values " << eigen.getN() << endl;
64  cout << FIXED(7,3) << eigen.getX() << endl;
65  cout << FIXED(7,3) << eigen.getY() << endl;
66 }
FIXED
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
JMessage.hh
JPrint.hh
main
int main(int argc, char **argv)
Definition: JEigenValues2D.cc:21
std::vector
Definition: JSTDTypes.hh:12
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JEigenValues2D.hh
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
JVector2D.hh
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67