AMDiS.cc 1.29 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
//
// 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;

23
24
25
26
#if defined(HAVE_PARALLEL_DOMAIN_AMDIS) && defined(HAVE_PARALLEL_MTL4)
  mtl::par::environment* mtl_environment=NULL;
#endif

27
28
29
30
31
  void init(int argc, char **argv)
  {
    FUNCNAME("AMDiS::init()");

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
32
33
34
#ifdef HAVE_PARALLEL_MTL4
    mtl_environment = new mtl::par::environment(argc, argv);
#else
35
36
    PetscInitialize(&argc, &argv, NULL, NULL);
    mpi::startRand();
37
#endif
38
39
40
41
42
43
44
45
46

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

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

Thomas Witkowski's avatar
Thomas Witkowski committed
47
    Parameters::init(string(argv[1]));
48
49
50
51
52
53
54
55
56
57
    Parameters::readArgv(argc, argv);
  }


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

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
    MeshDistributor::globalMeshDistributor->exitParallelization();
58
59
60
61
#ifdef HAVE_PARALLEL_MTL4
    if ( mtl_environment )
      delete mtl_environment;
#else
62
    PetscFinalize();
63
#endif
64
65
66
67
#endif
  }

}