aboutsummaryrefslogtreecommitdiff
path: root/Source/main.cpp
blob: 19413da7a1f20ab85c9cfbba89f3d8e27b5d7766 (plain) (blame)
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
48
49
50
51
52
53
54
55
56
#include <WarpX.H>
#include <WarpXUtil.H>

#include <AMReX.H>
#include <AMReX_ParmParse.H>
#include <AMReX_BLProfiler.H>
#include <AMReX_ParallelDescriptor.H>

#include <iostream>

using namespace amrex;

int main(int argc, char* argv[])
{
#if defined AMREX_USE_MPI
#if defined(_OPENMP) && defined(WARPX_USE_PSATD)
    int provided;
    MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
    AMREX_ALWAYS_ASSERT(provided >= MPI_THREAD_FUNNELED);
#else
    MPI_Init(&argc, &argv);
#endif
#endif

    amrex::Initialize(argc,argv);

    ConvertLabParamsToBoost();

    BL_PROFILE_VAR("main()", pmain);

    const Real strt_total = amrex::second();

    {
        WarpX warpx;

        warpx.InitData();

        warpx.Evolve();

        Real end_total = amrex::second() - strt_total;

        ParallelDescriptor::ReduceRealMax(end_total, ParallelDescriptor::IOProcessorNumber());
        if (warpx.Verbose()) {
            amrex::Print() << "Total Time                     : " << end_total << '\n';
            amrex::Print() << "WarpX Version: " << WarpX::Version() << '\n';
            amrex::Print() << "PICSAR Version: " << WarpX::PicsarVersion() << '\n';
        }
    }

    BL_PROFILE_VAR_STOP(pmain);

    amrex::Finalize();
#if defined AMREX_USE_MPI
    MPI_Finalize();
#endif
}