CheckerPartitioner.cc 1.23 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
//
// 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 "parallel/CheckerPartitioner.h"
#include "Traverse.h"


namespace AMDiS {

  void CheckerPartitioner::createInitialPartitioning()
  {
    FUNCNAME("CheckerPartitioner::createInitialPartitioning()");

    int mpiRank = mpiComm->Get_rank();
    int mpiSize = mpiComm->Get_size();

26
27
    int nElementsPerBlock = (mesh->getDim() == 2 ? 2 : 6);

28
29
    MSG("ELS_PER_BLOCK = %d\n", nElementsPerBlock);

30
31
32
33
34
    TraverseStack stack;
    ElInfo *elInfo = stack.traverseFirst(mesh, 0, Mesh::CALL_EL_LEVEL);
    while (elInfo) {
      Element *el = elInfo->getElement();
      int elIndex = el->getIndex();
35
      int elInRank = elIndex / nElementsPerBlock;
36
37
      TEST_EXIT_DBG(elInRank < mpiSize)("Should not happen!\n");

38
39
40
41
42
43
      if (elInRank == mpiRank) {
	MSG("EL %d IS MY!\n", elIndex);
      } else {
	MSG("EL %d IS IN RANK %d\n", elIndex, elInRank);
      }

44
45
46
47
48
49
50
51
      elementInRank[elIndex] = (elInRank == mpiRank);
      partitionMap[elIndex] = elInRank;	
	
      elInfo = stack.traverseNext(elInfo);
    }
  }

}