source: vmg_particles/vmg_particles.cpp@ dfed1c

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

Major vmg update.

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

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