/* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.ke
 * All rights reserved.
 * Use of this source code is governed by a MIT-style
 * license that can be found in the LICENSE file.    */
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>

#include "parameter.h"
#include "solver.h"
#include "timing.h"

int main(int argc, char** argv)
{

    MPI_Init(&argc, &argv);
    
    double startTime, endTime;
    Parameter params;
    Solver solver;

    initParameter(&params);

    if (argc < 2) {
        printf("Usage: %s <configFile>\n", argv[0]);
        exit(EXIT_SUCCESS);
    }

    readParameter(&params, argv[1]);
    initSolver(&solver, &params, 2);
    startTime = getTimeStamp();
    solveRB(&solver);
    endTime = getTimeStamp();
    writeResult(&solver, "p.dat");
    if(solver.rank == 0) printf(" %.2fs\n", endTime - startTime);

    MPI_Finalize();
    return EXIT_SUCCESS;
}
