/* * vmg - a versatile multigrid solver * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn * * vmg is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * vmg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /* * open_fas_mpi.cpp * * Created on: 25.01.2011 * Author: Julian Iseringhausen */ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef HAVE_MPI #include #ifdef HAVE_MARMOT #include #include #endif #include "base/factory.hpp" #include "base/math.hpp" #include "base/vector.hpp" #include "comm/comm_mpi.hpp" #include "comm/domain_decomposition_mpi.hpp" #include "cycles/cycle_fas_dirichlet.hpp" #include "level/level_operator_fas.hpp" #include "level/level_operator.hpp" #include "discretization/discretization_poisson_fv.hpp" #include "smoother/gsrb.hpp" #include "solver/givens.hpp" #include "solver/solver_regular.hpp" #include "mg.hpp" #include "interface_gaussian.hpp" using namespace VMG; struct LibraryOpenFASMPIFixture { LibraryOpenFASMPIFixture() { const Boundary boundary(Open, Open, Open); new CommMPI(boundary, new DomainDecompositionMPI()); new VMGInterfaces::InterfaceGaussian(1.0, boundary, 2, 3, 0.0, 20.0, 9, 1.6); new DiscretizationPoissonFV(2); new LevelOperatorFAS(Stencils::RestrictionFullWeight, Stencils::Injection, Stencils::InterpolationTrilinear); new GaussSeidelRB(); new Givens(); new CycleFASDirichlet(2); new ObjectStorage("PRESMOOTHSTEPS", 3); new ObjectStorage("POSTSMOOTHSTEPS", 3); new ObjectStorage("MAX_ITERATION", 12); new ObjectStorage("PRECISION", 1.0e-12); MG::PostInit(); MG::IsInitialized(); } ~LibraryOpenFASMPIFixture() { MG::Destroy(); } }; BOOST_FIXTURE_TEST_CASE(LibraryOpenFASMPITest, LibraryOpenFASMPIFixture) { MG::Solve(); double res_init = MG::GetFactory().Get("INITIAL_RESIDUAL")->Cast< ObjectStorage >()->Val(); double res = MG::GetComm()->ComputeResidualNorm(*MG::GetSol(), *MG::GetRhs()); BOOST_CHECK_SMALL(res/res_init, 1e-10); } #endif /* HAVE_MPI */