AMDiS.cc 1.49 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
Ups ...  
Thomas Witkowski committed
47
    Parameters::init(string(argv[1]));
48
49
50
51
    Parameters::readArgv(argc, argv);
  }


52
53
54
55
56
57
58
59
60
61
62
63
  void init(std::string initFileName)
  {
    FUNCNAME("AMDiS::init()");

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
    ERROR_EXIT("Does not work in parallel!\n");
#endif

    Parameters::init(initFileName);
  }


64
65
66
67
68
69
  void finalize()
  {
    FUNCNAME("AMDiS::finalize()");

#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
    MeshDistributor::globalMeshDistributor->exitParallelization();
70
#ifdef HAVE_PARALLEL_MTL4
Thomas Witkowski's avatar
Thomas Witkowski committed
71
    if (mtl_environment)
72
73
      delete mtl_environment;
#else
74
    PetscFinalize();
75
#endif
76
77
78
79
#endif
  }

}