From 62588e35aa3d7042b3a37b1b91b704459351e019 Mon Sep 17 00:00:00 2001 From: turcksin Date: Tue, 19 Feb 2013 21:40:41 +0000 Subject: [PATCH] Change typedef std::size_t size_type to typedef types::global_dof_index size_type in lac. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28480 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/types.h | 26 ++- deal.II/include/deal.II/lac/arpack_solver.h | 2 +- deal.II/include/deal.II/lac/block_indices.h | 32 ++-- deal.II/include/deal.II/lac/block_list.h | 12 +- .../include/deal.II/lac/block_matrix_array.h | 7 +- .../include/deal.II/lac/block_matrix_base.h | 41 +++-- .../include/deal.II/lac/block_sparse_matrix.h | 5 - .../lac/block_sparse_matrix.templates.h | 6 +- .../deal.II/lac/block_sparse_matrix_ez.h | 14 +- .../deal.II/lac/block_sparsity_pattern.h | 10 +- deal.II/include/deal.II/lac/block_vector.h | 2 +- .../deal.II/lac/block_vector.templates.h | 6 +- .../include/deal.II/lac/block_vector_base.h | 7 +- .../include/deal.II/lac/chunk_sparse_matrix.h | 10 +- .../lac/chunk_sparse_matrix.templates.h | 9 +- .../deal.II/lac/chunk_sparsity_pattern.h | 8 +- .../lac/compressed_set_sparsity_pattern.h | 8 +- .../lac/compressed_simple_sparsity_pattern.h | 10 +- .../deal.II/lac/compressed_sparsity_pattern.h | 10 +- .../include/deal.II/lac/constraint_matrix.h | 10 +- .../deal.II/lac/constraint_matrix.templates.h | 4 + deal.II/include/deal.II/lac/eigen.h | 2 +- deal.II/include/deal.II/lac/filtered_matrix.h | 6 +- deal.II/include/deal.II/lac/full_matrix.h | 10 +- deal.II/include/deal.II/lac/parallel_vector.h | 13 +- .../include/deal.II/lac/petsc_vector_base.h | 2 +- .../include/deal.II/lac/tridiagonal_matrix.h | 6 +- .../lac/trilinos_block_sparse_matrix.h | 14 +- .../deal.II/lac/trilinos_block_vector.h | 5 - .../lac/trilinos_parallel_block_vector.h | 5 - .../deal.II/lac/trilinos_precondition.h | 30 +-- .../deal.II/lac/trilinos_sparse_matrix.h | 59 +++--- .../deal.II/lac/trilinos_sparsity_pattern.h | 28 +-- deal.II/include/deal.II/lac/trilinos_vector.h | 52 ++---- .../deal.II/lac/trilinos_vector_base.h | 38 +--- deal.II/include/deal.II/lac/vector.h | 6 +- .../include/deal.II/lac/vector.templates.h | 4 +- deal.II/include/deal.II/lac/vector_memory.h | 2 +- deal.II/include/deal.II/lac/vector_view.h | 2 +- .../deal.II/matrix_free/dof_info.templates.h | 20 +- deal.II/source/lac/block_matrix_array.cc | 4 +- deal.II/source/lac/block_sparsity_pattern.cc | 8 +- deal.II/source/lac/chunk_sparsity_pattern.cc | 19 +- .../lac/compressed_set_sparsity_pattern.cc | 6 +- .../lac/compressed_simple_sparsity_pattern.cc | 10 +- .../source/lac/compressed_sparsity_pattern.cc | 6 +- deal.II/source/lac/constraint_matrix.cc | 35 ++-- .../lac/trilinos_block_sparse_matrix.cc | 4 +- deal.II/source/lac/trilinos_precondition.cc | 6 +- deal.II/source/lac/trilinos_sparse_matrix.cc | 174 +++++++++--------- .../source/lac/trilinos_sparsity_pattern.cc | 109 ++++++----- deal.II/source/lac/trilinos_vector.cc | 14 +- deal.II/source/lac/trilinos_vector_base.cc | 13 +- 53 files changed, 457 insertions(+), 494 deletions(-) diff --git a/deal.II/include/deal.II/base/types.h b/deal.II/include/deal.II/base/types.h index f5be470f6f..6cf53a8440 100644 --- a/deal.II/include/deal.II/base/types.h +++ b/deal.II/include/deal.II/base/types.h @@ -141,6 +141,24 @@ namespace types } +namespace TrilinosWrapper +{ + namespace types + { +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES + /** + * Declare type of integer used in the Epetra package of Trilinos. + */ + typedef int int_type; +#else + /** + * Declare type of integer used in the Epetra package of Trilinos. + */ + typedef long long int_type; +#endif + } +} + // this part of the namespace numbers got moved to the bottom types.h file, // because otherwise we get a circular inclusion of config.h, types.h, and @@ -178,10 +196,12 @@ namespace numbers * an invalid array * index, an invalid * array size, and the - * like. + * like. Invalid_size_type + * is equivalent to + * invalid_dof_index. */ - static const std::size_t - invalid_size_type = static_cast (-1); + const types::global_dof_index + invalid_size_type = static_cast (-1); /** * An invalid value for indices of degrees diff --git a/deal.II/include/deal.II/lac/arpack_solver.h b/deal.II/include/deal.II/lac/arpack_solver.h index 8466097867..b675d0e70d 100644 --- a/deal.II/include/deal.II/lac/arpack_solver.h +++ b/deal.II/include/deal.II/lac/arpack_solver.h @@ -79,7 +79,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** diff --git a/deal.II/include/deal.II/lac/block_indices.h b/deal.II/include/deal.II/lac/block_indices.h index ec3e580039..bb2567c2ea 100644 --- a/deal.II/include/deal.II/lac/block_indices.h +++ b/deal.II/include/deal.II/lac/block_indices.h @@ -53,7 +53,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Default @@ -75,14 +75,14 @@ public: * Specialized constructor for a * structure with blocks of equal size. */ - explicit BlockIndices(const size_type n_blocks, const size_type block_size = 0); + explicit BlockIndices(const unsigned int n_blocks, const size_type block_size = 0); /** * Reinitialize the number of * blocks and assign each block * the same number of elements. */ - void reinit (const size_type n_blocks, + void reinit (const unsigned int n_blocks, const size_type n_elements_per_block); /** @@ -111,7 +111,7 @@ public: /** * Number of blocks in index field. */ - size_type size () const; + unsigned int size () const; /** * Return the total number of @@ -120,12 +120,12 @@ public: * of the vector space of the * block vector. */ - size_type total_size () const; + std::size_t total_size () const; /** * The size of the @p ith block. */ - size_type block_size (const size_type i) const; + std::size_t block_size (const size_type i) const; //@} @@ -152,14 +152,14 @@ public: * the block, the second the * index within it. */ - std::pair + std::pair global_to_local (const size_type i) const; /** * Return the global index of * @p index in block @p block. */ - size_type local_to_global (const size_type block, + size_type local_to_global (const unsigned int block, const size_type index) const; /** @@ -203,7 +203,7 @@ private: * we cache this value for faster * access. */ - size_type n_blocks; + unsigned int n_blocks; /** * Global starting index of each @@ -333,7 +333,7 @@ const bool IsBlockMatrix::value; inline void -BlockIndices::reinit (const size_type nb, +BlockIndices::reinit (const unsigned int nb, const size_type block_size) { n_blocks = nb; @@ -370,7 +370,7 @@ BlockIndices::BlockIndices () inline BlockIndices::BlockIndices ( - const size_type n_blocks, + const unsigned int n_blocks, const size_type block_size) : n_blocks(n_blocks), @@ -403,7 +403,7 @@ BlockIndices::push_back(const size_type sz) inline -std::pair +std::pair BlockIndices::global_to_local (const size_type i) const { Assert (i block_container; @@ -341,7 +341,7 @@ BlockList::add( for (size_type i=0; i { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor creating a * useless object. initialize() diff --git a/deal.II/include/deal.II/lac/block_matrix_base.h b/deal.II/include/deal.II/lac/block_matrix_base.h index c8e7073d71..689129dc2d 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_matrix_base.h @@ -53,6 +53,11 @@ namespace BlockMatrixIterators class AccessorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef the value type of the * matrix we point into. @@ -120,6 +125,11 @@ namespace BlockMatrixIterators public AccessorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Type of the matrix used in * this accessor. @@ -212,7 +222,12 @@ namespace BlockMatrixIterators { public: /** - * Thype of the matrix used in + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + + /** + * Type of the matrix used in * this accessor. */ typedef const BlockMatrix MatrixType; @@ -376,7 +391,7 @@ public: typedef const value_type *const_pointer; typedef value_type &reference; typedef const value_type &const_reference; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; typedef MatrixIterator > @@ -1274,7 +1289,7 @@ namespace BlockMatrixIterators template inline - size_type + typename AccessorBase::size_type AccessorBase::block_row() const { Assert (row_block != numbers::invalid_size_type, @@ -1286,7 +1301,7 @@ namespace BlockMatrixIterators template inline - size_type + typename AccessorBase::size_type AccessorBase::block_column() const { Assert (col_block != numbers::invalid_size_type, @@ -1374,7 +1389,7 @@ namespace BlockMatrixIterators template inline - size_type + typename Accessor::size_type Accessor::row() const { Assert (this->row_block != numbers::invalid_size_type, @@ -1387,7 +1402,7 @@ namespace BlockMatrixIterators template inline - size_type + typename Accessor::size_type Accessor::column() const { Assert (this->col_block != numbers::invalid_size_type, @@ -1558,7 +1573,7 @@ namespace BlockMatrixIterators template inline - size_type + typename Accessor::size_type Accessor::row() const { Assert (this->row_block != numbers::invalid_size_type, @@ -1571,7 +1586,7 @@ namespace BlockMatrixIterators template inline - size_type + typename Accessor::size_type Accessor::column() const { Assert (this->col_block != numbers::invalid_size_type, @@ -1602,7 +1617,7 @@ namespace BlockMatrixIterators void Accessor::set_value (typename Accessor::value_type newval) const { - Assert (this->row_block != numbers::invalid_size_type + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); @@ -1806,7 +1821,7 @@ BlockMatrixBase::block (const size_type row, template inline -size_type +typename BlockMatrixBase::size_type BlockMatrixBase::m () const { return row_block_indices.total_size(); @@ -1816,7 +1831,7 @@ BlockMatrixBase::m () const template inline -size_type +typename BlockMatrixBase::size_type BlockMatrixBase::n () const { return column_block_indices.total_size(); @@ -1826,7 +1841,7 @@ BlockMatrixBase::n () const template inline -size_type +typename BlockMatrixBase::size_type BlockMatrixBase::n_block_cols () const { return column_block_indices.size(); @@ -1836,7 +1851,7 @@ BlockMatrixBase::n_block_cols () const template inline -size_type +typename BlockMatrixBase::size_type BlockMatrixBase::n_block_rows () const { return row_block_indices.size(); diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix.h b/deal.II/include/deal.II/lac/block_sparse_matrix.h index cd6c55c94f..2dafec46ee 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix.h @@ -45,11 +45,6 @@ template class BlockSparseMatrix : public BlockMatrixBase > { public: - /** - * Declare type for container size. - */ - typedef std::size_t size_type; - /** * Typedef the base class for simpler * access to its own typedefs. diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h b/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h index 215f259e9a..3e603402c2 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix.templates.h @@ -127,7 +127,7 @@ BlockSparseMatrix::empty () const template -size_type +typename BlockSparseMatrix::size_type BlockSparseMatrix::get_row_length (const size_type row) const { return sparsity_pattern->row_length(row); @@ -136,7 +136,7 @@ BlockSparseMatrix::get_row_length (const size_type row) const template -size_type +typename BlockSparseMatrix::size_type BlockSparseMatrix::n_nonzero_elements () const { return sparsity_pattern->n_nonzero_elements (); @@ -145,7 +145,7 @@ BlockSparseMatrix::n_nonzero_elements () const template -size_type +typename BlockSparseMatrix::size_type BlockSparseMatrix::n_actually_nonzero_elements (const double threshold) const { size_type count = 0; diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h index 45448976c8..70d4898819 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.h @@ -50,7 +50,7 @@ public: /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Default constructor. The @@ -333,7 +333,7 @@ private: template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::n_block_rows () const { return row_indices.size(); @@ -343,7 +343,7 @@ BlockSparseMatrixEZ::n_block_rows () const template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::n_rows () const { return row_indices.total_size(); @@ -353,7 +353,7 @@ BlockSparseMatrixEZ::n_rows () const template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::n_block_cols () const { return column_indices.size(); @@ -363,7 +363,7 @@ BlockSparseMatrixEZ::n_block_cols () const template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::n_cols () const { return column_indices.total_size(); @@ -401,7 +401,7 @@ BlockSparseMatrixEZ::block (const size_type row, template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::m () const { return n_rows(); @@ -411,7 +411,7 @@ BlockSparseMatrixEZ::m () const template inline -size_type +typename BlockSparseMatrixEZ::size_type BlockSparseMatrixEZ::n () const { return n_cols(); diff --git a/deal.II/include/deal.II/lac/block_sparsity_pattern.h b/deal.II/include/deal.II/lac/block_sparsity_pattern.h index 81cfa10a2b..c4ece2ec42 100644 --- a/deal.II/include/deal.II/lac/block_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/block_sparsity_pattern.h @@ -85,7 +85,7 @@ public: /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Define a value which is used @@ -1302,7 +1302,7 @@ BlockSparsityPatternBase::exists (const size_type i, template inline -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase:: row_length (const size_type row) const { @@ -1321,7 +1321,7 @@ row_length (const size_type row) const template inline -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::n_block_cols () const { return columns; @@ -1331,7 +1331,7 @@ BlockSparsityPatternBase::n_block_cols () const template inline -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::n_block_rows () const { return rows; @@ -1339,7 +1339,7 @@ BlockSparsityPatternBase::n_block_rows () const inline -size_type +BlockCompressedSimpleSparsityPattern::size_type BlockCompressedSimpleSparsityPattern::column_number (const size_type row, const size_type index) const { diff --git a/deal.II/include/deal.II/lac/block_vector.h b/deal.II/include/deal.II/lac/block_vector.h index 6dc910923d..d347cf90a7 100644 --- a/deal.II/include/deal.II/lac/block_vector.h +++ b/deal.II/include/deal.II/lac/block_vector.h @@ -101,7 +101,7 @@ public: * use blocks of different * sizes. */ - explicit BlockVector (const size_type num_blocks = 0, + explicit BlockVector (const unsigned int num_blocks = 0, const size_type block_size = 0); /** diff --git a/deal.II/include/deal.II/lac/block_vector.templates.h b/deal.II/include/deal.II/lac/block_vector.templates.h index 608fd7f4ec..c11397b996 100644 --- a/deal.II/include/deal.II/lac/block_vector.templates.h +++ b/deal.II/include/deal.II/lac/block_vector.templates.h @@ -88,9 +88,9 @@ BlockVector::BlockVector (const TrilinosWrappers::BlockVector &v) template -void BlockVector::reinit (const size_type n_bl, - const szie_type bl_sz, - const bool fast) +void BlockVector::reinit (const unsigned int n_bl, + const size_type bl_sz, + const bool fast) { std::vector n(n_bl, bl_sz); reinit(n, fast); diff --git a/deal.II/include/deal.II/lac/block_vector_base.h b/deal.II/include/deal.II/lac/block_vector_base.h index d8545fc9a8..c1ff69c2e2 100644 --- a/deal.II/include/deal.II/lac/block_vector_base.h +++ b/deal.II/include/deal.II/lac/block_vector_base.h @@ -302,7 +302,7 @@ namespace internal /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Type of the number this @@ -739,8 +739,7 @@ public: typedef dealii::internal::BlockVectorIterators::Iterator const_iterator; typedef typename BlockType::reference reference; typedef typename BlockType::const_reference const_reference; - - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Declare a type that has holds @@ -836,7 +835,7 @@ public: * is the sum of the dimensions of all * components. */ - size_type size () const; + std::size_t size () const; /** * Return an iterator pointing to diff --git a/deal.II/include/deal.II/lac/chunk_sparse_matrix.h b/deal.II/include/deal.II/lac/chunk_sparse_matrix.h index 44079dbba1..fd69771902 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.h @@ -52,7 +52,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Type of matrix entries. In analogy to @@ -1230,7 +1230,8 @@ private: template inline -size_type ChunkSparseMatrix::m () const +typename ChunkSparseMatrix::size_type +ChunkSparseMatrix::m () const { Assert (cols != 0, ExcNotInitialized()); return cols->rows; @@ -1239,7 +1240,8 @@ size_type ChunkSparseMatrix::m () const template inline -size_type ChunkSparseMatrix::n () const +typename ChunkSparseMatrix::size_type +ChunkSparseMatrix::n () const { Assert (cols != 0, ExcNotInitialized()); return cols->cols; @@ -1249,7 +1251,7 @@ size_type ChunkSparseMatrix::n () const template inline -size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::compute_location (const size_type i, const size_type j) const { diff --git a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h index 913610e275..3903dc5639 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -42,6 +42,11 @@ namespace internal // by hand or by using, for example, optimized BLAS versions for them. namespace ChunkSparseMatrix { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Add the result of multiplying a chunk * of size chunk_size times chunk_size by @@ -363,7 +368,7 @@ ChunkSparseMatrix::empty () const template -size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -373,7 +378,7 @@ ChunkSparseMatrix::n_nonzero_elements () const template -size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_actually_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); diff --git a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h index f6a2b24e9f..8c6618ba6f 100644 --- a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h @@ -49,7 +49,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Define a value which is used @@ -865,7 +865,7 @@ private: inline -size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::n_rows () const { return rows; @@ -873,7 +873,7 @@ ChunkSparsityPattern::n_rows () const inline -size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::n_cols () const { return cols; @@ -882,7 +882,7 @@ ChunkSparsityPattern::n_cols () const inline -size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::get_chunk_size () const { return chunk_size; diff --git a/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h index 5ba85606d9..4f0379a53b 100644 --- a/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h @@ -109,7 +109,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * An iterator that can be used to @@ -441,7 +441,7 @@ CompressedSetSparsityPattern::Line::add_entries (ForwardIterator begin, inline -size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_rows () const { return rows; @@ -450,7 +450,7 @@ CompressedSetSparsityPattern::n_rows () const inline -size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_cols () const { return cols; @@ -487,7 +487,7 @@ CompressedSetSparsityPattern::add_entries (const size_type row, inline -size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); diff --git a/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h index 9ef3fd35ae..c1f7e642a7 100644 --- a/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h @@ -90,7 +90,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * An iterator that can be used to @@ -488,7 +488,7 @@ CompressedSimpleSparsityPattern::Line::add (const size_type j) inline -std::size_t +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::n_rows () const { return rows; @@ -497,7 +497,7 @@ CompressedSimpleSparsityPattern::n_rows () const inline -std::size_t +types::global_dof_index CompressedSimpleSparsityPattern::n_cols () const { return cols; @@ -550,7 +550,7 @@ CompressedSimpleSparsityPattern::Line::Line () inline -std::size_t +types::global_dof_index CompressedSimpleSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); @@ -565,7 +565,7 @@ CompressedSimpleSparsityPattern::row_length (const size_type row) const inline -std::size_t +types::global_dof_index CompressedSimpleSparsityPattern::column_number (const size_type row, const size_type index) const { diff --git a/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h index 2d5328eedb..9ecc0ca4cc 100644 --- a/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h @@ -91,7 +91,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * An iterator that can be used to @@ -507,7 +507,7 @@ CompressedSparsityPattern::Line::add (const size_type j) inline -std::size_t +types::global_dof_index CompressedSparsityPattern::n_rows () const { return rows; @@ -516,7 +516,7 @@ CompressedSparsityPattern::n_rows () const inline -std::size_t +types::global_dof_index CompressedSparsityPattern::n_cols () const { return cols; @@ -561,7 +561,7 @@ CompressedSparsityPattern::Line::Line () inline -std::size_t +types::global_dof_index CompressedSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); @@ -574,7 +574,7 @@ CompressedSparsityPattern::row_length (const size_type row) const inline -std::size_t +types::global_dof_index CompressedSparsityPattern::column_number (const size_type row, const size_type index) const { diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index f3bbba92e0..8c261bcc93 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -142,7 +142,7 @@ public: /** * Declare the type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * An enum that describes what should @@ -636,7 +636,7 @@ public: * consumption (in bytes) of this * object. */ - size_type memory_consumption () const; + std::size_t memory_consumption () const; /** * @} @@ -1921,7 +1921,7 @@ ConstraintMatrix::set_inhomogeneity (const size_type line, inline -std::size_t +types::global_dof_index ConstraintMatrix::n_constraints () const { return lines.size(); @@ -1962,7 +1962,7 @@ ConstraintMatrix::is_inhomogeneously_constrained (const size_type index) const inline -const std::vector > * +const std::vector > * ConstraintMatrix::get_constraint_entries (const size_type line) const { // check whether the entry is @@ -1995,7 +1995,7 @@ ConstraintMatrix::get_inhomogeneity (const size_type line) const -inline std::size_t +inline types::global_dof_index ConstraintMatrix::calculate_line_index (const size_type line) const { //IndexSet is unused (serial case) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index 7dc2082af7..3aac17b9eb 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -730,6 +730,8 @@ namespace internal { namespace { + typedef types::global_dof_index size_type; + // TODO: in general we should iterate over the constraints and not over all DoFs // for performance reasons template @@ -1007,6 +1009,8 @@ ConstraintMatrix::distribute (VectorType &vec) const // local_to_global functions. namespace internals { + typedef types::global_dof_index size_type; + // this struct contains all the information // we need to store about each of the // global entries (global_row): are they diff --git a/deal.II/include/deal.II/lac/eigen.h b/deal.II/include/deal.II/lac/eigen.h index 4a1708fa93..1534bcaa92 100644 --- a/deal.II/include/deal.II/lac/eigen.h +++ b/deal.II/include/deal.II/lac/eigen.h @@ -53,7 +53,7 @@ public: /** * Declare type of container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Standardized data struct to diff --git a/deal.II/include/deal.II/lac/filtered_matrix.h b/deal.II/include/deal.II/lac/filtered_matrix.h index 13d05c53ae..f6d789f133 100644 --- a/deal.II/include/deal.II/lac/filtered_matrix.h +++ b/deal.II/include/deal.II/lac/filtered_matrix.h @@ -209,7 +209,7 @@ public: /** * Declare the type of container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Accessor class for iterators @@ -673,7 +673,7 @@ FilteredMatrix::Accessor::Accessor( template inline -size_type +types::global_dof_index FilteredMatrix::Accessor::row() const { return matrix->constraints[index].first; @@ -683,7 +683,7 @@ FilteredMatrix::Accessor::row() const template inline -size_type +types::global_dof_index FilteredMatrix::Accessor::column() const { return matrix->constraints[index].first; diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index 3fcedd8591..e38bb47873 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -63,7 +63,7 @@ public: /** * Declare type of container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Type of matrix entries. In analogy to @@ -1476,7 +1476,7 @@ public: template inline -std::size_t +types::global_dof_index FullMatrix::m() const { return this->n_rows(); @@ -1486,7 +1486,7 @@ FullMatrix::m() const template inline -std::size_t +types::global_dof_index FullMatrix::n() const { return this->n_cols(); @@ -1654,7 +1654,7 @@ Accessor (const FullMatrix *matrix, template inline -std::size_t +types::global_dof_index FullMatrix::Accessor::row() const { return a_row; @@ -1663,7 +1663,7 @@ FullMatrix::Accessor::row() const template inline -std::size_t +types::global_dof_index FullMatrix::Accessor::column() const { return a_col; diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index 3fe5684619..b649284114 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.h +++ b/deal.II/include/deal.II/lac/parallel_vector.h @@ -97,7 +97,7 @@ namespace parallel typedef const value_type *const_iterator; typedef value_type &reference; typedef const value_type &const_reference; - typedef size_t size_type; + typedef types::global_dof_index size_type; typedef typename numbers::NumberTraits::real_type real_type; /** @@ -1373,7 +1373,8 @@ namespace parallel template inline - std::size_t Vector::size () const + typename Vector::size_type + Vector::size () const { return partitioner->size(); } @@ -1382,7 +1383,8 @@ namespace parallel template inline - std::size_t Vector::local_size () const + typename Vector::size_type + Vector::local_size () const { return partitioner->local_size(); } @@ -1391,7 +1393,8 @@ namespace parallel template inline - std::pair + std::pair::size_type, + typename Vector::size_type> Vector::local_range () const { return partitioner->local_range(); @@ -1412,7 +1415,7 @@ namespace parallel template inline - std::size_t + typename Vector::size_type Vector::n_ghost_entries () const { return partitioner->n_ghost_indices(); diff --git a/deal.II/include/deal.II/lac/petsc_vector_base.h b/deal.II/include/deal.II/lac/petsc_vector_base.h index 07882b876a..fed7aafe65 100644 --- a/deal.II/include/deal.II/lac/petsc_vector_base.h +++ b/deal.II/include/deal.II/lac/petsc_vector_base.h @@ -252,7 +252,7 @@ namespace PETScWrappers */ typedef PetscScalar value_type; typedef PetscReal real_type; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; typedef internal::VectorReference reference; typedef const internal::VectorReference const_reference; diff --git a/deal.II/include/deal.II/lac/tridiagonal_matrix.h b/deal.II/include/deal.II/lac/tridiagonal_matrix.h index 738bde20c6..0f3d054588 100644 --- a/deal.II/include/deal.II/lac/tridiagonal_matrix.h +++ b/deal.II/include/deal.II/lac/tridiagonal_matrix.h @@ -48,7 +48,7 @@ public: /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * @name Constructors and initalization. @@ -380,7 +380,7 @@ private: #ifndef DOXYGEN template -size_type +types::global_dof_index TridiagonalMatrix::m() const { return diagonal.size(); @@ -389,7 +389,7 @@ TridiagonalMatrix::m() const template -size_type +types::global_dof_index TridiagonalMatrix::n() const { return diagonal.size(); diff --git a/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h index 01b733e0b6..c72568a415 100644 --- a/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h @@ -73,19 +73,7 @@ namespace TrilinosWrappers /** * Declare the type for container size. */ - typedef std::size_t size_type; - -#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES - /** - * Declare the type of integer. - */ - typedef int int_type; -#else - /** - * Declare the type of integer. - */ - typedef long long int_type; -#endif + typedef types::global_dof_index size_type; /** * Typedef the base class for simpler diff --git a/deal.II/include/deal.II/lac/trilinos_block_vector.h b/deal.II/include/deal.II/lac/trilinos_block_vector.h index c535f63c57..a707d97f2f 100644 --- a/deal.II/include/deal.II/lac/trilinos_block_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_block_vector.h @@ -65,11 +65,6 @@ namespace TrilinosWrappers class BlockVector : public BlockVectorBase { public: - /** - * Declare the type for container size. - */ - typedef std::size_t size_type; - /** * Typedef the base class for simpler * access to its own typedefs. diff --git a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h index ec8d1bbd86..8ad150cebc 100644 --- a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h @@ -67,11 +67,6 @@ namespace TrilinosWrappers class BlockVector : public BlockVectorBase { public: - /** - * Declare the type for container size. - */ - typedef std::size_t size_type; - /** * Typedef the base class for simpler * access to its own typedefs. diff --git a/deal.II/include/deal.II/lac/trilinos_precondition.h b/deal.II/include/deal.II/lac/trilinos_precondition.h index a649ffb011..b4683f1ee4 100644 --- a/deal.II/include/deal.II/lac/trilinos_precondition.h +++ b/deal.II/include/deal.II/lac/trilinos_precondition.h @@ -75,19 +75,7 @@ namespace TrilinosWrappers /** * Declare the type for container size. */ - typedef std::size_t size_type; - -#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES - /** - * Declare type of integer. - */ - typedef int int_type; -#else - /** - * Declare type of integer. - */ - typedef long long int_type; -#endif + typedef types::global_dof_index size_type; /** * Standardized data struct to @@ -1575,9 +1563,9 @@ namespace TrilinosWrappers void PreconditionBase::vmult (dealii::Vector &dst, const dealii::Vector &src) const { - AssertDimension (static_cast(dst.size()), + AssertDimension (static_cast(dst.size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast(src.size()), + AssertDimension (static_cast(src.size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1593,9 +1581,9 @@ namespace TrilinosWrappers void PreconditionBase::Tvmult (dealii::Vector &dst, const dealii::Vector &src) const { - AssertDimension (static_cast(dst.size()), + AssertDimension (static_cast(dst.size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast(src.size()), + AssertDimension (static_cast(src.size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1615,9 +1603,9 @@ namespace TrilinosWrappers PreconditionBase::vmult (parallel::distributed::Vector &dst, const parallel::distributed::Vector &src) const { - AssertDimension (static_cast(dst.local_size()), + AssertDimension (static_cast(dst.local_size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast(src.local_size()), + AssertDimension (static_cast(src.local_size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); @@ -1633,9 +1621,9 @@ namespace TrilinosWrappers PreconditionBase::Tvmult (parallel::distributed::Vector &dst, const parallel::distributed::Vector &src) const { - AssertDimension (static_cast(dst.local_size()), + AssertDimension (static_cast(dst.local_size()), preconditioner->OperatorDomainMap().NumMyElements()); - AssertDimension (static_cast(src.local_size()), + AssertDimension (static_cast(src.local_size()), preconditioner->OperatorRangeMap().NumMyElements()); Epetra_Vector tril_dst (View, preconditioner->OperatorDomainMap(), dst.begin()); 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 931b4a385f..22c7794bc5 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -101,19 +101,7 @@ namespace TrilinosWrappers /** * Declare the type for container size. */ - typedef std::size_t size_type; - -#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES - /** - * Declare type of integer. - */ - typedef int int_type; -#else - /** - * Declare type of integer. - */ - typedef long long int_type; -#endif + typedef types::global_dof_index size_type; /** * Constructor. @@ -395,7 +383,7 @@ namespace TrilinosWrappers /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Typedef for the matrix type @@ -3029,7 +3017,7 @@ namespace TrilinosWrappers bool SparseMatrix::in_local_range (const size_type index) const { - int_type begin, end; + TrilinosWrapper::types::int_type begin, end; begin = matrix->RowMap().MinMyGID(); end = matrix->RowMap().MaxMyGID()+1; @@ -3176,15 +3164,15 @@ namespace TrilinosWrappers last_action = Insert; - int_type *col_index_ptr; + TrilinosWrapper::types::int_type *col_index_ptr; TrilinosScalar const *col_value_ptr; - int_type n_columns; + TrilinosWrapper::types::int_typeint_type n_columns; // If we don't elide zeros, the pointers // are already available... if (elide_zero_values == false) { - col_index_ptr = (int_type *)col_indices; + col_index_ptr = (TrilinosWrapper::types::int_type *)col_indices; col_value_ptr = values; n_columns = n_cols; } @@ -3212,9 +3200,9 @@ namespace TrilinosWrappers } } - Assert(n_columns <= (int_type)n_cols, ExcInternalError()); + Assert(n_columns <= (TrilinosWrapper::types::int_type)n_cols, ExcInternalError()); - col_index_ptr = (int_type *)&column_indices[0]; + col_index_ptr = (TrilinosWrapper::types::int_type *)&column_indices[0]; col_value_ptr = &column_values[0]; } @@ -3233,7 +3221,7 @@ namespace TrilinosWrappers // add the possibility to insert new values, // and in the second we just replace // data. - if (row_partitioner().MyGID(static_cast(row)) == true) + if (row_partitioner().MyGID(static_cast(row)) == true) { if (matrix->Filled() == false) { @@ -3270,7 +3258,8 @@ namespace TrilinosWrappers if (matrix->Filled() == false) { - ierr = matrix->InsertGlobalValues (1, (int_type *)&row, + ierr = matrix->InsertGlobalValues (1, + (TrilinosWrapper::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3278,7 +3267,8 @@ namespace TrilinosWrappers ierr = 0; } else - ierr = matrix->ReplaceGlobalValues (1, (int_type *)&row, + ierr = matrix->ReplaceGlobalValues (1, + (TrilinosWrapper::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3404,15 +3394,15 @@ namespace TrilinosWrappers last_action = Add; - int_type *col_index_ptr; + TrilinosWrapper::types::int_type *col_index_ptr; TrilinosScalar const *col_value_ptr; - int_type n_columns; + TrilinosWrapper::types::int_type n_columns; // If we don't elide zeros, the pointers // are already available... if (elide_zero_values == false) { - col_index_ptr = (int_type *)col_indices; + col_index_ptr = (TrilinosWrapper::types::int_type *)col_indices; col_value_ptr = values; n_columns = n_cols; #ifdef DEBUG @@ -3443,9 +3433,9 @@ namespace TrilinosWrappers } } - Assert(n_columns <= (int_type)n_cols, ExcInternalError()); + Assert(n_columns <= (TrilinosWrapper::types::int_type)n_cols, ExcInternalError()); - col_index_ptr = (int_type *)&column_indices[0]; + col_index_ptr = (TrilinosWrapper::types::int_type *)&column_indices[0]; col_value_ptr = &column_values[0]; } @@ -3454,7 +3444,7 @@ namespace TrilinosWrappers // can directly call the Epetra_CrsMatrix // input function, which is much faster // than the Epetra_FECrsMatrix function. - if (row_partitioner().MyGID(static_cast(row)) == true) + if (row_partitioner().MyGID(static_cast(row)) == true) { ierr = matrix->Epetra_CrsMatrix::SumIntoGlobalValues(row, n_columns, const_cast(col_value_ptr), @@ -3474,7 +3464,8 @@ namespace TrilinosWrappers // one element at a time). compressed = false; - ierr = matrix->SumIntoGlobalValues (1, (int_type *)&row, n_columns, + ierr = matrix->SumIntoGlobalValues (1, + (TrilinosWrapper::types::int_type *)&row, n_columns, col_index_ptr, &col_value_ptr, Epetra_FECrsMatrix::ROW_MAJOR); @@ -3488,15 +3479,15 @@ namespace TrilinosWrappers std::cout << "Got error " << ierr << " in row " << row << " of proc " << row_partitioner().Comm().MyPID() << " when trying to add the columns:" << std::endl; - for (int_type i=0; i(row)), + TrilinosWrapper::types::int_type n_indices, *indices; + trilinos_sparsity_pattern().ExtractMyRowView(row_partitioner().LID(static_cast(row)), n_indices, indices); - for (int_type i=0; iRowMap().MinMyGID(); end = graph->RowMap().MaxMyGID()+1; @@ -1646,11 +1633,14 @@ namespace TrilinosWrappers if (begin == end) return; - int_type *col_index_ptr = (int_type *)(&*begin); - const int_type n_cols = static_cast(end - begin); + TrilinosWrapper::types::int_type *col_index_ptr = + (TrilinosWrapper::types::int_type *)(&*begin); + const TrilinosWrapper::types::int_type n_cols = + static_cast(end - begin); compressed = false; - const int ierr = graph->InsertGlobalIndices (1, (int_type *)&row, + const int ierr = graph->InsertGlobalIndices (1, + (TrilinosWrapper::types::int_type *)&row, n_cols, col_index_ptr); AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); @@ -1819,7 +1809,7 @@ namespace TrilinosWrappers SparsityPattern::reinit (const IndexSet &row_parallel_partitioning, const IndexSet &col_parallel_partitioning, const MPI_Comm &communicator, - const std::vector &n_entries_per_row) + const std::vector &n_entries_per_row) { Epetra_Map row_map = row_parallel_partitioning.make_trilinos_map (communicator, false); diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index 6baf82634f..285fad64fc 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -169,20 +169,7 @@ namespace TrilinosWrappers /** * Declare type for container size. */ - typedef std::size_t size_type; - -#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES - /** - * Declare type of integer. - */ - typedef int int_type; -#else - /** - * Declare type of integer. - */ - typedef long long int_type; -#endif - + typedef types::global_dof_index size_type; /** * @name Basic constructors and initalization. @@ -528,12 +515,12 @@ namespace TrilinosWrappers has_ghosts = vector->Map().UniqueGIDs()==false; - const int_type size = parallel_partitioner.NumMyElements(); + const TrilinosWrapper::types::int_type size = parallel_partitioner.NumMyElements(); // Need to copy out values, since the // deal.II might not use doubles, so // that a direct access is not possible. - for (int_type i=0; i Vector::Vector (const dealii::Vector &v) { - Epetra_LocalMap map ((int_type)v.size(), 0, Utilities::Trilinos::comm_self()); + Epetra_LocalMap map ((TrilinosWrapper::types::int_type)v.size(), 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector(map)); *this = v; } @@ -837,13 +807,13 @@ namespace TrilinosWrappers { vector.reset(); - Epetra_LocalMap map ((int_type)v.size(), 0, + Epetra_LocalMap map ((TrilinosWrapper::types::int_type)v.size(), 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector(map)); } const Epetra_Map &map = vector_partitioner(); - const int_type size = map.NumMyElements(); + const TrilinosWrapper::types::int_type size = map.NumMyElements(); Assert (map.MaxLID() == size-1, ExcDimensionMismatch(map.MaxLID(), size-1)); @@ -851,7 +821,7 @@ namespace TrilinosWrappers // Need to copy out values, since the // deal.II might not use doubles, so // that a direct access is not possible. - for (int_type i=0; iMap().LID(static_cast(row)); + const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast(row)); if (local_row == -1) { const int ierr = vector->ReplaceGlobalValues (1, - (const int_type *)(&row), + (const TrilinosWrapper::types::int_type *)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1473,11 +1449,11 @@ namespace TrilinosWrappers for (size_type i=0; iMap().LID(static_cast(row)); + const TrilinosWrapper::types::int_type local_row = vector->Map().LID(static_cast(row)); if (local_row == -1) { const int ierr = vector->SumIntoGlobalValues (1, - (const int_type *)(&row), + (const TrilinosWrapper::types::int_type *)(&row), &values[i]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); compressed = false; @@ -1512,7 +1488,7 @@ namespace TrilinosWrappers std::pair VectorBase::local_range () const { - int_type begin, end; + TrilinosWrapper::types::int_type begin, end; begin = vector->Map().MinMyGID(); end = vector->Map().MaxMyGID()+1; return std::make_pair (begin, end); diff --git a/deal.II/include/deal.II/lac/vector.h b/deal.II/include/deal.II/lac/vector.h index ce51bf021b..925915cf7b 100644 --- a/deal.II/include/deal.II/lac/vector.h +++ b/deal.II/include/deal.II/lac/vector.h @@ -117,7 +117,7 @@ public: typedef const value_type *const_iterator; typedef value_type &reference; typedef const value_type &const_reference; - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Declare a type that has holds @@ -590,7 +590,7 @@ public: /** * Return dimension of the vector. */ - size_type size () const; + std::size_t size () const; /** * Return whether the vector contains only @@ -998,7 +998,7 @@ public: * memory consumption (in bytes) * of this object. */ - size_type memory_consumption () const; + std::size_t memory_consumption () const; //@} /** diff --git a/deal.II/include/deal.II/lac/vector.templates.h b/deal.II/include/deal.II/lac/vector.templates.h index 816fe8116e..03234afcc0 100644 --- a/deal.II/include/deal.II/lac/vector.templates.h +++ b/deal.II/include/deal.II/lac/vector.templates.h @@ -322,6 +322,8 @@ namespace internal { namespace Vector { + typedef types::global_dof_index size_type; + template void set_subrange (const T s, const size_type begin, @@ -1432,7 +1434,7 @@ void Vector::block_read (std::istream &in) template -size_type +std::size_t Vector::memory_consumption () const { return sizeof(*this) + (max_vec_size * sizeof(Number)); diff --git a/deal.II/include/deal.II/lac/vector_memory.h b/deal.II/include/deal.II/lac/vector_memory.h index c61e34c3aa..aadd6eaa59 100644 --- a/deal.II/include/deal.II/lac/vector_memory.h +++ b/deal.II/include/deal.II/lac/vector_memory.h @@ -256,7 +256,7 @@ public: /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Constructor. The argument diff --git a/deal.II/include/deal.II/lac/vector_view.h b/deal.II/include/deal.II/lac/vector_view.h index b2dd304a9d..72fae49f8e 100644 --- a/deal.II/include/deal.II/lac/vector_view.h +++ b/deal.II/include/deal.II/lac/vector_view.h @@ -136,7 +136,7 @@ public: /** * Declare type for container size. */ - typedef std::size_t size_type; + typedef types::global_dof_index size_type; /** * Read write constructor. Takes the size diff --git a/deal.II/include/deal.II/matrix_free/dof_info.templates.h b/deal.II/include/deal.II/matrix_free/dof_info.templates.h index 06d4885148..9a28ef5686 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.templates.h @@ -41,16 +41,6 @@ namespace internal template struct ConstraintValues { - /** - * In the definition of next_constraint and constraints below, - * there is an argument that is in fact the size of constraints. - * To be clarified, we explicitly use the size_type of the - * std::map container as the type. We define the size_type for - * a container that contains rather than the real - * types in the `constraints' object to avoid self-recursiveness. - */ - typedef std::map::size_type size_type; - ConstraintValues(); /** @@ -66,8 +56,8 @@ namespace internal std::vector > constraint_entries; std::vector constraint_indices; - std::pair, size_type> next_constraint; - std::map, size_type, FPArrayComparator > constraints; + std::pair, types::global_dof_index> next_constraint; + std::map, types::global_dof_index, FPArrayComparator > constraints; }; @@ -89,7 +79,7 @@ namespace internal constraint_entries = entries; std::sort(constraint_entries.begin(), constraint_entries.end(), ConstraintComparator()); - for (size_type j=0; j, size_type, + std::pair, types::global_dof_index, FPArrayComparator >::iterator, bool> it = constraints.insert(next_constraint); - size_type insert_position = deal_II_numbers::invalid_unsigned_int; + types::global_dof_index insert_position = deal_II_numbers::invalid_dof_index; if (it.second == false) insert_position = it.first->second; else diff --git a/deal.II/source/lac/block_matrix_array.cc b/deal.II/source/lac/block_matrix_array.cc index 3a63bce74f..dcb82f4c14 100644 --- a/deal.II/source/lac/block_matrix_array.cc +++ b/deal.II/source/lac/block_matrix_array.cc @@ -249,7 +249,7 @@ BlockMatrixArray::matrix_norm_square ( template -size_type +typename BlockMatrixArray::size_type BlockMatrixArray::n_block_rows () const { return block_rows; @@ -258,7 +258,7 @@ BlockMatrixArray::n_block_rows () const template -size_type +typename BlockMatrixArray::size_type BlockMatrixArray::n_block_cols () const { return block_cols; diff --git a/deal.II/source/lac/block_sparsity_pattern.cc b/deal.II/source/lac/block_sparsity_pattern.cc index 0001be1ec2..68318e34cf 100644 --- a/deal.II/source/lac/block_sparsity_pattern.cc +++ b/deal.II/source/lac/block_sparsity_pattern.cc @@ -180,7 +180,7 @@ BlockSparsityPatternBase::empty () const template -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::max_entries_per_row () const { size_type max_entries = 0; @@ -199,7 +199,7 @@ BlockSparsityPatternBase::max_entries_per_row () const template -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::n_rows () const { // only count in first column, since @@ -213,7 +213,7 @@ BlockSparsityPatternBase::n_rows () const template -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::n_cols () const { // only count in first row, since @@ -227,7 +227,7 @@ BlockSparsityPatternBase::n_cols () const template -size_type +typename BlockSparsityPatternBase::size_type BlockSparsityPatternBase::n_nonzero_elements () const { size_type count = 0; diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index 59f8770389..79a3aaabe6 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -103,7 +103,7 @@ ChunkSparsityPattern::ChunkSparsityPattern (const size_type n, ChunkSparsityPattern::ChunkSparsityPattern ( - const types::global_dof_index m, + const size_type m, const std::vector &row_lengths, const size_type chunk_size, const bool) @@ -176,8 +176,8 @@ ChunkSparsityPattern::reinit (const size_type m, void ChunkSparsityPattern::reinit ( - const types::global_dof_index m, - const types::global_dof_index n, + const size_type m, + const size_type n, const VectorSlice > &row_lengths, const size_type chunk_size, const bool) @@ -256,6 +256,11 @@ namespace internal { namespace { + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + // distinguish between compressed sparsity types that define row_begin() // and SparsityPattern that uses begin() as iterator type template @@ -390,7 +395,7 @@ ChunkSparsityPattern::empty () const -size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::max_entries_per_row () const { return sparsity_pattern.max_entries_per_row() * chunk_size; @@ -422,7 +427,7 @@ ChunkSparsityPattern::exists (const size_type i, -size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::row_length (const size_type i) const { Assert (i::const_iterator i=lines.begin(); @@ -2230,7 +2231,7 @@ ConstraintMatrix::write_dot (std::ostream &out) const -size_type +std::size_t ConstraintMatrix::memory_consumption () const { return (MemoryConsumption::memory_consumption (lines) + @@ -2277,7 +2278,7 @@ ConstraintMatrix::memory_consumption () const #define PARALLEL_VECTOR_FUNCTIONS(VectorType) \ template void ConstraintMatrix:: \ distribute_local_to_global (const Vector &, \ - const std::vector &, \ + const std::vector &, \ VectorType &, \ const FullMatrix &) const @@ -2301,7 +2302,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global (const FullMatrix &, \ const Vector &, \ - const std::vector &, \ + const std::vector &, \ MatrixType &, \ VectorType &, \ bool , \ @@ -2310,7 +2311,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global > (const FullMatrix &, \ const Vector &, \ - const std::vector &, \ + const std::vector &, \ MatrixType &, \ Vector &, \ bool , \ @@ -2319,7 +2320,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global (const FullMatrix &, \ const Vector &, \ - const std::vector &, \ + const std::vector &, \ MatrixType &, \ VectorType &, \ bool , \ @@ -2328,7 +2329,7 @@ PARALLEL_VECTOR_FUNCTIONS(TrilinosWrappers::MPI::BlockVector); template void ConstraintMatrix:: \ distribute_local_to_global > (const FullMatrix &, \ const Vector &, \ - const std::vector &, \ + const std::vector &, \ MatrixType &, \ Vector &, \ bool , \ @@ -2379,27 +2380,27 @@ BLOCK_MATRIX_VECTOR_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix, TrilinosWrapp #define SPARSITY_FUNCTIONS(SparsityType) \ template void ConstraintMatrix::add_entries_local_to_global (\ - const std::vector &, \ + const std::vector &, \ SparsityType &, \ const bool, \ const Table<2,bool> &, \ internal::bool2type) const; \ template void ConstraintMatrix::add_entries_local_to_global (\ - const std::vector &, \ - const std::vector &, \ + const std::vector &, \ + const std::vector &, \ SparsityType &, \ const bool, \ const Table<2,bool> &) const #define BLOCK_SPARSITY_FUNCTIONS(SparsityType) \ template void ConstraintMatrix::add_entries_local_to_global (\ - const std::vector &, \ + const std::vector &, \ SparsityType &, \ const bool, \ const Table<2,bool> &, \ internal::bool2type) const; \ template void ConstraintMatrix::add_entries_local_to_global (\ - const std::vector &, \ - const std::vector &, \ + const std::vector &, \ + const std::vector &, \ SparsityType &, \ const bool, \ const Table<2,bool> &) const @@ -2422,8 +2423,8 @@ BLOCK_SPARSITY_FUNCTIONS(TrilinosWrappers::BlockSparsityPattern); #define ONLY_MATRIX_FUNCTIONS(MatrixType) \ template void ConstraintMatrix::distribute_local_to_global (\ const FullMatrix &, \ - const std::vector &, \ - const std::vector &, \ + const std::vector &, \ + const std::vector &, \ MatrixType &) const ONLY_MATRIX_FUNCTIONS(SparseMatrix); diff --git a/deal.II/source/lac/trilinos_block_sparse_matrix.cc b/deal.II/source/lac/trilinos_block_sparse_matrix.cc index a3cee9ef7f..4ea65083a4 100644 --- a/deal.II/source/lac/trilinos_block_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_block_sparse_matrix.cc @@ -148,7 +148,7 @@ namespace TrilinosWrappers std::vector parallel_partitioning; for (size_type i=0; i(block_sparsity_pattern.block(i,0).n_rows()), + (Epetra_Map(static_cast(block_sparsity_pattern.block(i,0).n_rows()), 0, Utilities::Trilinos::comm_self())); @@ -240,7 +240,7 @@ namespace TrilinosWrappers std::vector parallel_partitioning; for (size_type i=0; i(dealii_block_sparse_matrix.block(i,0).m()), + parallel_partitioning.push_back (Epetra_Map(static_cast(dealii_block_sparse_matrix.block(i,0).m()), 0, trilinos_communicator)); diff --git a/deal.II/source/lac/trilinos_precondition.cc b/deal.II/source/lac/trilinos_precondition.cc index 8f5afe056b..3a1d36fab7 100644 --- a/deal.II/source/lac/trilinos_precondition.cc +++ b/deal.II/source/lac/trilinos_precondition.cc @@ -602,7 +602,8 @@ namespace TrilinosWrappers for (size_type d=0; d(n_rows), 0, communicator)); + vector_distributor.reset (new Epetra_Map(static_cast(n_rows), + 0, communicator)); if (trilinos_matrix.get() == 0) trilinos_matrix.reset (new SparseMatrix()); diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index 3527268163..41631c5486 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -54,8 +54,8 @@ namespace TrilinosWrappers // get a representation of the present // row - int_type ncols; - int_type colnums = matrix->n(); + TrilinosWrapper::types::int_type ncols; + TrilinosWrapper::types::int_type colnums = matrix->n(); if (value_cache.get() == 0) { value_cache.reset (new std::vector (matrix->n())); @@ -68,10 +68,10 @@ namespace TrilinosWrappers } int ierr = matrix->trilinos_matrix(). - ExtractGlobalRowCopy((int_type)this->a_row, + ExtractGlobalRowCopy((TrilinosWrapper::types::int_type)this->a_row, colnums, ncols, &((*value_cache)[0]), - reinterpret_cast(&((*colnum_cache)[0]))); + reinterpret_cast(&((*colnum_cache)[0]))); value_cache->resize (ncols); colnum_cache->resize (ncols); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -116,7 +116,7 @@ namespace TrilinosWrappers : column_space_map (new Epetra_Map (input_map)), matrix (new Epetra_FECrsMatrix(Copy, *column_space_map, - int_type(n_max_entries_per_row), false)), + TrilinosWrapper::types::int_type(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -129,7 +129,7 @@ namespace TrilinosWrappers column_space_map (new Epetra_Map (input_map)), matrix (new Epetra_FECrsMatrix (Copy, *column_space_map, - (int_type *)const_cast(&(n_entries_per_row[0])), + (TrilinosWrapper::types::int_type *)const_cast(&(n_entries_per_row[0])), false)), last_action (Zero), compressed (false) @@ -143,7 +143,7 @@ namespace TrilinosWrappers : column_space_map (new Epetra_Map (input_col_map)), matrix (new Epetra_FECrsMatrix(Copy, input_row_map, - int_type(n_max_entries_per_row), false)), + TrilinosWrapper::types::int_type(n_max_entries_per_row), false)), last_action (Zero), compressed (false) {} @@ -156,7 +156,7 @@ namespace TrilinosWrappers : column_space_map (new Epetra_Map (input_col_map)), matrix (new Epetra_FECrsMatrix(Copy, input_row_map, - (int_type *)const_cast(&(n_entries_per_row[0])), + (TrilinosWrapper::types::int_type *)const_cast(&(n_entries_per_row[0])), false)), last_action (Zero), compressed (false) @@ -168,7 +168,7 @@ namespace TrilinosWrappers const size_type n, const size_type n_max_entries_per_row) : - column_space_map (new Epetra_Map (static_cast(n), 0, + column_space_map (new Epetra_Map (static_cast(n), 0, Utilities::Trilinos::comm_self())), // on one processor only, we know how the @@ -180,7 +180,7 @@ namespace TrilinosWrappers // information from columns is only // available when entries have been added matrix (new Epetra_FECrsMatrix(Copy, - Epetra_Map (static_cast(m), 0, + Epetra_Map (static_cast(m), 0, Utilities::Trilinos::comm_self()), *column_space_map, n_max_entries_per_row, @@ -195,13 +195,13 @@ namespace TrilinosWrappers const size_type n, const std::vector &n_entries_per_row) : - column_space_map (new Epetra_Map (static_cast(n), 0, + column_space_map (new Epetra_Map (static_cast(n), 0, Utilities::Trilinos::comm_self())), matrix (new Epetra_FECrsMatrix(Copy, - Epetra_Map (static_cast(m), 0, + Epetra_Map (static_cast(m), 0, Utilities::Trilinos::comm_self()), *column_space_map, - (int_type *)const_cast(&(n_entries_per_row[0])), + (TrilinosWrapper::types::int_type *)const_cast(&(n_entries_per_row[0])), false)), last_action (Zero), compressed (false) @@ -233,7 +233,7 @@ namespace TrilinosWrappers make_trilinos_map(communicator, false))), matrix (new Epetra_FECrsMatrix(Copy, *column_space_map, - (int_type *)const_cast(&(n_entries_per_row[0])), + (TrilinosWrapper::types::int_type *)const_cast(&(n_entries_per_row[0])), false)), last_action (Zero), compressed (false) @@ -269,7 +269,7 @@ namespace TrilinosWrappers matrix (new Epetra_FECrsMatrix(Copy, row_parallel_partitioning. make_trilinos_map(communicator, false), - (int_type *)const_cast(&(n_entries_per_row[0])), + (TrilinosWrapper::types::int_type *)const_cast(&(n_entries_per_row[0])), false)), last_action (Zero), compressed (false) @@ -338,10 +338,10 @@ namespace TrilinosWrappers void SparseMatrix::reinit (const SparsityType &sparsity_pattern) { - const Epetra_Map rows (static_cast(sparsity_pattern.n_rows()), + const Epetra_Map rows (static_cast(sparsity_pattern.n_rows()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast(sparsity_pattern.n_cols()), + const Epetra_Map columns (static_cast(sparsity_pattern.n_cols()), 0, Utilities::Trilinos::comm_self()); @@ -370,7 +370,7 @@ namespace TrilinosWrappers template void copy_row (const Sparsity &csp, const size_type row, - std::vector &row_indices) + 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) @@ -379,7 +379,7 @@ namespace TrilinosWrappers void copy_row (const dealii::SparsityPattern &csp, const size_int row, - std::vector &row_indices) + std::vector &row_indices) { dealii::SparsityPattern::iterator col_num = csp.begin (row); for (size_type col=0; col_num != csp.end (row); ++col_num, ++col) @@ -428,7 +428,7 @@ namespace TrilinosWrappers const size_t first_row = input_row_map.MinMyGID(), last_row = input_row_map.MaxMyGID()+1; - std::vector n_entries_per_row(last_row-first_row); + std::vector n_entries_per_row(last_row-first_row); for (size_type row=first_row; row row_indices; + std::vector row_indices; for (size_type row=first_row; row(dealii_sparse_matrix.m()), + const Epetra_Map rows (static_cast(dealii_sparse_matrix.m()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast(dealii_sparse_matrix.n()), + const Epetra_Map columns (static_cast(dealii_sparse_matrix.n()), 0, Utilities::Trilinos::comm_self()); reinit (rows, columns, dealii_sparse_matrix, drop_tolerance, @@ -581,10 +581,10 @@ namespace TrilinosWrappers const size_type n_rows = dealii_sparse_matrix.m(); - Assert (input_row_map.NumGlobalElements() == (int_type)n_rows, + Assert (input_row_map.NumGlobalElements() == (TrilinosWrapper::types::int_type)n_rows, ExcDimensionMismatch (input_row_map.NumGlobalElements(), n_rows)); - Assert (input_col_map.NumGlobalElements() == (int_type)dealii_sparse_matrix.n(), + Assert (input_col_map.NumGlobalElements() == (TrilinosWrapper::types::int_type)dealii_sparse_matrix.n(), ExcDimensionMismatch (input_col_map.NumGlobalElements(), dealii_sparse_matrix.n())); @@ -612,7 +612,7 @@ namespace TrilinosWrappers for (size_type row=0; row(row)) == true) + if (input_row_map.MyGID(static_cast(row)) == true) { ::dealii::SparsityPattern::iterator select_index = sparsity_pattern.begin(row); @@ -720,23 +720,25 @@ namespace TrilinosWrappers // Only do this on the rows owned // locally on this processor. - int_type local_row = matrix->LRID(static_cast(row)); + TrilinosWrapper::types::int_type local_row = + matrix->LRID(static_cast(row)); if (local_row >= 0) { TrilinosScalar *values; - int_type *col_indices; - int_type num_entries; + TrilinosWrapper::types::int_type *col_indices; + TrilinosWrapper::types::int_type num_entries; const int ierr = matrix->ExtractMyRowView(local_row, num_entries, values, col_indices); Assert (ierr == 0, ExcTrilinosError(ierr)); - int_type *diag_find = std::find(col_indices,col_indices+num_entries, - local_row); - int_type diag_index = (int_type)(diag_find - col_indices); + TrilinosWrapper::types::int_type *diag_find = std::find(col_indices, + col_indices+num_entries,local_row); + TrilinosWrapper::types::int_type diag_index = + (TrilinosWrapper::types::int_type)(diag_find - col_indices); - for (int_type j=0; jLRID(static_cast(i)), - trilinos_j = matrix->LCID(static_cast(j)); + TrilinosWrapper::types::int_type trilinos_i = matrix->LRID(static_cast(i)), + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -796,9 +798,9 @@ namespace TrilinosWrappers // Prepare pointers for extraction // of a view of the row. - int_type nnz_present = matrix->NumMyEntries(trilinos_i); - int_type nnz_extracted; - int_type *col_indices; + TrilinosWrapper::types::int_type nnz_present = matrix->NumMyEntries(trilinos_i); + TrilinosWrapper::types::int_type nnz_extracted; + TrilinosWrapper::types::int_type *col_indices; TrilinosScalar *values; // Generate the view and make @@ -815,10 +817,11 @@ namespace TrilinosWrappers // look for the value, and then // finally get it. - int_type *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + TrilinosWrapper::types::int_type *el_find = std::find(col_indices, + col_indices + nnz_present, trilinos_j); - int_type local_col_index = (int_type)(el_find - col_indices); + TrilinosWrapper::types::int_type local_col_index = + (TrilinosWrapper::types::int_type)(el_find - col_indices); // This is actually the only // difference to the el(i,j) @@ -847,7 +850,9 @@ namespace TrilinosWrappers { // Extract local indices in // the matrix. - int_type trilinos_i = matrix->LRID(static_cast(i)), trilinos_j = matrix->LCID(static_cast(j)); + TrilinosWrapper::types::int_type trilinos_i = + matrix->LRID(static_cast(i)), + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -868,9 +873,9 @@ namespace TrilinosWrappers // Prepare pointers for extraction // of a view of the row. - int_type nnz_present = matrix->NumMyEntries(trilinos_i); - int_type nnz_extracted; - int_type *col_indices; + TrilinosWrapper::types::int_type nnz_present = matrix->NumMyEntries(trilinos_i); + TrilinosWrapper::types::int_type nnz_extracted; + TrilinosWrapper::types::int_type *col_indices; TrilinosScalar *values; // Generate the view and make @@ -886,10 +891,11 @@ namespace TrilinosWrappers // Search the index where we // look for the value, and then // finally get it. - int_type *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + TrilinosWrapper::types::int_type *el_find = std::find(col_indices, + col_indices + nnz_present, trilinos_j); - int_type local_col_index = (int_type)(el_find - col_indices); + TrilinosWrapper::types::int_type local_col_index = + (TrilinosWrapper::types::int_type)(el_find - col_indices); // This is actually the only @@ -938,8 +944,9 @@ namespace TrilinosWrappers // get a representation of the // present row - int_type ncols = -1; - int_type local_row = matrix->LRID(static_cast(row)); + TrilinosWrapper::types::int_type ncols = -1; + TrilinosWrapper::types::int_type local_row = + matrix->LRID(static_cast(row)); // on the processor who owns this // row, we'll have a non-negative @@ -1005,15 +1012,15 @@ namespace TrilinosWrappers ExcMessage ("Parallel distribution of matrix B and vector V " "does not match.")); - const int_type local_N = inputright.local_size(); - for (int_type i=0; iExtractMyRowView (i, N_entries, new_data); inputright.trilinos_matrix().ExtractMyRowView (i, N_entries, B_data); double value = V.trilinos_vector()[0][i]; - for (int_type j=0; j= 0, ExcInternalError()); const sizretype GID = inputleft.row_partitioner().GID(i); - for (int_type j=0; j= 0, ExcInternalError()); const size_type GID = inputleft.row_partitioner().GID(i); - for (int_type j=0; jinvec_leng; + TrilinosWrapper::types::int_type max_per_proc; + TrilinosWrapper::types::int_type N_input_vector = B_->invec_leng; getrow_comm = B_->getrow->pre_comm; if ( getrow_comm != NULL) - for (int_type i = 0; i < getrow_comm->N_neighbors; i++) - for (int_type j = 0; j < getrow_comm->neighbors[i].N_send; j++) + for (TrilinosWrapper::types::int_type i = 0; i < getrow_comm->N_neighbors; i++) + for (TrilinosWrapper::types::int_type j = 0; j < getrow_comm->neighbors[i].N_send; j++) AssertThrow (getrow_comm->neighbors[i].send_list[j] < N_input_vector, ExcInternalError()); @@ -1213,8 +1220,9 @@ namespace TrilinosWrappers ExcDimensionMismatch(matrix->NumGlobalEntries(row), rhs.matrix->NumGlobalEntries(row))); - const int_type row_local = matrix->RowMap().LID(static_cast(row)); - int_type n_entries, rhs_n_entries; + const TrilinosWrapper::types::int_type row_local = + matrix->RowMap().LID(static_cast(row)); + TrilinosWrapper::types::int_type n_entries, rhs_n_entries; TrilinosScalar *value_ptr, *rhs_value_ptr; // In debug mode, we want to check @@ -1226,7 +1234,7 @@ namespace TrilinosWrappers // indices is relatively slow compared to // just working with the values. #ifdef DEBUG - int_type *index_ptr, *rhs_index_ptr; + TrilinosWrapper::types::int_type *index_ptr, *rhs_index_ptr; ierr = rhs.matrix->ExtractMyRowView (row_local, rhs_n_entries, rhs_value_ptr, rhs_index_ptr); Assert (ierr == 0, ExcTrilinosError(ierr)); @@ -1242,7 +1250,7 @@ namespace TrilinosWrappers AssertThrow (n_entries == rhs_n_entries, ExcDimensionMismatch (n_entries, rhs_n_entries)); - for (int_type i=0; i(rhs.matrix->NumGlobalEntries(row))); - std::vector column_indices (max_row_length); + std::vector column_indices (max_row_length); std::vector values (max_row_length); if (matrix->Filled() == true && rhs.matrix->Filled() == true && @@ -1275,8 +1283,9 @@ namespace TrilinosWrappers for (size_type row=local_range.first; row < local_range.second; ++row) { - const int_type row_local = matrix->RowMap().LID(static_cast(row)); - int_type n_entries; + const TrilinosWrapper::types::int_type row_local = + matrix->RowMap().LID(static_cast(row)); + TrilinosWrapper::types::int_type n_entries; ierr = rhs.matrix->ExtractMyRowCopy (row_local, max_row_length, n_entries, @@ -1284,7 +1293,7 @@ namespace TrilinosWrappers &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); - for (int_type i=0; iEpetra_CrsMatrix::ExtractGlobalRowCopy - ((int_type)row, max_row_length, n_entries, &values[0], &column_indices[0]); + ((TrilinosWrapper::types::int_type)row, max_row_length, + n_entries, &values[0], &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); - for (int_type i=0; iEpetra_CrsMatrix::SumIntoGlobalValues - ((int_type)row, n_entries, &values[0], &column_indices[0]); + ((TrilinosWrapper::types::int_type)row, n_entries, + &values[0], &column_indices[0]); Assert (ierr == 0, ExcTrilinosError(ierr)); } compress (); @@ -1362,13 +1373,13 @@ namespace TrilinosWrappers else { double *values; - int_type *indices; - int_type num_entries; + TrilinosWrapper::types::int_type *indices; + TrilinosWrapper::types::int_type num_entries; - for (int_type i=0; iNumMyRows(); ++i) + for (TrilinosWrapper::types::int_type i=0; iNumMyRows(); ++i) { matrix->ExtractMyRowView (i, num_entries, values, indices); - for (int_type j=0; jGRID(i) << "," << matrix->GCID(indices[j]) << ") " << values[j] << std::endl; } @@ -1384,9 +1395,8 @@ namespace TrilinosWrappers { size_type static_memory = sizeof(this) + sizeof (*matrix) + sizeof(*matrix->Graph().DataPtr()); - return ((sizeof(TrilinosScalar)+sizeof(int_type))*matrix->NumMyNonzeros() + - sizeof(int)*local_size() + - static_memory); + return ((sizeof(TrilinosScalar)+sizeof(TrilinosWrapper::types::int_type))* + matrix->NumMyNonzeros() + sizeof(int)*local_size() + static_memory); } diff --git a/deal.II/source/lac/trilinos_sparsity_pattern.cc b/deal.II/source/lac/trilinos_sparsity_pattern.cc index fc68eddba0..cea1e9f5cd 100644 --- a/deal.II/source/lac/trilinos_sparsity_pattern.cc +++ b/deal.II/source/lac/trilinos_sparsity_pattern.cc @@ -48,14 +48,14 @@ namespace TrilinosWrappers // get a representation of the present // row - int_type ncols; - int_type colnums = sparsity_pattern->n_cols(); + TrilinosWrapper::types::int_type ncols; + TrilinosWrapper::types::int_type colnums = sparsity_pattern->n_cols(); int ierr; - ierr = sparsity_pattern->graph->ExtractGlobalRowCopy((int_type)this->a_row, + ierr = sparsity_pattern->graph->ExtractGlobalRowCopy((TrilinosWrapper::types::int_type)this->a_row, colnums, ncols, - (int_type *)&(*colnum_cache)[0]); + (TrilinosWrapper::types::int_type *)&(*colnum_cache)[0]); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); // copy it into our caches if the @@ -177,8 +177,8 @@ namespace TrilinosWrappers const size_type n, const size_type n_entries_per_row) { - const Epetra_Map rows (static_cast(m), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast(n), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (static_cast(m), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map columns (static_cast(n), 0, Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -227,8 +227,10 @@ namespace TrilinosWrappers const size_type n, const std::vector &n_entries_per_row) { - const Epetra_Map rows (static_cast(m), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast(n), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (static_cast(m), 0, + Utilities::Trilinos::comm_self()); + const Epetra_Map columns (static_cast(n), 0, + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -238,7 +240,7 @@ namespace TrilinosWrappers void SparsityPattern::reinit (const Epetra_Map &input_row_map, const Epetra_Map &input_col_map, - const std::vector &n_entries_per_row) + const std::vector &n_entries_per_row) { // release memory before reallocation graph.reset (); @@ -280,7 +282,7 @@ namespace TrilinosWrappers template void copy_row (const Sparsity &csp, const size_type row, - std::vector &row_indices) + 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) @@ -289,7 +291,7 @@ namespace TrilinosWrappers void copy_row (const dealii::SparsityPattern &csp, const size_type row, - std::vector &row_indices) + std::vector &row_indices) { dealii::SparsityPattern::iterator col_num = csp.begin (row); for (size_type col=0; col_num != csp.end (row); ++col_num, ++col) @@ -322,7 +324,7 @@ namespace TrilinosWrappers const size_type first_row = input_row_map.MinMyGID(), last_row = input_row_map.MaxMyGID()+1; - std::vector n_entries_per_row(last_row - first_row); + std::vector n_entries_per_row(last_row - first_row); for (size_type row=first_row; row(graph->NumGlobalRows())); - std::vector row_indices; + std::vector row_indices; // Include possibility to exchange data // since CompressedSimpleSparsityPattern is @@ -347,7 +349,7 @@ namespace TrilinosWrappers if (exchange_data==false) for (size_type row=first_row; rowInsertGlobalIndices (1, reinterpret_cast(&row), + graph->InsertGlobalIndices (1, + reinterpret_cast(&row), row_length, &row_indices[0]); } @@ -387,8 +390,8 @@ namespace TrilinosWrappers void SparsityPattern::copy_from (const SparsityType &sp) { - const Epetra_Map rows (static_cast(sp.n_rows()), 0, Utilities::Trilinos::comm_self()); - const Epetra_Map columns (static_cast(sp.n_cols()), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map rows (static_cast(sp.n_rows()), 0, Utilities::Trilinos::comm_self()); + const Epetra_Map columns (static_cast(sp.n_cols()), 0, Utilities::Trilinos::comm_self()); reinit (rows, columns, sp); } @@ -436,7 +439,9 @@ namespace TrilinosWrappers { // Extract local indices in // the matrix. - int_type trilinos_i = graph->LRID(static_cast(i)), trilinos_j = graph->LCID(static_cast(j)); + TrilinosWrapper::types::int_type trilinos_i = + graph->LRID(static_cast(i)), + trilinos_j = graph->LCID(static_cast(j)); // If the data is not on the // present processor, we throw @@ -455,9 +460,9 @@ namespace TrilinosWrappers // local indices. if (graph->Filled() == false) { - int_type nnz_present = graph->NumGlobalIndices(i); - int_type nnz_extracted; - int_type *col_indices; + TrilinosWrapper::types::int_type nnz_present = graph->NumGlobalIndices(i); + TrilinosWrapper::types::int_type nnz_extracted; + TrilinosWrapper::types::int_type *col_indices; // Generate the view and make // sure that we have not generated @@ -469,10 +474,11 @@ namespace TrilinosWrappers ExcDimensionMismatch(nnz_present, nnz_extracted)); // Search the index - int_type *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + TrilinosWrapper::types::int_type *el_find = + std::find(col_indices, col_indices + nnz_present, trilinos_j); - int_type local_col_index = (int_type)(el_find - col_indices); + TrilinosWrapper::types::int_type local_col_index = + (TrilinosWrapper::types::int_type)(el_find - col_indices); if (local_col_index == nnz_present) return false; @@ -481,9 +487,9 @@ namespace TrilinosWrappers { // Prepare pointers for extraction // of a view of the row. - int_type nnz_present = graph->NumGlobalIndices(i); - int_type nnz_extracted; - int_type *col_indices; + TrilinosWrapper::types::int_type nnz_present = graph->NumGlobalIndices(i); + TrilinosWrapper::types::int_type nnz_extracted; + TrilinosWrapper::types::int_type *col_indices; // Generate the view and make // sure that we have not generated @@ -496,10 +502,11 @@ namespace TrilinosWrappers ExcDimensionMismatch(nnz_present, nnz_extracted)); // Search the index - int_type *el_find = std::find(col_indices, col_indices + nnz_present, - trilinos_j); + TrilinosWrapper::types::int_type *el_find = std::find(col_indices, + col_indices + nnz_present, trilinos_j); - int_type local_col_index = (int_type)(el_find - col_indices); + TrilinosWrapper::types::int_type local_col_index = + (TrilinosWrapper::types::int_type)(el_find - col_indices); if (local_col_index == nnz_present) return false; @@ -515,11 +522,11 @@ namespace TrilinosWrappers SparsityPattern::bandwidth () const { size_type local_b=0; - int_type global_b=0; + TrilinosWrapper::types::int_type global_b=0; for (size_type i=0; iExtractMyRowView(i, num_entries, indices); for (size_type j=0; j<(size_type)num_entries; ++j) { @@ -527,7 +534,7 @@ namespace TrilinosWrappers local_b = std::abs(static_cast(i-indices[j])); } } - graph->Comm().MaxAll((int_type *)&local_b, &global_b, 1); + graph->Comm().MaxAll((TrilinosWrapper::types::int_type *)&local_b, &global_b, 1); return static_cast(global_b); } @@ -536,7 +543,7 @@ namespace TrilinosWrappers size_type SparsityPattern::n_rows () const { - const int_type n_rows = graph -> NumGlobalRows(); + const TrilinosWrapper::types::int_type n_rows = graph -> NumGlobalRows(); return n_rows; } @@ -545,7 +552,7 @@ namespace TrilinosWrappers size_type SparsityPattern::n_cols () const { - int_type n_cols; + TrilinosWrapper::types::int_type n_cols; if (graph->Filled() == true) n_cols = graph -> NumGlobalCols(); else @@ -559,7 +566,7 @@ namespace TrilinosWrappers size_type SparsityPattern::local_size () const { - int_type n_rows = graph -> NumMyRows(); + TrilinosWrapper::types::int_type n_rows = graph -> NumMyRows(); return n_rows; } @@ -581,7 +588,7 @@ namespace TrilinosWrappers size_type SparsityPattern::n_nonzero_elements () const { - int_type nnz = graph->NumGlobalEntries(); + TrilinosWrapper::types::int_type nnz = graph->NumGlobalEntries(); return static_cast(nnz); } @@ -591,7 +598,7 @@ namespace TrilinosWrappers size_type SparsityPattern::max_entries_per_row () const { - int_type nnz = graph->MaxNumIndices(); + TrilinosWrapper::types::int_type nnz = graph->MaxNumIndices(); return static_cast(nnz); } @@ -605,8 +612,9 @@ namespace TrilinosWrappers // get a representation of the // present row - int_type ncols = -1; - int_type local_row = graph->LRID(static_cast(row)); + TrilinosWrapper::types::int_type ncols = -1; + TrilinosWrapper::types::int_type local_row = + graph->LRID(static_cast(row)); // on the processor who owns this // row, we'll have a non-negative @@ -638,13 +646,13 @@ namespace TrilinosWrappers out << *graph; else { - int_type *indices; - int_type num_entries; + TrilinosWrapper::types::int_type *indices; + TrilinosWrapper::types::int_type num_entries; - for (int_type i=0; iNumMyRows(); ++i) + for (TrilinosWrapper::types::int_type i=0; iNumMyRows(); ++i) { graph->ExtractMyRowView (i, num_entries, indices); - for (int_type j=0; jGRID(j)] << ") " << std::endl; } @@ -661,8 +669,8 @@ namespace TrilinosWrappers Assert (graph->Filled() == true, ExcInternalError()); for (size_type row=0; rowExtractMyRowView (row, num_entries, indices); for (size_type j=0; j<(size_type)num_entries; ++j) @@ -671,8 +679,9 @@ namespace TrilinosWrappers // j horizontal, gnuplot output is // x-y, that is we have to exchange // the order of output - out << indices[graph->GRID(static_cast(j))] << " " << -static_cast(row) - << std::endl; + out << indices[graph->GRID(static_cast(j))] + << " " << -static_cast(row) + << std::endl; } AssertThrow (out, ExcIO()); diff --git a/deal.II/source/lac/trilinos_vector.cc b/deal.II/source/lac/trilinos_vector.cc index 7b73a08247..ac53f93a92 100644 --- a/deal.II/source/lac/trilinos_vector.cc +++ b/deal.II/source/lac/trilinos_vector.cc @@ -231,10 +231,10 @@ namespace TrilinosWrappers size_type n_elements = 0, added_elements = 0, block_offset = 0; for (size_type block=0; block global_ids (n_elements, -1); + std::vector global_ids (n_elements, -1); for (size_type block=0; block(partitioning.size()), + Epetra_LocalMap map (static_cast(partitioning.size()), 0, #ifdef DEAL_II_COMPILER_SUPPORTS_MPI Epetra_MpiComm(communicator)); @@ -437,7 +437,7 @@ namespace TrilinosWrappers { if (size() != n) { - Epetra_LocalMap map ((int_type)n, 0, + Epetra_LocalMap map ((TrilinosWrapper::types::int_type)n, 0, Utilities::Trilinos::comm_self()); vector.reset (new Epetra_FEVector (map)); } @@ -488,9 +488,9 @@ namespace TrilinosWrappers const bool fast) { if (vector->Map().NumGlobalElements() != - static_cast(partitioning.size())) + static_cast(partitioning.size())) { - Epetra_LocalMap map (static_cast(partitioning.size()), + Epetra_LocalMap map (static_cast(partitioning.size()), 0, #ifdef DEAL_II_COMPILER_SUPPORTS_MPI Epetra_MpiComm(communicator)); diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index 255d72f7a5..8f2bc2e0ac 100644 --- a/deal.II/source/lac/trilinos_vector_base.cc +++ b/deal.II/source/lac/trilinos_vector_base.cc @@ -40,8 +40,8 @@ namespace TrilinosWrappers // we can use []. Note that we // can only get local values. - const int_type local_index = - vector.vector->Map().LID(static_cast(index)); + const TrilinosWrapper::types::int_type local_index = + vector.vector->Map().LID(static_cast(index)); Assert (local_index >= 0, ExcAccessToNonLocalElement (index, vector.vector->Map().MinMyGID(), @@ -168,7 +168,8 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - int_type trilinos_i = vector->Map().LID(static_cast(index)); + TrilinosWrapper::types::int_type trilinos_i = + vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; // If the element is not @@ -196,7 +197,8 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - int_type trilinos_i = vector->Map().LID(static_cast(index)); + TrilinosWrapper::types::int_type trilinos_i = + vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; // If the element is not present @@ -423,7 +425,8 @@ namespace TrilinosWrappers //one index and the value per local //entry. return sizeof(*this) - + this->local_size()*( sizeof(double)+sizeof(int_type) ); + + this->local_size()*( sizeof(double)+ + sizeof(TrilinosWrapper::types::int_type) ); } } /* end of namespace TrilinosWrappers */ -- 2.39.5