From: bangerth Date: Wed, 27 Mar 2013 02:04:37 +0000 (+0000) Subject: Add. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd20ad492ad38615b89ee388eeef3a12f2ea7b73;p=dealii-svn.git Add. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29051 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/trilinos/trilinos_64_bit_crash_01.cc b/tests/trilinos/trilinos_64_bit_crash_01.cc new file mode 100644 index 0000000000..abf28849db --- /dev/null +++ b/tests/trilinos/trilinos_64_bit_crash_01.cc @@ -0,0 +1,156 @@ +//---------------------------- trilinos_trilinos_64_bit_crash_01.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2004, 2005, 2008, 2013 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_trilinos_64_bit_crash_01.cc --------------------------- + +// test the BiCGStab solver using the Trilinos matrix and vector classes + + + +#include "../tests.h" +#include +#include +#include +#include +#include + + +typedef dealii::types::global_dof_index size_type; + +#ifndef DEAL_II_USE_LARGE_INDEX_TYPE +// define a helper function that queries the size of an Epetra_Map object +// by calling either the 32- or 64-bit function necessary, and returns the +// result in the correct data type so that we can use it in calling other +// Epetra member functions that are overloaded by index type +int n_global_elements (const Epetra_BlockMap &map) +{ + return map.NumGlobalElements(); +} + +int min_my_gid(const Epetra_BlockMap &map) +{ + return map.MinMyGID(); +} + +int max_my_gid(const Epetra_BlockMap &map) +{ + return map.MaxMyGID(); +} + +int n_global_cols(const Epetra_CrsGraph &graph) +{ + return graph.NumGlobalCols(); +} + +int global_column_index(const Epetra_CrsMatrix &matrix, int i) +{ + return matrix.GCID(i); +} + +int global_row_index(const Epetra_CrsMatrix &matrix, int i) +{ + return matrix.GRID(i); +} +#else +// define a helper function that queries the size of an Epetra_Map object +// by calling either the 32- or 64-bit function necessary, and returns the +// result in the correct data type so that we can use it in calling other +// Epetra member functions that are overloaded by index type +long long int n_global_elements (const Epetra_BlockMap &map) +{ + return map.NumGlobalElements64(); +} + +long long int min_my_gid(const Epetra_BlockMap &map) +{ + return map.MinMyGID64(); +} + +long long int max_my_gid(const Epetra_BlockMap &map) +{ + return map.MaxMyGID64(); +} + +long long int n_global_cols(const Epetra_CrsGraph &graph) +{ + return graph.NumGlobalCols64(); +} + +long long int global_column_index(const Epetra_CrsMatrix &matrix, int i) +{ + return matrix.GCID64(i); +} + +long long int global_row_index(const Epetra_CrsMatrix &matrix, int i) +{ + return matrix.GRID64(i); +} +#endif + + +template +void copy_row (const Sparsity &csp, + const size_type row, + std::vector &row_indices) +{ + typename Sparsity::row_iterator col_num = csp.row_begin (row); + for (size_type col=0; col_num != csp.row_end (row); ++col_num, ++col) + row_indices[col] = *col_num; +} + + +int main(int argc, char **argv) +{ + std::ofstream logfile("trilinos_64_bit_crash_01/output"); + deallog.attach(logfile); + deallog << std::setprecision(4); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv); + + + CompressedSimpleSparsityPattern sparsity_pattern (1,1); + sparsity_pattern.add(0,0); + sparsity_pattern.compress(); + + const Epetra_Map input_row_map (static_cast(sparsity_pattern.n_rows()), + 0, + Utilities::Trilinos::comm_self()); + const Epetra_Map input_col_map (static_cast(sparsity_pattern.n_cols()), + 0, + Utilities::Trilinos::comm_self()); + + + std_cxx1x::shared_ptr matrix; + + std_cxx1x::shared_ptr column_space_map(new Epetra_Map (input_col_map)); + + const size_type first_row = min_my_gid(input_row_map), + last_row = max_my_gid(input_row_map)+1; + std::vector n_entries_per_row(last_row-first_row); + + for (size_type row=first_row; row graph; + graph.reset (new Epetra_CrsGraph (Copy, input_row_map, input_col_map, + &n_entries_per_row[0], true)); + + TrilinosWrappers::types::int_type row_indices[1] = {0}; + + graph->Epetra_CrsGraph::InsertGlobalIndices (size_type(0), 1, &row_indices[0]); + + graph->FillComplete(input_col_map, input_row_map); + graph->OptimizeStorage(); + + deallog << "OK" << std::endl; +} diff --git a/tests/trilinos/trilinos_64_bit_crash_01/cmp/generic b/tests/trilinos/trilinos_64_bit_crash_01/cmp/generic new file mode 100644 index 0000000000..664748dd19 --- /dev/null +++ b/tests/trilinos/trilinos_64_bit_crash_01/cmp/generic @@ -0,0 +1,6 @@ + +DEAL::Size 32 Unknowns 961 +DEAL::Solver type: N6dealii14SolverBicgstabINS_16TrilinosWrappers6VectorEEE +DEAL:Bicgstab::Starting value 31.00 +DEAL:Bicgstab::Convergence step 29 value 0.0008735 +DEAL::Solver stopped after 29 iterations