1 #include <cstdlib>
2 #include <vector>
3 #include <fstream>
4 // #include <omp.h>
5 #include <iomanip>
6 
7 #include "libnormaliz/libnormaliz.h"
8 
9 using namespace std;
10 
11 using namespace libnormaliz;
12 
main(int argc,char * argv[])13 int main(int argc, char* argv[]) {
14 
15     if(argc < 3){
16         cout << "Not enaough parameters" << endl;
17         exit(1);
18     }
19 
20     string project_name(argv[1]);
21 
22     mpq_class total_mult = 0;
23 
24     size_t nr_blocks = stoi(string(argv[2]));
25     cout << "Summing " << nr_blocks << " partial multiplicities" << endl;
26     for(size_t i = 0; i< nr_blocks; ++i){
27         cout << "Reading block " << i << endl;
28         string name_in = project_name+".mult." + to_string(i);
29         const char* file_in = name_in.c_str();
30         ifstream in;
31         in.open(file_in, ifstream::in);
32         string type;
33         in >> type;
34         if(type != "multiplicity"){
35             cout << "spoiled mult " << i << endl;
36             exit(1);
37         }
38         size_t this_chunk;
39         in >> this_chunk;
40         if(i != this_chunk){
41             cout << "spoiled mult " << i << endl;
42             exit(1);
43         }
44         mpq_class mult;
45         in >> mult;
46         total_mult += mult;
47     }
48     cout << "Toatl miultiplicity" << endl;
49     cout << total_mult << endl;
50     cout << "Toatl miultiplicity (float) " << std::setprecision(12) << mpq_to_nmz_float(total_mult) << endl;
51 
52 }
53