source: test/unit_test/dirichlet_cs_mpi.cpp@ d24c2f

Last change on this file since d24c2f was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * dirichlet_cs_mpi.cpp
3 *
4 * Created on: 25.01.2011
5 * Author: Julian Iseringhausen
6 */
7
8#ifdef HAVE_CONFIG_H
9#include <config.h>
10#endif
11
12#ifdef HAVE_MPI
13
14#include <mpi.h>
15
16#include "base/factory.hpp"
17#include "base/vector.hpp"
18#include "comm/comm_mpi.cpp"
19#include "comm/domain_decomposition_mpi.hpp"
20#include "level/level_operator_cs.hpp"
21#include "level/level_operator.hpp"
22#include "samples/discretization_poisson_fd.hpp"
23#include "samples/stencils.hpp"
24#include "samples/techniques.hpp"
25#include "smoother/gsrb.hpp"
26#ifdef HAVE_LAPACK
27#include "solver/dgesv.hpp"
28#endif
29#include "solver/givens.hpp"
30#include "solver/solver_regular.hpp"
31#include "mg.hpp"
32
33#include "interface_sinus.hpp"
34#include "dirichlet_cs_mpi.hpp"
35
36using namespace VMG;
37using VMGTests::DirichletCSMPITestSuite;
38
39CPPUNIT_TEST_SUITE_REGISTRATION(DirichletCSMPITestSuite);
40
41void DirichletCSMPITestSuite::setUp()
42{
43 Factory& factory = MG::GetFactory();
44
45 Comm* comm = new CommMPI(Boundary(Dirichlet, Dirichlet, Dirichlet), new DomainDecompositionMPI());
46 comm->Register("COMM");
47
48 Interface* interface = new VMGInterfaces::InterfaceSinus(comm->BoundaryConditions(), 2, 6, 0.0, 1.0);
49 MG::SetInterface(interface, comm);
50
51 Discretization* discretization = new DiscretizationPoissonFD();
52 discretization->Register("DISCRETIZATION");
53
54 LevelOperator* lop = new LevelOperatorCS(Stencils::RestrictionFullWeight, Stencils::InterpolationTrilinear);
55 lop->Register("LEVEL_OPERATOR");
56
57 Smoother* smoother = new GaussSeidelRB();
58 smoother->Register("SMOOTHER");
59
60#ifdef HAVE_LAPACK
61 Solver* solver = new DGESV<SolverRegular>();
62#else
63 Solver* solver = new Givens<SolverRegular>();
64#endif
65 solver->Register("SOLVER");
66
67 Techniques::SetCorrectionSchemeDirichlet(interface->MinLevel(), interface->MaxLevel(), 2);
68
69 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3);
70 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3);
71 factory.RegisterObjectStorage("PRECISION", 1e-10);
72 factory.RegisterObjectStorage("MAX_ITERATION", 20);
73
74 MG::IsInitialized();
75}
76
77void DirichletCSMPITestSuite::tearDown()
78{
79 MG::Destroy();
80}
81
82void DirichletCSMPITestSuite::DirichletCSMPITest()
83{
84 MG::Solve();
85
86 double res_init = MG::GetFactory().Get("INITIAL_RESIDUAL")->Cast< ObjectStorage<double> >()->Val();
87 double res = MG::GetComm()->ComputeResidualNorm(*MG::GetSol(), *MG::GetRhs());
88
89 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, fabs(res/res_init), 1e-10);
90}
91
92#endif /* HAVE_MPI */
Note: See TracBrowser for help on using the repository browser.