forked from XBraid/xbraid-convergence-est
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
47 lines (40 loc) · 1.64 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <mpi.h>
#include <iostream>
#include <ctime>
#include "armadillo"
#include "io_routines.hpp"
#include "bound_routines.hpp"
#include "types.hpp"
using namespace arma;
using namespace std;
int main(int argc, char** argv){
MPI_Init(NULL, NULL);
appStruct app;
MPI_Comm_size(MPI_COMM_WORLD, &app.world_size);
MPI_Comm_rank(MPI_COMM_WORLD, &app.world_rank);
clock_t begin,end;
int errCode = 0;
if(app.world_rank == 0){
cout << endl << "Armadillo version: " << arma_version::as_string() << endl << endl;
}
// MGRIT settings - set defaults and parse commandline options
initalize_app_struct(app);
errCode = parse_commandline_options(app, argc, argv);
if(errCode != 0){ MPI_Finalize(); return 0; }
// read eigenvalues based on commandline options
setget_eigenvalues(app);
begin = clock();
// evaluate bound for residual or error propagator for complex eigenvalue case
if(app.sampleComplexPlane || app.fileComplexEigenvalues){
get_propagator_bound(app.bound, app.theoryLevel, app.cycle, app.relax, app.numberOfTimeSteps, app.coarseningFactors, app.lambdac, app.estimate);
// evaluate bound for residual or error propagator for real eigenvalue case
}else{
get_propagator_bound(app.bound, app.theoryLevel, app.cycle, app.relax, app.numberOfTimeSteps, app.coarseningFactors, app.lambdar, app.estimate);
}
end = clock();
cout << "Rank " << app.world_rank << " / " << app.world_size << " - Elapsed time: " << double(end-begin)/CLOCKS_PER_SEC << " seconds" << endl << endl;
// export results
export_estimates(app);
MPI_Finalize();
return 0;
}