## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "dune/istl/test/superlutest.cc" betweendune-istl-2.6.0.tar.gz and dune-istl-2.7.0.tar.gz

About: dune-istl - DUNE (Distributed and Unified Numerics Environment) is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods: DUNE Iterative Solver Template Library.

superlutest.cc  (dune-istl-2.6.0):superlutest.cc  (dune-istl-2.7.0)
skipping to change at line 18 skipping to change at line 18
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/timer.hh> #include <dune/common/timer.hh>
#include <dune/istl/bvector.hh> #include <dune/istl/bvector.hh>
#include <dune/istl/operators.hh> #include <dune/istl/operators.hh>
#include <dune/istl/superlu.hh> #include <dune/istl/superlu.hh>
#include "laplacian.hh" #include "laplacian.hh"
#if HAVE_SUPERLU #if HAVE_SUPERLU
template<typename > template<typename Matrix, typename Vector>
void runSuperLU(std::size_t N) void runSuperLU(std::size_t N)
{ {
Matrix mat;
mat;
Operator fop(mat); Operator fop(mat);
Vector b(N*N), x(N*N), b1(N/2), x1(N/2); Vector b(N*N), x(N*N), b1(N/2), x1(N/2);
setupLaplacian(mat,N); setupLaplacian(mat,N);
b=1; b=1;
b1=1; b1=1;
x=0; x=0;
x1=0; x1=0;
Dune::Timer watch; Dune::Timer watch;
watch.reset(); watch.reset();
Dune::SuperLU<> solver(mat, true); Dune::SuperLU<Matrix> solver(mat, true);
Dune::InverseOperatorResult res; Dune::InverseOperatorResult res;
Dune::SuperLU<> solver1; Dune::SuperLU<Matrix> solver1;
solver.setVerbosity(true); solver.setVerbosity(true);
solver.apply(x,b, res); solver.apply(x,b, res);
std::set<std::size_t> mrs; std::set<std::size_t> mrs;
for(std::size_t s=0; s < N/2; ++s) for(std::size_t s=0; s < N/2; ++s)
mrs.insert(s); mrs.insert(s);
solver1.setSubMatrix(mat,mrs); solver1.setSubMatrix(mat,mrs);
solver1.apply(x1,b1, res); solver1.apply(x1,b1, res);
solver1.apply(reinterpret_cast<typename Matrix::field_type*>(&x1[0]),
reinterpret_cast<typename Matrix::field_type*>(&b1[0]));
} }
// explicit template instantiation of SuperLU class
#if HAVE_SLU_SDEFS_H
template class Dune::SuperLU<Dune::BCRSMatrix<float>>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<float,1,1> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<float,2,2> >>;
#endif
#if HAVE_SLU_DDEFS_H
template class Dune::SuperLU<Dune::BCRSMatrix<double>>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<double,2,2> >>;
#endif
#if HAVE_SLU_CDEFS_H
template class Dune::SuperLU<Dune::BCRSMatrix<std::complex<float> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<flo
at>,1,1> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<flo
at>,2,2> >>;
#endif
#if HAVE_SLU_ZDEFS_H
template class Dune::SuperLU<Dune::BCRSMatrix<std::complex<double> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<dou
ble>,1,1> >>;
template class Dune::SuperLU<Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<dou
ble>,2,2> >>;
#endif
#endif #endif
int main(int argc, char** argv) int main(int argc, char** argv)
try try
{ {
#if HAVE_SUPERLU
std::size_t N=100; std::size_t N=100;
if(argc>1) if(argc>1)
N = atoi(argv[1]); N = atoi(argv[1]);
std::cout<<"testing for N="<<N<<"
#if // ---------------------------------------------------------------------------
---
std::cout<<"testing for N="<<N<<" BCRSMatrix<T>"<<std::endl;
#if HAVE_SLU_SDEFS_H
{
using Matrix = Dune::BCRSMatrix<float>;
using Vector = Dune::BlockVector<float>;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_DDEFS_H
{
using Matrix = Dune::BCRSMatrix<double>;
using Vector = Dune::BlockVector<double>;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_CDEFS_H
{
using Matrix = Dune::BCRSMatrix<std::complex<float> >;
using Vector = Dune::BlockVector<std::complex<float> >;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_ZDEFS_H
{
using Matrix = Dune::BCRSMatrix<std::complex<double> >;
using Vector = Dune::BlockVector<std::complex<double> >;
runSuperLU<Matrix,Vector>(N);
}
#endif
// ---------------------------------------------------------------------------
---
std::cout<<"testing for N="<<N<<" BCRSMatrix<FieldMatrix<T,1,1> >"<<std::endl;
#if HAVE_SLU_SDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<float,1,1> >;
using Vector = Dune::BlockVector<Dune::FieldVector<float,1> >;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_DDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> >;
using Vector = Dune::BlockVector<Dune::FieldVector<double,1> >;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_CDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<float>,1,1> >
;
using Vector = Dune::BlockVector<Dune::FieldVector<std::complex<float>,1> >;
runSuperLU<Matrix,Vector>(N);
}
#endif
#if HAVE_SLU_ZDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<double>,1,1>
>;
using Vector = Dune::BlockVector<Dune::FieldVector<std::complex<double>,1> >
;
runSuperLU<Matrix,Vector>(N);
}
#endif
// ---------------------------------------------------------------------------
---
std::cout<<"testing for N="<<N<<" BCRSMatrix<FieldMatrix<T,2,2> >"<<std::endl;
#if HAVE_SLU_SDEFS_H #if HAVE_SLU_SDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<float,2,2> >;
using Vector = Dune::BlockVector<Dune::FieldVector<float,2> >;
runSuperLU<Matrix,Vector>(N);
}
#endif #endif
#if HAVE_SLU_DDEFS_H #if HAVE_SLU_DDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<double,2,2> >;
using Vector = Dune::BlockVector<Dune::FieldVector<double,2> >;
runSuperLU<Matrix,Vector>(N);
}
#endif #endif
#if HAVE_SLU_CDEFS_H #if HAVE_SLU_CDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<float>,2,2> >
;
using Vector = Dune::BlockVector<Dune::FieldVector<std::complex<float>,2> >;
runSuperLU<Matrix,Vector>(N);
}
#endif #endif
#if HAVE_SLU_ZDEFS_H #if HAVE_SLU_ZDEFS_H
{
using Matrix = Dune::BCRSMatrix<Dune::FieldMatrix<std::complex<double>,2,2>
>;
using Vector = Dune::BlockVector<Dune::FieldVector<std::complex<double>,2> >
;
runSuperLU<Matrix,Vector>(N);
}
#endif #endif
return 0; return 0;
#else // HAVE_SUPERLU #else // HAVE_SUPERLU
std::cerr << "You need SuperLU to run this test." << std::endl; std::cerr << "You need SuperLU to run this test." << std::endl;
return 77; return 77;
#endif // HAVE_SUPERLU #endif // HAVE_SUPERLU
} }
catch (std::exception &e) catch (std::exception &e)
End of changes. 13 change blocks.
20 lines changed or deleted 133 lines changed or added