test0007.cc 1.93 KB
Newer Older
1
2
3
4
5
6
7
8
9
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE 0007
#define BOOST_TEST_NO_MAIN

#include <boost/test/unit_test.hpp>
#include <AMDiS.h>

using namespace AMDiS;
using namespace std;
10
using namespace AMDiS::Parallel;
11
12
13
14
15

/*
  - Test must run with 4 ranks.

  - Test for function Triangle::getSubBoundary()
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
  - Test on edge boundary between rank 0/1 and 2/3
*/

BOOST_AUTO_TEST_CASE(amdis_mpi_triangle_getsubboundary)
{
  BOOST_REQUIRE(MPI::COMM_WORLD.Get_size() == 4);

  ProblemStat ellipt("ellipt");
  ellipt.initialize(INIT_ALL);
  MeshDistributor::globalMeshDistributor->initParallelization();

  Mesh* mesh = ellipt.getMesh();

  BOOST_REQUIRE(mesh->getNumberOfElements() == 2047);
  BOOST_REQUIRE(mesh->getNumberOfLeaves() == 1024);

  MeshDistributor &meshDist = *(MeshDistributor::globalMeshDistributor);
  InteriorBoundary &intBoundary = meshDist.getIntBoundary();

  vector<AtomicBoundary> boundary;
  switch (MPI::COMM_WORLD.Get_rank()) {
  case 0:
    boundary = intBoundary.getOther(1);
    break;
  case 1:
    boundary = intBoundary.getOwn(0);
    break;
  case 2:
    boundary = intBoundary.getOther(3);
    break;
  case 3:
    boundary = intBoundary.getOwn(2);
    break;
  default:
    BOOST_ERROR("Wrong rank number!\n");
  }

  BOOST_REQUIRE(boundary.size() > 0);

56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
  bool found = false;
  vector<BoundaryObject> subBound;

  for (unsigned int i = 0; i < boundary.size(); i++) {
    if (boundary[i].rankObj.subObj == EDGE) {
      boundary[i].rankObj.el->getSubBoundary(boundary[i].rankObj, subBound);
      found = true;
    }
  }

  BOOST_CHECK(found);
  BOOST_CHECK(subBound.size() == 32);

  Spreadsheet sheet;
  sheet.read("data/data0007/bound_rank_" + lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + ".dat");
  vector<vector<double> > &data = sheet.getData();
}


int main(int argc, char **argv)
{
  AMDiS::init(argc, argv, "./init/test0007.dat.2d");

  boost::unit_test::unit_test_main(&init_unit_test, argc, argv);

  AMDiS::finalize();
}