From: Wolfgang Bangerth Date: Wed, 27 Mar 2013 11:20:54 +0000 (+0000) Subject: Simplify test. X-Git-Tag: v8.0.0~316^2~85 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8c71e66646f7d4fe83646630230fa37e7a41d58;p=dealii.git Simplify test. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29060 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 index abf28849db..a7ea18466b 100644 --- a/tests/trilinos/trilinos_64_bit_crash_01.cc +++ b/tests/trilinos/trilinos_64_bit_crash_01.cc @@ -1,4 +1,4 @@ -//---------------------------- trilinos_trilinos_64_bit_crash_01.cc --------------------------- +//---------------------------- trilinos_64_bit_crash_01.cc --------------------------- // $Id$ // Version: $Name$ // @@ -9,9 +9,10 @@ // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- trilinos_trilinos_64_bit_crash_01.cc --------------------------- +//---------------------------- trilinos_64_bit_crash_01.cc --------------------------- -// test the BiCGStab solver using the Trilinos matrix and vector classes +// extracted from deal_solver_02. at the time of writing this test, we ran +// into weird crashes with Trilinos when in 64 bit mode @@ -23,87 +24,22 @@ #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) +template +void test () { - return graph.NumGlobalCols64(); -} + const Epetra_Map map (int_type(1), + 0, + Epetra_MpiComm(MPI_COMM_SELF)); -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 + int n_entries_per_row[1] = {1}; + Epetra_CrsGraph graph (Copy, map, map, + &n_entries_per_row[0], true); + int_type row_indices[1] = {0}; + graph.InsertGlobalIndices (int_type(0), + 1, &row_indices[0]); -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; + graph.FillComplete(map, map); } @@ -117,40 +53,11 @@ int main(int argc, char **argv) Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv); + deallog << "32bit" << std::endl; + test(); - 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 << "64bit" << std::endl; + test(); deallog << "OK" << std::endl; }