aboutsummaryrefslogtreecommitdiff
path: root/Source/main.cpp
blob: d89e89e47cebf161b9bb12df3c0b2b1ebd6f352f (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

#include <iostream>

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

#include <WarpX.H>
#include <WarpXUtil.H>

using namespace amrex;

int main(int argc, char* argv[])
{
#if defined(_OPENMP) && defined(WARPX_USE_PSATD)
    int provided;
    MPI_Init_thread(&argc, &argv, MPI_THREAD_FUNNELED, &provided);
    assert(provided >= MPI_THREAD_FUNNELED);
#else
    MPI_Init(&argc, &argv);
#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();
    MPI_Finalize();
}