test0003.cc 1.47 KB
Newer Older
1
#define BOOST_TEST_DYN_LINK
2
#define BOOST_TEST_MODULE 0003
3
4
5
#define BOOST_TEST_NO_MAIN

#include <boost/test/unit_test.hpp>
6
#include <boost/lexical_cast.hpp>
7
8
9
10
#include <AMDiS.h>

using namespace AMDiS;
using namespace std;
11
using boost::lexical_cast;
12
13

/*
14
  - Test 2-level FETI-DP on the number of global primal and dual nodes.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
*/

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

  Mesh* mesh = ellipt.getMesh();
  BOOST_REQUIRE(mesh->getNumberOfLeaves() == 8);
  BOOST_REQUIRE(meshDist->getMeshLevelData().getLevelNumber() == 2);

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

39
40
41
42
43
44
45
  if (feti.getNumberOfPrimals() != 9) {
    BOOST_ERROR("Number of primals is " + lexical_cast<string>(feti.getNumberOfPrimals()) + " and not 9!\n");
  }

  if (feti.getNumberOfDuals() != 16) {
    BOOST_ERROR("Number of duals is " + lexical_cast<string>(feti.getNumberOfDuals()) + " and not 16!\n");
  }
46
47
48
49
50
51
52
53
54
55
56
}


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

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

  AMDiS::finalize();
}