test0005.cc 2.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE 0005
#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
  - Test for interior boundaries on a 2-level 4x4 rank decomposition.
  - Compaires the interior boundary object with a serialization file.
15
16
17
18
19
*/


void boundaryTest(RankToBoundMap &map0, RankToBoundMap &map1)
{
20
  BOOST_CHECK_MESSAGE(map0.size() == map1.size(),
21
22
23
24
25
26
27
28
		      "Boundaries have different size!\n");

  for (RankToBoundMap::iterator it = map0.begin(); it != map0.end(); ++it) {
    if (map1.count(it->first) == 0) {
      MSG("Boundary with rank %d missing!\n", it->first);
      BOOST_ERROR("");
    }

29
    BOOST_CHECK_MESSAGE(it->second.size() == map1[it->first].size(),
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
			"Wrong boundary size!\n");

    for (unsigned int i = 0; i < it->second.size(); i++)
      BOOST_CHECK_MESSAGE(it->second[i] == map1[it->first][i],
			  "Boundary is not equal!\n");
  }
}

BOOST_AUTO_TEST_CASE(amdis_mpi_feti_multilevel)
{
  BOOST_REQUIRE(MPI::COMM_WORLD.Get_size() == 16);

  ProblemStat ellipt("ellipt");
  ellipt.initialize(INIT_ALL);

  MeshDistributor *meshDist = MeshDistributor::globalMeshDistributor;
  meshDist->initParallelization();
47
48
49

  InteriorBoundary testBoundary;
  string filename = "data/data0005/interior_boundary_p" +
50
    lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + ".ser";
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
51
52
53
54
55
56
57

#if 0
  // Data was created with the following line
  ofstream myfile(filename.c_str());
  meshDist->getIntBoundary().serialize(myfile);
  myfile.close();
#else
58
59
60
61
62
63
64
  ifstream myfile(filename.c_str());
  testBoundary.deserialize(myfile, ellipt.getMesh());
  myfile.close();

  boundaryTest(testBoundary.getOwn(), meshDist->getIntBoundary().getOwn());
  boundaryTest(testBoundary.getOther(), meshDist->getIntBoundary().getOther());
  boundaryTest(testBoundary.getPeriodic(), meshDist->getIntBoundary().getPeriodic());
Thomas Witkowski's avatar
Blub    
Thomas Witkowski committed
65
#endif
66
67
68
69
70
71
72
73
74
75
76
}


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

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

  AMDiS::finalize();
}