test0002.cc 2.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE 0002
#define BOOST_TEST_NO_MAIN

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

using namespace AMDiS;
using namespace std;

/*
  - 
*/

15
BOOST_AUTO_TEST_CASE(amdis_mpi_feti)
16
17
18
19
20
21
22
23
24
25
26
{
  BOOST_REQUIRE(MPI::COMM_WORLD.Get_size() == 16);

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

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

  Mesh* mesh = ellipt.getMesh();
  BOOST_REQUIRE(mesh->getNumberOfLeaves() == 8);
27
  BOOST_REQUIRE(meshDist->getMeshLevelData().getLevelNumber() == 1);
28
29
30
31
32
33
34
35
36
37
38

  vector<const FiniteElemSpace*> feSpaces;
  feSpaces.push_back(ellipt.getFeSpace(0));

  PetscSolverFeti &feti = *(dynamic_cast<PetscSolverFeti*>(ellipt.getPetscSolver()));
  feti.setMeshDistributor(meshDist);
  feti.initialize(feSpaces);
  feti.createFetiData();

  BOOST_REQUIRE(feti.getNumberOfPrimals() == 21);
  BOOST_REQUIRE(feti.getNumberOfDuals() == 48);
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
68
69
70
71
72
73



  Spreadsheet sheet;
  sheet.read("data/data0002a");
  vector<double> data = sheet.getData()[MPI::COMM_WORLD.Get_rank()];
  
  const FiniteElemSpace *feSpace = ellipt.getFeSpace(0);
  vector<double> testData;
  testData.push_back(feti.getNumberOfRankPrimals());
  testData.push_back(feti.getNumberOfRankDuals());
  testData.push_back(meshDist->getNumberRankDofs(feSpace));
  testData.push_back(meshDist->getStartDofs(feSpace));
  testData.push_back(meshDist->getNumberOverallDofs(feSpace));

  BOOST_REQUIRE(data.size() - 1 == testData.size());
  BOOST_REQUIRE(equal(data.begin() + 1, data.end(), testData.begin()));

  ellipt.getRefinementManager()->globalRefine(mesh, 6);
  meshDist->checkMeshChange();
  feti.createFetiData();



  sheet.read("data/data0002b");
  data = sheet.getData()[MPI::COMM_WORLD.Get_rank()];
  testData.clear();
  testData.push_back(feti.getNumberOfRankPrimals());
  testData.push_back(feti.getNumberOfRankDuals());
  testData.push_back(meshDist->getNumberRankDofs(feSpace));
  testData.push_back(meshDist->getStartDofs(feSpace));
  testData.push_back(meshDist->getNumberOverallDofs(feSpace));

  BOOST_REQUIRE(data.size() - 1 == testData.size());
  BOOST_REQUIRE(equal(data.begin() + 1, data.end(), testData.begin()));
74
75
76
77
78
79
80
81
82
83
84
}


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

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

  AMDiS::finalize();
}