From: Wolfgang Bangerth Date: Tue, 10 May 2011 16:27:44 +0000 (+0000) Subject: Add a test that currently fails. X-Git-Tag: v8.0.0~4077 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61fa3abd086c6c78bb50c528d63950889210b9ab;p=dealii.git Add a test that currently fails. git-svn-id: https://svn.dealii.org/trunk@23688 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/trilinos_sparse_matrix_mmult_01.cc b/tests/mpi/trilinos_sparse_matrix_mmult_01.cc new file mode 100644 index 0000000000..354eda9961 --- /dev/null +++ b/tests/mpi/trilinos_sparse_matrix_mmult_01.cc @@ -0,0 +1,167 @@ +//---------------------------- trilinos_vector_equality_4.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005, 2008, 2010, 2011 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. +// +//---------------------------- trilinos_vector_equality_4.cc --------------------------- + + +// TrilinosWrappers::SparseMatrix::print got column indices wrong + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include + + +void test () +{ + const unsigned int n_procs = Utilities::System::get_n_mpi_processes(MPI_COMM_WORLD); + const unsigned int my_id = Utilities::System::get_this_mpi_process(MPI_COMM_WORLD); + + const unsigned int n_rows = 2; + const unsigned int n_cols = 2; + + IndexSet row_partitioning (n_rows); + IndexSet col_partitioning (n_cols); + + if (n_procs == 1) + { + row_partitioning.add_range(0, n_rows); + col_partitioning.add_range(0, n_cols); + } + else if (n_procs == 2) + { + if (my_id == 0) + { + row_partitioning.add_range(0, 1); + col_partitioning.add_range(0, 1); + } + else if (my_id == 1) + { + row_partitioning.add_range(1, n_rows); + col_partitioning.add_range(1, n_cols); + } + } + else + Assert (false, ExcNotImplemented()); + + /* A is + + 0 1 + 0 1 + */ + const unsigned int n_entries = 2; + const unsigned int line [n_entries] = {0, 1}; + const unsigned int local_index [n_entries] = {1, 1}; + const double local_value [n_entries] = {1.0, 1.0}; + + TrilinosWrappers::SparsityPattern sp (row_partitioning, col_partitioning, MPI_COMM_WORLD); + for (unsigned int i = 0; i < n_entries; ++i) + if (row_partitioning.is_element(line[i])) + sp.add(line[i], local_index[i]); + sp.compress(); + + TrilinosWrappers::SparseMatrix A; + A.clear (); + A.reinit (sp); + for (unsigned int i = 0; i