Skip to content
Snippets Groups Projects
Commit e95bfb9f authored by Christoph Grüninger's avatar Christoph Grüninger Committed by Steffen Müthing
Browse files

[tests] Use correct sized rhs for Superlu/UMFPack sub-matrix tests


This partially fixes FS#1724.

(cherry picked from commit 74ed27a8)
Signed-off-by: default avatarSteffen Müthing <muething@dune-project.org>
parent e25671cf
No related branches found
No related tags found
No related merge requests found
......@@ -53,11 +53,13 @@ try
BCRSMat mat;
Operator fop(mat);
Vector b(N*N), x(N*N);
Vector b(N*N), x(N*N), b1(N/2), x1(N/2);
setupLaplacian(mat,N);
b=1;
b1=1;
x=0;
x1=0;
Dune::Timer watch;
......@@ -69,17 +71,17 @@ try
Dune::SuperLU<BCRSMat> solver1;
solver.setVerbosity(true);
solver.apply(x,b, res);
std::set<std::size_t> mrs;
for(std::size_t s=0; s < N/2; ++s)
mrs.insert(s);
solver1.setSubMatrix(mat,mrs);
solver.setVerbosity(true);
solver.apply(x,b, res);
std::cout<<"Defect reduction is "<<res.reduction<<std::endl;
solver1.apply(x,b, res);
solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x[0]), reinterpret_cast<FIELD_TYPE*>(&b[0]));
solver1.apply(x1,b1, res);
solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x1[0]), reinterpret_cast<FIELD_TYPE*>(&b1[0]));
}
catch (Dune::Exception &e)
{
......
......@@ -37,11 +37,13 @@ int main(int argc, char** argv)
BCRSMat mat;
Operator fop(mat);
Vector b(N*N), x(N*N);
Vector b(N*N), x(N*N), b1(N/2), x1(N/2);
setupLaplacian(mat,N);
b=1;
b1=1;
x=0;
x1=0;
Dune::Timer watch;
......@@ -51,6 +53,9 @@ int main(int argc, char** argv)
Dune::InverseOperatorResult res;
solver.apply(x, b, res);
solver.free();
Dune::UMFPack<BCRSMat> solver1;
std::set<std::size_t> mrs;
......@@ -60,11 +65,8 @@ int main(int argc, char** argv)
solver1.setSubMatrix(mat,mrs);
solver1.setVerbosity(true);
solver.apply(x,b, res);
solver.free();
solver1.apply(x,b, res);
solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x[0]), reinterpret_cast<FIELD_TYPE*>(&b[0]));
solver1.apply(x1,b1, res);
solver1.apply(reinterpret_cast<FIELD_TYPE*>(&x1[0]), reinterpret_cast<FIELD_TYPE*>(&b1[0]));
Dune::UMFPack<BCRSMat> save_solver(mat,"umfpack_decomp",0);
Dune::UMFPack<BCRSMat> load_solver(mat,"umfpack_decomp",0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment