source: test/unit_test/library/periodic_fas_mpi.cpp@ b7b317

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

Fixed newly introduced error due to unexpected behaviour of git-svn. Sorry.

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

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[dfed1c]1/*
2 * periodic_fas_mpi.cpp
3 *
4 * Created on: Oct 20, 2010
5 * Author: Julian Iseringhausen
6 */
7
8#ifdef HAVE_CONFIG_H
9#include <config.h>
10#endif
11
[ac6d04]12#include <boost/test/unit_test.hpp>
13#include <boost/test/floating_point_comparison.hpp>
14
[dfed1c]15#ifdef HAVE_MPI
16
17#include <mpi.h>
[ac6d04]18#ifdef HAVE_MARMOT
19#include <enhancempicalls.h>
20#include <sourceinfompicalls.h>
21#endif
[dfed1c]22
23#include "base/factory.hpp"
[ac6d04]24#include "base/math.hpp"
[dfed1c]25#include "comm/comm_mpi.hpp"
26#include "comm/domain_decomposition_mpi.hpp"
27#include "level/level_operator_fas.hpp"
28#include "samples/discretization_poisson_fd.hpp"
29#include "samples/techniques.hpp"
30#include "smoother/gs.hpp"
31#include "smoother/gsrb.hpp"
32#ifdef HAVE_LAPACK
33#include "solver/dsysv.hpp"
34#endif
35#include "solver/givens.hpp"
36#include "solver/solver_singular.hpp"
37#include "mg.hpp"
38
39#include "interface_sinus.hpp"
40
41using namespace VMG;
42
[ac6d04]43const vmg_float sine_factor = static_cast<vmg_float>(2.0 * Math::pi);
[dfed1c]44
[ac6d04]45struct LibraryPeriodicFASMPIFixture
[dfed1c]46{
[ac6d04]47 LibraryPeriodicFASMPIFixture()
48 {
[dfed1c]49 Factory& factory = MG::GetFactory();
50
51 Comm* comm = new CommMPI(Boundary(Periodic, Periodic, Periodic), new DomainDecompositionMPI());
52 comm->Register("COMM");
53
[ac6d04]54 Interface* interface = new VMGInterfaces::InterfaceSinus(sine_factor, comm->BoundaryConditions(), 2, 6, 0.0, 1.0);
[dfed1c]55 MG::SetInterface(interface, comm);
56
[4571da]57 Discretization* discretization = new DiscretizationPoissonFD(2);
[dfed1c]58 discretization->Register("DISCRETIZATION");
59
60 LevelOperator* lop = new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear);
61 lop->Register("LEVEL_OPERATOR");
62
63 Smoother* smoother = new GaussSeidelRB();
64 smoother->Register("SMOOTHER");
65
66#ifdef HAVE_LAPACK
67 Solver* solver = new DSYSV<SolverSingular>();
68#else
69 Solver* solver = new Givens<SolverSingular>();
70#endif
71 solver->Register("SOLVER");
72
73 Techniques::SetFullApproximationSchemePeriodic(interface->MinLevel(), interface->MaxLevel(), 2);
74
75 factory.RegisterObjectStorage("PRESMOOTHSTEPS", 3);
76 factory.RegisterObjectStorage("POSTSMOOTHSTEPS", 3);
77 factory.RegisterObjectStorage("PRECISION", 1e-10);
[ac6d04]78 factory.RegisterObjectStorage("MAX_ITERATION", 7);
[dfed1c]79
80 MG::IsInitialized();
81
[ac6d04]82 MG::PostInit();
83 }
84
85 ~LibraryPeriodicFASMPIFixture()
86 {
[dfed1c]87 MG::Destroy();
[ac6d04]88 }
89};
[dfed1c]90
[ac6d04]91BOOST_FIXTURE_TEST_CASE(LibraryPeriodicFASMPITest, LibraryPeriodicFASMPIFixture)
[dfed1c]92{
93 MG::Solve();
94
95 double res_init = MG::GetFactory().Get("INITIAL_RESIDUAL")->Cast< ObjectStorage<double> >()->Val();
96 double res = MG::GetComm()->ComputeResidualNorm(*MG::GetSol(), *MG::GetRhs());
97
[ac6d04]98 BOOST_CHECK_SMALL(res/res_init, 1e-10);
[dfed1c]99}
100
101#endif /* HAVE_MPI */
Note: See TracBrowser for help on using the repository browser.