Skip to content
Snippets Groups Projects
Commit 48a0487f authored by Markus Blatt's avatar Markus Blatt
Browse files

Added test for twolevelmethod with Schwarz smoother.

parent a0edcdf7
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ endif(PARMETIS_FOUND)
if(CMAKE_USE_PTHREADS_INIT)
set(PTHREADTESTS pthreadamgtest pthreadfastamgtest)
endif(CMAKE_USE_PTHREADS_INIT)
set(NORMALTESTS amgtest fastamg graphtest kamgtest twolevelmethodtest ${PTHREADTESTS})
set(NORMALTESTS amgtest fastamg graphtest kamgtest twolevelmethodschwarztest twolevelmethodtest ${PTHREADTESTS})
set(ALLTESTS ${MPITESTS} ${PARMETISTESTS} ${NORMALTESTS} ${UMFPACKTESTS} ${SUPERLUTESTS})
# We do not want want to build the tests during make all,
......@@ -62,6 +62,10 @@ set_target_properties(pamg_comm_repart_test PROPERTIES COMPILE_FLAGS "-DAMG_REPA
add_executable(pamgtest "parallelamgtest.cc")
add_dune_superlu_flags(pamgtest)
add_executable(transfertest "transfertest.cc")
add_executable(twolevelmethodschwarztest "twolevelmethodtest.cc")
add_dune_superlu_flags(twolevelmethodschwarztest)
set_target_properties(twolevelmethodschwarztest PROPERTIES COMPILE_FLAGS "-DUSE_OVERLAPPINGSCHWARZ")
add_executable(twolevelmethodtest "twolevelmethodtest.cc")
foreach(_exe ${ALLTESTS})
target_link_libraries(${_exe} "dunecommon")
......
......@@ -5,7 +5,7 @@ if MPI
TESTPROGS = galerkintest hierarchytest pamgtest transfertest pamg_comm_repart_test
endif
NORMALTESTS = amgtest fastamg graphtest kamgtest twolevelmethodtest $(MPITESTS)
NORMALTESTS = amgtest fastamg graphtest kamgtest twolevelmethodschwarztest twolevelmethodtest $(MPITESTS)
# which tests to run
TESTS = $(NORMALTESTS) $(TESTPROGS)
......@@ -94,6 +94,12 @@ pamg_comm_repart_test_LDADD = \
$(DUNEMPILIBS) \
$(LDADD)
twolevelmethodschwarztest_SOURCES = twolevelmethodtest.cc
twolevelmethodschwarztest_CPPFLAGS = $(AM_CPPFLAGS) $(SUPERLU_CPPFLAGS)
twolevelmethodschwarztest_LDFLAGS = $(AM_LDFLAGS) $(SUPERLU_LDFLAGS)
twolevelmethodschwarztest_LDADD = \
$(SUPERLU_LIBS) \
$(LDADD)
twolevelmethodtest_SOURCES = twolevelmethodtest.cc
twolevelmethodtest_CPPFLAGS = $(AM_CPPFLAGS) $(SUPERLU_CPPFLAGS)
......
......@@ -3,7 +3,8 @@
#include <dune/common/timer.hh>
#include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/collectivecommunication.hh>
#include<dune/istl/paamg/twolevelmethod.hh>
#include <dune/istl/paamg/twolevelmethod.hh>
#include <dune/istl/overlappingschwarz.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dune/istl/solvers.hh>
......@@ -38,12 +39,26 @@ void testTwoLevelMethod()
BCRSMat mat = setupAnisotropic2d<BS,double>(N, indices, c, &n, 1);
Vector b(mat.N()), x(mat.M());
randomize(mat, b);
#ifndef USE_OVERLAPPINGSCHWARZ
typedef Dune::SeqSSOR<BCRSMat,Vector,Vector> FSmoother;
typedef Dune::SeqSOR<BCRSMat,Vector,Vector> CSmoother;
FSmoother fineSmoother(mat,1,1.0);
#else
typedef Dune::SeqOverlappingSchwarz<BCRSMat,Vector> FSmoother;
typedef FSmoother::subdomain_vector SubdomainVector;
SubdomainVector subdomains(N);
for(int i=0; i<N; ++i)
for(int j=0; j<N; ++j)
{
int index=i*N+j;
subdomains[j].insert(index);
}
FSmoother fineSmoother(mat,subdomains, 1.0, false);
#endif
typedef Dune::SeqJac<BCRSMat,Vector,Vector> CSmoother;
typedef Dune::Amg::CoarsenCriterion<
Dune::Amg::UnSymmetricCriterion<BCRSMat,Dune::Amg::FirstDiagonal> >
Criterion;
FSmoother fineSmoother(mat,1,1.0);
typedef Dune::Amg::AggregationLevelTransferPolicy<Operator,Criterion>
TransferPolicy;
typedef Dune::Amg::OneStepAMGCoarseSolverPolicy<Operator,CSmoother, Criterion>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment