From: wolf Date: Mon, 27 Jun 2005 21:05:25 +0000 (+0000) Subject: New tests. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be8fd37dc9aba1911dc123263fced15358d765cf;p=dealii-svn.git New tests. git-svn-id: https://svn.dealii.org/trunk@10954 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/bits/petsc_slowness_01.cc b/tests/bits/petsc_slowness_01.cc new file mode 100644 index 0000000000..8dce923d37 --- /dev/null +++ b/tests/bits/petsc_slowness_01.cc @@ -0,0 +1,145 @@ +//---------------------------- petsc_slowness_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- petsc_slowness_01.cc --------------------------- + + +// this is part of a whole suite of tests that checks the relative speed of +// using PETSc for sparse matrices as compared to the speed of our own +// library. the tests therefore may not all actually use PETSc, but they are +// meant to compare it +// +// the tests build the 5-point stencil matrix for a uniform grid of size N*N + +#include "../tests.h" +#include +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // first build the sparsity pattern + SparsityPattern sparsity (N*N, N*N, 5); + for(unsigned int i=0; i0) + { + sparsity.add(global-1, global); + sparsity.add(global, global-1); + } + if (j0) + { + sparsity.add(global-N, global); + sparsity.add(global, global-N); + } + if (i matrix (sparsity); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i v1(N*N), v2(N*N); + for (unsigned int i=0; i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // build the sparse matrix + PETScWrappers::SparseMatrix matrix (N*N, N*N, 5); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // build the sparse matrix + PETScWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD, + N*N, N*N, + N*N, N*N, + 5); + for(unsigned int i=0; i0) + { + matrix.add(global-1, global, -1); + matrix.add(global, global-1, -1); + } + if (j0) + { + matrix.add(global-N, global, -1); + matrix.add(global, global-N, -1); + } + if (i +#include +#include +#include +#include + + +void test () +{ + const unsigned int N = 200; + + // first find a random permutation of the + // indices + std::vector permutation (N); + { + std::vector unused_indices (N); + for (unsigned int i=0; i0) + { + matrix.add(global-1, global, rand()); + matrix.add(global, global-1, rand()); + } + if (j0) + { + matrix.add(global-N, global, rand()); + matrix.add(global, global-N, rand()); + } + if (i