test0005.cc 1.88 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#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;

/*
12
13
  - Test for interior boundaries on a 2-level 4x4 rank decomposition.
  - Compaires the interior boundary object with a serialization file.
14
15
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
56
57
58
59
60
61
62
63
64
65
66
67
*/


void boundaryTest(RankToBoundMap &map0, RankToBoundMap &map1)
{
  BOOST_CHECK_MESSAGE(map0.size() == map1.size(), 
		      "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("");
    }

    BOOST_CHECK_MESSAGE(it->second.size() == map1[it->first].size(), 
			"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();
  
  InteriorBoundary testBoundary;  
  string filename = "data/data0005/interior_boundary_p" + 
    lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + ".ser";
  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());
}


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();
}