From: Bruno Turcksin Date: Tue, 26 Mar 2013 15:50:26 +0000 (+0000) Subject: Use 64 bits version of trilinos functions and replace n_global_elements by NumGlobalE... X-Git-Tag: v8.0.0~316^2~93 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87b2669dfb15e9f466d926e15aab2051f950b2cc;p=dealii.git Use 64 bits version of trilinos functions and replace n_global_elements by NumGlobalElements64 which according to the Trilinos library works for 32 and 64 bits. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29039 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index 82a5ca95b9..c44a0e1459 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -3027,8 +3027,8 @@ namespace TrilinosWrappers SparseMatrix::in_local_range (const size_type index) const { TrilinosWrappers::types::int_type begin, end; - begin = matrix->RowMap().MinMyGID(); - end = matrix->RowMap().MaxMyGID()+1; + begin = matrix->RowMap().MinMyGID64(); + end = matrix->RowMap().MaxMyGID64()+1; return ((index >= static_cast(begin)) && (index < static_cast(end))); diff --git a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h index a0b7cb947f..99ad13531c 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -1011,7 +1011,7 @@ namespace TrilinosWrappers * entries per row on the current * processor. */ - size_type max_entries_per_row () const; + unsigned int max_entries_per_row () const; /** * Return the number of rows in this @@ -1594,8 +1594,8 @@ namespace TrilinosWrappers SparsityPattern::in_local_range (const size_type index) const { TrilinosWrappers::types::int_type begin, end; - begin = graph->RowMap().MinMyGID(); - end = graph->RowMap().MaxMyGID()+1; + begin = graph->RowMap().MinMyGID64(); + end = graph->RowMap().MaxMyGID64()+1; return ((index >= static_cast(begin)) && (index < static_cast(end))); diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h index f38ba80582..02e2bff5c7 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -1490,8 +1490,8 @@ namespace TrilinosWrappers VectorBase::local_range () const { TrilinosWrappers::types::int_type begin, end; - begin = vector->Map().MinMyGID(); - end = vector->Map().MaxMyGID()+1; + begin = vector->Map().MinMyGID64(); + end = vector->Map().MaxMyGID64()+1; return std::make_pair (begin, end); } diff --git a/deal.II/source/lac/trilinos_precondition.cc b/deal.II/source/lac/trilinos_precondition.cc index 6a8e1d5242..6203d1f313 100644 --- a/deal.II/source/lac/trilinos_precondition.cc +++ b/deal.II/source/lac/trilinos_precondition.cc @@ -591,9 +591,9 @@ namespace TrilinosWrappers Assert (n_relevant_rows == my_size, ExcDimensionMismatch(n_relevant_rows, my_size)); Assert (n_rows == - static_cast(distributed_constant_modes.GlobalLength()), + static_cast(distributed_constant_modes.GlobalLength64()), ExcDimensionMismatch(n_rows, - distributed_constant_modes.GlobalLength())); + distributed_constant_modes.GlobalLength64())); // Reshape null space as a // contiguous vector of diff --git a/deal.II/source/lac/trilinos_sparsity_pattern.cc b/deal.II/source/lac/trilinos_sparsity_pattern.cc index ea9fc2014d..a72333ad85 100644 --- a/deal.II/source/lac/trilinos_sparsity_pattern.cc +++ b/deal.II/source/lac/trilinos_sparsity_pattern.cc @@ -26,25 +26,6 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { - namespace - { - // 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 -#ifndef DEAL_II_USE_LARGE_INDEX_TYPE - int n_global_elements (const Epetra_BlockMap &map) - { - return map.NumGlobalElements(); - } -#else - long long int n_global_elements (const Epetra_BlockMap &map) - { - return map.NumGlobalElements64(); - } -#endif - } - namespace SparsityPatternIterators { @@ -69,6 +50,7 @@ namespace TrilinosWrappers // get a representation of the present // row int ncols; + // TODO: casting a size_type to an int, could be a problem int colnums = sparsity_pattern->n_cols(); int ierr; @@ -265,7 +247,7 @@ namespace TrilinosWrappers // release memory before reallocation graph.reset (); AssertDimension (n_entries_per_row.size(), - static_cast(n_global_elements(input_row_map))); + static_cast(input_row_map.NumGlobalElements64())); column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; @@ -333,9 +315,9 @@ namespace TrilinosWrappers graph.reset (); AssertDimension (sp.n_rows(), - static_cast(n_global_elements(input_row_map))); + static_cast(input_row_map.NumGlobalElements64())); AssertDimension (sp.n_cols(), - static_cast(n_global_elements(input_col_map))); + static_cast(input_col_map.NumGlobalElements64())); column_space_map.reset (new Epetra_Map (input_col_map)); compressed = false; @@ -575,9 +557,9 @@ namespace TrilinosWrappers { TrilinosWrappers::types::int_type n_cols; if (graph->Filled() == true) - n_cols = graph -> NumGlobalCols(); + n_cols = graph -> NumGlobalCols64(); else - n_cols = n_global_elements(*column_space_map); + n_cols = column_space_map->NumGlobalElements64(); return n_cols; } @@ -609,19 +591,19 @@ namespace TrilinosWrappers SparsityPattern::size_type SparsityPattern::n_nonzero_elements () const { - TrilinosWrappers::types::int_type nnz = graph->NumGlobalEntries(); + TrilinosWrappers::types::int_type nnz = graph->NumGlobalEntries64(); return static_cast(nnz); } - SparsityPattern::size_type + unsigned int SparsityPattern::max_entries_per_row () const { - TrilinosWrappers::types::int_type nnz = graph->MaxNumIndices(); + int nnz = graph->MaxNumIndices(); - return static_cast(nnz); + return static_cast(nnz); } diff --git a/deal.II/source/lac/trilinos_vector.cc b/deal.II/source/lac/trilinos_vector.cc index 4bdb8c558a..e58e0abaf3 100644 --- a/deal.II/source/lac/trilinos_vector.cc +++ b/deal.II/source/lac/trilinos_vector.cc @@ -28,25 +28,6 @@ DEAL_II_NAMESPACE_OPEN namespace TrilinosWrappers { - namespace - { - // 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 -#ifndef DEAL_II_USE_LARGE_INDEX_TYPE - int n_global_elements (const Epetra_BlockMap &map) - { - return map.NumGlobalElements(); - } -#else - long long int n_global_elements (const Epetra_BlockMap &map) - { - return map.NumGlobalElements64(); - } -#endif - } - namespace MPI { @@ -90,9 +71,9 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow (n_global_elements(input_map) == n_global_elements(v.vector->Map()), - ExcDimensionMismatch (n_global_elements(input_map), - n_global_elements(v.vector->Map()))); + AssertThrow (input_map.NumGlobalElements64() == v.vector->Map().NumGlobalElements64(), + ExcDimensionMismatch (input_map.NumGlobalElements64(), + v.vector->Map().NumGlobalElements64())); last_action = Zero; @@ -113,9 +94,10 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow ((size_type)parallel_partitioner.size() == n_global_elements(v.vector->Map()), + AssertThrow (parallel_partitioner.size() == + static_cast(v.vector->Map().NumGlobalElements64()), ExcDimensionMismatch (parallel_partitioner.size(), - n_global_elements(v.vector->Map()))); + v.vector->Map().NumGlobalElements64())); last_action = Zero; @@ -283,9 +265,9 @@ namespace TrilinosWrappers if (import_data == true) { - AssertThrow (static_cast(actual_vec->GlobalLength()) + AssertThrow (static_cast(actual_vec->GlobalLength64()) == v.size(), - ExcDimensionMismatch (actual_vec->GlobalLength(), + ExcDimensionMismatch (actual_vec->GlobalLength64(), v.size())); Epetra_Import data_exchange (vector->Map(), actual_vec->Map()); @@ -405,7 +387,7 @@ namespace TrilinosWrappers Vector::Vector (const Epetra_Map &input_map) { last_action = Zero; - Epetra_LocalMap map (n_global_elements(input_map), + Epetra_LocalMap map (input_map.NumGlobalElements64(), input_map.IndexBase(), input_map.Comm()); vector.reset (new Epetra_FEVector(map)); @@ -433,7 +415,7 @@ namespace TrilinosWrappers Vector::Vector (const VectorBase &v) { last_action = Zero; - Epetra_LocalMap map (n_global_elements(v.vector->Map()), + Epetra_LocalMap map (v.vector->Map().NumGlobalElements64(), v.vector->Map().IndexBase(), v.vector->Map().Comm()); vector.reset (new Epetra_FEVector(map)); @@ -479,9 +461,9 @@ namespace TrilinosWrappers Vector::reinit (const Epetra_Map &input_map, const bool fast) { - if (n_global_elements(vector->Map()) != n_global_elements(input_map)) + if (vector->Map().NumGlobalElements64() != input_map.NumGlobalElements64()) { - Epetra_LocalMap map (n_global_elements(input_map), + Epetra_LocalMap map (input_map.NumGlobalElements64(), input_map.IndexBase(), input_map.Comm()); vector.reset (new Epetra_FEVector (map)); @@ -506,7 +488,7 @@ namespace TrilinosWrappers const MPI_Comm &communicator, const bool fast) { - if (n_global_elements(vector->Map()) != + if (vector->Map().NumGlobalElements64() != static_cast(partitioning.size())) { Epetra_LocalMap map (static_cast(partitioning.size()), @@ -550,7 +532,7 @@ namespace TrilinosWrappers { if (local_range() != v.local_range()) { - Epetra_LocalMap map (v.vector->GlobalLength(), + Epetra_LocalMap map (v.vector->GlobalLength64(), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); @@ -605,7 +587,7 @@ namespace TrilinosWrappers { if (size() != v.size()) { - Epetra_LocalMap map (n_global_elements(v.vector->Map()), + Epetra_LocalMap map (v.vector->Map().NumGlobalElements64(), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); @@ -622,7 +604,7 @@ namespace TrilinosWrappers { if (size() != v.size()) { - Epetra_LocalMap map (n_global_elements(v.vector->Map()), + Epetra_LocalMap map (v.vector->Map().NumGlobalElements64(), v.vector->Map().IndexBase(), v.vector->Comm()); vector.reset (new Epetra_FEVector(map)); diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index f8f8675422..c8239f72d2 100644 --- a/deal.II/source/lac/trilinos_vector_base.cc +++ b/deal.II/source/lac/trilinos_vector_base.cc @@ -350,7 +350,7 @@ namespace TrilinosWrappers void VectorBase::print (const char *format) const { - Assert (vector->GlobalLength()!=0, ExcEmptyObject()); + Assert (vector->GlobalLength64()!=0, ExcEmptyObject()); for (size_type j=0; j