source: vmg_particles/vmg_particles.cpp@ 06e153

Last change on this file since 06e153 was f003a9, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Refactored vmg in order to separate the core library and the particle simulation part properly.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1798 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#endif
4
5#ifdef HAVE_MPI
6#include <mpi.h>
7#ifdef HAVE_MARMOT
8#include <enhancempicalls.h>
9#include <sourceinfompicalls.h>
10#endif
11#include "comm/mpi/error_handler.hpp"
12#endif
13
14#include <cstdio>
15
16#include "comm/comm.hpp"
17#include "units/particle/interface_particles_cf.hpp"
18#include "mg.hpp"
19
20using namespace VMG;
21
22int main(int argc, char* argv[])
23{
24#ifdef HAVE_MPI
25 int rank;
26
27 MPI_Init(&argc, &argv);
28
29#ifdef DEBUG
30 MPI_Errhandler mpiErrorHandler;
31 MPI_Comm_create_errhandler(VMG::MPI::ConvertToException, &mpiErrorHandler);
32 MPI_Comm_set_errhandler(MPI_COMM_WORLD, mpiErrorHandler);
33#endif
34
35 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
36 double start = MPI_Wtime();
37#endif
38
39 if (argc < 2) {
40#ifdef HAVE_MPI
41 if (rank == 0)
42#endif
43 std::printf("Wrong number of arguments specified.\nUsage: vmg_particles <config_filename>");
44 }
45
46 InterfaceParticlesCF interface(argv[1]);
47
48 if (!MG::IsInitialized()) {
49#ifdef HAVE_MPI
50 std::printf("%d: VMG is not properly initialized. Please check your config file.\n", rank);
51 MPI_Abort(MPI_COMM_WORLD, MPI_ERR_OTHER);
52#else
53 std::printf("VMG is not properly initialized. Please check your config file.\n", rank);
54#endif
55 return -1;
56 }
57
58 MG::Solve();
59
60#ifdef HAVE_MPI
61 double end = MPI_Wtime();
62 MG::GetComm()->PrintStringOnce("Running time: %e\n", end-start);
63#endif
64
65 MG::Destroy();
66
67#ifdef HAVE_MPI
68 MPI_Finalize();
69#endif
70
71 return 0;
72}
Note: See TracBrowser for help on using the repository browser.