From: turcksin Date: Mon, 18 Feb 2013 16:01:20 +0000 (+0000) Subject: Change types::global_dof_index to size_type in lac directory. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b145bcafd56779e41afa37fc03e7e201a5e2a6c;p=dealii-svn.git Change types::global_dof_index to size_type in lac directory. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28454 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/files b/deal.II/files index 4c1472e061..dddf844963 100644 --- a/deal.II/files +++ b/deal.II/files @@ -112,7 +112,7 @@ NATASHA source/hp/dof_objects.cc BRUNO source/hp/fe_collection.cc MARKUS source/hp/fe_values.cc BRUNO source/hp/mapping_collection.cc -source/lac/block_matrix_array.cc +BRUNO source/lac/block_matrix_array.cc MARKUS source/lac/block_sparse_matrix.cc MARKUS source/lac/block_sparse_matrix_ez.cc MARKUS source/lac/block_sparsity_pattern.cc @@ -356,11 +356,11 @@ BRUNO include/deal.II/integrators/laplace.h BRUNO include/deal.II/integrators/local_integrators.h BRUNO include/deal.II/integrators/maxwell.h BRUNO include/deal.II/integrators/patches.h -include/deal.II/lac/arpack_solver.h -include/deal.II/lac/block_indices.h -include/deal.II/lac/block_list.h -include/deal.II/lac/block_matrix_array.h -include/deal.II/lac/block_matrix_base.h +BRUNO include/deal.II/lac/arpack_solver.h +BRUNO include/deal.II/lac/block_indices.h +BRUNO include/deal.II/lac/block_list.h +BRUNO include/deal.II/lac/block_matrix_array.h +BRUNO include/deal.II/lac/block_matrix_base.h include/deal.II/lac/block_matrix.h MARKUS include/deal.II/lac/block_sparse_matrix_ez.h MARKUS include/deal.II/lac/block_sparse_matrix_ez.templates.h diff --git a/deal.II/include/deal.II/base/types.h b/deal.II/include/deal.II/base/types.h index 3e762a1276..cfa6313ccf 100644 --- a/deal.II/include/deal.II/base/types.h +++ b/deal.II/include/deal.II/base/types.h @@ -164,6 +164,24 @@ namespace numbers static const unsigned int invalid_unsigned_int = static_cast (-1); + /** + * Representation of the + * largest number that + * can be put into a + * size_type. This value + * is used throughout + * the library as a + * marker for an + * invalid size_type + * value, such as + * an invalid array + * index, an invalid + * array size, and the + * like. + */ + static const size_type + invalid_size_type = static_cast (-1); + /** * An invalid value for indices of degrees * of freedom. diff --git a/deal.II/include/deal.II/lac/arpack_solver.h b/deal.II/include/deal.II/lac/arpack_solver.h index b569834e21..f89bd00fb0 100644 --- a/deal.II/include/deal.II/lac/arpack_solver.h +++ b/deal.II/include/deal.II/lac/arpack_solver.h @@ -76,6 +76,12 @@ extern "C" void dneupd_(int *rvec, char *howmany, int *select, double *d, class ArpackSolver : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + + /** * An enum that lists the possible * choices for which eigenvalues to @@ -365,7 +371,7 @@ void ArpackSolver::solve ( tmp.reinit(src); - for (unsigned int i=0; i &n); + BlockIndices (const std::vector &n); /** * Specialized constructor for a * structure with blocks of equal size. */ - explicit BlockIndices(const unsigned int n_blocks, const unsigned int block_size = 0); + explicit BlockIndices(const size_type 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 unsigned int n_blocks, - const unsigned int n_elements_per_block); + void reinit (const size_type n_blocks, + const size_type n_elements_per_block); /** * Reinitialize the number of @@ -89,14 +93,14 @@ public: * of block @p i is set to * n[i]. */ - void reinit (const std::vector &n); + void reinit (const std::vector &n); /** * Add another block of given * size to the end of the block * structure. */ - void push_back(const unsigned int size); + void push_back(const size_type size); /** * @name Size information @@ -106,7 +110,7 @@ public: /** * Number of blocks in index field. */ - unsigned int size () const; + size_type size () const; /** * Return the total number of @@ -115,12 +119,12 @@ public: * of the vector space of the * block vector. */ - unsigned int total_size () const; + size_type total_size () const; /** * The size of the @p ith block. */ - unsigned int block_size (const unsigned int i) const; + size_type block_size (const size_type i) const; //@} @@ -147,20 +151,20 @@ public: * the block, the second the * index within it. */ - std::pair - global_to_local (const unsigned int i) const; + std::pair + global_to_local (const size_type i) const; /** * Return the global index of * @p index in block @p block. */ - unsigned int local_to_global (const unsigned int block, - const unsigned int index) const; + size_type local_to_global (const size_type block, + const size_type index) const; /** * The start index of the ith block. */ - unsigned int block_start (const unsigned int i) const; + size_type block_start (const size_type i) const; //@} /** @@ -198,7 +202,7 @@ private: * we cache this value for faster * access. */ - unsigned int n_blocks; + size_type n_blocks; /** * Global starting index of each @@ -206,7 +210,7 @@ private: * value is the total number of * entries. */ - std::vector start_indices; + std::vector start_indices; }; @@ -222,13 +226,13 @@ inline LogStream & operator << (LogStream &s, const BlockIndices &bi) { - const unsigned int n = bi.size(); + const size_type n = bi.size(); s << n << ":["; // Write first size without leading space if (n>0) s << bi.block_size(0); // Write all other sizes - for (unsigned int i=1; i" << bi.total_size(); return s; @@ -328,12 +332,12 @@ const bool IsBlockMatrix::value; inline void -BlockIndices::reinit (const unsigned int nb, - const unsigned int block_size) +BlockIndices::reinit (const size_type nb, + const size_type block_size) { n_blocks = nb; start_indices.resize(n_blocks+1); - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) start_indices[i] = i * block_size; } @@ -341,7 +345,7 @@ BlockIndices::reinit (const unsigned int nb, inline void -BlockIndices::reinit (const std::vector &n) +BlockIndices::reinit (const std::vector &n) { if (start_indices.size() != n.size()+1) { @@ -349,7 +353,7 @@ BlockIndices::reinit (const std::vector &n) start_indices.resize(n_blocks+1); } start_indices[0] = 0; - for (unsigned int i=1; i<=n_blocks; ++i) + for (size_type i=1; i<=n_blocks; ++i) start_indices[i] = start_indices[i-1] + n[i-1]; } @@ -365,20 +369,20 @@ BlockIndices::BlockIndices () inline BlockIndices::BlockIndices ( - const unsigned int n_blocks, - const unsigned int block_size) + const size_type n_blocks, + const size_type block_size) : n_blocks(n_blocks), start_indices(n_blocks+1) { - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) start_indices[i] = i * block_size; } inline -BlockIndices::BlockIndices (const std::vector &n) +BlockIndices::BlockIndices (const std::vector &n) : n_blocks(n.size()), start_indices(n.size()+1) @@ -389,7 +393,7 @@ BlockIndices::BlockIndices (const std::vector &n) inline void -BlockIndices::push_back(const unsigned int sz) +BlockIndices::push_back(const size_type sz) { start_indices.push_back(start_indices[n_blocks]+sz); ++n_blocks; @@ -398,8 +402,8 @@ BlockIndices::push_back(const unsigned int sz) inline -std::pair -BlockIndices::global_to_local (const unsigned int i) const +std::pair +BlockIndices::global_to_local (const size_type i) const { Assert (i(block, + return std::pair(block, i-start_indices[block]); } inline -unsigned int -BlockIndices::local_to_global (const unsigned int block, - const unsigned int index) const +size_type +BlockIndices::local_to_global (const size_type block, + const size_type index) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); Assert (index < start_indices[block+1]-start_indices[block], @@ -426,7 +430,7 @@ BlockIndices::local_to_global (const unsigned int block, inline -unsigned int +size_type BlockIndices::size () const { return n_blocks; @@ -435,7 +439,7 @@ BlockIndices::size () const inline -unsigned int +size_type BlockIndices::total_size () const { if (n_blocks == 0) return 0; @@ -445,8 +449,8 @@ BlockIndices::total_size () const inline -unsigned int -BlockIndices::block_size (const unsigned int block) const +size_type +BlockIndices::block_size (const size_type block) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); return start_indices[block+1]-start_indices[block]; @@ -455,8 +459,8 @@ BlockIndices::block_size (const unsigned int block) const inline -unsigned int -BlockIndices::block_start (const unsigned int block) const +size_type +BlockIndices::block_start (const size_type block) const { Assert (block < n_blocks, ExcIndexRange(block, 0, n_blocks)); return start_indices[block]; @@ -482,7 +486,7 @@ BlockIndices::operator == (const BlockIndices &b) const if (n_blocks != b.n_blocks) return false; - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) if (start_indices[i] != b.start_indices[i]) return false; @@ -498,7 +502,7 @@ BlockIndices::swap (BlockIndices &b) Assert (n_blocks == b.n_blocks, ExcDimensionMismatch(n_blocks, b.n_blocks)); - for (unsigned int i=0; i<=n_blocks; ++i) + for (size_type i=0; i<=n_blocks; ++i) std::swap (start_indices[i], b.start_indices[i]); } diff --git a/deal.II/include/deal.II/lac/block_list.h b/deal.II/include/deal.II/lac/block_list.h index 04c312d806..ef08306353 100644 --- a/deal.II/include/deal.II/lac/block_list.h +++ b/deal.II/include/deal.II/lac/block_list.h @@ -48,8 +48,13 @@ class BlockList : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /// The container for each index set - typedef std::vector block_container; + typedef std::vector block_container; /// The iterator for individual indices typedef block_container::const_iterator const_iterator; @@ -65,7 +70,7 @@ public: * argument is the dimension of * the vector space. */ - void create_sparsity_pattern(SparsityPattern &sparsity, unsigned int n) const; + void create_sparsity_pattern(SparsityPattern &sparsity, size_type n) const; /** * Add the indices in @@ -73,7 +78,7 @@ public: * block, eliminating * repeated indices. */ - void add(unsigned int block, const std::vector &indices); + void add(size_type block, const std::vector &indices); /** * Add the indices in @@ -83,16 +88,16 @@ public: * those indices for which * selected_indices is true. */ - void add(unsigned int block, - const std::vector &indices, + void add(size_type block, + const std::vector &indices, const std::vector &selected_indices, - unsigned int offset = 0); + size_type offset = 0); /** * Just set up the correct size * and assign indices to blocks later. */ - void initialize(unsigned int n_blocks); + void initialize(size_type n_blocks); /** * Set up all index sets using an @@ -110,7 +115,7 @@ public: * blocks as its first argument. */ template - void initialize(unsigned int n_blocks, + void initialize(size_type n_blocks, const ITERATOR begin, const typename identity::type end); @@ -133,7 +138,7 @@ public: * blocks as its first argument. */ template - void initialize_mg(unsigned int n_blocks, + void initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity::type end) DEAL_II_DEPRECATED; @@ -169,11 +174,11 @@ public: * blocks as its first argument. */ template - void initialize(unsigned int n_blocks, + void initialize(size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs, - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will * move to DoFTools. @@ -206,11 +211,11 @@ public: * blocks as its first argument. */ template - void initialize_mg(unsigned int n_blocks, + void initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs, - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will @@ -224,11 +229,11 @@ public: * around a vertex. */ template - void initialize_vertex_patches_mg(unsigned int n_blocks, + void initialize_vertex_patches_mg(size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs = std::vector(), - unsigned int offset = 0) DEAL_II_DEPRECATED; + size_type offset = 0) DEAL_II_DEPRECATED; /** * @deprecated This function will @@ -255,29 +260,29 @@ public: /** * The number of blocks. */ - unsigned int size() const; + size_type size() const; /** * The size of a single block. */ - unsigned int block_size(unsigned int block) const; + size_type block_size(size_type block) const; /** * Iterator to the first index in block. */ - const_iterator begin(unsigned int block) const; + const_iterator begin(size_type block) const; /** * End iterator for a single block. */ - const_iterator end(unsigned int block) const; + const_iterator end(size_type block) const; /** * Return the position of * index in * block, or - * numbers::invalid_unsigned_int, + * numbers::invalid_size_type, * if the index is not in the block. */ - unsigned int local_index(unsigned int block, unsigned int index) const; + size_type local_index(size_type block, size_type index) const; private: /** @@ -289,14 +294,14 @@ private: inline void -BlockList::create_sparsity_pattern(SparsityPattern &sparsity, unsigned int n) const +BlockList::create_sparsity_pattern(SparsityPattern &sparsity, size_type n) const { - std::vector sizes(size()); - for (unsigned int b=0; b sizes(size()); + for (size_type b=0; b &indices) +BlockList::add(const size_type block, const std::vector &indices) { AssertIndexRange(block, index_sets.size()); - for (unsigned int i=0; i &indice inline void BlockList::add( - const unsigned int block, - const std::vector &indices, + const size_type block, + const std::vector &indices, const std::vector &selected, - unsigned int offset) + size_type offset) { AssertIndexRange(block, index_sets.size()); AssertDimension(indices.size(), selected.size()); - for (unsigned int i=0; i inline void -BlockList::initialize(unsigned int n_blocks, const ITERATOR begin, const typename identity::type end) +BlockList::initialize(size_type n_blocks, const ITERATOR begin, const typename identity::type end) { index_sets.resize(n_blocks); - std::vector indices; - unsigned int k = 0; + std::vector indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -374,11 +379,11 @@ BlockList::initialize(unsigned int n_blocks, const ITERATOR begin, const typenam template inline void -BlockList::initialize_mg(unsigned int n_blocks, const ITERATOR begin, const typename identity::type end) +BlockList::initialize_mg(size_type n_blocks, const ITERATOR begin, const typename identity::type end) { index_sets.resize(n_blocks); - std::vector indices; - unsigned int k = 0; + std::vector indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -392,15 +397,15 @@ template inline void BlockList::initialize( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs, - unsigned int offset) + size_type offset) { index_sets.resize(n_blocks); - std::vector indices; - unsigned int k = 0; + std::vector indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -416,15 +421,15 @@ template inline void BlockList::initialize_mg( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs, - unsigned int offset) + size_type offset) { index_sets.resize(n_blocks); - std::vector indices; - unsigned int k = 0; + std::vector indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell, ++k) { indices.resize(cell->get_fe().dofs_per_cell); @@ -494,11 +499,11 @@ template inline void BlockList::initialize_vertex_patches_mg( - unsigned int n_blocks, + size_type n_blocks, const ITERATOR begin, const typename identity::type end, const std::vector &selected_dofs, - unsigned int offset) + size_type offset) { Assert(selected_dofs.size() == 0, ExcNotImplemented()); Assert(offset==0, ExcNotImplemented()); @@ -506,8 +511,8 @@ BlockList::initialize_vertex_patches_mg( Assert(fe.dofs_per_vertex == 0, ExcNotImplemented()); index_sets.resize(n_blocks); - std::vector indices; - unsigned int k = 0; + std::vector indices; + size_type k = 0; for (ITERATOR cell = begin; cell != end; ++cell) { if (cell_generates_vertex_patch(cell, true)) @@ -520,52 +525,52 @@ BlockList::initialize_vertex_patches_mg( cell->neighbor(4)->get_mg_dof_indices(indices); for (unsigned int i=0; ineighbor(4)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; ineighbor(4)->neighbor(2)->get_mg_dof_indices(indices); for (unsigned int i=0; ineighbor(4)->neighbor(2)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; ineighbor(2)->get_mg_dof_indices(indices); for (unsigned int i=0; i2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(2)->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); // no break here @@ -573,21 +578,21 @@ BlockList::initialize_vertex_patches_mg( cell->get_mg_dof_indices(indices); for (unsigned int i=0; i1) - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); cell->neighbor(0)->get_mg_dof_indices(indices); for (unsigned int i=0; i1) - indices[fe.face_to_cell_index(i,3)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,3)] = numbers::invalid_dof_index; if (dim>2) - indices[fe.face_to_cell_index(i,5)] = numbers::invalid_unsigned_int; + indices[fe.face_to_cell_index(i,5)] = numbers::invalid_dof_index; } add(k, indices); break; @@ -602,7 +607,7 @@ BlockList::initialize_vertex_patches_mg( inline -unsigned int +size_type BlockList::size() const { return index_sets.size(); @@ -610,8 +615,8 @@ BlockList::size() const inline -unsigned int -BlockList::block_size(unsigned int block) const +size_type +BlockList::block_size(size_type block) const { return index_sets[block].size(); } @@ -619,7 +624,7 @@ BlockList::block_size(unsigned int block) const inline BlockList::const_iterator -BlockList::begin(unsigned int block) const +BlockList::begin(size_type block) const { AssertIndexRange(block, index_sets.size()); return index_sets[block].begin(); @@ -628,7 +633,7 @@ BlockList::begin(unsigned int block) const inline BlockList::const_iterator -BlockList::end(unsigned int block) const +BlockList::end(size_type block) const { AssertIndexRange(block, index_sets.size()); return index_sets[block].end(); @@ -636,15 +641,15 @@ BlockList::end(unsigned int block) const inline -unsigned int -BlockList::local_index(unsigned int block, unsigned int index) const +size_type +BlockList::local_index(size_type block, size_type int index) const { AssertIndexRange(block, index_sets.size()); const block_container &b = index_sets[block]; - for (unsigned int i=0; i class BlockMatrixArray : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * Default constructor creating a * useless object. initialize() @@ -135,8 +140,8 @@ public: * Constructor fixing the * dimensions. */ - BlockMatrixArray (const unsigned int n_block_rows, - const unsigned int n_block_cols); + BlockMatrixArray (const size_type n_block_rows, + const size_type n_block_cols); /** * Initialize object @@ -145,8 +150,8 @@ public: * created by the default * constructor. */ - void initialize (const unsigned int n_block_rows, - const unsigned int n_block_cols); + void initialize (const size_type n_block_rows, + const size_type n_block_cols); /** * Constructor fixing the @@ -155,8 +160,8 @@ public: * @deprecated The last argument is ignored. Use the constructor with only * the first two arguments. */ - BlockMatrixArray (const unsigned int n_block_rows, - const unsigned int n_block_cols, + BlockMatrixArray (const size_type n_block_rows, + const size_type n_block_cols, VectorMemory > &mem) DEAL_II_DEPRECATED; /** @@ -169,16 +174,16 @@ public: * @deprecated The last argument is ignored. Use the function with same name * but only the first two arguments. */ - void initialize (const unsigned int n_block_rows, - const unsigned int n_block_cols, + void initialize (const size_type n_block_rows, + const size_type n_block_cols, VectorMemory > &mem) DEAL_II_DEPRECATED; /** * Adjust the matrix to a new * size and delete all blocks. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_cols); + void reinit (const size_type n_block_rows, + const size_type n_block_cols); /** * Add a block matrix entry. The @@ -200,11 +205,11 @@ public: * the multiplication functions. */ template - void enter (const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false); + void enter (const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false); /** * Add an entry like with enter, @@ -218,11 +223,11 @@ public: */ template void enter_aux (VectorMemory > &mem, - const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false) DEAL_II_DEPRECATED; + const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false) DEAL_II_DEPRECATED; /** @@ -235,13 +240,13 @@ public: * Number of block-entries per * column. */ - unsigned int n_block_rows () const; + size_type n_block_rows () const; /** * Number of block-entries per * row. */ - unsigned int n_block_cols () const; + size_type n_block_cols () const; /** * Matrix-vector multiplication. @@ -332,7 +337,7 @@ protected: */ template Entry (const MATRIX &matrix, - unsigned row, unsigned int col, + size_type row, size_type col, double prefix, bool transpose); /** @@ -362,13 +367,13 @@ protected: * Row number in the block * matrix. */ - unsigned int row; + size_type row; /** * Column number in the block * matrix. */ - unsigned int col; + size_type col; /** * Factor in front of the matrix @@ -399,11 +404,11 @@ private: /** * Number of blocks per column. */ - unsigned int block_rows; + size_type block_rows; /** * number of blocks per row. */ - unsigned int block_cols; + size_type block_cols; }; /*@}*/ @@ -485,7 +490,7 @@ public: * n_blocks is the * number of blocks in each direction. */ - BlockTrianglePrecondition (const unsigned int n_blocks); + BlockTrianglePrecondition (const size_type n_blocks); /** * Constructor. This matrix must be @@ -496,7 +501,7 @@ public: * @deprecated The second argument is ignored. Use the constructor with only * the first and third argument. */ - BlockTrianglePrecondition (const unsigned int n_block_rows, + BlockTrianglePrecondition (const size_type n_block_rows, VectorMemory > &mem, const bool backward = false) DEAL_II_DEPRECATED; @@ -510,7 +515,7 @@ public: * @deprecated The second argument * is ignored. Use the function without that argument. */ - void initialize (const unsigned int n_block_rows, + void initialize (const size_type n_block_rows, VectorMemory > &mem, const bool backward = false) DEAL_II_DEPRECATED; @@ -518,7 +523,7 @@ public: * Resize preconditioner to a new * size and clear all blocks. */ - void reinit (const unsigned int n_block_rows); + void reinit (const size_type n_block_rows); /** @@ -529,11 +534,11 @@ public: * matrices or preconditioners. */ template - void enter (const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false); + void enter (const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false); /** * Enter a block. This calls @@ -548,11 +553,11 @@ public: */ template void enter_aux (VectorMemory > &mem, - const MATRIX &matrix, - const unsigned int row, - const unsigned int col, - const double prefix = 1., - const bool transpose = false) DEAL_II_DEPRECATED; + const MATRIX &matrix, + const size_type row, + const size_type col, + const double prefix = 1., + const bool transpose = false) DEAL_II_DEPRECATED; /** * Preconditioning. @@ -609,7 +614,7 @@ public: * matrix here. */ DeclException1(ExcNoDiagonal, - unsigned int, + size_type, << "No diagonal entry was added for block " << arg1); /** @@ -620,7 +625,7 @@ public: * matrix here. */ DeclException1(ExcMultipleDiagonal, - unsigned int, + size_type, << "Inverse diagonal entries may not be added in block " << arg1); //@} @@ -632,7 +637,7 @@ private: * for one row. */ void do_row (BlockVector &dst, - unsigned int row_num) const; + size_type row_num) const; /** * Flag for backward insertion. @@ -649,8 +654,8 @@ template inline BlockMatrixArray::Entry::Entry ( const MATRIX &m, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) : @@ -669,8 +674,8 @@ inline void BlockMatrixArray::enter ( const MATRIX &matrix, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) { @@ -687,8 +692,8 @@ void BlockMatrixArray::enter_aux ( VectorMemory > &mem, const MATRIX &matrix, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) { @@ -728,7 +733,7 @@ BlockMatrixArray::print_latex (STREAM &out) const typename std::vector::const_iterator m = entries.begin(); typename std::vector::const_iterator end = entries.end(); - unsigned int matrix_number = 0; + size_type matrix_number = 0; for (; m != end ; ++m) { if (matrix_names.find(m->matrix) == matrix_names.end()) @@ -756,8 +761,8 @@ BlockMatrixArray::print_latex (STREAM &out) const array(m->row, m->col) += stream.str(); } - for (unsigned int i=0; i inline void BlockTrianglePrecondition::enter (const MATRIX &matrix, - unsigned row, unsigned int col, + size_type row, size_type col, double prefix, bool transpose) { BlockMatrixArray::enter(matrix, row, col, prefix, transpose); @@ -788,8 +793,8 @@ void BlockTrianglePrecondition::enter_aux ( VectorMemory > &mem, const MATRIX &matrix, - unsigned int row, - unsigned int col, + size_type row, + size_type col, double prefix, bool transpose) { 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 c81fabf3ab..c8e7073d71 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_matrix_base.h @@ -70,27 +70,27 @@ namespace BlockMatrixIterators * element represented by * this object. */ - unsigned int block_row() const; + size_type block_row() const; /** * Block column of the * element represented by * this object. */ - unsigned int block_column() const; + size_type block_column() const; protected: /** * Block row into which we presently * point. */ - unsigned int row_block; + size_type row_block; /** * Block column into which we * presently point. */ - unsigned int col_block; + size_type col_block; /** * Let the iterator class be a @@ -145,22 +145,22 @@ namespace BlockMatrixIterators * of rows in the matrix. */ Accessor (BlockMatrix *m, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of the entry at the @@ -236,8 +236,8 @@ namespace BlockMatrixIterators * of rows in the matrix. */ Accessor (const BlockMatrix *m, - const unsigned int row, - const unsigned int col); + const size_type row, + const size_type col); /** * Initalize const accessor @@ -250,14 +250,14 @@ namespace BlockMatrixIterators * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of the entry at the @@ -428,8 +428,8 @@ public: * given coordinates. */ BlockType & - block (const unsigned int row, - const unsigned int column); + block (const size_type row, + const size_type column); /** @@ -438,8 +438,8 @@ public: * constant objects. */ const BlockType & - block (const unsigned int row, - const unsigned int column) const; + block (const size_type row, + const size_type column) const; /** * Return the dimension of the @@ -447,7 +447,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int m () const; + size_type m () const; /** * Return the dimension of the @@ -455,7 +455,7 @@ public: * matrix is of dimension * $m \times n$. */ - unsigned int n () const; + size_type n () const; /** @@ -464,7 +464,7 @@ public: * sparsity pattern is presently * associated to this matrix. */ - unsigned int n_block_rows () const; + size_type n_block_rows () const; /** * Return the number of blocks in @@ -472,7 +472,7 @@ public: * sparsity pattern is presently * associated to this matrix. */ - unsigned int n_block_cols () const; + size_type n_block_cols () const; /** * Set the element (i,j) @@ -483,8 +483,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const value_type value); /** @@ -515,9 +515,9 @@ public: * values are treated. */ template - void set (const std::vector &indices, - const FullMatrix &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector &indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = false); /** * Same function as before, but now @@ -527,10 +527,10 @@ public: * on rows and columns, respectively. */ template - void set (const std::vector &row_indices, - const std::vector &col_indices, - const FullMatrix &full_matrix, - const bool elide_zero_values = false); + void set (const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = false); /** * Set several elements in the @@ -551,10 +551,10 @@ public: * values are treated. */ template - void set (const unsigned int row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values = false); + void set (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values = false); /** * Set several elements to values @@ -573,11 +573,11 @@ public: * values are inserted/replaced. */ template - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values = false); + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values = false); /** * Add value to the @@ -588,8 +588,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const value_type value); /** @@ -620,9 +620,9 @@ public: * into the matrix. */ template - void add (const std::vector &indices, - const FullMatrix &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector &indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = true); /** * Same function as before, but now @@ -632,10 +632,10 @@ public: * on rows and columns, respectively. */ template - void add (const std::vector &row_indices, - const std::vector &col_indices, - const FullMatrix &full_matrix, - const bool elide_zero_values = true); + void add (const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &full_matrix, + const bool elide_zero_values = true); /** * Set several elements in the @@ -655,10 +655,10 @@ public: * into the matrix. */ template - void add (const unsigned int row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values = true); + void add (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values = true); /** * Add an array of values given by @@ -678,12 +678,12 @@ public: * into the matrix. */ template - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Add matrix scaled by @@ -711,8 +711,8 @@ public: * if the wanted element does not * exist in the matrix. */ - value_type operator () (const unsigned int i, - const unsigned int j) const; + value_type operator () (const size_type i, + const size_type j) const; /** * This function is mostly like @@ -731,8 +731,8 @@ public: * solution, since the sparsity * of the matrix is not used. */ - value_type el (const unsigned int i, - const unsigned int j) const; + value_type el (const size_type i, + const size_type j) const; /** * Return the main diagonal element in @@ -751,7 +751,7 @@ public: * involve searching for the * right column number. */ - value_type diag_element (const unsigned int i) const; + value_type diag_element (const size_type i) const; /** * Call the compress() function on all @@ -876,12 +876,12 @@ public: * STL-like iterator with the * first entry of row r. */ - iterator begin (const unsigned int r); + iterator begin (const size_type r); /** * Final iterator of row r. */ - iterator end (const unsigned int r); + iterator end (const size_type r); /** * STL-like iterator with the * first entry. @@ -897,12 +897,12 @@ public: * STL-like iterator with the * first entry of row r. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row r. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * Return a reference to the underlying @@ -1223,7 +1223,7 @@ private: * individual blocks when doing a * collective add or set. */ - std::vector counter_within_block; + std::vector counter_within_block; /** * Temporary vector for column @@ -1231,7 +1231,7 @@ private: * local to global data on each * sparse matrix. */ - std::vector > column_indices; + std::vector > column_indices; /** * Temporary vector for storing the @@ -1274,10 +1274,10 @@ namespace BlockMatrixIterators template inline - unsigned int + size_type AccessorBase::block_row() const { - Assert (row_block != numbers::invalid_unsigned_int, + Assert (row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return row_block; @@ -1286,10 +1286,10 @@ namespace BlockMatrixIterators template inline - unsigned int + size_type AccessorBase::block_column() const { - Assert (col_block != numbers::invalid_unsigned_int, + Assert (col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return col_block; @@ -1300,8 +1300,8 @@ namespace BlockMatrixIterators inline Accessor::Accessor ( const BlockMatrix *matrix, - const unsigned int row, - const unsigned int col) + const size_type row, + const size_type col) : matrix(matrix), base_iterator(matrix->block(0,0).begin()) @@ -1312,12 +1312,12 @@ namespace BlockMatrixIterators // the end of the matrix if (row < matrix->m()) { - const std::pair indices + const std::pair indices = matrix->row_block_indices.global_to_local(row); // find the first block that does // have an entry in this row - for (unsigned int bc=0; bcn_block_cols(); ++bc) + for (size_type bc=0; bcn_block_cols(); ++bc) { base_iterator = matrix->block(indices.first, bc).begin(indices.second); @@ -1342,8 +1342,8 @@ namespace BlockMatrixIterators { // we were asked to create the end // iterator for this matrix - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; } } @@ -1374,10 +1374,10 @@ namespace BlockMatrixIterators template inline - unsigned int + size_type Accessor::row() const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->row_block_indices.local_to_global(this->row_block, 0) + @@ -1387,10 +1387,10 @@ namespace BlockMatrixIterators template inline - unsigned int + size_type Accessor::column() const { - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->column_block_indices.local_to_global(this->col_block,0) + @@ -1403,9 +1403,9 @@ namespace BlockMatrixIterators typename Accessor::value_type Accessor::value () const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return base_iterator->value(); @@ -1418,13 +1418,13 @@ namespace BlockMatrixIterators void Accessor::advance () { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); // Remember current row inside block - unsigned int local_row = base_iterator->row(); + size_type local_row = base_iterator->row(); // Advance one element inside the // current block @@ -1466,8 +1466,8 @@ namespace BlockMatrixIterators ++this->row_block; if (this->row_block == matrix->n_block_rows()) { - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; return; } } @@ -1493,9 +1493,9 @@ namespace BlockMatrixIterators // have to have the same // base_iterator representation, but // valid iterators have to - return (((this->row_block == numbers::invalid_unsigned_int) + return (((this->row_block == numbers::invalid_size_type) && - (this->col_block == numbers::invalid_unsigned_int)) + (this->col_block == numbers::invalid_size_type)) || (base_iterator == a.base_iterator)); @@ -1509,8 +1509,8 @@ namespace BlockMatrixIterators inline Accessor::Accessor ( BlockMatrix *matrix, - const unsigned int row, - const unsigned int col) + const size_type row, + const size_type col) : matrix(matrix), base_iterator(matrix->block(0,0).begin()) @@ -1520,12 +1520,12 @@ namespace BlockMatrixIterators // the end of the matrix if (row < matrix->m()) { - const std::pair indices + const std::pair indices = matrix->row_block_indices.global_to_local(row); // find the first block that does // have an entry in this row - for (unsigned int bc=0; bcn_block_cols(); ++bc) + for (size_type bc=0; bcn_block_cols(); ++bc) { base_iterator = matrix->block(indices.first, bc).begin(indices.second); @@ -1550,18 +1550,18 @@ namespace BlockMatrixIterators { // we were asked to create the end // iterator for this matrix - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; } } template inline - unsigned int + size_type Accessor::row() const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->row_block_indices.local_to_global(this->row_block, 0) + @@ -1571,10 +1571,10 @@ namespace BlockMatrixIterators template inline - unsigned int + size_type Accessor::column() const { - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return (matrix->column_block_indices.local_to_global(this->col_block,0) + @@ -1587,9 +1587,9 @@ namespace BlockMatrixIterators typename Accessor::value_type Accessor::value () const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); return base_iterator->value(); @@ -1602,9 +1602,9 @@ namespace BlockMatrixIterators void Accessor::set_value (typename Accessor::value_type newval) const { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); base_iterator->value() = newval; @@ -1617,13 +1617,13 @@ namespace BlockMatrixIterators void Accessor::advance () { - Assert (this->row_block != numbers::invalid_unsigned_int, + Assert (this->row_block != numbers::invalid_size_type, ExcIteratorPastEnd()); - Assert (this->col_block != numbers::invalid_unsigned_int, + Assert (this->col_block != numbers::invalid_size_type, ExcIteratorPastEnd()); // Remember current row inside block - unsigned int local_row = base_iterator->row(); + size_type local_row = base_iterator->row(); // Advance one element inside the // current block @@ -1665,8 +1665,8 @@ namespace BlockMatrixIterators ++this->row_block; if (this->row_block == matrix->n_block_rows()) { - this->row_block = numbers::invalid_unsigned_int; - this->col_block = numbers::invalid_unsigned_int; + this->row_block = numbers::invalid_size_type; + this->col_block = numbers::invalid_size_type; return; } } @@ -1693,9 +1693,9 @@ namespace BlockMatrixIterators // have to have the same // base_iterator representation, but // valid iterators have to - return (((this->row_block == numbers::invalid_unsigned_int) + return (((this->row_block == numbers::invalid_size_type) && - (this->col_block == numbers::invalid_unsigned_int)) + (this->col_block == numbers::invalid_size_type)) || (base_iterator == a.base_iterator)); @@ -1721,8 +1721,8 @@ BlockMatrixBase & BlockMatrixBase:: copy_from (const BlockMatrixType &source) { - for (unsigned int r=0; r::memory_consumption () const MemoryConsumption::memory_consumption(column_indices)+ MemoryConsumption::memory_consumption(column_values); - for (unsigned int r=0; rsub_objects[r][c]; mem += MemoryConsumption::memory_consumption(*p); @@ -1758,8 +1758,8 @@ inline void BlockMatrixBase::clear () { - for (unsigned int r=0; rsub_objects[r][c]; this->sub_objects[r][c] = 0; @@ -1776,8 +1776,8 @@ BlockMatrixBase::clear () template inline typename BlockMatrixBase::BlockType & -BlockMatrixBase::block (const unsigned int row, - const unsigned int column) +BlockMatrixBase::block (const size_type row, + const size_type column) { Assert (row::block (const unsigned int row, template inline const typename BlockMatrixBase::BlockType & -BlockMatrixBase::block (const unsigned int row, - const unsigned int column) const +BlockMatrixBase::block (const size_type row, + const size_type column) const { Assert (row::block (const unsigned int row, template inline -unsigned int +size_type BlockMatrixBase::m () const { return row_block_indices.total_size(); @@ -1816,7 +1816,7 @@ BlockMatrixBase::m () const template inline -unsigned int +size_type BlockMatrixBase::n () const { return column_block_indices.total_size(); @@ -1826,7 +1826,7 @@ BlockMatrixBase::n () const template inline -unsigned int +size_type BlockMatrixBase::n_block_cols () const { return column_block_indices.size(); @@ -1836,7 +1836,7 @@ BlockMatrixBase::n_block_cols () const template inline -unsigned int +size_type BlockMatrixBase::n_block_rows () const { return row_block_indices.size(); @@ -1850,15 +1850,15 @@ BlockMatrixBase::n_block_rows () const template inline void -BlockMatrixBase::set (const unsigned int i, - const unsigned int j, +BlockMatrixBase::set (const size_type i, + const size_type j, const value_type value) { prepare_set_operation(); Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair + const std::pair row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); block(row_index.first,col_index.first).set (row_index.second, @@ -1872,8 +1872,8 @@ template template inline void -BlockMatrixBase::set (const std::vector &row_indices, - const std::vector &col_indices, +BlockMatrixBase::set (const std::vector &row_indices, + const std::vector &col_indices, const FullMatrix &values, const bool elide_zero_values) { @@ -1882,7 +1882,7 @@ BlockMatrixBase::set (const std::vector &row_indices, Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i template inline void -BlockMatrixBase::set (const std::vector &indices, +BlockMatrixBase::set (const std::vector &indices, const FullMatrix &values, const bool elide_zero_values) { @@ -1901,7 +1901,7 @@ BlockMatrixBase::set (const std::vector &indices, ExcDimensionMismatch(indices.size(), values.m())); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i template inline void -BlockMatrixBase::set (const unsigned int row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values) +BlockMatrixBase::set (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1933,11 +1933,11 @@ template template inline void -BlockMatrixBase::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values) +BlockMatrixBase::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values) { prepare_set_operation(); @@ -1961,7 +1961,7 @@ BlockMatrixBase::set (const unsigned int row, // through all of them. if (column_indices[0].size() < n_cols) { - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) { column_indices[i].resize(n_cols); column_values[i].resize(n_cols); @@ -1970,7 +1970,7 @@ BlockMatrixBase::set (const unsigned int row, // Reset the number of added elements // in each block to zero. - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -1982,17 +1982,17 @@ BlockMatrixBase::set (const unsigned int row, // is stored contiguously (in fact, // indices will be intermixed when it // comes from an element matrix). - for (unsigned int j=0; j + const std::pair col_index = this->column_block_indices.global_to_local(col_indices[j]); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; column_indices[col_index.first][local_index] = col_index.second; column_values[col_index.first][local_index] = value; @@ -2001,8 +2001,8 @@ BlockMatrixBase::set (const unsigned int row, #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; - for (unsigned int i=0; in_block_cols(); ++i) + size_type length = 0; + for (size_type i=0; in_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2012,9 +2012,9 @@ BlockMatrixBase::set (const unsigned int row, // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair + const std::pair row_index = this->row_block_indices.global_to_local (row); - for (unsigned int block_col=0; block_col::set (const unsigned int row, template inline void -BlockMatrixBase::add (const unsigned int i, - const unsigned int j, +BlockMatrixBase::add (const size_type i, + const size_type j, const value_type value) { @@ -2051,7 +2051,7 @@ BlockMatrixBase::add (const unsigned int i, (value == value_type())) return; - const std::pair + const std::pair row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); block(row_index.first,col_index.first).add (row_index.second, @@ -2065,17 +2065,17 @@ template template inline void -BlockMatrixBase::add (const std::vector &row_indices, - const std::vector &col_indices, - const FullMatrix &values, - const bool elide_zero_values) +BlockMatrixBase::add (const std::vector &row_indices, + const std::vector &col_indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert (row_indices.size() == values.m(), ExcDimensionMismatch(row_indices.size(), values.m())); Assert (col_indices.size() == values.n(), ExcDimensionMismatch(col_indices.size(), values.n())); - for (unsigned int i=0; i template inline void -BlockMatrixBase::add (const std::vector &indices, - const FullMatrix &values, - const bool elide_zero_values) +BlockMatrixBase::add (const std::vector &indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i template inline void -BlockMatrixBase::add (const unsigned int row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values) +BlockMatrixBase::add (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -2126,12 +2126,12 @@ template template inline void -BlockMatrixBase::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, - const bool elide_zero_values, - const bool col_indices_are_sorted) +BlockMatrixBase::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number *values, + const bool elide_zero_values, + const bool col_indices_are_sorted) { prepare_add_operation(); @@ -2143,24 +2143,24 @@ BlockMatrixBase::add (const unsigned int row, #ifdef DEBUG // check whether indices really are // sorted. - unsigned int before = col_indices[0]; - for (unsigned int i=1; i + const std::pair row_index = this->row_block_indices.global_to_local (row); if (this->n_block_cols() > 1) { - const unsigned int *first_block = Utilities::lower_bound (col_indices, - col_indices+n_cols, - this->column_block_indices.block_start(1)); + const size_type *first_block = Utilities::lower_bound (col_indices, + col_indices+n_cols, + this->column_block_indices.block_start(1)); - const unsigned int n_zero_block_indices = first_block - col_indices; + const size_type n_zero_block_indices = first_block - col_indices; block(row_index.first, 0).add (row_index.second, n_zero_block_indices, col_indices, @@ -2206,7 +2206,7 @@ BlockMatrixBase::add (const unsigned int row, // through all of them. if (column_indices[0].size() < n_cols) { - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) { column_indices[i].resize(n_cols); column_values[i].resize(n_cols); @@ -2215,7 +2215,7 @@ BlockMatrixBase::add (const unsigned int row, // Reset the number of added elements // in each block to zero. - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -2227,17 +2227,17 @@ BlockMatrixBase::add (const unsigned int row, // block is stored contiguously (in // fact, data will be intermixed when // it comes from an element matrix). - for (unsigned int j=0; j + const std::pair col_index = this->column_block_indices.global_to_local(col_indices[j]); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; column_indices[col_index.first][local_index] = col_index.second; column_values[col_index.first][local_index] = value; @@ -2246,8 +2246,8 @@ BlockMatrixBase::add (const unsigned int row, #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; - for (unsigned int i=0; in_block_cols(); ++i) + size_type length = 0; + for (size_type i=0; in_block_cols(); ++i) length += counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2257,9 +2257,9 @@ BlockMatrixBase::add (const unsigned int row, // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair + const std::pair row_index = this->row_block_indices.global_to_local (row); - for (unsigned int block_col=0; block_col::add (const value_type factor, (factor == 0)) return; - for (unsigned int row=0; row::add (const value_type factor, template inline typename BlockMatrixBase::value_type -BlockMatrixBase::operator () (const unsigned int i, - const unsigned int j) const +BlockMatrixBase::operator () (const size_type i, + const size_type j) const { - const std::pair + const std::pair row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); return block(row_index.first,col_index.first) (row_index.second, @@ -2322,10 +2322,10 @@ BlockMatrixBase::operator () (const unsigned int i, template inline typename BlockMatrixBase::value_type -BlockMatrixBase::el (const unsigned int i, - const unsigned int j) const +BlockMatrixBase::el (const size_type i, + const size_type j) const { - const std::pair + const std::pair row_index = row_block_indices.global_to_local (i), col_index = column_block_indices.global_to_local (j); return block(row_index.first,col_index.first).el (row_index.second, @@ -2337,12 +2337,12 @@ BlockMatrixBase::el (const unsigned int i, template inline typename BlockMatrixBase::value_type -BlockMatrixBase::diag_element (const unsigned int i) const +BlockMatrixBase::diag_element (const size_type i) const { Assert (n_block_rows() == n_block_cols(), ExcNotQuadratic()); - const std::pair + const std::pair index = row_block_indices.global_to_local (i); return block(index.first,index.first).diag_element(index.second); } @@ -2354,8 +2354,8 @@ inline void BlockMatrixBase::compress (::dealii::VectorOperation::values operation) { - for (unsigned int r=0; r::operator *= (const value_type factor) Assert (n_block_cols() != 0, ExcNotInitialized()); Assert (n_block_rows() != 0, ExcNotInitialized()); - for (unsigned int r=0; r::operator /= (const value_type factor) const value_type factor_inv = 1. / factor; - for (unsigned int r=0; r::vmult_add (BlockVectorType &dst, Assert (src.n_blocks() == n_block_cols(), ExcDimensionMismatch(src.n_blocks(), n_block_cols())); - for (unsigned int row=0; row::Tvmult_add (BlockVectorType &dst, Assert (src.n_blocks() == n_block_rows(), ExcDimensionMismatch(src.n_blocks(), n_block_rows())); - for (unsigned int row=0; row::matrix_norm_square (const BlockVectorType &v) const ExcDimensionMismatch(v.n_blocks(), n_block_rows())); value_type norm_sqr = 0; - for (unsigned int row=0; row::print (std::ostream &out, const bool alternative_output) const { - for (unsigned int row=0; row::end () const template inline typename BlockMatrixBase::const_iterator -BlockMatrixBase::begin (const unsigned int r) const +BlockMatrixBase::begin (const size_type r) const { Assert (r::begin (const unsigned int r) const template inline typename BlockMatrixBase::const_iterator -BlockMatrixBase::end (const unsigned int r) const +BlockMatrixBase::end (const size_type r) const { Assert (r::end () template inline typename BlockMatrixBase::iterator -BlockMatrixBase::begin (const unsigned int r) +BlockMatrixBase::begin (const size_type r) { Assert (r::begin (const unsigned int r) template inline typename BlockMatrixBase::iterator -BlockMatrixBase::end (const unsigned int r) +BlockMatrixBase::end (const size_type r) { Assert (r void BlockMatrixBase::collect_sizes () { - std::vector row_sizes (this->n_block_rows()); - std::vector col_sizes (this->n_block_cols()); + std::vector row_sizes (this->n_block_rows()); + std::vector col_sizes (this->n_block_cols()); // first find out the row sizes // from the first block column - for (unsigned int r=0; rn_block_rows(); ++r) + for (size_type r=0; rn_block_rows(); ++r) row_sizes[r] = sub_objects[r][0]->m(); // then check that the following // block columns have the same // sizes - for (unsigned int c=1; cn_block_cols(); ++c) - for (unsigned int r=0; rn_block_rows(); ++r) + for (size_type c=1; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) Assert (row_sizes[r] == sub_objects[r][c]->m(), ExcIncompatibleRowNumbers (r,0,r,c)); @@ -2849,10 +2849,10 @@ BlockMatrixBase::collect_sizes () // then do the same with the columns - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type c=0; cn_block_cols(); ++c) col_sizes[c] = sub_objects[0][c]->n(); - for (unsigned int r=1; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=1; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) Assert (col_sizes[c] == sub_objects[r][c]->n(), ExcIncompatibleRowNumbers (0,c,r,c)); @@ -2867,8 +2867,8 @@ template void BlockMatrixBase::prepare_add_operation () { - for (unsigned int row=0; row void BlockMatrixBase::prepare_set_operation () { - for (unsigned int row=0; row 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. @@ -204,7 +209,7 @@ public: * Return the number of entries * in a specific row. */ - unsigned int get_row_length (const types::global_dof_index row) const; + size_type get_row_length (const size_type row) const; /** * Return the number of nonzero @@ -215,7 +220,7 @@ public: * the entries should happen to * be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the number of actually @@ -224,7 +229,7 @@ public: * (with absolute value larger than * threshold) of all the blocks. */ - unsigned int n_actually_nonzero_elements (const double threshold = 0.0) const; + size_type n_actually_nonzero_elements (const double threshold = 0.0) const; /** * Return a (constant) reference @@ -470,8 +475,8 @@ BlockSparseMatrix::operator = (const double d) { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) this->block(r,c) = d; return *this; @@ -596,7 +601,7 @@ precondition_Jacobi (BlockVectorType &dst, // do a diagonal preconditioning. uses only // the diagonal blocks of the matrix - for (unsigned int i=0; in_block_rows(); ++i) + for (size_type i=0; in_block_rows(); ++i) this->block(i,i).precondition_Jacobi (dst.block(i), src.block(i), omega); 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 d31077225a..215f259e9a 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 @@ -60,8 +60,8 @@ operator = (const BlockSparseMatrix &m) // anything except than checking // whether the base objects want to // do something - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) this->block(r,c) = m.block(r,c); return *this; @@ -100,8 +100,8 @@ reinit (const BlockSparsityPattern &sparsity) sparsity.n_block_cols()); // and reinitialize the blocks - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) { BlockType *p = new SparseMatrix(); p->reinit (sparsity.block(r,c)); @@ -115,8 +115,8 @@ template bool BlockSparseMatrix::empty () const { - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) if (this->block(r,c).empty () == false) return false; @@ -127,8 +127,8 @@ BlockSparseMatrix::empty () const template -unsigned int -BlockSparseMatrix::get_row_length (const types::global_dof_index row) const +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 types::global_dof_index row) co template -unsigned int +size_type BlockSparseMatrix::n_nonzero_elements () const { return sparsity_pattern->n_nonzero_elements (); @@ -145,12 +145,12 @@ BlockSparseMatrix::n_nonzero_elements () const template -unsigned int +size_type BlockSparseMatrix::n_actually_nonzero_elements (const double threshold) const { - unsigned int count = 0; - for (unsigned int i=0; in_block_rows(); ++i) - for (unsigned int j=0; jn_block_cols(); ++j) + size_type count = 0; + for (size_type i=0; in_block_rows(); ++i) + for (size_type j=0; jn_block_cols(); ++j) count += this->sub_objects[i][j]->n_actually_nonzero_elements (threshold); return count; @@ -177,8 +177,8 @@ print_formatted (std::ostream &out, const char *zero_string, const double denominator) const { - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) { out << "Component (" << r << "," << c << ")" << std::endl; this->block(r,c).print_formatted (out, precision, scientific, @@ -194,8 +194,8 @@ BlockSparseMatrix::memory_consumption () const { std::size_t mem = sizeof(*this); mem += MemoryConsumption::memory_consumption (this->sub_objects); - for (unsigned int r=0; rn_block_rows(); ++r) - for (unsigned int c=0; cn_block_cols(); ++c) + for (size_type r=0; rn_block_rows(); ++r) + for (size_type c=0; cn_block_cols(); ++c) mem += MemoryConsumption::memory_consumption(*this->sub_objects[r][c]); return mem; 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 f623643e9b..45448976c8 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 @@ -47,6 +47,11 @@ template class BlockSparseMatrixEZ : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef std::size_t size_type; + /** * Default constructor. The * result is an empty object with @@ -61,8 +66,8 @@ public: * blocks themselves still have * zero dimension. */ - BlockSparseMatrixEZ (const unsigned int block_rows, - const unsigned int block_cols); + BlockSparseMatrixEZ (const size_type block_rows, + const size_type block_cols); /** * Copy constructor. This is @@ -123,8 +128,8 @@ public: * called to update internal data * structures. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_cols); + void reinit (const size_type n_block_rows, + const size_type n_block_cols); /** * This function collects the * sizes of the sub-objects and @@ -144,8 +149,8 @@ public: * given coordinates. */ SparseMatrixEZ & - block (const unsigned int row, - const unsigned int column); + block (const size_type row, + const size_type column); /** @@ -154,20 +159,20 @@ public: * constant objects. */ const SparseMatrixEZ & - block (const unsigned int row, - const unsigned int column) const; + block (const size_type row, + const size_type column) const; /** * Return the number of blocks in a * column. */ - unsigned int n_block_rows () const; + size_type n_block_rows () const; /** * Return the number of blocks in a * row. */ - unsigned int n_block_cols () const; + size_type n_block_cols () const; /** * Return whether the object is @@ -189,7 +194,7 @@ public: * space. It is the sum of rows * of the rows of sub-matrices. */ - types::global_dof_index n_rows () const; + size_type n_rows () const; /** * Return number of columns of @@ -199,7 +204,7 @@ public: * columns of the columns of * sub-matrices. */ - types::global_dof_index n_cols () const; + size_type n_cols () const; /** * Return the dimension of the @@ -207,7 +212,7 @@ public: * matrix is of dimension * $m \times n$. */ - types::global_dof_index m () const; + size_type m () const; /** * Return the dimension of the @@ -215,7 +220,7 @@ public: * matrix is of dimension * $m \times n$. */ - types::global_dof_index n () const; + size_type n () const; /** * Set the element (i,j) @@ -226,8 +231,8 @@ public: * allowed to store zero values * in non-existent fields. */ - void set (const types::global_dof_index i, - const types::global_dof_index j, + void set (const size_type i, + const size_type j, const Number value); /** @@ -239,7 +244,7 @@ public: * is allowed to store zero * values in non-existent fields. */ - void add (const types::global_dof_index i, const types::global_dof_index j, + void add (const size_type i, const size_type j, const Number value); @@ -328,7 +333,7 @@ private: template inline -unsigned int +size_type BlockSparseMatrixEZ::n_block_rows () const { return row_indices.size(); @@ -338,7 +343,7 @@ BlockSparseMatrixEZ::n_block_rows () const template inline -unsigned int +size_type BlockSparseMatrixEZ::n_rows () const { return row_indices.total_size(); @@ -348,7 +353,7 @@ BlockSparseMatrixEZ::n_rows () const template inline -unsigned int +size_type BlockSparseMatrixEZ::n_block_cols () const { return column_indices.size(); @@ -358,7 +363,7 @@ BlockSparseMatrixEZ::n_block_cols () const template inline -unsigned int +size_type BlockSparseMatrixEZ::n_cols () const { return column_indices.total_size(); @@ -369,8 +374,8 @@ BlockSparseMatrixEZ::n_cols () const template inline SparseMatrixEZ & -BlockSparseMatrixEZ::block (const unsigned int row, - const unsigned int column) +BlockSparseMatrixEZ::block (const size_type row, + const size_type column) { Assert (row::block (const unsigned int row, template inline const SparseMatrixEZ & -BlockSparseMatrixEZ::block (const unsigned int row, - const unsigned int column) const +BlockSparseMatrixEZ::block (const size_type row, + const size_type column) const { Assert (row::block (const unsigned int row, template inline -types::global_dof_index +size_type BlockSparseMatrixEZ::m () const { return n_rows(); @@ -406,7 +411,7 @@ BlockSparseMatrixEZ::m () const template inline -types::global_dof_index +size_type BlockSparseMatrixEZ::n () const { return n_cols(); @@ -417,14 +422,14 @@ BlockSparseMatrixEZ::n () const template inline void -BlockSparseMatrixEZ::set (const types::global_dof_index i, - const types::global_dof_index j, +BlockSparseMatrixEZ::set (const size_type i, + const size_type j, const Number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair + const std::pair row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); block(row_index.first,col_index.first).set (row_index.second, @@ -437,14 +442,14 @@ BlockSparseMatrixEZ::set (const types::global_dof_index i, template inline void -BlockSparseMatrixEZ::add (const types::global_dof_index i, - const types::global_dof_index j, +BlockSparseMatrixEZ::add (const size_type i, + const size_type j, const Number value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); - const std::pair + const std::pair row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); block(row_index.first,col_index.first).add (row_index.second, @@ -466,8 +471,8 @@ BlockSparseMatrixEZ::vmult (BlockVector &dst, dst = 0.; - for (unsigned int row=0; row &dst, Assert (src.n_blocks() == n_block_cols(), ExcDimensionMismatch(src.n_blocks(), n_block_cols())); - for (unsigned int row=0; row &dst, dst = 0.; - for (unsigned int row=0; row &dst, Assert (src.n_blocks() == n_block_rows(), ExcDimensionMismatch(src.n_blocks(), n_block_rows())); - for (unsigned int row=0; row::print_statistics (STREAM &out, bool full) { - unsigned int used_total = 0; - unsigned int allocated_total = 0; - unsigned int reserved_total = 0; - std::vector used_by_line_total; - - unsigned int used; - unsigned int allocated; - unsigned int reserved; - std::vector used_by_line; - - for (unsigned int i=0; i used_by_line_total; + + size_type used; + size_type allocated; + size_type reserved; + std::vector used_by_line; + + for (size_type i=0; i::print_statistics (STREAM &out, bool full) if (full) { used_by_line_total.resize(used_by_line.size()); - for (unsigned int i=0; i< used_by_line.size(); ++i) + for (size_type i=0; i< used_by_line.size(); ++i) if (used_by_line[i] != 0) { out << "row-entries\t" << i @@ -587,7 +592,7 @@ BlockSparseMatrixEZ::print_statistics (STREAM &out, bool full) << "used:" << used_total << std::endl << "allocated:" << allocated_total << std::endl << "reserved:" << reserved_total << std::endl; - for (unsigned int i=0; i< used_by_line_total.size(); ++i) + for (size_type i=0; i< used_by_line_total.size(); ++i) if (used_by_line_total[i] != 0) { out << "row-entries\t" << i diff --git a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h index 7b77108246..a97b1175b0 100644 --- a/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h +++ b/deal.II/include/deal.II/lac/block_sparse_matrix_ez.templates.h @@ -28,8 +28,8 @@ BlockSparseMatrixEZ::BlockSparseMatrixEZ () template BlockSparseMatrixEZ:: -BlockSparseMatrixEZ (const unsigned int rows, - const unsigned int cols) +BlockSparseMatrixEZ (const size_type rows, + const size_type cols) : row_indices (rows, 0), column_indices (cols, 0) @@ -60,8 +60,8 @@ operator = (const BlockSparseMatrixEZ &m) // anything except than checking // whether the base objects want to // do something - for (unsigned int r=0; r::operator = (const double d) { Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - for (unsigned int r=0; r::BlockSparseMatrixEZ ( template void -BlockSparseMatrixEZ::reinit (const unsigned int rows, - const unsigned int cols) +BlockSparseMatrixEZ::reinit (const size_type rows, + const size_type cols) { row_indices.reinit(rows, 0); column_indices.reinit(cols, 0); @@ -122,8 +122,8 @@ template bool BlockSparseMatrixEZ::empty () const { - for (unsigned int r=0; r void BlockSparseMatrixEZ::collect_sizes () { - const unsigned int rows = n_block_rows(); - const unsigned int columns = n_block_cols(); - std::vector row_sizes (rows); - std::vector col_sizes (columns); + const size_type rows = n_block_rows(); + const size_type columns = n_block_cols(); + std::vector row_sizes (rows); + std::vector col_sizes (columns); // first find out the row sizes // from the first block column - for (unsigned int r=0; r::collect_sizes () // then do the same with the columns - for (unsigned int c=0; c class BlockSparsityPatternBase : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef std::size_t size_type; + /** * Define a value which is used * to indicate that a certain @@ -94,7 +99,7 @@ public: * the respective value of the * SparsityPattern class. */ - static const unsigned int invalid_entry = SparsityPattern::invalid_entry; + static const size_type invalid_entry = SparsityPattern::invalid_entry; /** * Initialize the matrix empty, @@ -116,8 +121,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPatternBase (const unsigned int n_block_rows, - const unsigned int n_block_columns); + BlockSparsityPatternBase (const size_type n_block_rows, + const size_type n_block_columns); /** * Copy constructor. This @@ -163,8 +168,8 @@ public: * user call whatever function * she desires. */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * Copy operator. For this the @@ -195,8 +200,8 @@ public: * given coordinates. */ SparsityPatternBase & - block (const unsigned int row, - const unsigned int column); + block (const size_type row, + const size_type column); /** @@ -205,8 +210,8 @@ public: * constant objects. */ const SparsityPatternBase & - block (const unsigned int row, - const unsigned int column) const; + block (const size_type row, + const size_type column) const; /** * Grant access to the object @@ -239,13 +244,13 @@ public: * Return the number of blocks in a * column. */ - unsigned int n_block_rows () const; + size_type n_block_rows () const; /** * Return the number of blocks in a * row. */ - unsigned int n_block_cols () const; + size_type n_block_cols () const; /** * Return whether the object is @@ -268,7 +273,7 @@ public: * blocks in a row, and the * maximum over all rows. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the matrix. @@ -282,7 +287,7 @@ public: * to which block (i,j) belongs * and then relays to that block. */ - void add (const types::global_dof_index i, const types::global_dof_index j); + void add (const size_type i, const size_type j); /** * Add several nonzero entries to the @@ -300,10 +305,10 @@ public: * blocks. */ template - void add_entries (const unsigned int row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); /** * Return number of rows of this @@ -313,7 +318,7 @@ public: * of the (block-)rows of * sub-matrices. */ - types::global_dof_index n_rows () const; + size_type n_rows () const; /** * Return number of columns of @@ -323,13 +328,13 @@ public: * columns of the (block-)columns * of sub-matrices. */ - types::global_dof_index n_cols () const; + size_type n_cols () const; /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const types::global_dof_index i, const types::global_dof_index j) const; + bool exists (const size_type i, const size_type j) const; /** * Number of entries in a @@ -337,7 +342,7 @@ public: * all the blocks that form this * row. */ - unsigned int row_length (const types::global_dof_index row) const; + size_type row_length (const size_type row) const; /** * Return the number of nonzero @@ -358,7 +363,7 @@ public: * the sum of the values as * returned by the sub-objects. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Print the sparsity of the @@ -410,12 +415,12 @@ protected: /** * Number of block rows. */ - unsigned int rows; + size_type rows; /** * Number of block columns. */ - unsigned int columns; + size_type columns; /** * Array of sparsity patterns. @@ -445,7 +450,7 @@ private: * individual blocks when doing a * collective add or set. */ - std::vector counter_within_block; + std::vector counter_within_block; /** * Temporary vector for column @@ -453,7 +458,7 @@ private: * local to global data on each * sparse matrix. */ - std::vector > block_column_indices; + std::vector > block_column_indices; /** * Make the block sparse matrix a @@ -501,15 +506,15 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Forwarding to * BlockSparsityPatternBase::reinit(). */ - void reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns); + void reinit (const size_type n_block_rows, + const size_type n_block_columns); /** * Initialize the pattern with @@ -535,7 +540,7 @@ public: */ void reinit (const BlockIndices &row_indices, const BlockIndices &col_indices, - const std::vector > &row_lengths); + const std::vector > &row_lengths); /** @@ -672,8 +677,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -686,8 +691,8 @@ public: * and then entering the index * values. */ - BlockCompressedSparsityPattern (const std::vector &row_block_sizes, - const std::vector &col_block_sizes); + BlockCompressedSparsityPattern (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Initialize the pattern with @@ -713,8 +718,8 @@ public: * row_block_sizes[i] * times col_block_sizes[j]. */ - void reinit (const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes); + void reinit (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Resize the matrix to a tensor @@ -789,8 +794,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSetSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSetSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -803,8 +808,8 @@ public: * and then entering the index * values. */ - BlockCompressedSetSparsityPattern (const std::vector &row_block_sizes, - const std::vector &col_block_sizes); + BlockCompressedSetSparsityPattern (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Initialize the pattern with @@ -830,8 +835,8 @@ public: * row_block_sizes[i] * times col_block_sizes[j]. */ - void reinit (const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes); + void reinit (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Resize the matrix to a tensor @@ -899,8 +904,8 @@ public: * to call collect_sizes() after * you assign them sizes. */ - BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockCompressedSimpleSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -913,8 +918,8 @@ public: * and then entering the index * values. */ - BlockCompressedSimpleSparsityPattern (const std::vector &row_block_sizes, - const std::vector &col_block_sizes); + BlockCompressedSimpleSparsityPattern (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Initialize the pattern with symmetric @@ -945,8 +950,8 @@ public: * row_block_sizes[i] * times col_block_sizes[j]. */ - void reinit (const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes); + void reinit (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Resize the pattern with symmetric @@ -962,8 +967,8 @@ public: * Return the column number of * the @p index th entry in row @p row. */ - unsigned int column_number (const unsigned int row, - const unsigned int index) const; + size_type column_number (const size_type row, + const size_type index) const; /** * Allow the use of the reinit @@ -1025,8 +1030,8 @@ namespace TrilinosWrappers * to call collect_sizes() after * you assign them sizes. */ - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns); + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns); /** * Initialize the pattern with @@ -1039,8 +1044,8 @@ namespace TrilinosWrappers * and then entering the index * values. */ - BlockSparsityPattern (const std::vector &row_block_sizes, - const std::vector &col_block_sizes); + BlockSparsityPattern (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Initialize the pattern with an array @@ -1087,8 +1092,8 @@ namespace TrilinosWrappers * row_block_sizes[i] * times col_block_sizes[j]. */ - void reinit (const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes); + void reinit (const std::vector &row_block_sizes, + const std::vector &col_block_sizes); /** * Resize the matrix to a square tensor @@ -1129,8 +1134,8 @@ namespace TrilinosWrappers template inline SparsityPatternBase & -BlockSparsityPatternBase::block (const unsigned int row, - const unsigned int column) +BlockSparsityPatternBase::block (const size_type row, + const size_type column) { Assert (row::block (const unsigned int row, template inline const SparsityPatternBase & -BlockSparsityPatternBase::block (const unsigned int row, - const unsigned int column) const +BlockSparsityPatternBase::block (const size_type row, + const size_type column) const { Assert (row::get_column_indices () const template inline void -BlockSparsityPatternBase::add (const types::global_dof_index i, - const types::global_dof_index j) +BlockSparsityPatternBase::add (const size_type i, + const size_type j) { // if you get an error here, are // you sure you called // collect_sizes() before? - const std::pair + const std::pair row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); sub_objects[row_index.first][col_index.first]->add (row_index.second, @@ -1193,10 +1198,10 @@ BlockSparsityPatternBase::add (const types::global_dof_inde template template void -BlockSparsityPatternBase::add_entries (const types::global_dof_index row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted) +BlockSparsityPatternBase::add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted) { // Resize scratch arrays if (block_column_indices.size() < this->n_block_cols()) @@ -1205,7 +1210,7 @@ BlockSparsityPatternBase::add_entries (const types::global_ counter_within_block.resize (this->n_block_cols()); } - const types::global_dof_index n_cols = static_cast(end - begin); + const size_type n_cols = static_cast(end - begin); // Resize sub-arrays to n_cols. This // is a bit wasteful, but we resize @@ -1218,12 +1223,12 @@ BlockSparsityPatternBase::add_entries (const types::global_ // enough before actually going // through all of them. if (block_column_indices[0].size() < n_cols) - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) block_column_indices[i].resize(n_cols); // Reset the number of added elements // in each block to zero. - for (unsigned int i=0; in_block_cols(); ++i) + for (size_type i=0; in_block_cols(); ++i) counter_within_block[i] = 0; // Go through the column indices to @@ -1237,12 +1242,12 @@ BlockSparsityPatternBase::add_entries (const types::global_ // comes from an element matrix). for (ForwardIterator it = begin; it != end; ++it) { - const types::global_dof_index col = *it; + const size_type col = *it; - const std::pair + const std::pair col_index = this->column_indices.global_to_local(col); - const unsigned int local_index = counter_within_block[col_index.first]++; + const size_type local_index = counter_within_block[col_index.first]++; block_column_indices[col_index.first][local_index] = col_index.second; } @@ -1250,8 +1255,8 @@ BlockSparsityPatternBase::add_entries (const types::global_ #ifdef DEBUG // If in debug mode, do a check whether // the right length has been obtained. - unsigned int length = 0; - for (unsigned int i=0; in_block_cols(); ++i) + size_type length = 0; + for (size_type i=0; in_block_cols(); ++i) length += counter_within_block[i]; Assert (length == n_cols, ExcInternalError()); #endif @@ -1261,9 +1266,9 @@ BlockSparsityPatternBase::add_entries (const types::global_ // where we should start reading out // data. Now let's write the data into // the individual blocks! - const std::pair + const std::pair row_index = this->row_indices.global_to_local (row); - for (unsigned int block_col=0; block_col::add_entries (const types::global_ template inline bool -BlockSparsityPatternBase::exists (const types::global_dof_index i, - const types::global_dof_index j) const +BlockSparsityPatternBase::exists (const size_type i, + const size_type j) const { // if you get an error here, are // you sure you called // collect_sizes() before? - const std::pair + const std::pair row_index = row_indices.global_to_local (i), col_index = column_indices.global_to_local (j); return sub_objects[row_index.first][col_index.first]->exists (row_index.second, @@ -1297,16 +1302,16 @@ BlockSparsityPatternBase::exists (const types::global_dof_i template inline -unsigned int +size_type BlockSparsityPatternBase:: -row_length (const types::global_dof_index row) const +row_length (const size_type row) const { - const std::pair + const std::pair row_index = row_indices.global_to_local (row); - unsigned int c = 0; + size_type c = 0; - for (unsigned int b=0; brow_length (row_index.second); return c; @@ -1316,7 +1321,7 @@ row_length (const types::global_dof_index row) const template inline -unsigned int +size_type BlockSparsityPatternBase::n_block_cols () const { return columns; @@ -1326,7 +1331,7 @@ BlockSparsityPatternBase::n_block_cols () const template inline -unsigned int +size_type BlockSparsityPatternBase::n_block_rows () const { return rows; @@ -1334,20 +1339,20 @@ BlockSparsityPatternBase::n_block_rows () const inline -unsigned int -BlockCompressedSimpleSparsityPattern::column_number (const unsigned int row, - const unsigned int index) const +size_type +BlockCompressedSimpleSparsityPattern::column_number (const size_type row, + const size_type index) const { // .first= ith block, .second = jth row in that block - const std::pair + const std::pair row_index = row_indices.global_to_local (row); Assert(indexrow_length (row_index.second); + size_type rowlen = sub_objects[row_index.first][b]->row_length (row_index.second); if (indexcolumn_number(row_index.second, index-c); c += rowlen; @@ -1361,8 +1366,8 @@ BlockCompressedSimpleSparsityPattern::column_number (const unsigned int row, inline void BlockSparsityPattern::reinit ( - const unsigned int n_block_rows, - const unsigned int n_block_columns) + const size_type n_block_rows, + const size_type n_block_columns) { BlockSparsityPatternBase::reinit ( n_block_rows, n_block_columns); diff --git a/deal.II/include/deal.II/lac/block_vector.h b/deal.II/include/deal.II/lac/block_vector.h index 5a86446e24..568fb2242b 100644 --- a/deal.II/include/deal.II/lac/block_vector.h +++ b/deal.II/include/deal.II/lac/block_vector.h @@ -56,6 +56,11 @@ template 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. @@ -101,8 +106,8 @@ public: * use blocks of different * sizes. */ - explicit BlockVector (const unsigned int num_blocks = 0, - const types::global_dof_index block_size = 0); + explicit BlockVector (const size_type num_blocks = 0, + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to @@ -157,7 +162,7 @@ public: * block_sizes[i] zero * elements. */ - BlockVector (const std::vector &block_sizes); + BlockVector (const std::vector &block_sizes); /** * Constructor. Initialize vector @@ -185,7 +190,7 @@ public: * different blocks. */ template - BlockVector (const std::vector &n, + BlockVector (const std::vector &n, const InputIterator first, const InputIterator end); @@ -271,7 +276,7 @@ public: * is filled with zeros. */ void reinit (const unsigned int num_blocks, - const types::global_dof_index block_size = 0, + const size_type block_size = 0, const bool fast = false); /** @@ -305,8 +310,8 @@ public: * since they may be routed to * the wrong block. */ - void reinit (const std::vector &N, - const bool fast=false); + void reinit (const std::vector &N, + const bool fast=false); /** * Reinitialize the BlockVector @@ -470,7 +475,7 @@ public: template template -BlockVector::BlockVector (const std::vector &n, +BlockVector::BlockVector (const std::vector &n, const InputIterator first, const InputIterator end) { @@ -479,7 +484,7 @@ BlockVector::BlockVector (const std::vector &n, // copy elements soon reinit (n, true); InputIterator start = first; - for (unsigned int b=0; b(n[b])); @@ -543,7 +548,7 @@ template inline void BlockVector::compress (::dealii::VectorOperation::values operation) { - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].compress(operation); } @@ -555,7 +560,7 @@ void BlockVector::scale (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i] *= factor; } 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 690077e4c9..608fd7f4ec 100644 --- a/deal.II/include/deal.II/lac/block_vector.templates.h +++ b/deal.II/include/deal.II/lac/block_vector.templates.h @@ -23,7 +23,7 @@ DEAL_II_NAMESPACE_OPEN template BlockVector::BlockVector (const unsigned int n_blocks, - const types::global_dof_index block_size) + const size_type block_size) { reinit (n_blocks, block_size); } @@ -31,7 +31,7 @@ BlockVector::BlockVector (const unsigned int n_blocks, template -BlockVector::BlockVector (const std::vector &n) +BlockVector::BlockVector (const std::vector &n) { reinit (n, false); } @@ -52,7 +52,7 @@ BlockVector::BlockVector (const BlockVector &v) this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i] = v.components[i]; } @@ -78,7 +78,7 @@ BlockVector::BlockVector (const TrilinosWrappers::BlockVector &v) this->block_indices = v.get_block_indices(); this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i] = v.block(i); BaseClass::collect_sizes(); @@ -88,24 +88,24 @@ BlockVector::BlockVector (const TrilinosWrappers::BlockVector &v) template -void BlockVector::reinit (const unsigned int n_bl, - const types::global_dof_index bl_sz, - const bool fast) +void BlockVector::reinit (const size_type n_bl, + const szie_type bl_sz, + const bool fast) { - std::vector n(n_bl, bl_sz); + std::vector n(n_bl, bl_sz); reinit(n, fast); } template -void BlockVector::reinit (const std::vector &n, - const bool fast) +void BlockVector::reinit (const std::vector &n, + const bool fast) { this->block_indices.reinit (n); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].reinit(n[i], fast); } @@ -119,7 +119,7 @@ void BlockVector::reinit ( if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].reinit(n.block_size(i), fast); } @@ -133,7 +133,7 @@ void BlockVector::reinit (const BlockVector &v, if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->block(i).reinit(v.block(i), fast); } @@ -161,7 +161,7 @@ void BlockVector::swap (BlockVector &v) Assert (this->n_blocks() == v.n_blocks(), ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) dealii::swap (this->components[i], v.components[i]); dealii::swap (this->block_indices, v.block_indices); } @@ -174,7 +174,7 @@ void BlockVector::print (std::ostream &out, const bool scientific, const bool across) const { - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) { if (across) out << 'C' << i << ':'; @@ -189,7 +189,7 @@ void BlockVector::print (std::ostream &out, template void BlockVector::block_write (std::ostream &out) const { - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].block_write(out); } @@ -198,7 +198,7 @@ void BlockVector::block_write (std::ostream &out) const template void BlockVector::block_read (std::istream &in) { - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].block_read(in); } 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 cc4c3b731c..3c2f99ff5a 100644 --- a/deal.II/include/deal.II/lac/block_vector_base.h +++ b/deal.II/include/deal.II/lac/block_vector_base.h @@ -299,6 +299,11 @@ namespace internal typedef Iterator InverseConstnessIterator; public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * Type of the number this * iterator points @@ -354,8 +359,8 @@ namespace internal * const or non-const * reference. */ - Iterator (BlockVector &parent, - const types::global_dof_index global_index); + Iterator (BlockVector &parent, + const size_type global_index); /** * Copy constructor. @@ -382,12 +387,12 @@ namespace internal * the respective member * variables. */ - Iterator (BlockVector &parent, - const types::global_dof_index global_index, - const unsigned int current_block, - const types::global_dof_index index_within_block, - const types::global_dof_index next_break_forward, - const types::global_dof_index next_break_backward); + Iterator (BlockVector &parent, + const size_type global_index, + const size_type current_block, + const size_type index_within_block, + const size_type next_break_forward, + const size_type next_break_backward); public: @@ -614,7 +619,7 @@ namespace internal * element to which we * presently point. */ - types::global_dof_index global_index; + size_type global_index; /** * Current block and index @@ -622,8 +627,8 @@ namespace internal * element presently pointed * to. */ - unsigned int current_block; - types::global_dof_index index_within_block; + size_type current_block; + size_type index_within_block; /** * Indices of the global @@ -637,8 +642,8 @@ namespace internal * efficient than always * asking the parent object. */ - types::global_dof_index next_break_forward; - types::global_dof_index next_break_backward; + size_type next_break_forward; + size_type next_break_backward; /** * Move forward one element. @@ -800,13 +805,13 @@ public: * Access to a single block. */ BlockType & - block (const unsigned int i); + block (const size_type i); /** * Read-only access to a single block. */ const BlockType & - block (const unsigned int i) const; + block (const size_type i) const; /** * Return a reference on the @@ -831,7 +836,7 @@ public: * is the sum of the dimensions of all * components. */ - types::global_dof_index size () const; + size_type size () const; /** * Return an iterator pointing to @@ -862,20 +867,20 @@ public: /** * Access components, returns U(i). */ - value_type operator() (const types::global_dof_index i) const; + value_type operator() (const size_type i) const; /** * Access components, returns U(i) * as a writeable reference. */ - reference operator() (const types::global_dof_index i); + reference operator() (const size_type i); /** * Access components, returns U(i). * * Exactly the same as operator(). */ - value_type operator[] (const types::global_dof_index i) const; + value_type operator[] (const size_type i) const; /** * Access components, returns U(i) @@ -883,7 +888,7 @@ public: * * Exactly the same as operator(). */ - reference operator[] (const types::global_dof_index i); + reference operator[] (const size_type i); /** * Copy operator: fill all components of @@ -965,7 +970,7 @@ public: * in the local range of this processor. * Asks the corresponding block. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Return whether the vector contains only @@ -1011,8 +1016,8 @@ public: * indices. */ template - void add (const std::vector &indices, - const std::vector &values); + void add (const std::vector &indices, + const std::vector &values); /** * This is a second collective @@ -1022,8 +1027,8 @@ public: * values. */ template - void add (const std::vector &indices, - const Vector &values); + void add (const std::vector &indices, + const Vector &values); /** * Take an address where @@ -1035,9 +1040,9 @@ public: * functions above. */ template - void add (const unsigned int n_elements, - const types::global_dof_index *indices, - const Number *values); + void add (const size_type n_elements, + const size_type *indices, + const Number *values); /** * $U(0-DIM)+=s$. Addition of s @@ -1232,11 +1237,11 @@ namespace internal inline Iterator:: Iterator (BlockVector &parent, - const types::global_dof_index global_index, - const unsigned int current_block, - const types::global_dof_index index_within_block, - const types::global_dof_index next_break_forward, - const types::global_dof_index next_break_backward) + const size_type global_index, + const size_type current_block, + const size_type index_within_block, + const size_type next_break_forward, + const size_type next_break_backward) : parent (&parent), global_index (global_index), @@ -1640,8 +1645,8 @@ namespace internal template Iterator:: - Iterator (BlockVector &parent, - const types::global_dof_index global_index) + Iterator (BlockVector &parent, + const size_type global_index) : parent (&parent), global_index (global_index) @@ -1654,7 +1659,7 @@ namespace internal // past-the-end if (global_index < parent.size()) { - const std::pair + const std::pair indices = parent.block_indices.global_to_local(global_index); current_block = indices.first; index_within_block = indices.second; @@ -1762,7 +1767,7 @@ BlockVectorBase::BlockVectorBase () template inline -types::global_dof_index +size_type BlockVectorBase::size () const { return block_indices.total_size(); @@ -1772,7 +1777,7 @@ BlockVectorBase::size () const template inline -unsigned int +size_type BlockVectorBase::n_blocks () const { return block_indices.size(); @@ -1782,7 +1787,7 @@ BlockVectorBase::n_blocks () const template inline typename BlockVectorBase::BlockType & -BlockVectorBase::block (const unsigned int i) +BlockVectorBase::block (const size_type i) { Assert(i::block (const unsigned int i) template inline const typename BlockVectorBase::BlockType & -BlockVectorBase::block (const unsigned int i) const +BlockVectorBase::block (const size_type i) const { Assert(i::collect_sizes () { - std::vector sizes (n_blocks()); + std::vector sizes (n_blocks()); - for (unsigned int i=0; i::compress (::dealii::VectorOperation::values operation) { - for (unsigned int i=0; i inline bool BlockVectorBase::in_local_range -(const types::global_dof_index global_index) const +(const size_type global_index) const { - const std::pair local_index + const std::pair local_index = block_indices.global_to_local (global_index); return components[local_index.first].in_local_range (global_index); @@ -1903,7 +1908,7 @@ template bool BlockVectorBase::all_zero () const { - for (unsigned int i=0; i bool BlockVectorBase::is_non_negative () const { - for (unsigned int i=0; i &v) const ExcDimensionMismatch(n_blocks(), v.n_blocks())); value_type sum = 0.; - for (unsigned int i=0; i::real_type BlockVectorBase::norm_sqr () const { real_type sum = 0.; - for (unsigned int i=0; i::value_type BlockVectorBase::mean_value () const { value_type sum = 0.; - for (unsigned int i=0; i::real_type BlockVectorBase::l1_norm () const { real_type sum = 0.; - for (unsigned int i=0; i::real_type BlockVectorBase::linfty_norm () const { real_type sum = 0.; - for (unsigned int i=0; i::operator -= (const BlockVectorBase &v) Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i template inline void -BlockVectorBase::add (const std::vector &indices, - const std::vector &values) +BlockVectorBase::add (const std::vector &indices, + const std::vector &values) { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); @@ -2049,13 +2054,13 @@ template template inline void -BlockVectorBase::add (const std::vector &indices, - const Vector &values) +BlockVectorBase::add (const std::vector &indices, + const Vector &values) { Assert (indices.size() == values.size(), ExcDimensionMismatch(indices.size(), values.size())); - const unsigned int n_indices = indices.size(); - for (unsigned int i=0; i template inline void -BlockVectorBase::add (const unsigned int n_indices, - const types::global_dof_index *indices, - const Number *values) +BlockVectorBase::add (const size_type n_indices, + const size_type *indices, + const Number *values) { - for (unsigned int i=0; i::add (const value_type a) { Assert (numbers::is_finite(a), ExcNumberNotFinite()); - for (unsigned int i=0; i::add (const BlockVectorBase &v) Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::add (const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::add (const value_type a, ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i::sadd (const value_type x, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::sadd (const value_type x, const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::sadd (const value_type x, const value_type a, Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i::sadd (const value_type x, const value_type a, Assert (n_blocks() == y.n_blocks(), ExcDimensionMismatch(n_blocks(), y.n_blocks())); - for (unsigned int i=0; i::scale (const BlockVector2 &v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::equ (const value_type a, Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - for (unsigned int i=0; i::memory_consumption () const { std::size_t mem = sizeof(this->n_blocks()); - for (unsigned int i=0; icomponents.size(); ++i) + for (size_type i=0; icomponents.size(); ++i) mem += MemoryConsumption::memory_consumption (this->components[i]); mem += MemoryConsumption::memory_consumption (this->block_indices); return mem; @@ -2294,7 +2299,7 @@ void BlockVectorBase::equ (const value_type a, Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - for (unsigned int i=0; i::equ (const value_type a, template void BlockVectorBase::update_ghost_values () const { - for (unsigned int i=0; i::operator = (const value_type s) Assert (numbers::is_finite(s), ExcNumberNotFinite()); - for (unsigned int i=0; i::operator = (const BlockVectorBase &v) { AssertDimension(n_blocks(), v.n_blocks()); - for (unsigned int i=0; i::operator = (const BlockVectorBase &v) { AssertDimension(n_blocks(), v.n_blocks()); - for (unsigned int i=0; i::operator = (const VectorType &v) Assert (size() == v.size(), ExcDimensionMismatch(size(), v.size())); - unsigned int index_v = 0; - for (unsigned int b=0; b &v) const { Assert (block_indices == v.block_indices, ExcDifferentBlockIndices()); - for (unsigned int i=0; i::operator *= (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; i::operator /= (const value_type factor) Assert (numbers::is_finite(factor), ExcNumberNotFinite()); Assert (factor > 0., ExcDivideByZero() ); - for (unsigned int i=0; i::operator /= (const value_type factor) template inline typename BlockVectorBase::value_type -BlockVectorBase::operator() (const types::global_dof_index i) const +BlockVectorBase::operator() (const size_type i) const { - const std::pair local_index + const std::pair local_index = block_indices.global_to_local (i); return components[local_index.first](local_index.second); } @@ -2433,9 +2438,9 @@ BlockVectorBase::operator() (const types::global_dof_index i) const template inline typename BlockVectorBase::reference -BlockVectorBase::operator() (const types::global_dof_index i) +BlockVectorBase::operator() (const size_type i) { - const std::pair local_index + const std::pair local_index = block_indices.global_to_local (i); return components[local_index.first](local_index.second); } @@ -2445,7 +2450,7 @@ BlockVectorBase::operator() (const types::global_dof_index i) template inline typename BlockVectorBase::value_type -BlockVectorBase::operator[] (const types::global_dof_index i) const +BlockVectorBase::operator[] (const size_type i) const { return operator()(i); } @@ -2455,7 +2460,7 @@ BlockVectorBase::operator[] (const types::global_dof_index i) const template inline typename BlockVectorBase::reference -BlockVectorBase::operator[] (const types::global_dof_index i) +BlockVectorBase::operator[] (const size_type i) { return operator()(i); } 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 aac418b41e..44079dbba1 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.h @@ -49,6 +49,11 @@ template class ChunkSparseMatrix : public virtual Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * Type of matrix entries. In analogy to * the STL container classes. @@ -290,7 +295,7 @@ public: * matrix is of dimension * $m \times n$. */ - types::global_dof_index m () const; + size_type m () const; /** * Return the dimension of the @@ -298,7 +303,7 @@ public: * matrix is of dimension * $m \times n$. */ - types::global_dof_index n () const; + size_type n () const; /** * Return the number of nonzero @@ -309,7 +314,7 @@ public: * the entries should happen to * be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the number of actually @@ -323,7 +328,7 @@ public: * sparsity pattern but only the * ones that are nonzero. */ - unsigned int n_actually_nonzero_elements () const; + size_type n_actually_nonzero_elements () const; /** * Return a (constant) reference @@ -361,8 +366,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void set (const types::global_dof_index i, - const types::global_dof_index j, + void set (const size_type i, + const size_type j, const number value); /** @@ -374,8 +379,8 @@ public: * is allowed to store zero * values in non-existent fields. */ - void add (const types::global_dof_index i, - const types::global_dof_index j, + void add (const size_type i, + const size_type j, const number value); /** @@ -396,12 +401,12 @@ public: * into the matrix. */ template - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Multiply the entire matrix by a @@ -574,8 +579,8 @@ public: * tailored better to a sparse matrix * structure. */ - number operator () (const types::global_dof_index i, - const types::global_dof_index j) const; + number operator () (const size_type i, + const size_type j) const; /** * This function is mostly like @@ -601,8 +606,8 @@ public: * tailored better to a sparse matrix * structure. */ - number el (const types::global_dof_index i, - const types::global_dof_index j) const; + number el (const size_type i, + const size_type j) const; /** * Return the main diagonal @@ -620,14 +625,14 @@ public: * involve searching for the * right column number. */ - number diag_element (const types::global_dof_index i) const; + number diag_element (const size_type i) const; /** * Same as above, but return a * writeable reference. You're * sure you know what you do? */ - number &diag_element (const types::global_dof_index i); + number &diag_element (const size_type i); //@} /** @@ -940,8 +945,8 @@ public: */ template void PSOR (Vector &v, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const number om = 1.) const; /** @@ -966,8 +971,8 @@ public: */ template void TPSOR (Vector &v, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const number om = 1.) const; /** @@ -1202,14 +1207,14 @@ private: * object, using the reinit() * function. */ - unsigned int max_len; + size_type max_len; /** * Return the location of entry * $(i,j)$ within the val array. */ - unsigned int compute_location (const types::global_dof_index i, - const types::global_dof_index j) const; + size_type compute_location (const size_type i, + const size_type j) const; // make all other sparse matrices // friends @@ -1225,7 +1230,7 @@ private: template inline -types::global_dof_index ChunkSparseMatrix::m () const +size_type ChunkSparseMatrix::m () const { Assert (cols != 0, ExcNotInitialized()); return cols->rows; @@ -1234,7 +1239,7 @@ types::global_dof_index ChunkSparseMatrix::m () const template inline -types::global_dof_index ChunkSparseMatrix::n () const +size_type ChunkSparseMatrix::n () const { Assert (cols != 0, ExcNotInitialized()); return cols->cols; @@ -1244,12 +1249,12 @@ types::global_dof_index ChunkSparseMatrix::n () const template inline -unsigned int -ChunkSparseMatrix::compute_location (const types::global_dof_index i, - const types::global_dof_index j) const +size_type +ChunkSparseMatrix::compute_location (const size_type i, + const size_type j) const { - const unsigned int chunk_size = cols->get_chunk_size(); - const unsigned int chunk_index + const size_type chunk_size = cols->get_chunk_size(); + const size_type chunk_index = cols->sparsity_pattern(i/chunk_size, j/chunk_size); if (chunk_index == ChunkSparsityPattern::invalid_entry) @@ -1267,8 +1272,8 @@ ChunkSparseMatrix::compute_location (const types::global_dof_index i, template inline -void ChunkSparseMatrix::set (const types::global_dof_index i, - const types::global_dof_index j, +void ChunkSparseMatrix::set (const size_type i, + const size_type j, const number value) { @@ -1279,7 +1284,7 @@ void ChunkSparseMatrix::set (const types::global_dof_index i, // the matrix that are not part of // the sparsity pattern, if the // value to which we set it is zero - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); Assert ((index != SparsityPattern::invalid_entry) || (value == 0.), ExcInvalidIndex(i,j)); @@ -1292,8 +1297,8 @@ void ChunkSparseMatrix::set (const types::global_dof_index i, template inline -void ChunkSparseMatrix::add (const types::global_dof_index i, - const types::global_dof_index j, +void ChunkSparseMatrix::add (const size_type i, + const size_type j, const number value) { @@ -1303,7 +1308,7 @@ void ChunkSparseMatrix::add (const types::global_dof_index i, if (value != 0.) { - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); Assert ((index != ChunkSparsityPattern::invalid_entry), ExcInvalidIndex(i,j)); @@ -1316,15 +1321,15 @@ void ChunkSparseMatrix::add (const types::global_dof_index i, template template inline -void ChunkSparseMatrix::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number2 *values, - const bool /*elide_zero_values*/, - const bool /*col_indices_are_sorted*/) +void ChunkSparseMatrix::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, + const number2 *values, + const bool /*elide_zero_values*/, + const bool /*col_indices_are_sorted*/) { // TODO: could be done more efficiently... - for (unsigned int col=0; col(values[col])); } @@ -1338,7 +1343,7 @@ ChunkSparseMatrix::operator *= (const number factor) Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // multiply all elements of the matrix with // the given factor. this includes the @@ -1372,7 +1377,7 @@ ChunkSparseMatrix::operator /= (const number factor) const number factor_inv = 1. / factor; - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // multiply all elements of the matrix with // the given factor. this includes the @@ -1398,8 +1403,8 @@ ChunkSparseMatrix::operator /= (const number factor) template inline -number ChunkSparseMatrix::operator () (const types::global_dof_index i, - const types::global_dof_index j) const +number ChunkSparseMatrix::operator () (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); AssertThrow (compute_location(i,j) != SparsityPattern::invalid_entry, @@ -1411,11 +1416,11 @@ number ChunkSparseMatrix::operator () (const types::global_dof_index i, template inline -number ChunkSparseMatrix::el (const types::global_dof_index i, - const types::global_dof_index j) const +number ChunkSparseMatrix::el (const size_type i, + const size_type j) const { Assert (cols != 0, ExcNotInitialized()); - const unsigned int index = compute_location(i,j); + const size_type index = compute_location(i,j); if (index != ChunkSparsityPattern::invalid_entry) return val[index]; @@ -1427,7 +1432,7 @@ number ChunkSparseMatrix::el (const types::global_dof_index i, template inline -number ChunkSparseMatrix::diag_element (const types::global_dof_index i) const +number ChunkSparseMatrix::diag_element (const size_type i) const { Assert (cols != 0, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); @@ -1436,7 +1441,7 @@ number ChunkSparseMatrix::diag_element (const types::global_dof_index i) // Use that the first element in each row // of a quadratic matrix is the main // diagonal of the chunk sparsity pattern - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); return val[cols->sparsity_pattern.rowstart[i/chunk_size] * chunk_size * chunk_size @@ -1450,7 +1455,7 @@ number ChunkSparseMatrix::diag_element (const types::global_dof_index i) template inline -number &ChunkSparseMatrix::diag_element (const types::global_dof_index i) +number &ChunkSparseMatrix::diag_element (const size_type i) { Assert (cols != 0, ExcNotInitialized()); Assert (m() == n(), ExcNotQuadratic()); @@ -1459,7 +1464,7 @@ number &ChunkSparseMatrix::diag_element (const types::global_dof_index i // Use that the first element in each row // of a quadratic matrix is the main // diagonal of the chunk sparsity pattern - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); return val[cols->sparsity_pattern.rowstart[i/chunk_size] * chunk_size * chunk_size @@ -1477,14 +1482,14 @@ void ChunkSparseMatrix::copy_from (const ForwardIterator begin, const ForwardIterator end) { - Assert (static_cast(std::distance (begin, end)) == m(), + Assert (static_cast(std::distance (begin, end)) == m(), ExcIteratorRange (std::distance (begin, end), m())); // for use in the inner loop, we // define a typedef to the type of // the inner iterators typedef typename std::iterator_traits::value_type::const_iterator inner_iterator; - unsigned int row=0; + size_type row=0; for (ForwardIterator i=begin; i!=end; ++i, ++row) { const inner_iterator end_of_row = i->end(); 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 713506d619..913610e275 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 @@ -54,20 +54,20 @@ namespace internal typename DstIterator> inline void - chunk_vmult_add (const unsigned int chunk_size, + chunk_vmult_add (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i::value_type sum = 0; - for (unsigned int j=0; j inline void - chunk_vmult_subtract (const unsigned int chunk_size, + chunk_vmult_subtract (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i::value_type sum = 0; - for (unsigned int j=0; j inline void - chunk_Tvmult_add (const unsigned int chunk_size, + chunk_Tvmult_add (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator src, DstIterator dst) { - for (unsigned int i=0; i::value_type sum = 0; - for (unsigned int j=0; j inline result_type - chunk_matrix_scalar_product (const unsigned int chunk_size, + chunk_matrix_scalar_product (const size_type chunk_size, const MatrixIterator matrix, const SrcIterator1 u, const SrcIterator2 v) @@ -158,13 +158,13 @@ namespace internal MatrixIterator matrix_row = matrix; - for (unsigned int i=0; i::value_type sum = 0; - for (unsigned int j=0; j::ChunkSparseMatrix (const ChunkSparsityPattern &c, Assert (c.n_cols() == id.n(), ExcDimensionMismatch (c.n_cols(), id.n())); reinit (c); - for (unsigned int i=0; iset(i,i,1.); } @@ -268,7 +268,7 @@ ChunkSparseMatrix::operator = (const double d) if (val) { - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); std::fill_n (val, cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size, @@ -290,7 +290,7 @@ ChunkSparseMatrix::operator= (const IdentityMatrix &id) ExcDimensionMismatch (cols->n_cols(), id.n())); *this = 0; - for (unsigned int i=0; iset(i,i,1.); return *this; @@ -317,8 +317,8 @@ ChunkSparseMatrix::reinit (const ChunkSparsityPattern &sparsity) // enough so that we can store full // chunks. this entails some padding // elements - const unsigned int chunk_size = cols->get_chunk_size(); - const unsigned int N = cols->sparsity_pattern.n_nonzero_elements() * + const size_type chunk_size = cols->get_chunk_size(); + const size_type N = cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size; if (N > max_len || max_len == 0) { @@ -363,7 +363,7 @@ ChunkSparseMatrix::empty () const template -unsigned int +size_type ChunkSparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -373,7 +373,7 @@ ChunkSparseMatrix::n_nonzero_elements () const template -unsigned int +size_type ChunkSparseMatrix::n_actually_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -383,7 +383,7 @@ ChunkSparseMatrix::n_actually_nonzero_elements () const // the matrix. since we have the invariant // that padding elements are zero, nothing // bad can happen here - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); return std::count_if(&val[0], &val[cols->sparsity_pattern.n_nonzero_elements () * chunk_size * chunk_size], @@ -415,7 +415,7 @@ ChunkSparseMatrix::copy_from (const ChunkSparseMatrix &matri // copy everything, including padding // elements - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); std::copy (&matrix.val[0], &matrix.val[cols->sparsity_pattern.n_nonzero_elements() * chunk_size * chunk_size], @@ -435,8 +435,8 @@ ChunkSparseMatrix::copy_from (const FullMatrix &matrix) *this = 0; // then copy old matrix - for (unsigned int row=0; row::add (const number factor, // add everything, including padding // elements - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); number *val_ptr = &val[0]; const somenumber *matrix_ptr = &matrix.val[0]; const number *const end_ptr = &val[cols->sparsity_pattern.n_nonzero_elements() @@ -532,7 +532,7 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, Assert (!PointerComparison::equal(&src, &dst), ExcSourceEqualsDestination()); - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need // to treat the last chunk row and column @@ -541,16 +541,16 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename OutVector::iterator dst_ptr = dst.begin(); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -568,8 +568,8 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, else // we're at a chunk column that // has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) += (val_ptr[r*cols->chunk_size + c] * src(*colnum_ptr * cols->chunk_size + c)); @@ -586,7 +586,7 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, // necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -599,8 +599,8 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, { // we're at a chunk row but not // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) += (val_ptr[r*cols->chunk_size + c] * src(*colnum_ptr * cols->chunk_size + c)); @@ -608,8 +608,8 @@ ChunkSparseMatrix::vmult_add (OutVector &dst, else // we're at a chunk row and // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) += (val_ptr[r*cols->chunk_size + c] * src(*colnum_ptr * cols->chunk_size + c)); @@ -634,7 +634,7 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, Assert (!PointerComparison::equal(&src, &dst), ExcSourceEqualsDestination()); - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need // to treat the last chunk row and column @@ -643,7 +643,7 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); @@ -651,10 +651,10 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, // like in vmult_add, but don't keep an // iterator into dst around since we're not // traversing it sequentially this time - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -672,8 +672,8 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, else // we're at a chunk column that // has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); @@ -687,7 +687,7 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, // necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -700,8 +700,8 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, { // we're at a chunk row but not // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); @@ -709,8 +709,8 @@ ChunkSparseMatrix::Tvmult_add (OutVector &dst, else // we're at a chunk row and // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(*colnum_ptr * cols->chunk_size + c) += (val_ptr[r*cols->chunk_size + c] * src(chunk_row * cols->chunk_size + r)); @@ -738,7 +738,7 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons // like matrix_scalar_product, except that // the two vectors are now the same - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need // to treat the last chunk row and column @@ -747,16 +747,16 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector::const_iterator v_ptr = v.begin(); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -776,8 +776,8 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons else // we're at a chunk column that // has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -796,7 +796,7 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons // necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -809,8 +809,8 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons { // we're at a chunk row but not // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -820,8 +820,8 @@ ChunkSparseMatrix::matrix_norm_square (const Vector &v) cons else // we're at a chunk row and // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += v(chunk_row * cols->chunk_size + r) @@ -853,7 +853,7 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, // function somenumber result = 0; - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need // to treat the last chunk row and column @@ -862,16 +862,16 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); - const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const number *val_ptr = val; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector::const_iterator u_ptr = u.begin(); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -891,8 +891,8 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, else // we're at a chunk column that // has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -911,7 +911,7 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, // necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -924,8 +924,8 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, { // we're at a chunk row but not // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -935,8 +935,8 @@ ChunkSparseMatrix::matrix_scalar_product (const Vector &u, else // we're at a chunk row and // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) result += u(chunk_row * cols->chunk_size + r) @@ -960,7 +960,7 @@ ChunkSparseMatrix::l1_norm () const Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all rows and columns; it is // safe to also loop over the padding @@ -970,11 +970,11 @@ ChunkSparseMatrix::l1_norm () const Vector column_sums(cols->sparsity_pattern.n_cols() * cols->chunk_size); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row]; + for (size_type chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row]; jsparsity_pattern.rowstart[chunk_row+1] ; ++j) - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int s=0; schunk_size; ++s) + for (size_type r=0; rchunk_size; ++r) + for (size_type s=0; schunk_size; ++s) column_sums(cols->sparsity_pattern.colnums[j] * cols->chunk_size + s) += numbers::NumberTraits::abs(val[j * cols->chunk_size * @@ -1000,7 +1000,7 @@ ChunkSparseMatrix::linfty_norm () const // done in the SparseMatrix class but since // it is rarely called in time critical // places it is probably not worth it - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all rows and columns; it is // safe to also loop over the padding @@ -1010,11 +1010,11 @@ ChunkSparseMatrix::linfty_norm () const Vector row_sums(cols->sparsity_pattern.n_rows() * cols->chunk_size); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row]; + for (size_type chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row]; jsparsity_pattern.rowstart[chunk_row+1] ; ++j) - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int s=0; schunk_size; ++s) + for (size_type r=0; rchunk_size; ++r) + for (size_type s=0; schunk_size; ++s) row_sums(chunk_row * cols->chunk_size + r) += numbers::NumberTraits::abs(val[j * cols->chunk_size * cols->chunk_size + @@ -1073,7 +1073,7 @@ ChunkSparseMatrix::residual (Vector &dst, // vmult_add, except that we subtract // rather than add A*u ///////// - const unsigned int n_chunk_rows = cols->sparsity_pattern.n_rows(); + const size_type n_chunk_rows = cols->sparsity_pattern.n_rows(); // loop over all chunks. note that we need // to treat the last chunk row and column @@ -1082,16 +1082,16 @@ ChunkSparseMatrix::residual (Vector &dst, const bool rows_have_padding = (m() % cols->chunk_size != 0), cols_have_padding = (n() % cols->chunk_size != 0); - const unsigned int n_regular_chunk_rows + const size_type n_regular_chunk_rows = (rows_have_padding ? n_chunk_rows-1 : n_chunk_rows); const number *val_ptr = val; - const unsigned int *colnum_ptr = cols->sparsity_pattern.colnums; + const size_type *colnum_ptr = cols->sparsity_pattern.colnums; typename Vector::iterator dst_ptr = dst.begin(); - for (unsigned int chunk_row=0; chunk_rowsparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -1109,8 +1109,8 @@ ChunkSparseMatrix::residual (Vector &dst, else // we're at a chunk column that // has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); @@ -1127,7 +1127,7 @@ ChunkSparseMatrix::residual (Vector &dst, // necessary if (rows_have_padding) { - const unsigned int chunk_row = n_chunk_rows - 1; + const size_type chunk_row = n_chunk_rows - 1; const number *const val_end_of_row = &val[cols->sparsity_pattern.rowstart[chunk_row+1] * cols->chunk_size @@ -1140,8 +1140,8 @@ ChunkSparseMatrix::residual (Vector &dst, { // we're at a chunk row but not // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); @@ -1149,8 +1149,8 @@ ChunkSparseMatrix::residual (Vector &dst, else // we're at a chunk row and // column that has padding - for (unsigned int r=0; rchunk_size; ++r) - for (unsigned int c=0; cchunk_size; ++c) + for (size_type r=0; rchunk_size; ++r) + for (size_type c=0; cchunk_size; ++c) dst(chunk_row * cols->chunk_size + r) -= (val_ptr[r*cols->chunk_size + c] * u(*colnum_ptr * cols->chunk_size + c)); @@ -1278,8 +1278,8 @@ template template void ChunkSparseMatrix::PSOR (Vector &dst, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const number /*om*/) const { Assert (cols != 0, ExcNotInitialized()); @@ -1300,8 +1300,8 @@ template template void ChunkSparseMatrix::TPSOR (Vector &dst, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const number /*om*/) const { Assert (cols != 0, ExcNotInitialized()); @@ -1444,9 +1444,9 @@ void ChunkSparseMatrix::print_formatted (std::ostream &out, width = precision+2; } - for (unsigned int i=0; isparsity_pattern(i,j) != SparsityPattern::invalid_entry) out << std::setw(width) << val[cols->sparsity_pattern(i,j)] * denominator << ' '; @@ -1472,28 +1472,28 @@ void ChunkSparseMatrix::print_pattern (std::ostream &out, Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - const unsigned int chunk_size = cols->get_chunk_size(); + const size_type chunk_size = cols->get_chunk_size(); // loop over all chunk rows and columns, // and each time we find something repeat // it chunk_size times in both directions - for (unsigned int i=0; isparsity_pattern.n_rows(); ++i) + for (size_type i=0; isparsity_pattern.n_rows(); ++i) { - for (unsigned int d=0; dsparsity_pattern.n_cols(); ++j) + for (size_type d=0; dsparsity_pattern.n_cols(); ++j) if (cols->sparsity_pattern(i,j) == SparsityPattern::invalid_entry) { - for (unsigned int e=0; esparsity_pattern(i,j)]) > threshold) { - for (unsigned int e=0; e class ChunkSparseMatrix; class ChunkSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; /** * Define a value which is used @@ -71,7 +75,7 @@ public: * but the actual value of the * variable may change over time. */ - static const unsigned int invalid_entry = SparsityPattern::invalid_entry; + static const size_type invalid_entry = SparsityPattern::invalid_entry; /** * Initialize the matrix empty, @@ -127,19 +131,19 @@ public: * @arg max_per_row maximum * number of nonzero entries per row */ - ChunkSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n, - const unsigned int max_chunks_per_row, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_chunks_per_row, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_chunks_per_row, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_chunks_per_row, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -154,19 +158,19 @@ public: * each row. This vector must * have one entry for each row. */ - ChunkSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n, - const std::vector &row_lengths, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -182,9 +186,9 @@ public: * taking row and column numbers * separately. */ - ChunkSparsityPattern (const types::global_dof_index n, - const unsigned int max_per_row, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type n, + const size_type max_per_row, + const size_type chunk_size); /** * Initialize a quadratic matrix. @@ -196,17 +200,17 @@ public: * each row. This vector must * have one entry for each row. */ - ChunkSparsityPattern (const types::global_dof_index m, - const std::vector &row_lengths, - const unsigned int chunk_size); + ChunkSparsityPattern (const size_type m, + const std::vector &row_lengths, + const size_type chunk_size); /** * @deprecated This constructor is deprecated. Use the version * without the last argument */ - ChunkSparsityPattern (const unsigned int m, - const std::vector &row_lengths, - const unsigned int chunk_size, + ChunkSparsityPattern (const size_type m, + const std::vector &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -235,19 +239,19 @@ public: * operations to the other * reinit function. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n, - const unsigned int max_per_row, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size, + void reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -274,38 +278,38 @@ public: * optimized access in relaxation * methods of SparseMatrix. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n, - const std::vector &row_lengths, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const unsigned int chunk_size, - const bool optimize_diagonal) DEAL_II_DEPRECATED; + void reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size, + const bool optimize_diagonal) DEAL_II_DEPRECATED; /** * Same as above, but with a * VectorSlice argument instead. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n, - const VectorSlice > &row_lengths, - const unsigned int chunk_size); + void reinit (const size_type m, + const size_type n, + const VectorSlice > &row_lengths, + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ - void reinit (const unsigned int m, - const unsigned int n, - const VectorSlice > &row_lengths, - const unsigned int chunk_size, + void reinit (const size_type m, + const size_type n, + const VectorSlice > &row_lengths, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -376,13 +380,13 @@ public: * contents of one * line. Dereferencing these * inner iterators must either - * yield a pair of an unsigned - * integer as column index and a + * yield a pair of a size_type + * as column index and a * value of arbitrary type (such * a type would be used if we * wanted to describe a sparse * matrix with one such object), - * or simply an unsigned integer + * or simply a size_type * (of we only wanted to describe * a sparsity pattern). The * function is able to determine @@ -407,8 +411,8 @@ public: * may be used to fill a sparsity * pattern: * @code - * std::vector > column_indices (n_rows); - * for (unsigned int row=0; row > column_indices (n_rows); + * for (size_type row=0; rowend (namely * std::vectors), and the * inner iterators dereferenced - * yield unsigned integers as + * yield size_type as * column indices. Note that we * could have replaced each of * the two std::vector @@ -437,8 +441,8 @@ public: * whole matrix, not only a * sparsity pattern: * @code - * std::vector > entries (n_rows); - * for (unsigned int row=0; row > entries (n_rows); + * for (size_type row=0; rowstd::vector * could be replaced by * std::list, and the inner - * std::map + * std::map * could be replaced by - * std::vector >, + * std::vector >, * or a list or set of such * pairs, as they all return * iterators that point to such * pairs. */ template - void copy_from (const types::global_dof_index n_rows, - const types::global_dof_index n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size); + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function * without the last argument */ template - void copy_from (const unsigned int n_rows, - const unsigned int n_cols, + void copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -498,7 +502,7 @@ public: */ template void copy_from (const SparsityType &csp, - const unsigned int chunk_size); + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function @@ -506,7 +510,7 @@ public: */ template void copy_from (const SparsityType &csp, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -522,7 +526,7 @@ public: */ template void copy_from (const FullMatrix &matrix, - const unsigned int chunk_size); + const size_type chunk_size); /** * @deprecated This function is deprecated. Use the function @@ -530,7 +534,7 @@ public: */ template void copy_from (const FullMatrix &matrix, - const unsigned int chunk_size, + const size_type chunk_size, const bool optimize_diagonal) DEAL_II_DEPRECATED; /** @@ -546,7 +550,7 @@ public: * argument when constructing this * object. */ - unsigned int get_chunk_size () const; + size_type get_chunk_size () const; /** * Return the maximum number of entries per @@ -556,7 +560,7 @@ public: * number of entries actually allocated by * the user. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the matrix. @@ -566,8 +570,8 @@ public: * If the entry already exists, nothing * bad happens. */ - void add (const types::global_dof_index i, - const types::global_dof_index j); + void add (const size_type i, + const size_type j); /** * Make the sparsity pattern @@ -587,26 +591,26 @@ public: * matrix, which equals the dimension * of the image space. */ - inline types::global_dof_index n_rows () const; + inline size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - inline types::global_dof_index n_cols () const; + inline size_type n_cols () const; /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const types::global_dof_index i, - const types::global_dof_index j) const; + bool exists (const size_type i, + const size_type j) const; /** * Number of entries in a specific row. */ - unsigned int row_length (const types::global_dof_index row) const; + size_type row_length (const size_type row) const; /** * Compute the bandwidth of the matrix @@ -618,7 +622,7 @@ public: * bandwidth a $n\times m$ matrix can * have is $\max\{n-1,m-1\}$. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements of @@ -632,7 +636,7 @@ public: * matrix struct is compressed. It does not * make too much sense otherwise anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether the structure is @@ -825,18 +829,18 @@ private: * Number of rows that this sparsity * structure shall represent. */ - types::global_dof_index rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - types::global_dof_index cols; + size_type cols; /** * The size of chunks. */ - unsigned int chunk_size; + size_type chunk_size; /** * The reduced sparsity pattern. We store @@ -861,7 +865,7 @@ private: inline -types::global_dof_index +size_type ChunkSparsityPattern::n_rows () const { return rows; @@ -869,7 +873,7 @@ ChunkSparsityPattern::n_rows () const inline -types::global_dof_index +size_type ChunkSparsityPattern::n_cols () const { return cols; @@ -878,7 +882,7 @@ ChunkSparsityPattern::n_cols () const inline -unsigned int +size_type ChunkSparsityPattern::get_chunk_size () const { return chunk_size; @@ -905,11 +909,11 @@ ChunkSparsityPattern::optimize_diagonal () const template void -ChunkSparsityPattern::copy_from (const types::global_dof_index n_rows, - const types::global_dof_index n_cols, +ChunkSparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (n_rows, n_cols, begin, end, chunk_size); @@ -919,13 +923,13 @@ ChunkSparsityPattern::copy_from (const types::global_dof_index n_rows, template void -ChunkSparsityPattern::copy_from (const unsigned int n_rows, - const unsigned int n_cols, +ChunkSparsityPattern::copy_from (const size_type n_rows, + const size_type n_cols, const ForwardIterator begin, const ForwardIterator end, - const unsigned int chunk_size) + const size_type chunk_size) { - Assert (static_cast(std::distance (begin, end)) == n_rows, + Assert (static_cast(std::distance (begin, end)) == n_rows, ExcIteratorRange (std::distance (begin, end), n_rows)); // first determine row lengths for @@ -939,7 +943,7 @@ ChunkSparsityPattern::copy_from (const unsigned int n_rows, // diagonal entry is in a certain // row or not const bool is_square = (n_rows == n_cols); - std::vector row_lengths; + std::vector row_lengths; row_lengths.reserve(n_rows); for (ForwardIterator i=begin; i!=end; ++i) row_lengths.push_back (std::distance (i->begin(), i->end()) @@ -949,14 +953,14 @@ ChunkSparsityPattern::copy_from (const unsigned int n_rows, // now enter all the elements into // the matrix - unsigned int row = 0; + size_type row = 0; typedef typename std::iterator_traits::value_type::const_iterator inner_iterator; for (ForwardIterator i=begin; i!=end; ++i, ++row) { const inner_iterator end_of_row = i->end(); for (inner_iterator j=i->begin(); j!=end_of_row; ++j) { - const unsigned int col + const size_type col = internal::SparsityPatternTools::get_column_index_from_iterator(*j); Assert (col < n_cols, ExcInvalidIndex(col,n_cols)); 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 7ef7288685..4bca0c0f1b 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 @@ -106,13 +106,18 @@ template class SparseMatrix; class CompressedSetSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::set::const_iterator row_iterator; + typedef std::set::const_iterator row_iterator; /** @@ -150,14 +155,14 @@ public: * matrix with @p m rows and * @p n columns. */ - CompressedSetSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n); + CompressedSetSparsityPattern (const size_type m, + const size_type n); /** * Initialize a square matrix of * dimension @p n. */ - CompressedSetSparsityPattern (const types::global_dof_index n); + CompressedSetSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -177,8 +182,8 @@ public: * max_entries_per_row() nonzero * entries per row. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n); + void reinit (const size_type m, + const size_type n); /** * Since this object is kept @@ -206,15 +211,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const types::global_dof_index i, - const types::global_dof_index j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -223,17 +228,17 @@ public: * happens. */ template - void add_entries (const types::global_dof_index row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const types::global_dof_index i, - const types::global_dof_index j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -289,19 +294,19 @@ public: * matrix, which equals the dimension * of the image space. */ - types::global_dof_index n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - types::global_dof_index n_cols () const; + size_type n_cols () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const types::global_dof_index row) const; + size_type row_length (const size_type row) const; /** * Return an iterator that can loop over @@ -309,12 +314,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const types::global_dof_index row) const; + row_iterator row_begin (const size_type row) const; /** * End iterator for the given row. */ - row_iterator row_end (const types::global_dof_index row) const; + row_iterator row_end (const size_type row) const; /** @@ -325,14 +330,14 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity * pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether this object stores only @@ -357,13 +362,13 @@ private: * Number of rows that this sparsity * structure shall represent. */ - types::global_dof_index rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - types::global_dof_index cols; + size_type cols; /** * For each row of the matrix, store the @@ -374,7 +379,7 @@ private: */ struct Line { - std::set entries; + std::set entries; /** * Constructor. @@ -385,7 +390,7 @@ private: * Add the given column number to * this line. */ - void add (const types::global_dof_index col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -417,7 +422,7 @@ CompressedSetSparsityPattern::Line::Line () inline void -CompressedSetSparsityPattern::Line::add (const types::global_dof_index j) +CompressedSetSparsityPattern::Line::add (const size_type j) { entries.insert (j); } @@ -436,7 +441,7 @@ CompressedSetSparsityPattern::Line::add_entries (ForwardIterator begin, inline -types::global_dof_index +size_type CompressedSetSparsityPattern::n_rows () const { return rows; @@ -445,7 +450,7 @@ CompressedSetSparsityPattern::n_rows () const inline -types::global_dof_index +size_type CompressedSetSparsityPattern::n_cols () const { return cols; @@ -455,8 +460,8 @@ CompressedSetSparsityPattern::n_cols () const inline void -CompressedSetSparsityPattern::add (const types::global_dof_index i, - const types::global_dof_index j) +CompressedSetSparsityPattern::add (const size_type i, + const size_type j) { Assert (i inline void -CompressedSetSparsityPattern::add_entries (const types::global_dof_index row, +CompressedSetSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool /*indices_are_sorted*/) @@ -482,8 +487,8 @@ CompressedSetSparsityPattern::add_entries (const types::global_dof_index row, inline -unsigned int -CompressedSetSparsityPattern::row_length (const types::global_dof_index row) const +size_type +CompressedSetSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); @@ -494,7 +499,7 @@ CompressedSetSparsityPattern::row_length (const types::global_dof_index row) con inline CompressedSetSparsityPattern::row_iterator -CompressedSetSparsityPattern::row_begin (const types::global_dof_index row) const +CompressedSetSparsityPattern::row_begin (const size_type row) const { return (lines[row].entries.begin ()); } @@ -503,7 +508,7 @@ CompressedSetSparsityPattern::row_begin (const types::global_dof_index row) cons inline CompressedSetSparsityPattern::row_iterator -CompressedSetSparsityPattern::row_end (const types::global_dof_index row) const +CompressedSetSparsityPattern::row_end (const size_type row) const { return (lines[row].entries.end ()); } 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 78209fde07..6ebde752c4 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 @@ -87,13 +87,18 @@ template class SparseMatrix; class CompressedSimpleSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::vector::const_iterator row_iterator; + typedef std::vector::const_iterator row_iterator; /** * Initialize the matrix empty, @@ -136,15 +141,15 @@ public: * default argument keeps all * entries. */ - CompressedSimpleSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n, + CompressedSimpleSparsityPattern (const size_type m, + const size_type n, const IndexSet &rowset = IndexSet()); /** * Initialize a square matrix of * dimension @p n. */ - CompressedSimpleSparsityPattern (const types::global_dof_index n); + CompressedSimpleSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -170,8 +175,8 @@ public: * default argument keeps all * entries. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n, + void reinit (const size_type m, + const size_type n, const IndexSet &rowset = IndexSet()); /** @@ -200,15 +205,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const types::global_dof_index i, - const types::global_dof_index j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -217,17 +222,17 @@ public: * happens. */ template - void add_entries (const types::global_dof_index row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_unique_and_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_unique_and_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const types::global_dof_index i, - const types::global_dof_index j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -283,14 +288,14 @@ public: * matrix, which equals the dimension * of the image space. */ - types::global_dof_index n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - types::global_dof_index n_cols () const; + size_type n_cols () const; /** * Number of entries in a @@ -300,15 +305,15 @@ public: * index set of rows that we want * to store. */ - unsigned int row_length (const types::global_dof_index row) const; + size_type row_length (const size_type row) const; /** * Access to column number field. * Return the column number of * the @p indexth entry in @p row. */ - unsigned int column_number (const types::global_dof_index row, - const types::global_dof_index index) const; + size_type column_number (const size_type row, + const size_type index) const; /** * Return an iterator that can loop over @@ -316,12 +321,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const types::global_dof_index row) const; + row_iterator row_begin (const size_type row) const; /** * Returns the end of the current row. */ - row_iterator row_end (const types::global_dof_index row) const; + row_iterator row_end (const size_type row) const; /** * Compute the bandwidth of the matrix * represented by this structure. The @@ -330,13 +335,13 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return the IndexSet that sets which @@ -370,20 +375,20 @@ public: * memory consumption (in bytes) * of this object. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; private: /** * Number of rows that this sparsity * structure shall represent. */ - types::global_dof_index rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - types::global_dof_index cols; + size_type cols; /** * A set that contains the valid rows. @@ -409,7 +414,7 @@ private: * this row. This array is always * kept sorted. */ - std::vector entries; + std::vector entries; /** * Constructor. @@ -420,7 +425,7 @@ private: * Add the given column number to * this line. */ - void add (const types::global_dof_index col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -434,7 +439,7 @@ private: /** * estimates memory consumption. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; }; @@ -452,7 +457,7 @@ private: inline void -CompressedSimpleSparsityPattern::Line::add (const types::global_dof_index j) +CompressedSimpleSparsityPattern::Line::add (const size_type j) { // first check the last element (or if line // is still empty) @@ -464,7 +469,7 @@ CompressedSimpleSparsityPattern::Line::add (const types::global_dof_index j) // do a binary search to find the place // where to insert: - std::vector::iterator + std::vector::iterator it = Utilities::lower_bound(entries.begin(), entries.end(), j); @@ -483,7 +488,7 @@ CompressedSimpleSparsityPattern::Line::add (const types::global_dof_index j) inline -types::global_dof_index +size_type CompressedSimpleSparsityPattern::n_rows () const { return rows; @@ -492,7 +497,7 @@ CompressedSimpleSparsityPattern::n_rows () const inline -types::global_dof_index +size_type CompressedSimpleSparsityPattern::n_cols () const { return cols; @@ -502,8 +507,8 @@ CompressedSimpleSparsityPattern::n_cols () const inline void -CompressedSimpleSparsityPattern::add (const types::global_dof_index i, - const types::global_dof_index j) +CompressedSimpleSparsityPattern::add (const size_type i, + const size_type j) { Assert (i 0 && !rowset.is_element(i)) return; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? i : rowset.index_within_set(i); lines[rowindex].add (j); } @@ -521,7 +526,7 @@ CompressedSimpleSparsityPattern::add (const types::global_dof_index i, template inline void -CompressedSimpleSparsityPattern::add_entries (const types::global_dof_index row, +CompressedSimpleSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted) @@ -531,7 +536,7 @@ CompressedSimpleSparsityPattern::add_entries (const types::global_dof_index row, if (rowset.size() > 0 && !rowset.is_element(row)) return; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.index_within_set(row); lines[rowindex].add_entries (begin, end, indices_are_sorted); } @@ -545,14 +550,14 @@ CompressedSimpleSparsityPattern::Line::Line () inline -unsigned int -CompressedSimpleSparsityPattern::row_length (const types::global_dof_index row) const +size_type +CompressedSimpleSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); if (rowset.size() > 0 && !rowset.is_element(row)) return 0; - const unsigned int rowindex = + const size_type rowindex = rowset.size()==0 ? row : rowset.index_within_set(row); return lines[rowindex].entries.size(); } @@ -560,14 +565,14 @@ CompressedSimpleSparsityPattern::row_length (const types::global_dof_index row) inline -unsigned int -CompressedSimpleSparsityPattern::column_number (const types::global_dof_index row, - const types::global_dof_index index) const +size_type +CompressedSimpleSparsityPattern::column_number (const size_type row, + const size_type index) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); Assert( rowset.size() == 0 || rowset.is_element(row), ExcInternalError()); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; Assert (index < lines[local_row].entries.size(), ExcIndexRange (index, 0, lines[local_row].entries.size())); return lines[local_row].entries[index]; @@ -577,10 +582,10 @@ CompressedSimpleSparsityPattern::column_number (const types::global_dof_index ro inline CompressedSimpleSparsityPattern::row_iterator -CompressedSimpleSparsityPattern::row_begin (const types::global_dof_index row) const +CompressedSimpleSparsityPattern::row_begin (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; return lines[local_row].entries.begin(); } @@ -588,10 +593,10 @@ CompressedSimpleSparsityPattern::row_begin (const types::global_dof_index row) c inline CompressedSimpleSparsityPattern::row_iterator -CompressedSimpleSparsityPattern::row_end (const types::global_dof_index row) const +CompressedSimpleSparsityPattern::row_end (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); - const unsigned int local_row = rowset.size() ? rowset.index_within_set(row) : row; + const size_type local_row = rowset.size() ? rowset.index_within_set(row) : row; return lines[local_row].entries.end(); } 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 d0bbf926d8..f0a77f0b0a 100644 --- a/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h @@ -88,13 +88,18 @@ template class SparseMatrix; class CompressedSparsityPattern : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * An iterator that can be used to * iterate over the elements of a single * row. The result of dereferencing such * an iterator is a column index. */ - typedef std::vector::const_iterator row_iterator; + typedef std::vector::const_iterator row_iterator; /** * Initialize the matrix empty, @@ -131,14 +136,14 @@ public: * matrix with @p m rows and * @p n columns. */ - CompressedSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n); + CompressedSparsityPattern (const size_type m, + const size_type n); /** * Initialize a square matrix of * dimension @p n. */ - CompressedSparsityPattern (const types::global_dof_index n); + CompressedSparsityPattern (const size_type n); /** * Copy operator. For this the @@ -158,8 +163,8 @@ public: * max_entries_per_row() nonzero * entries per row. */ - void reinit (const types::global_dof_index m, - const types::global_dof_index n); + void reinit (const size_type m, + const size_type n); /** * Since this object is kept @@ -187,15 +192,15 @@ public: * this number may change as * entries are added. */ - unsigned int max_entries_per_row () const; + size_type max_entries_per_row () const; /** * Add a nonzero entry to the * matrix. If the entry already * exists, nothing bad happens. */ - void add (const types::global_dof_index i, - const types::global_dof_index j); + void add (const size_type i, + const size_type j); /** * Add several nonzero entries to the @@ -204,17 +209,17 @@ public: * happens. */ template - void add_entries (const types::global_dof_index row, - ForwardIterator begin, - ForwardIterator end, - const bool indices_are_unique_and_sorted = false); + void add_entries (const size_type row, + ForwardIterator begin, + ForwardIterator end, + const bool indices_are_unique_and_sorted = false); /** * Check if a value at a certain * position may be non-zero. */ - bool exists (const types::global_dof_index i, - const types::global_dof_index j) const; + bool exists (const size_type i, + const size_type j) const; /** * Make the sparsity pattern @@ -270,27 +275,27 @@ public: * matrix, which equals the dimension * of the image space. */ - types::global_dof_index n_rows () const; + size_type n_rows () const; /** * Return number of columns of this * matrix, which equals the dimension * of the range space. */ - types::global_dof_index n_cols () const; + size_type n_cols () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const types::global_dof_index row) const; + size_type row_length (const size_type row) const; /** * Access to column number field. * Return the column number of * the @p indexth entry in @p row. */ - unsigned int column_number (const types::global_dof_index row, - const unsigned int index) const; + size_type column_number (const size_type row, + const size_type index) const; /** * Return an iterator that can loop over @@ -298,12 +303,12 @@ public: * row. Dereferencing the iterator yields * a column index. */ - row_iterator row_begin (const types::global_dof_index row) const; + row_iterator row_begin (const size_type row) const; /** * Returns the end of the current row. */ - row_iterator row_end (const types::global_dof_index row) const; + row_iterator row_end (const size_type row) const; /** * Compute the bandwidth of the matrix @@ -313,14 +318,14 @@ public: * $(i,j)$ represents a nonzero entry * of the matrix. */ - unsigned int bandwidth () const; + size_type bandwidth () const; /** * Return the number of nonzero elements * allocated through this sparsity * pattern. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Return whether this object stores only @@ -345,13 +350,13 @@ private: * Number of rows that this sparsity * structure shall represent. */ - types::global_dof_index rows; + size_type rows; /** * Number of columns that this sparsity * structure shall represent. */ - types::global_dof_index cols; + size_type cols; /** * Store some data for each row @@ -447,7 +452,7 @@ private: * Add the given column number to * this line. */ - void add (const types::global_dof_index col_num); + void add (const size_type col_num); /** * Add the columns specified by the @@ -480,7 +485,7 @@ private: inline void -CompressedSparsityPattern::Line::add (const types::global_dof_index j) +CompressedSparsityPattern::Line::add (const size_type j) { // first check whether this entry is // already in the cache. if so, we can @@ -502,7 +507,7 @@ CompressedSparsityPattern::Line::add (const types::global_dof_index j) inline -types::global_dof_index +size_type CompressedSparsityPattern::n_rows () const { return rows; @@ -511,7 +516,7 @@ CompressedSparsityPattern::n_rows () const inline -types::global_dof_index +size_type CompressedSparsityPattern::n_cols () const { return cols; @@ -521,8 +526,8 @@ CompressedSparsityPattern::n_cols () const inline void -CompressedSparsityPattern::add (const types::global_dof_index i, - const types::global_dof_index j) +CompressedSparsityPattern::add (const size_type i, + const size_type j) { Assert (i inline void -CompressedSparsityPattern::add_entries (const types::global_dof_index row, +CompressedSparsityPattern::add_entries (const size_type row, ForwardIterator begin, ForwardIterator end, const bool indices_are_sorted) @@ -556,8 +561,8 @@ CompressedSparsityPattern::Line::Line () inline -unsigned int -CompressedSparsityPattern::row_length (const types::global_dof_index row) const +size_type +CompressedSparsityPattern::row_length (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); @@ -569,9 +574,9 @@ CompressedSparsityPattern::row_length (const types::global_dof_index row) const inline -unsigned int -CompressedSparsityPattern::column_number (const types::global_dof_index row, - const unsigned int index) const +size_type +CompressedSparsityPattern::column_number (const size_type row, + const size_type index) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); Assert (index < lines[row].entries.size(), @@ -586,7 +591,7 @@ CompressedSparsityPattern::column_number (const types::global_dof_index row, inline CompressedSparsityPattern::row_iterator -CompressedSparsityPattern::row_begin (const types::global_dof_index row) const +CompressedSparsityPattern::row_begin (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); @@ -599,7 +604,7 @@ CompressedSparsityPattern::row_begin (const types::global_dof_index row) const inline CompressedSparsityPattern::row_iterator -CompressedSparsityPattern::row_end (const types::global_dof_index row) const +CompressedSparsityPattern::row_end (const size_type row) const { Assert (row < n_rows(), ExcIndexRange (row, 0, n_rows())); return lines[row].entries.end(); diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 3f7f3eb56c..e8a1c7cf8e 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -54,8 +54,8 @@ namespace internals //TODO[WB]: We should have a function of the kind -// ConstraintMatrix::add_constraint (const types::global_dof_index constrained_dof, -// const std::vector > &entries, +// ConstraintMatrix::add_constraint (const size_type constrained_dof, +// const std::vector > &entries, // const double inhomogeneity = 0); // rather than building up constraints piecemeal through add_line/add_entry // etc. This would also eliminate the possibility of accidentally changing @@ -139,6 +139,11 @@ namespace internals class ConstraintMatrix : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * An enum that describes what should * happen if the two ConstraintMatrix @@ -221,7 +226,7 @@ public: * line. Always returns true if not in * the distributed case. */ - bool can_store_line (const types::global_dof_index line_index) const; + bool can_store_line (const size_type line_index) const; /** * This function copies the content of @p @@ -271,7 +276,7 @@ public: * line already exists, then the function * simply returns without doing anything. */ - void add_line (const types::global_dof_index line); + void add_line (const size_type line); /** * Call the first add_line() function for @@ -315,7 +320,7 @@ public: * inhomogeneities using * set_inhomogeneity(). */ - void add_lines (const std::set &lines); + void add_lines (const std::set &lines); /** * Call the first add_line() function for @@ -360,8 +365,8 @@ public: * same. Thus, it does no harm to * enter a constraint twice. */ - void add_entry (const types::global_dof_index line, - const types::global_dof_index column, + void add_entry (const size_type line, + const size_type column, const double value); /** @@ -373,8 +378,8 @@ public: * function several times, but is * faster. */ - void add_entries (const types::global_dof_index line, - const std::vector > &col_val_pairs); + void add_entries (const size_type line, + const std::vector > &col_val_pairs); /** * Set an imhomogeneity to the @@ -385,8 +390,8 @@ public: * @note the line needs to be added with * one of the add_line() calls first. */ - void set_inhomogeneity (const types::global_dof_index line, - const double value); + void set_inhomogeneity (const size_type line, + const double value); /** * Close the filling of entries. Since @@ -471,7 +476,7 @@ public: * finally merge() them together * again. */ - void shift (const types::global_dof_index offset); + void shift (const size_type offset); /** * Clear all entries of this @@ -499,7 +504,7 @@ public: * Return number of constraints stored in * this matrix. */ - unsigned int n_constraints () const; + size_type n_constraints () const; /** * Return whether the degree of freedom @@ -515,7 +520,7 @@ public: * called, we have to perform a linear * search through all entries. */ - bool is_constrained (const types::global_dof_index index) const; + bool is_constrained (const size_type index) const; /** * Return whether the dof is @@ -536,7 +541,7 @@ public: * freedom but with a weight different * from one. */ - bool is_identity_constrained (const types::global_dof_index index) const; + bool is_identity_constrained (const size_type index) const; /** * Return the maximum number of other @@ -555,7 +560,7 @@ public: * constrained node are indirected to * the nodes it is constrained to. */ - unsigned int max_constraint_indirections () const; + size_type max_constraint_indirections () const; /** * Returns true in case the @@ -563,7 +568,7 @@ public: * non-trivial inhomogeneous valeus set * to the dof. */ - bool is_inhomogeneously_constrained (const types::global_dof_index index) const; + bool is_inhomogeneously_constrained (const size_type index) const; /** * Returns false if all @@ -580,8 +585,8 @@ public: * zero pointer in case the dof is not * constrained. */ - const std::vector > * - get_constraint_entries (const types::global_dof_index line) const; + const std::vector > * + get_constraint_entries (const size_type line) const; /** * Returns the value of the inhomogeneity @@ -589,7 +594,7 @@ public: * line. Unconstrained dofs also return a * zero value. */ - double get_inhomogeneity (const types::global_dof_index line) const; + double get_inhomogeneity (const size_type line) const; /** * Print the constraint lines. Mainly @@ -631,7 +636,7 @@ public: * consumption (in bytes) of this * object. */ - std::size_t memory_consumption () const; + size_type memory_consumption () const; /** * @} @@ -985,9 +990,9 @@ public: */ template void - distribute_local_to_global (const InVector &local_vector, - const std::vector &local_dof_indices, - OutVector &global_vector) const; + distribute_local_to_global (const InVector &local_vector, + const std::vector &local_dof_indices, + OutVector &global_vector) const; /** * This function takes a vector of @@ -1062,10 +1067,10 @@ public: */ template void - distribute_local_to_global (const Vector &local_vector, - const std::vector &local_dof_indices, - VectorType &global_vector, - const FullMatrix &local_matrix) const; + distribute_local_to_global (const Vector &local_vector, + const std::vector &local_dof_indices, + VectorType &global_vector, + const FullMatrix &local_matrix) const; /** * Enter a single value into a @@ -1073,9 +1078,9 @@ public: */ template void - distribute_local_to_global (const unsigned int index, - const double value, - VectorType &global_vector) const; + distribute_local_to_global (const size_type index, + const double value, + VectorType &global_vector) const; /** * This function takes a pointer to a @@ -1195,9 +1200,9 @@ public: */ template void - distribute_local_to_global (const FullMatrix &local_matrix, - const std::vector &local_dof_indices, - MatrixType &global_matrix) const; + distribute_local_to_global (const FullMatrix &local_matrix, + const std::vector &local_dof_indices, + MatrixType &global_matrix) const; /** * Does the same as the function @@ -1206,10 +1211,10 @@ public: */ template void - distribute_local_to_global (const FullMatrix &local_matrix, - const std::vector &row_indices, - const std::vector &col_indices, - MatrixType &global_matrix) const; + distribute_local_to_global (const FullMatrix &local_matrix, + const std::vector &row_indices, + const std::vector &col_indices, + MatrixType &global_matrix) const; /** * This function simultaneously @@ -1231,12 +1236,12 @@ public: */ template void - distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, - const std::vector &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs = false) const; + distribute_local_to_global (const FullMatrix &local_matrix, + const Vector &local_vector, + const std::vector &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs = false) const; /** * Do a similar operation as the @@ -1319,9 +1324,9 @@ public: */ template void - add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries = true, + add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries = true, const Table<2,bool> &dof_mask = default_empty_table) const; /** @@ -1332,11 +1337,11 @@ public: template void - add_entries_local_to_global (const std::vector &row_indices, - const std::vector &col_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries = true, - const Table<2,bool> &dof_mask = default_empty_table) const; + add_entries_local_to_global (const std::vector &row_indices, + const std::vector &col_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries = true, + const Table<2,bool> &dof_mask = default_empty_table) const; /** * This function imports values from a @@ -1451,7 +1456,7 @@ public: * @ingroup Exceptions */ DeclException1 (ExcLineInexistant, - types::global_dof_index, + size_type, << "The specified line " << arg1 << " does not exist."); /** @@ -1520,7 +1525,7 @@ private: * of entries that make up the homogenous * part of a constraint. */ - typedef std::vector > Entries; + typedef std::vector > Entries; /** * Number of this line. Since only @@ -1529,7 +1534,7 @@ private: * and have to store the line * number explicitly. */ - types::global_dof_index line; + size_type line; /** * Row numbers and values of the @@ -1601,7 +1606,7 @@ private: std::vector lines; /** - * A list of unsigned integers that + * A list of size_type that * contains the position of the * ConstraintLine of a constrained degree * of freedom, or @@ -1658,7 +1663,7 @@ private: * contributions into vectors and * matrices. */ - std::vector lines_cache; + std::vector lines_cache; /** * This IndexSet is used to limit the @@ -1681,7 +1686,7 @@ private: * index of line @p line in the vector * lines_cache using local_lines. */ - unsigned int calculate_line_index (const types::global_dof_index line) const; + size_type calculate_line_index (const size_type line) const; /** * Return @p true if the weight of an @@ -1690,7 +1695,7 @@ private: * used to delete entries with zero * weight. */ - static bool check_zero_weight (const std::pair &p); + static bool check_zero_weight (const std::pair &p); /** * Dummy table that serves as default @@ -1706,12 +1711,12 @@ private: */ template void - distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, - const std::vector &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, + distribute_local_to_global (const FullMatrix &local_matrix, + const Vector &local_vector, + const std::vector &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type) const; /** @@ -1721,12 +1726,12 @@ private: */ template void - distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, - const std::vector &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, + distribute_local_to_global (const FullMatrix &local_matrix, + const Vector &local_vector, + const std::vector &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type) const; /** @@ -1736,10 +1741,10 @@ private: */ template void - add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, + add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type) const; /** @@ -1749,10 +1754,10 @@ private: */ template void - add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, + add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type) const; /** @@ -1766,7 +1771,7 @@ private: * row indices. */ void - make_sorted_row_list (const std::vector &local_dof_indices, + make_sorted_row_list (const std::vector &local_dof_indices, internals::GlobalRowsFromLocal &global_rows) const; /** @@ -1780,18 +1785,18 @@ private: * function. */ void - make_sorted_row_list (const std::vector &local_dof_indices, - std::vector &active_dofs) const; + make_sorted_row_list (const std::vector &local_dof_indices, + std::vector &active_dofs) const; /** * Internal helper function for * distribute_local_to_global function. */ double - resolve_vector_entry (const types::global_dof_index i, + resolve_vector_entry (const size_type i, const internals::GlobalRowsFromLocal &global_rows, const Vector &local_vector, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, const FullMatrix &local_matrix) const; }; @@ -1822,7 +1827,7 @@ ConstraintMatrix::ConstraintMatrix (const ConstraintMatrix &constraint_matrix) inline void -ConstraintMatrix::add_line (const types::global_dof_index line) +ConstraintMatrix::add_line (const size_type line) { Assert (sorted==false, ExcMatrixIsClosed()); @@ -1838,7 +1843,7 @@ ConstraintMatrix::add_line (const types::global_dof_index line) // :-) Assert (line != numbers::invalid_unsigned_int, ExcInternalError()); - const unsigned int line_index = calculate_line_index (line); + const size_type line_index = calculate_line_index (line); // check whether line already exists; it // may, in which case we can just quit @@ -1848,7 +1853,7 @@ ConstraintMatrix::add_line (const types::global_dof_index line) // if necessary enlarge vector of // existing entries for cache if (line_index >= lines_cache.size()) - lines_cache.resize (std::max(2*static_cast(lines_cache.size()), + lines_cache.resize (std::max(2*static_cast(lines_cache.size()), line_index+1), numbers::invalid_unsigned_int); @@ -1864,9 +1869,9 @@ ConstraintMatrix::add_line (const types::global_dof_index line) inline void -ConstraintMatrix::add_entry (const types::global_dof_index line, - const types::global_dof_index column, - const double value) +ConstraintMatrix::add_entry (const size_type line, + const size_type column, + const double value) { Assert (sorted==false, ExcMatrixIsClosed()); Assert (line != column, @@ -1901,10 +1906,10 @@ ConstraintMatrix::add_entry (const types::global_dof_index line, inline void -ConstraintMatrix::set_inhomogeneity (const types::global_dof_index line, - const double value) +ConstraintMatrix::set_inhomogeneity (const size_type line, + const double value) { - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); Assert( line_index < lines_cache.size() && lines_cache[line_index] != numbers::invalid_unsigned_int, ExcMessage("call add_line() before calling set_inhomogeneity()")); @@ -1916,7 +1921,7 @@ ConstraintMatrix::set_inhomogeneity (const types::global_dof_index line, inline -unsigned int +size_type ConstraintMatrix::n_constraints () const { return lines.size(); @@ -1926,9 +1931,9 @@ ConstraintMatrix::n_constraints () const inline bool -ConstraintMatrix::is_constrained (const types::global_dof_index index) const +ConstraintMatrix::is_constrained (const size_type index) const { - const unsigned int line_index = calculate_line_index(index); + const size_type line_index = calculate_line_index(index); return ((line_index < lines_cache.size()) && (lines_cache[line_index] != numbers::invalid_unsigned_int)); @@ -1938,12 +1943,12 @@ ConstraintMatrix::is_constrained (const types::global_dof_index index) const inline bool -ConstraintMatrix::is_inhomogeneously_constrained (const types::global_dof_index index) const +ConstraintMatrix::is_inhomogeneously_constrained (const size_type index) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(index); + const size_type line_index = calculate_line_index(index); if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_unsigned_int) return false; @@ -1957,13 +1962,13 @@ ConstraintMatrix::is_inhomogeneously_constrained (const types::global_dof_index inline -const std::vector > * -ConstraintMatrix::get_constraint_entries (const types::global_dof_index line) const +const std::vector > * +ConstraintMatrix::get_constraint_entries (const size_type line) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_unsigned_int) return 0; @@ -1975,12 +1980,12 @@ ConstraintMatrix::get_constraint_entries (const types::global_dof_index line) co inline double -ConstraintMatrix::get_inhomogeneity (const types::global_dof_index line) const +ConstraintMatrix::get_inhomogeneity (const size_type line) const { // check whether the entry is // constrained. could use is_constrained, but // that means computing the line index twice - const unsigned int line_index = calculate_line_index(line); + const size_type line_index = calculate_line_index(line); if (line_index >= lines_cache.size() || lines_cache[line_index] == numbers::invalid_unsigned_int) return 0; @@ -1990,8 +1995,8 @@ ConstraintMatrix::get_inhomogeneity (const types::global_dof_index line) const -inline unsigned int -ConstraintMatrix::calculate_line_index (const types::global_dof_index line) const +inline size_type +ConstraintMatrix::calculate_line_index (const size_type line) const { //IndexSet is unused (serial case) if (!local_lines.size()) @@ -2006,7 +2011,7 @@ ConstraintMatrix::calculate_line_index (const types::global_dof_index line) cons inline bool -ConstraintMatrix::can_store_line (types::global_dof_index line_index) const +ConstraintMatrix::can_store_line (size_type line_index) const { return !local_lines.size() || local_lines.is_element(line_index); } @@ -2016,9 +2021,9 @@ ConstraintMatrix::can_store_line (types::global_dof_index line_index) const template inline void ConstraintMatrix::distribute_local_to_global ( - const types::global_dof_index index, - const double value, - VectorType &global_vector) const + const size_type index, + const double value, + VectorType &global_vector) const { Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); @@ -2028,7 +2033,7 @@ void ConstraintMatrix::distribute_local_to_global ( { const ConstraintLine &position = lines[lines_cache[calculate_line_index(index)]]; - for (unsigned int j=0; j inline void ConstraintMatrix::distribute_local_to_global ( - const InVector &local_vector, - const std::vector &local_dof_indices, - OutVector &global_vector) const + const InVector &local_vector, + const std::vector &local_dof_indices, + OutVector &global_vector) const { Assert (local_vector.size() == local_dof_indices.size(), ExcDimensionMismatch(local_vector.size(), local_dof_indices.size())); @@ -2097,7 +2102,7 @@ void ConstraintMatrix::get_dof_values (const VectorType &global_vector, const ConstraintLine &position = lines[lines_cache[calculate_line_index(*local_indices_begin)]]; typename VectorType::value_type value = position.inhomogeneity; - for (unsigned int j=0; j inline void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix &local_matrix, - const std::vector &local_dof_indices, - MatrixType &global_matrix) const +distribute_local_to_global (const FullMatrix &local_matrix, + const std::vector &local_dof_indices, + MatrixType &global_matrix) const { // create a dummy and hand on to the // function actually implementing this @@ -2130,12 +2135,12 @@ template inline void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, - const std::vector &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs) const +distribute_local_to_global (const FullMatrix &local_matrix, + const Vector &local_vector, + const std::vector &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs) const { // enter the internal function with the // respective block information set, the @@ -2152,10 +2157,10 @@ template inline void ConstraintMatrix:: -add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask) const +add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask) const { // enter the internal function with the // respective block information set, the 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 29aa3e2da0..7dc2082af7 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -80,15 +80,15 @@ ConstraintMatrix::condense (const VectorType &uncondensed, new_line.reserve (uncondensed.size()); std::vector::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.size(); + size_type shift = 0; + size_type n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -100,7 +100,7 @@ ConstraintMatrix::condense (const VectorType &uncondensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; ientries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed(new_line[next_constraint->entries[q].first]) += uncondensed(row) * next_constraint->entries[q].second; @@ -159,7 +159,7 @@ ConstraintMatrix::condense (VectorType &vec) const "without any matrix specified.")); const typename VectorType::value_type old_value = vec(constraint_line->line); - for (unsigned int q=0; q!=constraint_line->entries.size(); ++q) + for (size_type q=0; q!=constraint_line->entries.size(); ++q) if (vec.in_local_range(constraint_line->entries[q].first) == true) vec(constraint_line->entries[q].first) += (static_cast @@ -219,15 +219,15 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, new_line.reserve (uncondensed_struct.n_rows()); std::vector::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - const unsigned int n_rows = uncondensed_struct.n_rows(); + size_type shift = 0; + const size_type n_rows = uncondensed_struct.n_rows(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -239,7 +239,7 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; i &uncondensed, // only evaluated so often as there are // entries in new_line[*] which tells us // which constraints exist - for (unsigned int row=0; row &uncondensed, while (c->line != p->column()) ++c; - for (unsigned int q=0; q!=c->entries.size(); ++q) + for (size_type q=0; q!=c->entries.size(); ++q) // distribute to rows with // appropriate weight condensed.add (new_line[row], new_line[c->entries[q].first], @@ -307,7 +307,7 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, // for each column: distribute if (new_line[p->column()] != -1) // column is not constrained - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[p->column()], p->value() * @@ -323,8 +323,8 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, while (c->line != p->column()) ++c; - for (unsigned int r=0; r!=c->entries.size(); ++r) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type r=0; r!=c->entries.size(); ++r) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[c->entries[r].first], p->value() * @@ -332,7 +332,7 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, c->entries[r].second); if (use_vectors == true) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed_vector (new_line[next_constraint->entries[q].first]) -= p->value() * next_constraint->entries[q].second * @@ -341,7 +341,7 @@ ConstraintMatrix::condense (const SparseMatrix &uncondensed, // condense the vector if (use_vectors == true) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed_vector(new_line[next_constraint->entries[q].first]) += uncondensed_vector(row) * next_constraint->entries[q].second; @@ -372,33 +372,33 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, AssertDimension (vec.size(), sparsity.n_rows()); double average_diagonal = 0; - for (unsigned int i=0; i distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c::iterator entry = uncondensed.begin(row); entry != uncondensed.end(row); ++entry) { - const types::global_dof_index column = entry->column(); + const size_type column = entry->column(); // end of row reached? // this should not @@ -408,7 +408,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, Assert (column != SparsityPattern::invalid_entry, ExcMatrixNotClosed()); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) // distribute entry at // regular row @p row // and irregular column @@ -416,7 +416,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // set old entry to // zero { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) uncondensed.add (row, lines[distribute[column]].entries[q].first, @@ -444,7 +444,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, entry = uncondensed.begin(row); entry != uncondensed.end(row); ++entry) { - const types::global_dof_index column = entry->column(); + const size_type column = entry->column(); // end of row reached? // this should not @@ -454,7 +454,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, Assert (column != SparsityPattern::invalid_entry, ExcMatrixNotClosed()); - if (distribute[column] == numbers::invalid_unsigned_int) + if (distribute[column] == numbers::invalid_size_type) // distribute entry at // irregular row // @p row and regular @@ -462,7 +462,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // column. set // old entry to zero { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[q].first, column, @@ -480,9 +480,9 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // to one on main // diagonal, zero otherwise { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[p].first, lines[distribute[column]].entries[q].first, @@ -505,7 +505,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // take care of vector if (use_vectors == true) { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) vec(lines[distribute[row]].entries[q].first) += (vec(row) * lines[distribute[row]].entries[q].second); @@ -527,7 +527,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, // the other function above. const bool use_vectors = vec.n_blocks() == 0 ? false : true; - const unsigned int blocks = uncondensed.n_block_rows(); + const size_type blocks = uncondensed.n_block_rows(); const BlockSparsityPattern & sparsity = uncondensed.get_sparsity_pattern (); @@ -550,8 +550,8 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, } double average_diagonal = 0; - for (unsigned int b=0; b &uncondensed, // store for each index whether it must be // distributed or not. If entry is - // numbers::invalid_unsigned_int, + // numbers::invalid_size_type, // no distribution is necessary. // otherwise, the number states which line // in the constraint matrix handles this // index - std::vector distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c + const std::pair block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; + const size_type block_row = block_index.first; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -593,17 +593,17 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_col::iterator entry = uncondensed.block(block_row, block_col).begin(block_index.second); entry != uncondensed.block(block_row, block_col).end(block_index.second); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col,entry->column()); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at // regular row @p row // and irregular column @@ -612,7 +612,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, { const double old_value = entry->value (); - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) uncondensed.add (row, lines[distribute[global_col]].entries[q].first, @@ -640,18 +640,18 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, // whole row into the // chunks defined by the // blocks - for (unsigned int block_col=0; block_col::iterator entry = uncondensed.block(block_row, block_col).begin(block_index.second); entry != uncondensed.block(block_row, block_col).end(block_index.second); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, entry->column()); if (distribute[global_col] == - numbers::invalid_unsigned_int) + numbers::invalid_size_type) // distribute // entry at // irregular @@ -664,7 +664,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, { const double old_value = entry->value(); - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[q].first, global_col, @@ -684,9 +684,9 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, { const double old_value = entry->value (); - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) { - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) uncondensed.add (lines[distribute[row]].entries[p].first, lines[distribute[global_col]].entries[q].first, old_value * @@ -707,7 +707,7 @@ ConstraintMatrix::condense (BlockSparseMatrix &uncondensed, // take care of vector if (use_vectors == true) { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) vec(lines[distribute[row]].entries[q].first) += (vec(row) * lines[distribute[row]].entries[q].second); @@ -733,14 +733,14 @@ namespace internal // TODO: in general we should iterate over the constraints and not over all DoFs // for performance reasons template - void set_zero_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, unsigned int shift = 0) + void set_zero_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, size_type shift = 0) { Assert(!vec.has_ghost_elements(), ExcInternalError());//ExcGhostsPresent()); - const unsigned int + const size_type start = vec.local_range().first, end = vec.local_range().second; - for (unsigned int i=start; i void set_zero_in_parallel(const dealii::ConstraintMatrix &cm, VEC &vec, internal::bool2type) { - unsigned int start_shift = 0; - for (unsigned int j=0; j::const_iterator constraint_line = cm.lines.begin(); for (; constraint_line!=cm.lines.end(); ++constraint_line) vec(constraint_line->line) = 0.;*/ - for (unsigned int i=0; i void ConstraintMatrix:: distribute_local_to_global (const Vector &local_vector, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, VectorType &global_vector, const FullMatrix &local_matrix) const { @@ -837,11 +837,11 @@ distribute_local_to_global (const Vector &local_vector, AssertDimension (local_matrix.m(), local_dof_indices.size()); AssertDimension (local_matrix.n(), local_dof_indices.size()); - const unsigned int n_local_dofs = local_vector.size(); + const size_type n_local_dofs = local_vector.size(); if (lines.empty()) global_vector.add(local_dof_indices, local_vector); else - for (unsigned int i=0; i &local_vector, // find the constraint line to the given // global dof index - const unsigned int line_index = calculate_line_index (local_dof_indices[i]); + const size_type line_index = calculate_line_index (local_dof_indices[i]); const ConstraintLine *position = lines_cache.size() <= line_index ? 0 : &lines[lines_cache[line_index]]; @@ -865,7 +865,7 @@ distribute_local_to_global (const Vector &local_vector, // constrained. If so, distribute the constraint const double val = position->inhomogeneity; if (val != 0) - for (unsigned int j=0; j &local_vector, const ConstraintLine &position_j = lines[lines_cache[calculate_line_index(local_dof_indices[j])]]; - for (unsigned int q=0; q &local_vector, // now distribute the constraint, // but make sure we don't touch // the entries of fixed dofs - for (unsigned int j=0; jentries.size(); ++j) + for (size_type j=0; jentries.size(); ++j) { Assert (!(!local_lines.size() || local_lines.is_element(position->entries[j].first)) @@ -921,15 +921,15 @@ ConstraintMatrix::distribute (const VectorType &condensed, old_line.reserve (uncondensed.size()); std::vector::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.size(); + size_type shift = 0; + size_type n_rows = uncondensed.size(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) old_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -941,7 +941,7 @@ ConstraintMatrix::distribute (const VectorType &condensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; iinhomogeneity; // then add the different // contributions - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) uncondensed(line) += (condensed(old_line[next_constraint->entries[i].first]) * next_constraint->entries[i].second); ++next_constraint; @@ -992,7 +992,7 @@ ConstraintMatrix::distribute (VectorType &vec) const // different contributions typename VectorType::value_type new_value = next_constraint->inhomogeneity; - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) new_value += (static_cast (vec(next_constraint->entries[i].first)) * next_constraint->entries[i].second); @@ -1036,8 +1036,8 @@ namespace internals // comes from a constraint. struct Distributing { - Distributing (const unsigned int global_row = numbers::invalid_unsigned_int, - const unsigned int local_row = numbers::invalid_unsigned_int); + Distributing (const size_type global_row = numbers::invalid_size_type, + const size_type local_row = numbers::invalid_size_type); Distributing (const Distributing &in); Distributing &operator = (const Distributing &in); bool operator < (const Distributing &in) const @@ -1045,22 +1045,22 @@ namespace internals return global_row [20*6]; + data = new std::pair [20*6]; individual_size.resize(20); n_used_elements = 0; } - unsigned int element_size; + size_type element_size; - std::pair *data; + std::pair *data; - std::vector individual_size; + std::vector individual_size; - unsigned int n_used_elements; + size_type n_used_elements; - unsigned int insert_new_index (const std::pair &pair) + size_type insert_new_index (const std::pair &pair) { if (element_size == 0) reinit(); if (n_used_elements == individual_size.size()) { - std::pair *new_data = - new std::pair [2*individual_size.size()*element_size]; + std::pair *new_data = + new std::pair [2*individual_size.size()*element_size]; memcpy (new_data, data, individual_size.size()*element_size* - sizeof(std::pair)); + sizeof(std::pair)); delete [] data; data = new_data; individual_size.resize (2*individual_size.size(), 0); } - unsigned int index = n_used_elements; + size_type index = n_used_elements; data[index*element_size] = pair; individual_size[index] = 1; ++n_used_elements; return index; } - void append_index (const unsigned int index, - const std::pair &pair) + void append_index (const size_type index, + const std::pair &pair) { AssertIndexRange (index, n_used_elements); - const unsigned int my_size = individual_size[index]; + const size_type my_size = individual_size[index]; if (my_size == element_size) { - std::pair *new_data = - new std::pair [2*individual_size.size()*element_size]; - for (unsigned int i=0; i *new_data = + new std::pair [2*individual_size.size()*element_size]; + for (size_type i=0; i)); + element_size*sizeof(std::pair)); delete [] data; data = new_data; element_size *= 2; @@ -1167,14 +1167,14 @@ namespace internals individual_size[index]++; } - unsigned int - get_size (const unsigned int index) const + size_type + get_size (const size_type index) const { return individual_size[index]; } - const std::pair * - get_entry (const unsigned int index) const + const std::pair * + get_entry (const size_type index) const { return &data[index*element_size]; } @@ -1223,7 +1223,7 @@ namespace internals class GlobalRowsFromLocal { public: - GlobalRowsFromLocal (const unsigned int n_local_rows) + GlobalRowsFromLocal (const size_type n_local_rows) : total_row_indices (n_local_rows), n_active_rows (n_local_rows), @@ -1232,8 +1232,8 @@ namespace internals // implemented below - void insert_index (const unsigned int global_row, - const unsigned int local_row, + void insert_index (const size_type global_row, + const size_type local_row, const double constraint_value); void sort (); @@ -1245,15 +1245,15 @@ namespace internals << "Constr rows " << n_constraints() << std::endl << "Inhom rows " << n_inhomogeneous_rows << std::endl << "Local: "; - for (unsigned int i=0 ; i= n_inhomogeneous_rows, ExcInternalError()); std::swap (total_row_indices[n_active_rows+i], @@ -1391,7 +1391,7 @@ namespace internals // easily when the // GlobalRowsToLocal has been // set up - unsigned int constraint_origin (unsigned int i) const + size_type constraint_origin (size_type i) const { return total_row_indices[n_active_rows+i].local_row; } @@ -1410,35 +1410,35 @@ namespace internals // how many rows there are, // constraints disregarded - unsigned int n_active_rows; + size_type n_active_rows; // the number of rows with // inhomogeneous constraints - unsigned int n_inhomogeneous_rows; + size_type n_inhomogeneous_rows; }; // a function that appends an additional // row to the list of values, or appends a // value to an already existing // row. Similar functionality as for - // std::map, but + // std::map, but // here done for a // std::vector, much faster // for short lists as we have them here inline void - GlobalRowsFromLocal::insert_index (const unsigned int global_row, - const unsigned int local_row, - const double constraint_value) + GlobalRowsFromLocal::insert_index (const size_type global_row, + const size_type local_row, + const double constraint_value) { typedef std::vector::iterator index_iterator; index_iterator pos, pos1; Distributing row_value (global_row); - std::pair constraint (local_row, constraint_value); + std::pair constraint (local_row, constraint_value); // check whether the list was really // sorted before entering here - for (unsigned int i=1; iconstraint_position == numbers::invalid_unsigned_int) + if (pos1->constraint_position == numbers::invalid_size_type) pos1->constraint_position = data_cache.insert_new_index (constraint); else data_cache.append_index (pos1->constraint_position, constraint); @@ -1472,19 +1472,19 @@ namespace internals void GlobalRowsFromLocal::sort () { - unsigned int i, j, j2, temp, templ, istep; - unsigned int step; + size_type i, j, j2, temp, templ, istep; + size_type step; // check whether the // constraints are really empty. - const unsigned int length = size(); + const size_type length = size(); // make sure that we are in the // range of the vector AssertIndexRange (length, total_row_indices.size()+1); - for (unsigned int i=0; i inline void - make_block_starts (const BlockType &block_object, - GlobalRowsFromLocal &global_rows, - std::vector &block_starts) + make_block_starts (const BlockType &block_object, + GlobalRowsFromLocal &global_rows, + std::vector &block_starts) { AssertDimension (block_starts.size(), block_object.n_block_rows()+1); typedef std::vector::iterator row_iterator; row_iterator block_indices = global_rows.total_row_indices.begin(); - const unsigned int num_blocks = block_object.n_block_rows(); - const unsigned int n_active_rows = global_rows.size(); + const size_type num_blocks = block_object.n_block_rows(); + const size_type n_active_rows = global_rows.size(); // find end of rows. block_starts[0] = 0; - for (unsigned int i=1; i inline void - make_block_starts (const BlockType &block_object, - std::vector &row_indices, - std::vector &block_starts) + make_block_starts (const BlockType &block_object, + std::vector &row_indices, + std::vector &block_starts) { AssertDimension (block_starts.size(), block_object.n_block_rows()+1); - typedef std::vector::iterator row_iterator; + typedef std::vector::iterator row_iterator; row_iterator col_indices = row_indices.begin(); - const unsigned int num_blocks = block_object.n_block_rows(); + const size_type num_blocks = block_object.n_block_rows(); // find end of rows. block_starts[0] = 0; - for (unsigned int i=1; i &local_matrix) { - const unsigned int loc_col = global_cols.local_row(j); + const size_type loc_col = global_cols.local_row(j); double col_val; // case 1: row has direct contribution in // local matrix. decide whether col has a // direct contribution. if not, // set the value to zero. - if (loc_row != numbers::invalid_unsigned_int) + if (loc_row != numbers::invalid_size_type) { - col_val = ((loc_col != numbers::invalid_unsigned_int) ? + col_val = ((loc_col != numbers::invalid_size_type) ? local_matrix(loc_row, loc_col) : 0); // account for indirect contributions by // constraints in column - for (unsigned int p=0; p &local_matrix, - unsigned int *&col_ptr, - number *&val_ptr) + const size_type i, + const size_type column_start, + const size_type column_end, + const FullMatrix &local_matrix, + size_type *&col_ptr, + number *&val_ptr) { if (column_end == column_start) return; AssertIndexRange (column_end-1, global_cols.size()); - const unsigned int loc_row = global_rows.local_row(i); + const size_type loc_row = global_rows.local_row(i); // fast function if there are no indirect // references to any of the local rows at @@ -1690,9 +1690,9 @@ namespace internals AssertIndexRange(loc_row, local_matrix.m()); const double *matrix_ptr = &local_matrix(loc_row, 0); - for (unsigned int j=column_start; j static inline void add_value (const double value, - const unsigned int row, - const unsigned int column, + const size_type row, + const size_type column, SparseMatrixIterator &matrix_values) { if (value != 0.) @@ -1758,11 +1758,11 @@ namespace internals inline void resolve_matrix_row (const GlobalRowsFromLocal &global_rows, - const unsigned int i, - const unsigned int column_start, - const unsigned int column_end, - const FullMatrix &local_matrix, - SparseMatrix *sparse_matrix) + const size_type i, + const size_type column_start, + const size_type column_end, + const FullMatrix &local_matrix, + SparseMatrix *sparse_matrix) { if (column_end == column_start) return; @@ -1773,8 +1773,8 @@ namespace internals if (sparsity.n_nonzero_elements() == 0) return; - const unsigned int row = global_rows.global_row(i); - const unsigned int loc_row = global_rows.local_row(i); + const size_type row = global_rows.global_row(i); + const size_type loc_row = global_rows.local_row(i); typename SparseMatrix::iterator matrix_values = sparse_matrix->begin(row); @@ -1793,9 +1793,9 @@ namespace internals AssertIndexRange (loc_row, local_matrix.m()); const double *matrix_ptr = &local_matrix(loc_row, 0); - for (unsigned int j=column_start; jbegin(row)->value() += matrix_ptr[loc_row]; - for (unsigned int j=column_start; jbegin(row)->value() += resolve_matrix_entry (global_rows, global_rows, i, i, loc_row, local_matrix); - for (unsigned int j=column_start; jbegin(row)->value() += col_val; @@ -1886,7 +1886,7 @@ namespace internals else { ++matrix_values; // jump over diagonal element - for (unsigned int j=column_start; j &dof_mask, - std::vector::iterator &col_ptr) + std::vector::iterator &col_ptr) { if (column_end == column_start) return; - const unsigned int loc_row = global_rows.local_row(i); + const size_type loc_row = global_rows.local_row(i); // fast function if there are no indirect // references to any of the local rows at @@ -1928,9 +1928,9 @@ namespace internals Assert(loc_row < dof_mask.n_rows(), ExcInternalError()); - for (unsigned int j=column_start; j inline void set_matrix_diagonals (const internals::GlobalRowsFromLocal &global_rows, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, const FullMatrix &local_matrix, const ConstraintMatrix &constraints, MatrixType &global_matrix, @@ -2027,14 +2027,14 @@ add_this_index: if (global_rows.n_constraints() > 0) { double average_diagonal = 0; - for (unsigned int i=0; i(local_matrix.m()); - for (unsigned int i=0; i inline void set_sparsity_diagonals (const internals::GlobalRowsFromLocal &global_rows, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, const Table<2,bool> &dof_mask, const bool keep_constrained_entries, SparsityType &sparsity_pattern) @@ -2077,13 +2077,13 @@ add_this_index: // that have been left out above if (global_rows.n_constraints() > 0) { - for (unsigned int i=0; i &local_dof_indices, +make_sorted_row_list (const std::vector &local_dof_indices, internals::GlobalRowsFromLocal &global_rows) const { - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); AssertDimension (n_local_dofs, global_rows.size()); // when distributing the local data to @@ -2149,13 +2149,13 @@ make_sorted_row_list (const std::vector &local_dof_indices, // cache whether we have to resolve any // indirect rows generated from resolving // constrained dofs. - unsigned int added_rows = 0; + size_type added_rows = 0; // first add the indices in an unsorted // way and only keep track of the // constraints that appear. They are // resolved in a second step. - for (unsigned int i = 0; i &local_dof_indices, } global_rows.sort(); - const unsigned int n_constrained_rows = n_local_dofs-added_rows; - for (unsigned int i=0; i &local_dof_indices, inline void ConstraintMatrix:: -make_sorted_row_list (const std::vector &local_dof_indices, - std::vector &active_dofs) const +make_sorted_row_list (const std::vector &local_dof_indices, + std::vector &active_dofs) const { - const unsigned int n_local_dofs = local_dof_indices.size(); - unsigned int added_rows = 0; - for (unsigned int i = 0; i &local_dof_indices, } std::sort (active_dofs.begin(), active_dofs.begin()+added_rows); - const unsigned int n_constrained_dofs = n_local_dofs-added_rows; - for (unsigned int i=n_constrained_dofs; i>0; --i) + const size_type n_constrained_dofs = n_local_dofs-added_rows; + for (size_type i=n_constrained_dofs; i>0; --i) { - const unsigned int local_row = active_dofs.back(); + const size_type local_row = active_dofs.back(); // remove constrained entry since we // are going to resolve it in place active_dofs.pop_back(); - const unsigned int global_row = local_dof_indices[local_row]; + const size_type global_row = local_dof_indices[local_row]; const ConstraintLine &position = lines[lines_cache[calculate_line_index(global_row)]]; - for (unsigned int q=0; q &local_dof_indices, // the list sorted else { - std::vector::iterator it = + std::vector::iterator it = Utilities::lower_bound(active_dofs.begin(), active_dofs.end()-i+1, new_index); @@ -2252,23 +2252,23 @@ make_sorted_row_list (const std::vector &local_dof_indices, inline double ConstraintMatrix:: -resolve_vector_entry (const unsigned int i, +resolve_vector_entry (const size_type i, const internals::GlobalRowsFromLocal &global_rows, const Vector &local_vector, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, const FullMatrix &local_matrix) const { - const unsigned int loc_row = global_rows.local_row(i); - const unsigned int n_inhomogeneous_rows = global_rows.n_inhomogeneities(); + const size_type loc_row = global_rows.local_row(i); + const size_type n_inhomogeneous_rows = global_rows.n_inhomogeneities(); double val = 0; // has a direct contribution from some local // entry. If we have inhomogeneous // constraints, compute the contribution of // the inhomogeneity in the current row. - if (loc_row != numbers::invalid_unsigned_int) + if (loc_row != numbers::invalid_size_type) { val = local_vector(loc_row); - for (unsigned int i=0; i &local_matrix, const Vector &local_vector, - const std::vector &local_dof_indices, + const std::vector &local_dof_indices, MatrixType &global_matrix, VectorType &global_vector, bool use_inhomogeneities_for_rhs, @@ -2325,18 +2325,18 @@ ConstraintMatrix::distribute_local_to_global ( } Assert (lines.empty() || sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // create arrays for the column data // (indices and values) that will then be // written into the matrix. Shortcut for // deal.II sparse matrix - std::vector cols; - std::vector vals; + std::vector cols; + std::vector vals; SparseMatrix *sparse_matrix = dynamic_cast *>(&global_matrix); if (use_dealii_matrix == false) @@ -2351,21 +2351,21 @@ ConstraintMatrix::distribute_local_to_global ( // the global rows that we will touch and // call resolve_matrix_row for each of // those. - for (unsigned int i=0; i 0) global_matrix.add(row, n_values, &cols[0], &vals[0], false, true); @@ -2404,10 +2404,10 @@ ConstraintMatrix::distribute_local_to_global ( template void ConstraintMatrix::distribute_local_to_global ( - const FullMatrix &local_matrix, - const std::vector &row_indices, - const std::vector &col_indices, - MatrixType &global_matrix) const + const FullMatrix &local_matrix, + const std::vector &row_indices, + const std::vector &col_indices, + MatrixType &global_matrix) const { typedef double number; @@ -2415,37 +2415,37 @@ ConstraintMatrix::distribute_local_to_global ( AssertDimension (local_matrix.n(), col_indices.size()); //Assert (sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_row_dofs = row_indices.size(); - const unsigned int n_local_col_dofs = col_indices.size(); + const size_type n_local_row_dofs = row_indices.size(); + const size_type n_local_col_dofs = col_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_row_dofs); internals::GlobalRowsFromLocal global_cols (n_local_col_dofs); make_sorted_row_list (row_indices, global_rows); make_sorted_row_list (col_indices, global_cols); - const unsigned int n_actual_row_dofs = global_rows.size(); - const unsigned int n_actual_col_dofs = global_cols.size(); + const size_type n_actual_row_dofs = global_rows.size(); + const size_type n_actual_col_dofs = global_cols.size(); // create arrays for the column data // (indices and values) that will then be // written into the matrix. Shortcut for // deal.II sparse matrix - std::vector cols (n_actual_col_dofs); + std::vector cols (n_actual_col_dofs); std::vector vals (n_actual_col_dofs); // now do the actual job. - for (unsigned int i=0; i 0) global_matrix.add(row, n_values, &cols[0], &vals[0], false, true); @@ -2460,12 +2460,12 @@ ConstraintMatrix::distribute_local_to_global ( template void ConstraintMatrix:: -distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, - const std::vector &local_dof_indices, - MatrixType &global_matrix, - VectorType &global_vector, - bool use_inhomogeneities_for_rhs, +distribute_local_to_global (const FullMatrix &local_matrix, + const Vector &local_vector, + const std::vector &local_dof_indices, + MatrixType &global_matrix, + VectorType &global_vector, + bool use_inhomogeneities_for_rhs, internal::bool2type) const { const bool use_vectors = (local_vector.size() == 0 && @@ -2486,26 +2486,26 @@ distribute_local_to_global (const FullMatrix &local_matrix, } Assert (sorted == true, ExcMatrixNotClosed()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); - std::vector global_indices; + std::vector global_indices; if (use_vectors == true) { global_indices.resize(n_actual_dofs); - for (unsigned int i=0; i block_starts(num_blocks+1, n_actual_dofs); + const size_type num_blocks = global_matrix.n_block_rows(); + std::vector block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts (global_matrix, global_rows, block_starts); - std::vector cols; + std::vector cols; std::vector vals; if (use_dealii_matrix == false) { @@ -2518,26 +2518,26 @@ distribute_local_to_global (const FullMatrix &local_matrix, // through the blocks of the matrix // separately, which allows us to set the // block entries individually - for (unsigned int block=0; block 0) global_matrix.block(block, block_col).add(row, n_values, @@ -2579,15 +2579,15 @@ distribute_local_to_global (const FullMatrix &local_matrix, template void ConstraintMatrix:: -add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, +add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type ) const { Assert (sparsity_pattern.n_rows() == sparsity_pattern.n_cols(), ExcNotQuadratic()); - const unsigned int n_local_dofs = local_dof_indices.size(); + const size_type n_local_dofs = local_dof_indices.size(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_dofs) { @@ -2604,15 +2604,15 @@ add_entries_local_to_global (const std::vector &local_dof_indices, // indices that come from constraints. if (dof_mask_is_active == false) { - std::vector actual_dof_indices (n_local_dofs); + std::vector actual_dof_indices (n_local_dofs); make_sorted_row_list (local_dof_indices, actual_dof_indices); - const unsigned int n_actual_dofs = actual_dof_indices.size(); + const size_type n_actual_dofs = actual_dof_indices.size(); // now add the indices we collected above // to the sparsity pattern. Very easy // here - just add the same array to all // the rows... - for (unsigned int i=0; i &local_dof_indices, // the nice matrix structure we use // elsewhere, so manually add those // indices one by one. - for (unsigned int i=0; i &local_dof_indices, // for additional comments. internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // create arrays for the column indices // that will then be written into the // sparsity pattern. - std::vector cols (n_actual_dofs); + std::vector cols (n_actual_dofs); - for (unsigned int i=0; i::iterator col_ptr = cols.begin(); - const unsigned int row = global_rows.global_row(i); + std::vector::iterator col_ptr = cols.begin(); + const size_type row = global_rows.global_row(i); internals::resolve_matrix_row (global_rows, i, 0, n_actual_dofs, dof_mask, col_ptr); @@ -2681,14 +2681,14 @@ add_entries_local_to_global (const std::vector &local_dof_indices, template void ConstraintMatrix:: -add_entries_local_to_global (const std::vector &row_indices, - const std::vector &col_indices, +add_entries_local_to_global (const std::vector &row_indices, + const std::vector &col_indices, SparsityType &sparsity_pattern, const bool keep_constrained_entries, const Table<2,bool> &dof_mask) const { - const unsigned int n_local_rows = row_indices.size(); - const unsigned int n_local_cols = col_indices.size(); + const size_type n_local_rows = row_indices.size(); + const size_type n_local_cols = col_indices.size(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_rows && dof_mask.n_cols() == n_local_cols) dof_mask_is_active = true; @@ -2702,17 +2702,17 @@ add_entries_local_to_global (const std::vector &row_indices, // indices that come from constraints. if (dof_mask_is_active == false) { - std::vector actual_row_indices (n_local_rows); - std::vector actual_col_indices (n_local_cols); + std::vector actual_row_indices (n_local_rows); + std::vector actual_col_indices (n_local_cols); make_sorted_row_list (row_indices, actual_row_indices); make_sorted_row_list (col_indices, actual_col_indices); - const unsigned int n_actual_rows = actual_row_indices.size(); + const size_type n_actual_rows = actual_row_indices.size(); // now add the indices we collected above // to the sparsity pattern. Very easy // here - just add the same array to all // the rows... - for (unsigned int i=0; i &row_indices, // of those to the sparsity pattern if (keep_constrained_entries == true) { - for (unsigned int i=0; i &row_indices, template void ConstraintMatrix:: -add_entries_local_to_global (const std::vector &local_dof_indices, - SparsityType &sparsity_pattern, - const bool keep_constrained_entries, - const Table<2,bool> &dof_mask, +add_entries_local_to_global (const std::vector &local_dof_indices, + SparsityType &sparsity_pattern, + const bool keep_constrained_entries, + const Table<2,bool> &dof_mask, internal::bool2type ) const { // just as the other @@ -2760,8 +2760,8 @@ add_entries_local_to_global (const std::vector &local_dof_indices, Assert (sparsity_pattern.n_block_rows() == sparsity_pattern.n_block_cols(), ExcNotQuadratic()); - const unsigned int n_local_dofs = local_dof_indices.size(); - const unsigned int num_blocks = sparsity_pattern.n_block_rows(); + const size_type n_local_dofs = local_dof_indices.size(); + const size_type num_blocks = sparsity_pattern.n_block_rows(); bool dof_mask_is_active = false; if (dof_mask.n_rows() == n_local_dofs) @@ -2772,29 +2772,29 @@ add_entries_local_to_global (const std::vector &local_dof_indices, if (dof_mask_is_active == false) { - std::vector actual_dof_indices (n_local_dofs); + std::vector actual_dof_indices (n_local_dofs); make_sorted_row_list (local_dof_indices, actual_dof_indices); - const unsigned int n_actual_dofs = actual_dof_indices.size(); + const size_type n_actual_dofs = actual_dof_indices.size(); // additional construct that also takes // care of block indices. - std::vector block_starts(num_blocks+1, n_actual_dofs); + std::vector block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts (sparsity_pattern, actual_dof_indices, block_starts); - for (unsigned int block=0; block::iterator index_it = actual_dof_indices.begin(); - for (unsigned int block_col = 0; block_col::iterator index_it = actual_dof_indices.begin(); + for (size_type block_col = 0; block_col &local_dof_indices, } } - for (unsigned int i=0; i &local_dof_indices, // function for block matrices internals::GlobalRowsFromLocal global_rows (n_local_dofs); make_sorted_row_list (local_dof_indices, global_rows); - const unsigned int n_actual_dofs = global_rows.size(); + const size_type n_actual_dofs = global_rows.size(); // additional construct that also takes // care of block indices. - std::vector block_starts(num_blocks+1, n_actual_dofs); + std::vector block_starts(num_blocks+1, n_actual_dofs); internals::make_block_starts(sparsity_pattern, global_rows, block_starts); - std::vector cols (n_actual_dofs); + std::vector cols (n_actual_dofs); // the basic difference to the // non-block variant from now onwards // is that we go through the blocks // of the matrix separately. - for (unsigned int block=0; block::iterator col_ptr = cols.begin(); + std::vector::iterator col_ptr = cols.begin(); internals::resolve_matrix_row (global_rows, i, begin_block, end_block, dof_mask, col_ptr); diff --git a/deal.II/include/deal.II/lac/parallel_block_vector.h b/deal.II/include/deal.II/lac/parallel_block_vector.h index 221570efd0..3ddbee9d6c 100644 --- a/deal.II/include/deal.II/lac/parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/parallel_block_vector.h @@ -55,6 +55,11 @@ namespace parallel 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. @@ -100,8 +105,8 @@ namespace parallel * use blocks of different * sizes. */ - explicit BlockVector (const unsigned int num_blocks = 0, - const unsigned int block_size = 0); + explicit BlockVector (const size_type num_blocks = 0, + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to @@ -145,7 +150,7 @@ namespace parallel * block_sizes[i] zero * elements. */ - BlockVector (const std::vector &block_sizes); + BlockVector (const std::vector &block_sizes); /** * Destructor. Clears memory @@ -203,8 +208,8 @@ namespace parallel * If fast==false, the vector * is filled with zeros. */ - void reinit (const unsigned int num_blocks, - const unsigned int block_size = 0, + void reinit (const size_type num_blocks, + const size_type block_size = 0, const bool fast = false); /** @@ -238,8 +243,8 @@ namespace parallel * since they may be routed to * the wrong block. */ - void reinit (const std::vector &N, - const bool fast=false); + void reinit (const std::vector &N, + const bool fast=false); /** * Change the dimension to that @@ -344,8 +349,8 @@ namespace parallel template inline - BlockVector::BlockVector (const unsigned int n_blocks, - const unsigned int block_size) + BlockVector::BlockVector (const size_type n_blocks, + const size_type block_size) { reinit (n_blocks, block_size); } @@ -354,7 +359,7 @@ namespace parallel template inline - BlockVector::BlockVector (const std::vector &n) + BlockVector::BlockVector (const std::vector &n) { reinit (n, false); } @@ -370,7 +375,7 @@ namespace parallel this->components.resize (v.n_blocks()); this->block_indices = v.block_indices; - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i] = v.components[i]; } @@ -392,25 +397,25 @@ namespace parallel template inline - void BlockVector::reinit (const unsigned int n_bl, - const unsigned int bl_sz, + void BlockVector::reinit (const size_type n_bl, + const size_type bl_sz, const bool fast) { - std::vector n(n_bl, bl_sz); + std::vector n(n_bl, bl_sz); reinit(n, fast); } template inline - void BlockVector::reinit (const std::vector &n, - const bool fast) + void BlockVector::reinit (const std::vector &n, + const bool fast) { this->block_indices.reinit (n); if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].reinit(n[i], fast); } @@ -426,7 +431,7 @@ namespace parallel if (this->components.size() != this->n_blocks()) this->components.resize(this->n_blocks()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->block(i).reinit(v.block(i), fast); } @@ -496,7 +501,7 @@ namespace parallel Assert (this->n_blocks() == v.n_blocks(), ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) dealii::swap (this->components[i], v.components[i]); dealii::swap (this->block_indices, v.block_indices); } @@ -509,7 +514,7 @@ namespace parallel Assert (numbers::is_finite(factor), ExcNumberNotFinite()); - for (unsigned int i=0; in_blocks(); ++i) + for (size_type i=0; in_blocks(); ++i) this->components[i].scale(factor); } diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index a99f840b48..96a96cd170 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.h +++ b/deal.II/include/deal.II/lac/parallel_vector.h @@ -84,6 +84,11 @@ namespace parallel class Vector : public Subscriptor { public: + /** + * Declare the type for container size. + */ + typedef std::size_t size_type; + /** * Declare standard types used in all * containers. These types parallel those in @@ -120,7 +125,7 @@ namespace parallel * global size without any actual parallel * distribution. */ - Vector (const unsigned int size); + Vector (const size_type size); /** * Constructs a parallel vector. The local @@ -165,8 +170,8 @@ namespace parallel * size without any actual parallel * distribution. */ - void reinit (const unsigned int size, - const bool fast = false); + void reinit (const size_type size, + const bool fast = false); /** * Uses the parallel layout of the input @@ -487,13 +492,13 @@ namespace parallel * equal to the sum of the number of locally * owned indices among all the processors. */ - types::global_dof_index size () const; + size_type size () const; /** * Returns the local size of the vector, i.e., * the number of indices owned locally. */ - unsigned int local_size() const; + size_type local_size() const; /** * Returns the half-open interval that @@ -502,19 +507,19 @@ namespace parallel * local_range().second - * local_range().first. */ - std::pair local_range () const; + std::pair local_range () const; /** * Returns true if the given global index is * in the local range of this processor. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Returns the number of ghost elements * present on the vector. */ - unsigned int n_ghost_entries () const; + size_type n_ghost_entries () const; /** * Returns whether the given global index is a @@ -523,7 +528,7 @@ namespace parallel * are owned locally and for indices not * present at all. */ - bool is_ghost_entry (const types::global_dof_index global_index) const; + bool is_ghost_entry (const size_type global_index) const; /** * Make the @p Vector class a bit like @@ -569,7 +574,7 @@ namespace parallel * vector or be specified as a ghost * index at construction. */ - Number operator () (const types::global_dof_index global_index) const; + Number operator () (const size_type global_index) const; /** * Read and write access to the data @@ -579,7 +584,7 @@ namespace parallel * vector or be specified as a ghost * index at construction. */ - Number &operator () (const types::global_dof_index global_index); + Number &operator () (const size_type global_index); /** * Read access to the data in the @@ -592,7 +597,7 @@ namespace parallel * This function does the same thing * as operator(). */ - Number operator [] (const types::global_dof_index global_index) const; + Number operator [] (const size_type global_index) const; /** * Read and write access to the data @@ -605,7 +610,7 @@ namespace parallel * This function does the same thing * as operator(). */ - Number &operator [] (const types::global_dof_index global_index); + Number &operator [] (const size_type global_index); /** * Read access to the data field specified by @@ -616,7 +621,7 @@ namespace parallel * [local_size,local_size+ * n_ghost_entries]. */ - Number local_element (const unsigned int local_index) const; + Number local_element (const size_type local_index) const; /** * Read and write access to the data field @@ -626,7 +631,7 @@ namespace parallel * indices with indices * [local_size,local_size+n_ghosts]. */ - Number &local_element (const unsigned int local_index); + Number &local_element (const size_type local_index); //@} @@ -656,7 +661,7 @@ namespace parallel * indices. */ template - void add (const std::vector &indices, + void add (const std::vector &indices, const std::vector &values); /** @@ -667,7 +672,7 @@ namespace parallel * values. */ template - void add (const std::vector &indices, + void add (const std::vector &indices, const ::dealii::Vector &values); /** @@ -680,8 +685,8 @@ namespace parallel * functions above. */ template - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const OtherNumber *values); /** @@ -896,7 +901,7 @@ namespace parallel * The size that is currently allocated in the * val array. */ - unsigned int allocated_size; + size_type allocated_size; /** * Pointer to the array of @@ -963,7 +968,7 @@ namespace parallel * A helper function that is used to resize * the val array. */ - void resize_val (const unsigned int new_allocated_size); + void resize_val (const size_type new_allocated_size); /* * Make all other vector types @@ -1026,7 +1031,7 @@ namespace parallel template inline - Vector::Vector (const unsigned int size) + Vector::Vector (const size_type size) : allocated_size (0), val (0), @@ -1086,7 +1091,7 @@ namespace parallel reinit (c, true); else if (partitioner.get() != c.partitioner.get()) { - unsigned int local_ranges_different_loc = (local_range() != + size_type local_ranges_different_loc = (local_range() != c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, @@ -1118,7 +1123,7 @@ namespace parallel reinit (c, true); else if (partitioner.get() != c.partitioner.get()) { - unsigned int local_ranges_different_loc = (local_range() != + size_type local_ranges_different_loc = (local_range() != c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, @@ -1373,7 +1378,7 @@ namespace parallel template inline - types::global_dof_index Vector::size () const + size_type Vector::size () const { return partitioner->size(); } @@ -1382,7 +1387,7 @@ namespace parallel template inline - unsigned int Vector::local_size () const + size_type Vector::local_size () const { return partitioner->local_size(); } @@ -1391,7 +1396,7 @@ namespace parallel template inline - std::pair + std::pair Vector::local_range () const { return partitioner->local_range(); @@ -1403,7 +1408,7 @@ namespace parallel inline bool Vector::in_local_range - (const types::global_dof_index global_index) const + (const size_type global_index) const { return partitioner->in_local_range (global_index); } @@ -1412,7 +1417,7 @@ namespace parallel template inline - unsigned int + size_type Vector::n_ghost_entries () const { return partitioner->n_ghost_indices(); @@ -1423,7 +1428,7 @@ namespace parallel template inline bool - Vector::is_ghost_entry (const types::global_dof_index global_index) const + Vector::is_ghost_entry (const size_type global_index) const { return partitioner->is_ghost_entry (global_index); } @@ -1473,7 +1478,7 @@ namespace parallel template inline Number - Vector::operator() (const types::global_dof_index global_index) const + Vector::operator() (const size_type global_index) const { return val[partitioner->global_to_local(global_index)]; } @@ -1483,7 +1488,7 @@ namespace parallel template inline Number & - Vector::operator() (const types::global_dof_index global_index) + Vector::operator() (const size_type global_index) { return val[partitioner->global_to_local (global_index)]; } @@ -1493,7 +1498,7 @@ namespace parallel template inline Number - Vector::operator[] (const types::global_dof_index global_index) const + Vector::operator[] (const size_type global_index) const { return operator()(global_index); } @@ -1503,7 +1508,7 @@ namespace parallel template inline Number & - Vector::operator[] (const types::global_dof_index global_index) + Vector::operator[] (const size_type global_index) { return operator()(global_index); } @@ -1513,7 +1518,7 @@ namespace parallel template inline Number - Vector::local_element (const unsigned int local_index) const + Vector::local_element (const size_type local_index) const { AssertIndexRange (local_index, partitioner->local_size()+ @@ -1526,7 +1531,7 @@ namespace parallel template inline Number & - Vector::local_element (const unsigned int local_index) + Vector::local_element (const size_type local_index) { AssertIndexRange (local_index, partitioner->local_size()+ @@ -1589,7 +1594,7 @@ namespace parallel template inline void - Vector::add (const std::vector &indices, + Vector::add (const std::vector &indices, const std::vector &values) { AssertDimension (indices.size(), values.size()); @@ -1602,7 +1607,7 @@ namespace parallel template inline void - Vector::add (const std::vector &indices, + Vector::add (const std::vector &indices, const ::dealii::Vector &values) { AssertDimension (indices.size(), values.size()); @@ -1615,11 +1620,11 @@ namespace parallel template inline void - Vector::add (const unsigned int n_indices, - const unsigned int *indices, + Vector::add (const size_type n_indices, + const size_type *indices, const OtherNumber *values) { - for (unsigned int i=0; i::clear_mpi_requests () { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - for (unsigned int j=0; j void - Vector::resize_val (const unsigned int new_alloc_size) + Vector::resize_val (const size_type new_alloc_size) { if (new_alloc_size > allocated_size) { @@ -66,8 +66,8 @@ namespace parallel template void - Vector::reinit (const unsigned int size, - const bool fast) + Vector::reinit (const size_type size, + const bool fast) { clear_mpi_requests(); // check whether we need to reallocate @@ -107,8 +107,8 @@ namespace parallel if (partitioner.get() != v.partitioner.get()) { partitioner = v.partitioner; - const unsigned int new_allocated_size = partitioner->local_size() + - partitioner->n_ghost_indices(); + const size_type new_allocated_size = partitioner->local_size() + + partitioner->n_ghost_indices(); resize_val (new_allocated_size); vector_view.reinit (partitioner->local_size(), val); } @@ -159,8 +159,8 @@ namespace parallel partitioner = partitioner_in; // set vector size and allocate memory - const unsigned int new_allocated_size = partitioner->local_size() + - partitioner->n_ghost_indices(); + const size_type new_allocated_size = partitioner->local_size() + + partitioner->n_ghost_indices(); resize_val (new_allocated_size); vector_view.reinit (partitioner->local_size(), val); @@ -213,8 +213,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); // Need to send and receive the data. Use // non-blocking communication, where it is @@ -232,7 +232,7 @@ namespace parallel // up yet if (import_data == 0) import_data = new Number[part.n_import_indices()]; - for (unsigned int i=0; ival[current_index_start], part.ghost_targets()[i].second*sizeof(Number), @@ -294,8 +294,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); AssertDimension (n_ghost_targets+n_import_targets, compress_requests.size()); @@ -309,7 +309,7 @@ namespace parallel Assert (ierr == MPI_SUCCESS, ExcInternalError()); Number *read_position = import_data; - std::vector >::const_iterator + std::vector >::const_iterator my_imports = part.import_indices().begin(); // If add_ghost_data is set, add the imported @@ -317,11 +317,11 @@ namespace parallel // vector entries. if (add_ghost_data == true) for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; jsecond; j++) + for (size_type j=my_imports->first; jsecond; j++) local_element(j) += *read_position++; else for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; jsecond; j++) + for (size_type j=my_imports->first; jsecond; j++) local_element(j) = *read_position++; AssertDimension(read_position-import_data,part.n_import_indices()); } @@ -359,8 +359,8 @@ namespace parallel // make this function thread safe Threads::Mutex::ScopedLock lock (mutex); - const unsigned int n_import_targets = part.import_targets().size(); - const unsigned int n_ghost_targets = part.ghost_targets().size(); + const size_type n_import_targets = part.import_targets().size(); + const size_type n_ghost_targets = part.ghost_targets().size(); // Need to send and receive the data. Use // non-blocking communication, where it is @@ -370,9 +370,9 @@ namespace parallel { Assert (part.local_size() == vector_view.size(), ExcInternalError()); - unsigned int current_index_start = part.local_size(); + size_type current_index_start = part.local_size(); update_ghost_values_requests.resize (n_import_targets+n_ghost_targets); - for (unsigned int i=0; i 0) import_data = new Number[part.n_import_indices()]; current_index_start = 0; - for (unsigned int i=0; i >::const_iterator + std::vector >::const_iterator my_imports = part.import_indices().begin(); for ( ; my_imports!=part.import_indices().end(); ++my_imports) - for (unsigned int j=my_imports->first; jsecond; j++) + for (size_type j=my_imports->first; jsecond; j++) *write_position++ = local_element(j); } @@ -552,19 +552,19 @@ namespace parallel << partitioner->size() << std::endl << "Vector data:" << std::endl; if (across) - for (unsigned int i=0; ilocal_size(); ++i) + for (size_type i=0; ilocal_size(); ++i) out << local_element(i) << ' '; else - for (unsigned int i=0; ilocal_size(); ++i) + for (size_type i=0; ilocal_size(); ++i) out << local_element(i) << std::endl; out << std::endl; out << "Ghost entries (global index / value):" << std::endl; if (across) - for (unsigned int i=0; in_ghost_indices(); ++i) + for (size_type i=0; in_ghost_indices(); ++i) out << '(' << partitioner->ghost_indices().nth_index_in_set(i) << '/' << local_element(partitioner->local_size()+i) << ") "; else - for (unsigned int i=0; in_ghost_indices(); ++i) + for (size_type i=0; in_ghost_indices(); ++i) out << '(' << partitioner->ghost_indices().nth_index_in_set(i) << '/' << local_element(partitioner->local_size()+i) << ")" << std::endl; @@ -573,7 +573,7 @@ namespace parallel #ifdef DEAL_II_COMPILER_SUPPORTS_MPI MPI_Barrier (partitioner->get_communicator()); - for (unsigned int i=partitioner->this_mpi_process()+1; + for (size_type i=partitioner->this_mpi_process()+1; in_mpi_processes(); i++) MPI_Barrier (partitioner->get_communicator()); #endif 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 1a5dc2d2ec..01b733e0b6 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 @@ -75,7 +75,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare the type of integer. */ diff --git a/deal.II/include/deal.II/lac/trilinos_precondition.h b/deal.II/include/deal.II/lac/trilinos_precondition.h index 4c5542d5d2..a649ffb011 100644 --- a/deal.II/include/deal.II/lac/trilinos_precondition.h +++ b/deal.II/include/deal.II/lac/trilinos_precondition.h @@ -77,7 +77,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare type of integer. */ 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 3b89fde249..931b4a385f 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -103,7 +103,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare type of integer. */ 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 6588ba7053..b1ec5e4c72 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -75,7 +75,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare type of integer. */ diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index 4436f4542e..e246ac093d 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -171,7 +171,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare type of integer. */ 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 64068ae42f..8ac308fbf1 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -99,7 +99,7 @@ namespace TrilinosWrappers */ typedef std::size_t size_type; -#ifdef EPETRA_NO_64BIT_GLOBAL_INDICES +#ifdef DEAL_II_EPETRA_NO_64BIT_GLOBAL_INDICES /** * Declare type of integer. */ diff --git a/deal.II/include/deal.II/lac/vector.h b/deal.II/include/deal.II/lac/vector.h index f316827928..98139d2966 100644 --- a/deal.II/include/deal.II/lac/vector.h +++ b/deal.II/include/deal.II/lac/vector.h @@ -585,7 +585,7 @@ public: * Since this is not a distributed * vector the method always returns true. */ - bool in_local_range (const types::global_dof_index global_index) const; + bool in_local_range (const size_type global_index) const; /** * Return dimension of the vector. @@ -1200,7 +1200,7 @@ size_type Vector::size () const template inline bool Vector::in_local_range -(const types::global_dof_index) const +(const size_type) const { return true; } diff --git a/deal.II/source/lac/block_matrix_array.cc b/deal.II/source/lac/block_matrix_array.cc index e62f320d35..3a63bce74f 100644 --- a/deal.II/source/lac/block_matrix_array.cc +++ b/deal.II/source/lac/block_matrix_array.cc @@ -51,8 +51,8 @@ BlockMatrixArray::BlockMatrixArray () template BlockMatrixArray::BlockMatrixArray ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) + const size_type n_block_rows, + const size_type n_block_cols) : block_rows (n_block_rows), block_cols (n_block_cols) {} @@ -60,8 +60,8 @@ BlockMatrixArray::BlockMatrixArray ( template BlockMatrixArray::BlockMatrixArray ( - const unsigned int n_block_rows, - const unsigned int n_block_cols, + const size_type n_block_rows, + const size_type n_block_cols, VectorMemory > &) : block_rows (n_block_rows), block_cols (n_block_cols) @@ -71,8 +71,8 @@ BlockMatrixArray::BlockMatrixArray ( template void BlockMatrixArray::initialize ( - const unsigned int n_block_rows, - const unsigned int n_block_cols, + const size_type n_block_rows, + const size_type n_block_cols, VectorMemory > &) { block_rows = n_block_rows; @@ -83,8 +83,8 @@ BlockMatrixArray::initialize ( template void BlockMatrixArray::initialize ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) + const size_type n_block_rows, + const size_type n_block_cols) { block_rows = n_block_rows; block_cols = n_block_cols; @@ -95,8 +95,8 @@ BlockMatrixArray::initialize ( template void BlockMatrixArray::reinit ( - const unsigned int n_block_rows, - const unsigned int n_block_cols) + const size_type n_block_rows, + const size_type n_block_cols) { clear(); block_rows = n_block_rows; @@ -218,7 +218,7 @@ BlockMatrixArray::matrix_scalar_product ( number result = 0.; - for (unsigned int i=0; i::matrix_norm_square ( template -unsigned int +size_type BlockMatrixArray::n_block_rows () const { return block_rows; @@ -258,7 +258,7 @@ BlockMatrixArray::n_block_rows () const template -unsigned int +size_type BlockMatrixArray::n_block_cols () const { return block_cols; @@ -277,7 +277,7 @@ BlockTrianglePrecondition::BlockTrianglePrecondition() template BlockTrianglePrecondition::BlockTrianglePrecondition( - const unsigned int block_rows, + const size_type block_rows, VectorMemory > &, const bool backward) : @@ -288,7 +288,7 @@ BlockTrianglePrecondition::BlockTrianglePrecondition( template BlockTrianglePrecondition::BlockTrianglePrecondition( - const unsigned int block_rows) + const size_type block_rows) : BlockMatrixArray (block_rows, block_rows), backward(false) @@ -298,7 +298,7 @@ BlockTrianglePrecondition::BlockTrianglePrecondition( template void BlockTrianglePrecondition::initialize( - const unsigned int n_block_rows, + const size_type n_block_rows, VectorMemory > &, const bool backward) { @@ -310,7 +310,7 @@ BlockTrianglePrecondition::initialize( template void BlockTrianglePrecondition::reinit ( - const unsigned int n) + const size_type n) { BlockMatrixArray::reinit(n,n); } @@ -320,7 +320,7 @@ template void BlockTrianglePrecondition::do_row ( BlockVector &dst, - unsigned int row_num) const + size_type row_num) const { GrowingVectorMemory > mem; typename std::vector::Entry>::const_iterator @@ -339,12 +339,12 @@ BlockTrianglePrecondition::do_row ( // they are not ordered by rows. for (; m != end ; ++m) { - const unsigned int i=m->row; + const size_type i=m->row; // Ignore everything not in // this row if (i != row_num) continue; - const unsigned int j=m->col; + const size_type j=m->col; // Only use the lower (upper) // triangle for forward // (backward) substitution @@ -379,7 +379,7 @@ BlockTrianglePrecondition::do_row ( else { aux = 0.; - for (unsigned int i=0; i::vmult ( if (backward) { - for (unsigned int i=n_block_rows(); i>0;) + for (size_type i=n_block_rows(); i>0;) do_row(dst, --i); } else { - for (unsigned int i=0; i::BlockSparsityPatternBase () template BlockSparsityPatternBase:: -BlockSparsityPatternBase (const unsigned int n_block_rows, - const unsigned int n_block_columns) +BlockSparsityPatternBase (const size_type n_block_rows, + const size_type n_block_columns) : rows (0), columns (0) @@ -67,14 +67,14 @@ BlockSparsityPatternBase::~BlockSparsityPatternBase () template void BlockSparsityPatternBase:: -reinit (const unsigned int n_block_rows, - const unsigned int n_block_columns) +reinit (const size_type n_block_rows, + const size_type n_block_columns) { // delete previous content and // clean the sub_objects array // completely - for (unsigned int i=0; i &bsp) Assert (rows == bsp.rows, ExcDimensionMismatch(rows, bsp.rows)); Assert (columns == bsp.columns, ExcDimensionMismatch(columns, bsp.columns)); // copy objects - for (unsigned int i=0; i void BlockSparsityPatternBase::collect_sizes () { - std::vector row_sizes (rows); - std::vector col_sizes (columns); + std::vector row_sizes (rows); + std::vector col_sizes (columns); // first find out the row sizes // from the first block column - for (unsigned int r=0; rn_rows(); // then check that the following // block columns have the same // sizes - for (unsigned int c=1; cn_rows(), ExcIncompatibleRowNumbers (r,0,r,c)); @@ -141,10 +141,10 @@ BlockSparsityPatternBase::collect_sizes () // then do the same with the columns - for (unsigned int c=0; cn_cols(); - for (unsigned int r=1; rn_cols(), ExcIncompatibleRowNumbers (0,c,r,c)); @@ -159,8 +159,8 @@ template void BlockSparsityPatternBase::compress () { - for (unsigned int i=0; icompress (); } @@ -170,8 +170,8 @@ template bool BlockSparsityPatternBase::empty () const { - for (unsigned int i=0; iempty () == false) return false; return true; @@ -180,14 +180,14 @@ BlockSparsityPatternBase::empty () const template -unsigned int +size_type BlockSparsityPatternBase::max_entries_per_row () const { - unsigned int max_entries = 0; - for (unsigned int block_row=0; block_rowmax_entries_per_row (); if (this_row > max_entries) @@ -199,13 +199,13 @@ BlockSparsityPatternBase::max_entries_per_row () const template -types::global_dof_index +size_type BlockSparsityPatternBase::n_rows () const { // only count in first column, since // all rows should be equivalent - types::global_dof_index count = 0; - for (unsigned int r=0; rn_rows(); return count; } @@ -213,13 +213,13 @@ BlockSparsityPatternBase::n_rows () const template -types::global_dof_index +size_type BlockSparsityPatternBase::n_cols () const { // only count in first row, since // all rows should be equivalent - types::global_dof_index count = 0; - for (unsigned int c=0; cn_cols(); return count; } @@ -227,12 +227,12 @@ BlockSparsityPatternBase::n_cols () const template -unsigned int +size_type BlockSparsityPatternBase::n_nonzero_elements () const { - unsigned int count = 0; - for (unsigned int i=0; in_nonzero_elements (); return count; } @@ -243,17 +243,17 @@ template void BlockSparsityPatternBase::print(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib void BlockSparsityPatternBase::print(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib void BlockSparsityPatternBase::print_gnuplot(std::ostream &out) const { - unsigned int k=0; - for (unsigned int ib=0; ib(i+k) << std::endl;; l += b.n_cols(); @@ -347,8 +347,8 @@ BlockSparsityPattern::BlockSparsityPattern () -BlockSparsityPattern::BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) +BlockSparsityPattern::BlockSparsityPattern (const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase(n_rows, n_columns) @@ -359,23 +359,23 @@ void BlockSparsityPattern::reinit( const BlockIndices &rows, const BlockIndices &cols, - const std::vector > &row_lengths) + const std::vector > &row_lengths) { AssertDimension (row_lengths.size(), cols.size()); this->reinit(rows.size(), cols.size()); - for (unsigned int j=0; j > + VectorSlice > block_rows(row_lengths[j], start, length); block(i,j).reinit(rows.block_size(i), cols.block_size(j), @@ -391,8 +391,8 @@ BlockSparsityPattern::reinit( bool BlockSparsityPattern::is_compressed () const { - for (unsigned int i=0; iis_compressed () == false) return false; return true; @@ -408,8 +408,8 @@ BlockSparsityPattern::memory_consumption () const MemoryConsumption::memory_consumption (sub_objects) + MemoryConsumption::memory_consumption (row_indices) + MemoryConsumption::memory_consumption (column_indices)); - for (unsigned int r=0; r(n_rows, n_columns) @@ -487,8 +487,8 @@ BlockCompressedSparsityPattern ( BlockCompressedSparsityPattern:: BlockCompressedSparsityPattern ( - const std::vector &row_indices, - const std::vector &col_indices) + const std::vector &row_indices, + const std::vector &col_indices) { reinit(row_indices, col_indices); } @@ -505,12 +505,12 @@ BlockCompressedSparsityPattern ( void BlockCompressedSparsityPattern::reinit ( - const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes) + const std::vector &row_block_sizes, + const std::vector &col_block_sizes) { BlockSparsityPatternBase::reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -524,8 +524,8 @@ BlockCompressedSparsityPattern::reinit ( { BlockSparsityPatternBase::reinit(row_indices.size(), col_indices.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_indices.block_size(i), col_indices.block_size(j)); this->collect_sizes(); @@ -540,8 +540,8 @@ BlockCompressedSetSparsityPattern::BlockCompressedSetSparsityPattern () BlockCompressedSetSparsityPattern:: BlockCompressedSetSparsityPattern ( - const unsigned int n_rows, - const unsigned int n_columns) + const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase(n_rows, n_columns) @@ -550,8 +550,8 @@ BlockCompressedSetSparsityPattern ( BlockCompressedSetSparsityPattern:: BlockCompressedSetSparsityPattern ( - const std::vector &row_indices, - const std::vector &col_indices) + const std::vector &row_indices, + const std::vector &col_indices) { reinit(row_indices, col_indices); } @@ -568,12 +568,12 @@ BlockCompressedSetSparsityPattern ( void BlockCompressedSetSparsityPattern::reinit ( - const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes) + const std::vector &row_block_sizes, + const std::vector &col_block_sizes) { BlockSparsityPatternBase::reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -587,8 +587,8 @@ BlockCompressedSetSparsityPattern::reinit ( { BlockSparsityPatternBase::reinit(row_indices.size(), col_indices.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_indices.block_size(i), col_indices.block_size(j)); this->collect_sizes(); @@ -602,8 +602,8 @@ BlockCompressedSimpleSparsityPattern::BlockCompressedSimpleSparsityPattern () BlockCompressedSimpleSparsityPattern:: -BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) +BlockCompressedSimpleSparsityPattern (const size_type n_rows, + const size_type n_columns) : BlockSparsityPatternBase(n_rows, n_columns) @@ -612,14 +612,14 @@ BlockCompressedSimpleSparsityPattern (const unsigned int n_rows, BlockCompressedSimpleSparsityPattern:: -BlockCompressedSimpleSparsityPattern (const std::vector &row_indices, - const std::vector &col_indices) +BlockCompressedSimpleSparsityPattern (const std::vector &row_indices, + const std::vector &col_indices) : BlockSparsityPatternBase(row_indices.size(), col_indices.size()) { - for (unsigned int i=0; iblock(i,j).reinit(row_indices[i],col_indices[j]); this->collect_sizes(); } @@ -631,8 +631,8 @@ BlockCompressedSimpleSparsityPattern (const std::vector &partitioning) BlockSparsityPatternBase(partitioning.size(), partitioning.size()) { - for (unsigned int i=0; iblock(i,j).reinit(partitioning[i].size(), partitioning[j].size(), partitioning[i]); @@ -643,13 +643,13 @@ BlockCompressedSimpleSparsityPattern (const std::vector &partitioning) void BlockCompressedSimpleSparsityPattern::reinit ( - const std::vector< types::global_dof_index > &row_block_sizes, - const std::vector< types::global_dof_index > &col_block_sizes) + const std::vector &row_block_sizes, + const std::vector &col_block_sizes) { BlockSparsityPatternBase:: reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -660,8 +660,8 @@ BlockCompressedSimpleSparsityPattern::reinit ( { BlockSparsityPatternBase:: reinit(partitioning.size(), partitioning.size()); - for (unsigned int i=0; iblock(i,j).reinit(partitioning[i].size(), partitioning[j].size(), partitioning[i]); @@ -679,8 +679,8 @@ namespace TrilinosWrappers BlockSparsityPattern:: - BlockSparsityPattern (const unsigned int n_rows, - const unsigned int n_columns) + BlockSparsityPattern (const size_type n_rows, + const size_type n_columns) : dealii::BlockSparsityPatternBase(n_rows, n_columns) @@ -689,14 +689,14 @@ namespace TrilinosWrappers BlockSparsityPattern:: - BlockSparsityPattern (const std::vector &row_indices, - const std::vector &col_indices) + BlockSparsityPattern (const std::vector &row_indices, + const std::vector &col_indices) : BlockSparsityPatternBase(row_indices.size(), col_indices.size()) { - for (unsigned int i=0; iblock(i,j).reinit(row_indices[i],col_indices[j]); this->collect_sizes(); } @@ -710,8 +710,8 @@ namespace TrilinosWrappers (parallel_partitioning.size(), parallel_partitioning.size()) { - for (unsigned int i=0; iblock(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j]); this->collect_sizes(); @@ -727,8 +727,8 @@ namespace TrilinosWrappers (parallel_partitioning.size(), parallel_partitioning.size()) { - for (unsigned int i=0; iblock(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j], communicator); @@ -738,13 +738,13 @@ namespace TrilinosWrappers void - BlockSparsityPattern::reinit (const std::vector &row_block_sizes, - const std::vector &col_block_sizes) + BlockSparsityPattern::reinit (const std::vector &row_block_sizes, + const std::vector &col_block_sizes) { dealii::BlockSparsityPatternBase:: reinit(row_block_sizes.size(), col_block_sizes.size()); - for (unsigned int i=0; iblock(i,j).reinit(row_block_sizes[i],col_block_sizes[j]); this->collect_sizes(); } @@ -757,8 +757,8 @@ namespace TrilinosWrappers dealii::BlockSparsityPatternBase:: reinit(parallel_partitioning.size(), parallel_partitioning.size()); - for (unsigned int i=0; iblock(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j]); this->collect_sizes(); @@ -773,8 +773,8 @@ namespace TrilinosWrappers dealii::BlockSparsityPatternBase:: reinit(parallel_partitioning.size(), parallel_partitioning.size()); - for (unsigned int i=0; iblock(i,j).reinit(parallel_partitioning[i], parallel_partitioning[j], communicator); diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index b5a9c2bea8..59f8770389 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -42,10 +42,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const ChunkSparsityPattern &s) -ChunkSparsityPattern::ChunkSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n, - const unsigned int max_per_row, - const unsigned int chunk_size, +ChunkSparsityPattern::ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -54,10 +54,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const types::global_dof_index m, } -ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::ChunkSparsityPattern (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -67,10 +67,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int m, ChunkSparsityPattern::ChunkSparsityPattern ( - const types::global_dof_index m, - const types::global_dof_index n, - const std::vector &row_lengths, - const unsigned int chunk_size, + const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -81,10 +81,10 @@ ChunkSparsityPattern::ChunkSparsityPattern ( ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -93,9 +93,9 @@ ChunkSparsityPattern::ChunkSparsityPattern ( -ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::ChunkSparsityPattern (const size_type n, + const size_type max_per_row, + const size_type chunk_size) { reinit (n, n, max_per_row, chunk_size); } @@ -104,8 +104,8 @@ ChunkSparsityPattern::ChunkSparsityPattern (const unsigned int n, ChunkSparsityPattern::ChunkSparsityPattern ( const types::global_dof_index m, - const std::vector &row_lengths, - const unsigned int chunk_size, + const std::vector &row_lengths, + const size_type chunk_size, const bool) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -116,9 +116,9 @@ ChunkSparsityPattern::ChunkSparsityPattern ( ChunkSparsityPattern::ChunkSparsityPattern ( - const unsigned int m, - const std::vector &row_lengths, - const unsigned int chunk_size) + const size_type m, + const std::vector &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -148,10 +148,10 @@ ChunkSparsityPattern::operator = (const ChunkSparsityPattern &s) void -ChunkSparsityPattern::reinit (const types::global_dof_index m, - const types::global_dof_index n, - const unsigned int max_per_row, - const unsigned int chunk_size, +ChunkSparsityPattern::reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size, const bool) { reinit (m, n, max_per_row, chunk_size); @@ -159,16 +159,16 @@ ChunkSparsityPattern::reinit (const types::global_dof_index m, void -ChunkSparsityPattern::reinit (const unsigned int m, - const unsigned int n, - const unsigned int max_per_row, - const unsigned int chunk_size) +ChunkSparsityPattern::reinit (const size_type m, + const size_type n, + const size_type max_per_row, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); // simply map this function to the // other @p{reinit} function - const std::vector row_lengths (m, max_per_row); + const std::vector row_lengths (m, max_per_row); reinit (m, n, row_lengths, chunk_size); } @@ -178,8 +178,8 @@ void ChunkSparsityPattern::reinit ( const types::global_dof_index m, const types::global_dof_index n, - const VectorSlice > &row_lengths, - const unsigned int chunk_size, + const VectorSlice > &row_lengths, + const size_type chunk_size, const bool) { reinit (m, n, row_lengths, chunk_size); @@ -188,10 +188,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const VectorSlice > &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const VectorSlice > &row_lengths, + const size_type chunk_size) { Assert (row_lengths.size() == m, ExcInvalidNumber (m)); Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -208,8 +208,8 @@ ChunkSparsityPattern::reinit ( // (n/chunk_size). rounding up in integer // arithmetic equals // ((m+chunk_size-1)/chunk_size): - const unsigned int m_chunks = (m+chunk_size-1) / chunk_size, - n_chunks = (n+chunk_size-1) / chunk_size; + const size_type m_chunks = (m+chunk_size-1) / chunk_size, + n_chunks = (n+chunk_size-1) / chunk_size; // compute the maximum number of chunks in // each row. the passed array denotes the @@ -222,8 +222,8 @@ ChunkSparsityPattern::reinit ( // row zero at columns {0,2} and for row // one at {4,6} --> we'll need 4 chunks for // the first chunk row!) : - std::vector chunk_row_lengths (m_chunks, 0); - for (unsigned int i=0; i chunk_row_lengths (m_chunks, 0); + for (size_type i=0; i void ChunkSparsityPattern::copy_from (const SparsityType &csp, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (csp, chunk_size); @@ -260,7 +260,7 @@ namespace internal // and SparsityPattern that uses begin() as iterator type template void copy_row (const Sparsity &csp, - const unsigned int row, + const size_type row, ChunkSparsityPattern &dst) { typename Sparsity::row_iterator col_num = csp.row_begin (row); @@ -269,7 +269,7 @@ namespace internal } void copy_row (const SparsityPattern &csp, - const unsigned int row, + const size_type row, ChunkSparsityPattern &dst) { SparsityPattern::iterator col_num = csp.begin (row); @@ -283,15 +283,15 @@ namespace internal template void ChunkSparsityPattern::copy_from (const SparsityType &csp, - const unsigned int chunk_size) + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); // count number of entries per row, then // initialize the underlying sparsity // pattern - std::vector entries_per_row (csp.n_rows(), 0); - for (unsigned int row = 0; row entries_per_row (csp.n_rows(), 0); + for (size_type row = 0; row void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, - const unsigned int chunk_size, + const size_type chunk_size, const bool) { copy_from (matrix, chunk_size); @@ -320,7 +320,7 @@ void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, template void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, - const unsigned int chunk_size) + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -328,10 +328,10 @@ void ChunkSparsityPattern::copy_from (const FullMatrix &matrix, // pattern. remember to also allocate space for the diagonal entry (if that // hasn't happened yet) if m==n since we always allocate that for diagonal // matrices - std::vector entries_per_row (matrix.m(), 0); - for (unsigned int row=0; row entries_per_row (matrix.m(), 0); + for (size_type row=0; row &matrix, chunk_size); // then actually fill it - for (unsigned int row=0; row &matrix, void ChunkSparsityPattern::reinit ( - const types::global_dof_index m, - const types::global_dof_index n, - const std::vector &row_lengths, - const unsigned int chunk_size, + const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size, const bool) { reinit (m, n, row_lengths, chunk_size); @@ -370,10 +370,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const unsigned int chunk_size) + const size_type m, + const size_type n, + const std::vector &row_lengths, + const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -390,7 +390,7 @@ ChunkSparsityPattern::empty () const -unsigned int +size_type ChunkSparsityPattern::max_entries_per_row () const { return sparsity_pattern.max_entries_per_row() * chunk_size; @@ -399,8 +399,8 @@ ChunkSparsityPattern::max_entries_per_row () const void -ChunkSparsityPattern::add (const types::global_dof_index i, - const types::global_dof_index j) +ChunkSparsityPattern::add (const size_type i, + const size_type j) { Assert (i (const CompressedSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from (const CompressedSetSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from (const CompressedSimpleSparsityPattern &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from (const FullMatrix &, - const unsigned int, + const size_type , const bool); template void ChunkSparsityPattern::copy_from (const FullMatrix &, - const unsigned int, + const size_type , const bool); DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/lac/compressed_set_sparsity_pattern.cc b/deal.II/source/lac/compressed_set_sparsity_pattern.cc index e01be57aca..47007d37aa 100644 --- a/deal.II/source/lac/compressed_set_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_set_sparsity_pattern.cc @@ -46,8 +46,8 @@ CompressedSetSparsityPattern (const CompressedSetSparsityPattern &s) -CompressedSetSparsityPattern::CompressedSetSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n) +CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type m, + const size_type n) : rows(0), cols(0) @@ -57,7 +57,7 @@ CompressedSetSparsityPattern::CompressedSetSparsityPattern (const types::global_ -CompressedSetSparsityPattern::CompressedSetSparsityPattern (const types::global_dof_index n) +CompressedSetSparsityPattern::CompressedSetSparsityPattern (const size_type n) : rows(0), cols(0) @@ -82,8 +82,8 @@ CompressedSetSparsityPattern::operator = (const CompressedSetSparsityPattern &s) void -CompressedSetSparsityPattern::reinit (const types::global_dof_index m, - const types::global_dof_index n) +CompressedSetSparsityPattern::reinit (const size_type m, + const size_type n) { rows = m; cols = n; @@ -108,13 +108,13 @@ CompressedSetSparsityPattern::empty () const -unsigned int +size_type CompressedSetSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i(lines[i].entries.size())); + m = std::max (m, static_cast(lines[i].entries.size())); } return m; @@ -123,8 +123,8 @@ CompressedSetSparsityPattern::max_entries_per_row () const bool -CompressedSetSparsityPattern::exists (const types::global_dof_index i, - const types::global_dof_index j) const +CompressedSetSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i::const_iterator + for (std::set::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -170,11 +170,11 @@ CompressedSetSparsityPattern::print (std::ostream &out) const { AssertThrow (out, ExcIO()); - for (unsigned int row=0; row::const_iterator + for (std::set::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -192,9 +192,9 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const { AssertThrow (out, ExcIO()); - for (unsigned int row=0; row::const_iterator + for (std::set::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -211,16 +211,16 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +size_type CompressedSetSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row::const_iterator + for (std::set::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast(std::abs(static_cast(row-*j))) > b) + if (static_cast(std::abs(static_cast(row-*j))) > b) b = std::abs(static_cast(row-*j)); } @@ -229,11 +229,11 @@ CompressedSetSparsityPattern::bandwidth () const -unsigned int +size_type CompressedSetSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i 3) { @@ -60,8 +60,8 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, // first entry is a duplicate before // actually doing something. ForwardIterator my_it = begin; - unsigned int col = *my_it; - std::vector::iterator it = + size_type col = *my_it; + std::vector::iterator it = Utilities::lower_bound(entries.begin(), entries.end(), col); while (*it == col) { @@ -90,14 +90,14 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, // resize vector by just inserting the // list - const unsigned int pos1 = it - entries.begin(); + const size_type pos1 = it - entries.begin(); Assert (pos1 <= entries.size(), ExcInternalError()); entries.insert (it, my_it, end); it = entries.begin() + pos1; - Assert (entries.size() >= (unsigned int)(it-entries.begin()), ExcInternalError()); + Assert (entries.size() >= (size_type)(it-entries.begin()), ExcInternalError()); // now merge the two lists. - std::vector::iterator it2 = it + (end-my_it); + std::vector::iterator it2 = it + (end-my_it); // as long as there are indices both in // the end of the entries list and in the @@ -125,7 +125,7 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, *it++ = *it2++; // resize and return - const unsigned int new_size = it - entries.begin(); + const size_type new_size = it - entries.begin(); Assert (new_size <= stop_size, ExcInternalError()); entries.resize (new_size); return; @@ -140,8 +140,8 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, if (stop_size > entries.capacity()) entries.reserve (stop_size); - unsigned int col = *my_it; - std::vector::iterator it, it2; + size_type col = *my_it; + std::vector::iterator it, it2; // insert the first element as for one // entry only first check the last // element (or if line is still empty) @@ -209,7 +209,7 @@ CompressedSimpleSparsityPattern::Line::add_entries (ForwardIterator begin, std::size_t CompressedSimpleSparsityPattern::Line::memory_consumption () const { - return entries.capacity()*sizeof(unsigned int)+sizeof(Line); + return entries.capacity()*sizeof(size_type)+sizeof(Line); } @@ -236,8 +236,8 @@ CompressedSimpleSparsityPattern (const CompressedSimpleSparsityPattern &s) -CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n, +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type m, + const size_type n, const IndexSet &rowset_ ) : @@ -250,7 +250,7 @@ CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const types::g -CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const types::global_dof_index n) +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type n) : rows(0), cols(0), @@ -276,8 +276,8 @@ CompressedSimpleSparsityPattern::operator = (const CompressedSimpleSparsityPatte void -CompressedSimpleSparsityPattern::reinit (const types::global_dof_index m, - const types::global_dof_index n, +CompressedSimpleSparsityPattern::reinit (const size_type m, + const size_type n, const IndexSet &rowset_) { rows = m; @@ -306,13 +306,13 @@ CompressedSimpleSparsityPattern::empty () const -unsigned int +size_type CompressedSimpleSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i(lines[i].entries.size())); + m = std::max (m, static_cast(lines[i].entries.size())); } return m; @@ -321,14 +321,14 @@ CompressedSimpleSparsityPattern::max_entries_per_row () const bool -CompressedSimpleSparsityPattern::exists (const types::global_dof_index i, - const types::global_dof_index j) const +CompressedSimpleSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -375,11 +375,11 @@ CompressedSimpleSparsityPattern::symmetrize () void CompressedSimpleSparsityPattern::print (std::ostream &out) const { - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -395,12 +395,12 @@ CompressedSimpleSparsityPattern::print (std::ostream &out) const void CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const { - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -419,19 +419,19 @@ CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +size_type CompressedSimpleSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast(std::abs(static_cast(rowindex-*j))) > b) + if (static_cast(std::abs(static_cast(rowindex-*j))) > b) b = std::abs(static_cast(rowindex-*j)); } @@ -440,11 +440,11 @@ CompressedSimpleSparsityPattern::bandwidth () const -unsigned int +size_type CompressedSimpleSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i::iterator, - std::vector::iterator, +add_entries(std::vector::iterator, + std::vector::iterator, const bool); #endif diff --git a/deal.II/source/lac/compressed_sparsity_pattern.cc b/deal.II/source/lac/compressed_sparsity_pattern.cc index ebc337ca88..740c529b18 100644 --- a/deal.II/source/lac/compressed_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_sparsity_pattern.cc @@ -338,8 +338,8 @@ CompressedSparsityPattern (const CompressedSparsityPattern &s) -CompressedSparsityPattern::CompressedSparsityPattern (const types::global_dof_index m, - const types::global_dof_index n) +CompressedSparsityPattern::CompressedSparsityPattern (const size_type m, + const size_type n) : rows(0), cols(0) @@ -349,7 +349,7 @@ CompressedSparsityPattern::CompressedSparsityPattern (const types::global_dof_in -CompressedSparsityPattern::CompressedSparsityPattern (const types::global_dof_index n) +CompressedSparsityPattern::CompressedSparsityPattern (const size_type n) : rows(0), cols(0) @@ -374,8 +374,8 @@ CompressedSparsityPattern::operator = (const CompressedSparsityPattern &s) void -CompressedSparsityPattern::reinit (const types::global_dof_index m, - const types::global_dof_index n) +CompressedSparsityPattern::reinit (const size_type m, + const size_type n) { rows = m; cols = n; @@ -400,15 +400,15 @@ CompressedSparsityPattern::empty () const -unsigned int +size_type CompressedSparsityPattern::max_entries_per_row () const { - unsigned int m = 0; - for (unsigned int i=0; i(lines[i].entries.size())); + m = std::max (m, static_cast(lines[i].entries.size())); } return m; @@ -417,8 +417,8 @@ CompressedSparsityPattern::max_entries_per_row () const bool -CompressedSparsityPattern::exists (const types::global_dof_index i, - const types::global_dof_index j) const +CompressedSparsityPattern::exists (const size_type i, + const size_type j) const { Assert (i::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) @@ -468,14 +468,14 @@ CompressedSparsityPattern::symmetrize () void CompressedSparsityPattern::print (std::ostream &out) const { - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) out << ',' << *j; @@ -491,11 +491,11 @@ CompressedSparsityPattern::print (std::ostream &out) const void CompressedSparsityPattern::print_gnuplot (std::ostream &out) const { - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) // while matrix entries are usually @@ -511,19 +511,19 @@ CompressedSparsityPattern::print_gnuplot (std::ostream &out) const -unsigned int +size_type CompressedSparsityPattern::bandwidth () const { - unsigned int b=0; - for (unsigned int row=0; row::const_iterator + for (std::vector::const_iterator j=lines[row].entries.begin(); j != lines[row].entries.end(); ++j) - if (static_cast(std::abs(static_cast(row-*j))) > b) + if (static_cast(std::abs(static_cast(row-*j))) > b) b = std::abs(static_cast(row-*j)); } @@ -532,11 +532,11 @@ CompressedSparsityPattern::bandwidth () const -unsigned int +size_type CompressedSparsityPattern::n_nonzero_elements () const { - unsigned int n=0; - for (unsigned int i=0; i::iterator, - std::vector::iterator, +add_entries(std::vector::iterator, + std::vector::iterator, const bool); #endif diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index bba9512788..e0929273e2 100644 --- a/deal.II/source/lac/constraint_matrix.cc +++ b/deal.II/source/lac/constraint_matrix.cc @@ -54,7 +54,7 @@ const Table<2,bool> ConstraintMatrix::default_empty_table = Table<2,bool>(); bool -ConstraintMatrix::check_zero_weight (const std::pair &p) +ConstraintMatrix::check_zero_weight (const std::pair &p) { return (p.second == 0); } @@ -77,7 +77,7 @@ ConstraintMatrix::ConstraintLine::operator == (const ConstraintLine &a) const -std::size_t +size_type ConstraintMatrix::ConstraintLine::memory_consumption () const { return (MemoryConsumption::memory_consumption (line) + @@ -88,9 +88,9 @@ ConstraintMatrix::ConstraintLine::memory_consumption () const void -ConstraintMatrix::add_lines (const std::set &lines) +ConstraintMatrix::add_lines (const std::set &lines) { - for (std::set::const_iterator + for (std::set::const_iterator i = lines.begin(); i != lines.end(); ++i) add_line (*i); } @@ -100,7 +100,7 @@ ConstraintMatrix::add_lines (const std::set &lines) void ConstraintMatrix::add_lines (const std::vector &lines) { - for (unsigned int i=0; i &lines) void ConstraintMatrix::add_lines (const IndexSet &lines) { - for (unsigned int i=0; i > &col_val_pairs) +(const size_type line, + const std::vector > &col_val_pairs) { Assert (sorted==false, ExcMatrixIsClosed()); Assert (is_constrained(line), ExcLineInexistant(line)); @@ -136,7 +136,7 @@ ConstraintMatrix::add_entries // an entry for this column already // exists, since we don't want to // enter it twice - for (std::vector >::const_iterator + for (std::vector >::const_iterator col_val_pair = col_val_pairs.begin(); col_val_pair!=col_val_pairs.end(); ++col_val_pair) { @@ -175,10 +175,10 @@ void ConstraintMatrix::add_selected_constraints line!=constraints.lines.end(); ++line) if (filter.is_element(line->line)) { - const unsigned int row = filter.index_within_set (line->line); + const size_type row = filter.index_within_set (line->line); add_line (row); set_inhomogeneity (row, line->inhomogeneity); - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) if (filter.is_element(line->entries[i].first)) add_entry (row, filter.index_within_set (line->entries[i].first), line->entries[i].second); @@ -200,9 +200,9 @@ void ConstraintMatrix::close () // modify the size any more after this // point. { - std::vector new_lines (lines_cache.size(), - numbers::invalid_unsigned_int); - unsigned int counter = 0; + std::vector new_lines (lines_cache.size(), + numbers::invalid_size_type); + size_type counter = 0; for (std::vector::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) new_lines[calculate_line_index(line->line)] = counter; @@ -211,8 +211,8 @@ void ConstraintMatrix::close () // in debug mode: check whether we really // set the pointers correctly. - for (unsigned int i=0; i::iterator line = lines.begin(); line!=lines.end(); ++line) { @@ -278,7 +278,7 @@ void ConstraintMatrix::close () // efficient. also, we have to do // it only once, rather than in // each iteration - unsigned int iteration = 0; + size_type iteration = 0; while (true) { bool chained_constraint_replaced = false; @@ -289,7 +289,7 @@ void ConstraintMatrix::close () #ifdef DEBUG // we need to keep track of how many replacements we do in this line, because we can // end up in a cycle A->B->C->A without the number of entries growing. - unsigned int n_replacements = 0; + size_type n_replacements = 0; #endif @@ -304,7 +304,7 @@ void ConstraintMatrix::close () // elements that we don't // store on the current // processor - unsigned int entry = 0; + size_type entry = 0; while (entry < line->entries.size()) if (((local_lines.size() == 0) || @@ -320,8 +320,8 @@ void ConstraintMatrix::close () // look up the chain // of constraints for // this entry - const unsigned int dof_index = line->entries[entry].first; - const double weight = line->entries[entry].second; + const size_type dof_index = line->entries[entry].first; + const double weight = line->entries[entry].second; Assert (dof_index != line->line, ExcMessage ("Cycle in constraints detected!")); @@ -356,7 +356,7 @@ void ConstraintMatrix::close () // of other dofs: if (constrained_line->entries.size() > 0) { - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) Assert (dof_index != constrained_line->entries[i].first, ExcMessage ("Cycle in constraints detected!")); @@ -369,7 +369,7 @@ void ConstraintMatrix::close () constrained_line->entries[0].second * weight); - for (unsigned int i=1; ientries.size(); ++i) + for (size_type i=1; ientries.size(); ++i) line->entries .push_back (std::make_pair (constrained_line->entries[i].first, constrained_line->entries[i].second * @@ -458,8 +458,8 @@ void ConstraintMatrix::close () // lets us allocate the correct amount // of memory for the constraint // entries. - unsigned int duplicates = 0; - for (unsigned int i=1; ientries.size(); ++i) + size_type duplicates = 0; + for (size_type i=1; ientries.size(); ++i) if (line->entries[i].first == line->entries[i-1].first) duplicates++; @@ -480,7 +480,7 @@ void ConstraintMatrix::close () // resolve the duplicates new_entries.reserve (line->entries.size() - duplicates); new_entries.push_back(line->entries[0]); - for (unsigned int j=1; jentries.size(); ++j) + for (size_type j=1; jentries.size(); ++j) if (line->entries[j].first == line->entries[j-1].first) { Assert (new_entries.back().first == line->entries[j].first, @@ -497,7 +497,7 @@ void ConstraintMatrix::close () // really no duplicates // left and that the list // is still sorted - for (unsigned int j=1; jentries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) sum += line->entries[i].second; if ((sum != 1.0) && (std::fabs (sum-1.) < 1.e-13)) { - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) line->entries[i].second /= sum; line->inhomogeneity /= sum; } @@ -591,7 +591,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, if (other_constraints.lines_cache.size() > lines_cache.size()) lines_cache.resize(other_constraints.lines_cache.size(), - numbers::invalid_unsigned_int); + numbers::invalid_size_type); // first action is to fold into the present // object possible constraints in the @@ -613,7 +613,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, line!=lines.end(); ++line) { tmp.clear (); - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) { // if the present dof is not // constrained, or if we won't take @@ -646,7 +646,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, for (ConstraintLine::Entries::const_iterator j=other_line->begin(); j!=other_line->end(); ++j) - tmp.push_back (std::pair(j->first, + tmp.push_back (std::pair(j->first, j->second*weight)); line->inhomogeneity += other_constraints.get_inhomogeneity(line->entries[i].first) * @@ -701,7 +701,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, } // update the lines cache - unsigned int counter = 0; + size_type counter = 0; for (std::vector::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) lines_cache[calculate_line_index(line->line)] = counter; @@ -717,13 +717,13 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, -void ConstraintMatrix::shift (const unsigned int offset) +void ConstraintMatrix::shift (const size_type offset) { //TODO: this doesn't work with IndexSets yet. [TH] AssertThrow(local_lines.size()==0, ExcNotImplemented()); lines_cache.insert (lines_cache.begin(), offset, - numbers::invalid_unsigned_int); + numbers::invalid_size_type); for (std::vector::iterator i = lines.begin(); i != lines.end(); ++i) @@ -746,7 +746,7 @@ void ConstraintMatrix::clear () } { - std::vector tmp; + std::vector tmp; lines_cache.swap (tmp); } @@ -780,15 +780,15 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, new_line.reserve (uncondensed.n_rows()); std::vector::const_iterator next_constraint = lines.begin(); - unsigned int shift = 0; - unsigned int n_rows = uncondensed.n_rows(); + size_type shift = 0; + size_type n_rows = uncondensed.n_rows(); if (next_constraint == lines.end()) // if no constraint is to be handled - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) new_line.push_back (row); else - for (unsigned int row=0; row!=n_rows; ++row) + for (size_type row=0; row!=n_rows; ++row) if (row == next_constraint->line) { // this line is constrained @@ -800,7 +800,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // nothing more to do; finish rest // of loop { - for (unsigned int i=row+1; iline != j->column()) ++c; - for (unsigned int q=0; q!=c->entries.size(); ++q) + for (size_type q=0; q!=c->entries.size(); ++q) condensed.add (new_line[row], new_line[c->entries[q].first]); } else @@ -839,7 +839,7 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, // for each entry: distribute if (new_line[j->column()] != -1) // column is not constrained - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[j->column()]); @@ -852,8 +852,8 @@ void ConstraintMatrix::condense (const SparsityPattern &uncondensed, std::vector::const_iterator c = lines.begin(); while (c->line != j->column()) ++c; - for (unsigned int p=0; p!=c->entries.size(); ++p) - for (unsigned int q=0; q!=next_constraint->entries.size(); ++q) + for (size_type p=0; p!=c->entries.size(); ++p) + for (size_type q=0; q!=next_constraint->entries.size(); ++q) condensed.add (new_line[next_constraint->entries[q].first], new_line[c->entries[p].first]); }; @@ -874,21 +874,21 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const // store for each index whether it must be // distributed or not. If entry is - // numbers::invalid_unsigned_int, + // numbers::invalid_size_type, // no distribution is necessary. // otherwise, the number states which line // in the constraint matrix handles this // index - std::vector distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; cis_valid_entry()); ++entry) { - const unsigned int column = entry->column(); + const size_type column = entry->column(); - if (distribute[column] != numbers::invalid_unsigned_int) + if (distribute[column] != numbers::invalid_size_type) { // distribute entry // at regular row // @p{row} and // irregular column // sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) sparsity.add (row, @@ -932,12 +932,12 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const for (SparsityPattern::iterator entry = sparsity.begin(row); (entry != sparsity.end(row)) && entry->is_valid_entry(); ++entry) { - const unsigned int column = entry->column(); - if (distribute[column] == numbers::invalid_unsigned_int) + const size_type column = entry->column(); + if (distribute[column] == numbers::invalid_size_type) // distribute entry at irregular // row @p{row} and regular column // sparsity.colnums[j] - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, column); @@ -945,8 +945,8 @@ void ConstraintMatrix::condense (SparsityPattern &sparsity) const // distribute entry at irregular // row @p{row} and irregular column // sparsity.get_column_numbers()[j] - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[column]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, lines[distribute[column]].entries[q].first); @@ -967,31 +967,31 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const // store for each index whether it must be // distributed or not. If entry is - // numbers::invalid_unsigned_int, + // numbers::invalid_size_type, // no distribution is necessary. // otherwise, the number states which line // in the constraint matrix handles this // index - std::vector distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c distribute(sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute(sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c + const std::pair block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; + const size_type block_row = block_index.first; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -1364,7 +1364,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_colis_valid_entry(); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global(block_col, entry->column()); - if (distribute[global_col] != numbers::invalid_unsigned_int) + if (distribute[global_col] != numbers::invalid_size_type) // distribute entry at regular // row @p{row} and irregular column // global_col { - for (unsigned int q=0; + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (row, lines[distribute[global_col]].entries[q].first); @@ -1398,7 +1398,7 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const // whole row into the // chunks defined by the // blocks - for (unsigned int block_col=0; block_colis_valid_entry(); ++entry) { - const unsigned int global_col + const size_type global_col = index_mapping.local_to_global (block_col, entry->column()); - if (distribute[global_col] == numbers::invalid_unsigned_int) + if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular // row @p{row} and regular column // global_col. { - for (unsigned int q=0; q!=lines[distribute[row]].entries.size(); ++q) + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); } else @@ -1425,8 +1425,8 @@ void ConstraintMatrix::condense (BlockSparsityPattern &sparsity) const // row @p{row} and irregular column // @p{global_col} { - for (unsigned int p=0; p!=lines[distribute[row]].entries.size(); ++p) - for (unsigned int q=0; q!=lines[distribute[global_col]].entries.size(); ++q) + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) + for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, lines[distribute[global_col]].entries[q].first); } @@ -1453,32 +1453,32 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const const BlockIndices & index_mapping = sparsity.get_column_indices(); - const unsigned int n_blocks = sparsity.n_block_rows(); + const size_type n_blocks = sparsity.n_block_rows(); // store for each index whether it must be // distributed or not. If entry is - // numbers::invalid_unsigned_int, + // numbers::invalid_size_type, // no distribution is necessary. // otherwise, the number states which line // in the constraint matrix handles this // index - std::vector distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row + const std::pair block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -1504,23 +1504,23 @@ void ConstraintMatrix::condense (BlockCompressedSparsityPattern &sparsity) const // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_col distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row + const std::pair block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -1638,7 +1638,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_col distribute (sparsity.n_rows(), - numbers::invalid_unsigned_int); + std::vector distribute (sparsity.n_rows(), + numbers::invalid_size_type); - for (unsigned int c=0; c(c); - const unsigned int n_rows = sparsity.n_rows(); - for (unsigned int row=0; row + const std::pair block_index = index_mapping.global_to_local(row); - const unsigned int block_row = block_index.first; - const unsigned int local_row = block_index.second; + const size_type block_row = block_index.first; + const size_type local_row = block_index.second; - if (distribute[row] == numbers::invalid_unsigned_int) + if (distribute[row] == numbers::invalid_size_type) // regular line. loop over // all columns and see // whether this column must @@ -1774,23 +1774,23 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) // this blockrow and the // corresponding row // therein - for (unsigned int block_col=0; block_col + const std::pair local_range = vec.local_range(); my_indices.add_range (local_range.first, local_range.second); - std::set individual_indices; + std::set individual_indices; for (constraint_iterator it = begin_my_constraints; it != end_my_constraints; ++it) - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) if ((it->entries[i].first < local_range.first) || (it->entries[i].first >= local_range.second)) @@ -1925,7 +1925,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::Vector &vec) const // next_constraint.line by adding the // different contributions double new_value = it->inhomogeneity; - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) new_value += (vec_distribute(it->entries[i].first) * it->entries[i].second); vec(it->line) = new_value; @@ -1947,7 +1947,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::BlockVector &vec) const Assert (sorted==true, ExcMatrixIsClosed()); IndexSet my_indices (vec.size()); - for (unsigned int block=0; block::const_iterator constraint_iterator; ConstraintLine index_comparison; @@ -1968,15 +1968,15 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::BlockVector &vec) const // constraints indicate. No caching done // yet. would need some more clever data // structures for doing that. - const std::pair + const std::pair local_range = vec.block(block).local_range(); my_indices.add_range (local_range.first, local_range.second); - std::set individual_indices; + std::set individual_indices; for (constraint_iterator it = begin_my_constraints; it != end_my_constraints; ++it) - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) if ((it->entries[i].first < local_range.first) || (it->entries[i].first >= local_range.second)) @@ -2002,7 +2002,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::BlockVector &vec) const // here we import the data vec_distribute.reinit(vec,true); - for (unsigned int block=0; block::const_iterator constraint_iterator; ConstraintLine index_comparison; @@ -2024,7 +2024,7 @@ ConstraintMatrix::distribute (TrilinosWrappers::MPI::BlockVector &vec) const // next_constraint.line by adding the // different contributions double new_value = it->inhomogeneity; - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) new_value += (vec_distribute(it->entries[i].first) * it->entries[i].second); vec(it->line) = new_value; @@ -2063,15 +2063,15 @@ ConstraintMatrix::distribute (PETScWrappers::MPI::Vector &vec) const // all indices we need to read from IndexSet my_indices (vec.size()); - const std::pair + const std::pair local_range = vec.local_range(); my_indices.add_range (local_range.first, local_range.second); - std::set individual_indices; + std::set individual_indices; for (constraint_iterator it = begin_my_constraints; it != end_my_constraints; ++it) - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) if ((it->entries[i].first < local_range.first) || (it->entries[i].first >= local_range.second)) @@ -2100,7 +2100,7 @@ ConstraintMatrix::distribute (PETScWrappers::MPI::Vector &vec) const // next_constraint.line by adding the // different contributions PetscScalar new_value = it->inhomogeneity; - for (unsigned int i=0; ientries.size(); ++i) + for (size_type i=0; ientries.size(); ++i) new_value += (PetscScalar(ghost_vec(it->entries[i].first)) * it->entries[i].second); vec(it->line) = new_value; @@ -2122,7 +2122,7 @@ ConstraintMatrix::distribute (PETScWrappers::MPI::BlockVector & /*vec*/) const -bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const +bool ConstraintMatrix::is_identity_constrained (const size_type index) const { if (is_constrained(index) == false) return false; @@ -2139,16 +2139,16 @@ bool ConstraintMatrix::is_identity_constrained (const unsigned int index) const -unsigned int ConstraintMatrix::max_constraint_indirections () const +size_type ConstraintMatrix::max_constraint_indirections () const { - unsigned int return_value = 0; + size_type return_value = 0; for (std::vector::const_iterator i=lines.begin(); i!=lines.end(); ++i) // use static cast, since // typeof(size)==std::size_t, which is != - // unsigned int on AIX + // size_type on AIX return_value = std::max(return_value, - static_cast(i->entries.size())); + static_cast(i->entries.size())); return return_value; } @@ -2168,14 +2168,14 @@ bool ConstraintMatrix::has_inhomogeneities () const void ConstraintMatrix::print (std::ostream &out) const { - for (unsigned int i=0; i!=lines.size(); ++i) + for (size_type i=0; i!=lines.size(); ++i) { // output the list of // constraints as pairs of dofs // and their weights if (lines[i].entries.size() > 0) { - for (unsigned int j=0; j 0) - for (unsigned int j=0; j" << lines[i].entries[j].first << "; // weight: " << lines[i].entries[j].second @@ -2230,7 +2230,7 @@ ConstraintMatrix::write_dot (std::ostream &out) const -std::size_t +size_type ConstraintMatrix::memory_consumption () const { return (MemoryConsumption::memory_consumption (lines) + @@ -2267,7 +2267,7 @@ ConstraintMatrix::memory_consumption () const VectorType &condensed_vector) const; \ template void ConstraintMatrix:: \ distribute_local_to_global (const Vector &, \ - const std::vector &, \ + const std::vector &, \ VectorType &, \ const FullMatrix &) const; \ template void ConstraintMatrix::distribute(const VectorType &condensed,\ @@ -2277,7 +2277,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 +2301,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 +2310,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 +2319,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 +2328,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 +2379,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 +2422,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);