From b5b241bd7c7d37af4e74724a5aedfbb542cce27d Mon Sep 17 00:00:00 2001 From: "kainan.wang" Date: Tue, 26 Mar 2013 16:49:47 +0000 Subject: [PATCH] generic methods for XXX and XXX64 in trilinos git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29040 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/lac/trilinos_sparse_matrix.cc | 24 ++++- .../source/lac/trilinos_sparsity_pattern.cc | 88 ++++++++++++++++--- 2 files changed, 100 insertions(+), 12 deletions(-) diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index ef89d1e715..e560780454 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -43,11 +43,31 @@ namespace TrilinosWrappers { 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(); + } #else 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(); + } #endif } @@ -446,8 +466,8 @@ namespace TrilinosWrappers column_space_map.reset (new Epetra_Map (input_col_map)); - const size_type first_row = input_row_map.MinMyGID64(), - last_row = input_row_map.MaxMyGID64()+1; + 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 1) graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, - n_entries_per_row[input_row_map.MinMyGID64()], + n_entries_per_row[min_my_gid(input_row_map)], false)); else graph.reset(new Epetra_FECrsGraph(Copy, input_row_map, input_col_map, - n_entries_per_row[input_row_map.MinMyGID64()], + n_entries_per_row[max_my_gid(input_row_map)], false)); } @@ -325,8 +393,8 @@ namespace TrilinosWrappers Assert (input_row_map.LinearMap() == true, ExcMessage ("This function is not efficient if the map is not contiguous.")); - const size_type first_row = input_row_map.MinMyGID64(), - last_row = input_row_map.MaxMyGID64()+1; + 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->NumGlobalRows())); + static_cast(n_global_rows(*graph))); std::vector row_indices; @@ -546,7 +614,7 @@ namespace TrilinosWrappers SparsityPattern::size_type SparsityPattern::n_rows () const { - const TrilinosWrappers::types::int_type n_rows = graph -> NumGlobalRows(); + const TrilinosWrappers::types::int_type n_rows = n_global_rows(*graph); return n_rows; } @@ -557,7 +625,7 @@ namespace TrilinosWrappers { TrilinosWrappers::types::int_type n_cols; if (graph->Filled() == true) - n_cols = graph -> NumGlobalCols64(); + n_cols = n_global_cols(*graph); else n_cols = column_space_map->NumGlobalElements64(); @@ -580,8 +648,8 @@ namespace TrilinosWrappers SparsityPattern::local_range () const { size_type begin, end; - begin = graph -> RowMap().MinMyGID64(); - end = graph -> RowMap().MaxMyGID64()+1; + begin = min_my_gid(graph->RowMap()); + end = max_my_gid(graph->RowMap())+1; return std::make_pair (begin, end); } @@ -591,7 +659,7 @@ namespace TrilinosWrappers SparsityPattern::size_type SparsityPattern::n_nonzero_elements () const { - TrilinosWrappers::types::int_type nnz = graph->NumGlobalEntries64(); + TrilinosWrappers::types::int_type nnz = n_global_entries(*graph); return static_cast(nnz); } -- 2.39.5