AMDiS.cc 1.06 KB
Newer Older
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
57
58
//
// Software License for AMDiS
//
// Copyright (c) 2010 Dresden University of Technology 
// All rights reserved.
// Authors: Simon Vey, Thomas Witkowski et al.
//
// This file is part of AMDiS
//
// See also license.opensource.txt in the distribution.


#include "AMDiS.h"
#include <string>
#ifdef HAVE_ZOLTAN
#include <zoltan_cpp.h>
#endif

namespace AMDiS {

  using namespace std;

  void init(int argc, char **argv)
  {
    FUNCNAME("AMDiS::init()");

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
    PetscInitialize(&argc, &argv, NULL, NULL);
    mpi::startRand();

#ifdef HAVE_ZOLTAN
    float zoltanVersion = 0.0;
    Zoltan_Initialize(argc, argv, &zoltanVersion);
#endif
#endif

    TEST_EXIT(argc >= 2)("No init file!\n");

    if (string(argv[0]) != "ddt")
      Parameters::init(string(argv[1]));
    else 
      Parameters::init(string(argv[2]));

    Parameters::readArgv(argc, argv);
  }


  void finalize()
  {
    FUNCNAME("AMDiS::finalize()");

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
    MeshDistributor::globalMeshDistributor->exitParallelization();
    PetscFinalize();
#endif
  }

}