From: turcksin Date: Thu, 21 Feb 2013 15:35:26 +0000 (+0000) Subject: Convert unsigned int to size_type in lac. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe3df0bee2074f29210c5024e6671508e349d4aa;p=dealii-svn.git Convert unsigned int to size_type in lac. git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@28509 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/files b/deal.II/files index dddf844963..5e614a31aa 100644 --- a/deal.II/files +++ b/deal.II/files @@ -123,27 +123,27 @@ MARKUS source/lac/compressed_set_sparsity_pattern.cc MARKUS source/lac/compressed_simple_sparsity_pattern.cc MARKUS source/lac/compressed_sparsity_pattern.cc WOLFGANG source/lac/constraint_matrix.cc -source/lac/full_matrix.cc -source/lac/lapack_full_matrix.cc -source/lac/matrix_lib.cc -source/lac/matrix_out.cc -source/lac/operator.cc +BRUNO source/lac/full_matrix.cc +BRUNO source/lac/lapack_full_matrix.cc +BRUNO source/lac/matrix_lib.cc +BRUNO source/lac/matrix_out.cc +BRUNO source/lac/operator.cc MARKUS source/lac/parallel_vector.cc -source/lac/petsc_block_sparse_matrix.cc -source/lac/petsc_full_matrix.cc -source/lac/petsc_matrix_base.cc -source/lac/petsc_parallel_block_sparse_matrix.cc -source/lac/petsc_parallel_block_vector.cc -source/lac/petsc_parallel_sparse_matrix.cc -source/lac/petsc_parallel_vector.cc -source/lac/petsc_precondition.cc -source/lac/petsc_solver.cc -source/lac/petsc_sparse_matrix.cc -source/lac/petsc_vector_base.cc -source/lac/petsc_vector.cc -source/lac/precondition_block.cc -source/lac/precondition_block_ez.cc -source/lac/relaxation_block.cc +BRUNO source/lac/petsc_block_sparse_matrix.cc +BRUNO source/lac/petsc_full_matrix.cc +BRUNO source/lac/petsc_matrix_base.cc +BRUNO source/lac/petsc_parallel_block_sparse_matrix.cc +BRUNO source/lac/petsc_parallel_block_vector.cc +BRUNO source/lac/petsc_parallel_sparse_matrix.cc +BRUNO source/lac/petsc_parallel_vector.cc +BRUNO source/lac/petsc_precondition.cc +BRUNO source/lac/petsc_solver.cc +BRUNO source/lac/petsc_sparse_matrix.cc +BRUNO source/lac/petsc_vector_base.cc +BRUNO source/lac/petsc_vector.cc +BRUNO source/lac/precondition_block.cc +BRUNO source/lac/precondition_block_ez.cc +BRUNO source/lac/relaxation_block.cc source/lac/slepc_solver.cc source/lac/slepc_spectral_transformation.cc source/lac/solver.cc @@ -361,7 +361,7 @@ 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 +BRUNO 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 MARKUS include/deal.II/lac/block_sparse_matrix.h @@ -381,44 +381,44 @@ WOLFGANG include/deal.II/lac/constraint_matrix.templates.h BRUNO include/deal.II/lac/eigen.h BRUNO include/deal.II/lac/exceptions.h BRUNO include/deal.II/lac/filtered_matrix.h -include/deal.II/lac/full_matrix.h -include/deal.II/lac/full_matrix.templates.h -include/deal.II/lac/householder.h -include/deal.II/lac/identity_matrix.h -include/deal.II/lac/iterative_inverse.h -include/deal.II/lac/lapack_full_matrix.h -include/deal.II/lac/lapack_support.h -include/deal.II/lac/matrix_block.h -include/deal.II/lac/matrix_iterator.h -include/deal.II/lac/matrix_lib.h -include/deal.II/lac/matrix_lib.templates.h -include/deal.II/lac/matrix_out.h +BRUNO include/deal.II/lac/full_matrix.h +BRUNO include/deal.II/lac/full_matrix.templates.h +BRUNO include/deal.II/lac/householder.h +BRUNO include/deal.II/lac/identity_matrix.h +BRUNO include/deal.II/lac/iterative_inverse.h +BRUNO include/deal.II/lac/lapack_full_matrix.h +BRUNO include/deal.II/lac/lapack_support.h +BRUNO include/deal.II/lac/matrix_block.h +BRUNO include/deal.II/lac/matrix_iterator.h +BRUNO include/deal.II/lac/matrix_lib.h +BRUNO include/deal.II/lac/matrix_lib.templates.h +BRUNO include/deal.II/lac/matrix_out.h MARKUS include/deal.II/lac/parallel_block_vector.h MARKUS include/deal.II/lac/parallel_vector.h MARKUS include/deal.II/lac/parallel_vector.templates.h -include/deal.II/lac/petsc_block_sparse_matrix.h -include/deal.II/lac/petsc_block_vector.h -include/deal.II/lac/petsc_full_matrix.h -include/deal.II/lac/petsc_matrix_base.h -include/deal.II/lac/petsc_parallel_block_sparse_matrix.h -include/deal.II/lac/petsc_parallel_block_vector.h -include/deal.II/lac/petsc_parallel_sparse_matrix.h -include/deal.II/lac/petsc_parallel_vector.h -include/deal.II/lac/petsc_precondition.h -include/deal.II/lac/petsc_solver.h -include/deal.II/lac/petsc_sparse_matrix.h -include/deal.II/lac/petsc_vector_base.h -include/deal.II/lac/petsc_vector.h -include/deal.II/lac/pointer_matrix.h -include/deal.II/lac/precondition_block_base.h -include/deal.II/lac/precondition_block.h -include/deal.II/lac/precondition_block.templates.h -include/deal.II/lac/precondition.h -include/deal.II/lac/precondition_selector.h -include/deal.II/lac/relaxation_block.h -include/deal.II/lac/relaxation_block.templates.h -include/deal.II/lac/schur_matrix.h -include/deal.II/lac/shifted_matrix.h +BRUNO include/deal.II/lac/petsc_block_sparse_matrix.h +BRUNO include/deal.II/lac/petsc_block_vector.h +BRUNO include/deal.II/lac/petsc_full_matrix.h +BRUNO include/deal.II/lac/petsc_matrix_base.h +BRUNO include/deal.II/lac/petsc_parallel_block_sparse_matrix.h +BRUNO include/deal.II/lac/petsc_parallel_block_vector.h +BRUNO include/deal.II/lac/petsc_parallel_sparse_matrix.h +BRUNO include/deal.II/lac/petsc_parallel_vector.h +BRUNO include/deal.II/lac/petsc_precondition.h +BRUNO include/deal.II/lac/petsc_solver.h +BRUNO include/deal.II/lac/petsc_sparse_matrix.h +BRUNO include/deal.II/lac/petsc_vector_base.h +BRUNO include/deal.II/lac/petsc_vector.h +BRUNO include/deal.II/lac/pointer_matrix.h +BRUNO include/deal.II/lac/precondition_block_base.h +BRUNO include/deal.II/lac/precondition_block.h +BRUNO include/deal.II/lac/precondition_block.templates.h +BRUNO include/deal.II/lac/precondition.h +BRUNO include/deal.II/lac/precondition_selector.h +BRUNO include/deal.II/lac/relaxation_block.h +BRUNO include/deal.II/lac/relaxation_block.templates.h +BRUNO include/deal.II/lac/schur_matrix.h +BRUNO include/deal.II/lac/shifted_matrix.h include/deal.II/lac/slepc_solver.h include/deal.II/lac/slepc_spectral_transformation.h include/deal.II/lac/solver_bicgstab.h diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index e38bb47873..71ba524f5f 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -1476,7 +1476,7 @@ public: template inline -types::global_dof_index +typename FullMatrix::size_type FullMatrix::m() const { return this->n_rows(); @@ -1486,7 +1486,7 @@ FullMatrix::m() const template inline -types::global_dof_index +typename FullMatrix::size_type FullMatrix::n() const { return this->n_cols(); @@ -1529,7 +1529,7 @@ FullMatrix::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); @@ -1550,7 +1550,7 @@ FullMatrix::copy_transposed (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); @@ -1654,7 +1654,7 @@ Accessor (const FullMatrix *matrix, template inline -types::global_dof_index +typename FullMatrix::size_type FullMatrix::Accessor::row() const { return a_row; @@ -1663,7 +1663,7 @@ FullMatrix::Accessor::row() const template inline -types::global_dof_index +typename FullMatrix::size_type FullMatrix::Accessor::column() const { return a_col; diff --git a/deal.II/include/deal.II/lac/full_matrix.templates.h b/deal.II/include/deal.II/lac/full_matrix.templates.h index d7adfc766f..d6cdf55406 100644 --- a/deal.II/include/deal.II/lac/full_matrix.templates.h +++ b/deal.II/include/deal.II/lac/full_matrix.templates.h @@ -32,23 +32,23 @@ DEAL_II_NAMESPACE_OPEN template -FullMatrix::FullMatrix (const unsigned int n) +FullMatrix::FullMatrix (const size_type n) : Table<2,number> (n,n) {} template -FullMatrix::FullMatrix (const unsigned int m, - const unsigned int n) +FullMatrix::FullMatrix (const size_type m, + const size_type n) : Table<2,number> (m, n) {} template -FullMatrix::FullMatrix (const unsigned int m, - const unsigned int n, +FullMatrix::FullMatrix (const size_type m, + const size_type n, const number *entries) : Table<2,number> (m, n) @@ -70,7 +70,7 @@ FullMatrix::FullMatrix (const IdentityMatrix &id) : Table<2,number> (id.m(), id.n()) { - for (unsigned int i=0; i & FullMatrix::operator = (const IdentityMatrix &id) { this->reinit (id.m(), id.n()); - for (unsigned int i=0; i::operator = (const LAPACKFullMatrix &M) { Assert (this->m() == M.n_rows(), ExcDimensionMismatch(this->m(), M.n_rows())); Assert (this->n() == M.n_cols(), ExcDimensionMismatch(this->n(), M.n_rows())); - for (unsigned int i=0; im(); ++i) - for (unsigned int j=0; jn(); ++j) + for (size_type i=0; im(); ++i) + for (size_type j=0; jn(); ++j) (*this)(i,j) = M(i,j); return *this; @@ -199,11 +199,11 @@ FullMatrix::vmult (Vector &dst, // avoid copying it when using the () // operator const number2 *src_ptr = &(*const_cast*>(&src))(0); - const unsigned int size_m = m(), size_n = n(); - for (unsigned int i=0; i::Tvmult (Vector &dst, const number *e = &this->values[0]; number2 *dst_ptr = &dst(0); - const unsigned int size_m = m(), size_n = n(); + const size_type size_m = m(), size_n = n(); // zero out data if we are not adding if (!adding) - for (unsigned int j=0; j::residual (Vector &dst, Assert (&src != &dst, ExcSourceEqualsDestination()); number res = 0.; - const unsigned int size_m = m(), - size_n = n(); - for (unsigned int i=0; i::forward (Vector &dst, Assert (dst.size() == m(), ExcDimensionMismatch(dst.size(), m())); Assert (src.size() == n(), ExcDimensionMismatch(src.size(), n())); - unsigned int i,j; - unsigned int nu = ( (m()::backward (Vector &dst, { Assert (!this->empty(), ExcEmptyMatrix()); - unsigned int j; - unsigned int nu = (m()=0; --i) { number2 s = src(i); @@ -320,10 +320,10 @@ void FullMatrix::backward (Vector &dst, template template void FullMatrix::fill (const FullMatrix &src, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -335,13 +335,13 @@ void FullMatrix::fill (const FullMatrix &src, ExcIndexRange (src_offset_j, 0, src.n())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, + const size_type rows = std::min (m() - dst_offset_i, src.m() - src_offset_i); - const unsigned int cols = std::min (n() - dst_offset_j, + const size_type cols = std::min (n() - dst_offset_j, src.n() - src_offset_j); - for (unsigned int i=0; i::fill (const FullMatrix &src, template template void FullMatrix::fill_permutation (const FullMatrix &src, - const std::vector &p_rows, - const std::vector &p_cols) + const std::vector &p_rows, + const std::vector &p_cols) { Assert (p_rows.size() == this->n_rows(), ExcDimensionMismatch (p_rows.size(), this->n_rows())); Assert (p_cols.size() == this->n_cols(), ExcDimensionMismatch (p_cols.size(), this->n_cols())); - for (unsigned int i=0; in_rows(); ++i) - for (unsigned int j=0; jn_cols(); ++j) + for (size_type i=0; in_rows(); ++i) + for (size_type j=0; jn_cols(); ++j) (*this)(i,j) = src(p_rows[i], p_cols[j]); } @@ -376,75 +376,75 @@ void FullMatrix::fill_permutation (const FullMatrix &src, template -void FullMatrix::add_row (const unsigned int i, +void FullMatrix::add_row (const size_type i, const number s, - const unsigned int j) + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k -void FullMatrix::add_row (const unsigned int i, +void FullMatrix::add_row (const size_type i, const number s, - const unsigned int j, + const size_type j, const number t, - const unsigned int k) + const size_type k) { Assert (!this->empty(), ExcEmptyMatrix()); - const unsigned int size_m = m(); - for (unsigned int l=0; l -void FullMatrix::add_col (const unsigned int i, const number s, - const unsigned int j) +void FullMatrix::add_col (const size_type i, const number s, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k -void FullMatrix::add_col (const unsigned int i, const number s, - const unsigned int j, const number t, - const unsigned int k) +void FullMatrix::add_col (const size_type i, const number s, + const size_type j, const number t, + const size_type k) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int l=0; l -void FullMatrix::swap_row (const unsigned int i, - const unsigned int j) +void FullMatrix::swap_row (const size_type i, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k -void FullMatrix::swap_col (const unsigned int i, - const unsigned int j) +void FullMatrix::swap_col (const size_type i, + const size_type j) { Assert (!this->empty(), ExcEmptyMatrix()); - for (unsigned int k=0; k::diagadd (const number src) Assert (!this->empty(), ExcEmptyMatrix()); Assert (m() == n(), ExcDimensionMismatch(m(),n())); - for (unsigned int i=0; i::equ (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i::equ (const number a, Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m())); Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n())); - for (unsigned int i=0; i::equ (const number a, Assert (m() == C.m(), ExcDimensionMismatch(m(), C.m())); Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n())); - for (unsigned int i=0; i::mmult (FullMatrix &dst, #endif - const unsigned int m = this->m(), n = src.n(), l = this->n(); + const size_type m = this->m(), n = src.n(), l = this->n(); // arrange the loops in a way that // we keep write operations low, @@ -600,11 +600,11 @@ void FullMatrix::mmult (FullMatrix &dst, // than reading), even though we // need to access the data in src // not in a contiguous way. - for (unsigned int i=0; i::Tmmult (FullMatrix &dst, #endif - const unsigned int m = n(), n = src.n(), l = this->m(); + const size_type m = n(), n = src.n(), l = this->m(); // arrange the loops in a way that // we keep write operations low, @@ -692,11 +692,11 @@ void FullMatrix::Tmmult (FullMatrix &dst, // optimized gemm operation in case // the matrix is big, so this // shouldn't be too bad. - for (unsigned int i=0; i::mTmult (FullMatrix &dst, #endif - const unsigned int m = this->m(), n = src.m(), l = this->n(); + const size_type m = this->m(), n = src.m(), l = this->n(); // arrange the loops in a way that // we keep write operations low, // (writing is usually more costly // than reading). - for (unsigned int i=0; i::TmTmult (FullMatrix &dst, #endif - const unsigned int m = n(), n = src.m(), l = this->m(); + const size_type m = n(), n = src.m(), l = this->m(); // arrange the loops in a way that // we keep write operations low, @@ -869,11 +869,11 @@ void FullMatrix::TmTmult (FullMatrix &dst, // optimized gemm operation in case // the matrix is big, so this // shouldn't be too bad. - for (unsigned int i=0; i::triple_product( // For all entries of the product // AD - for (unsigned int i=0; ioperator()(k,j) += scaling * ADij * B(i,k); else - for (unsigned int k=0; koperator()(k,j) += scaling * ADij * B(k,i); } } @@ -948,11 +948,11 @@ FullMatrix::matrix_norm_square (const Vector &v) const Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); number2 sum = 0.; - const unsigned int n_rows = m(); + const size_type n_rows = m(); const number *val_ptr = &this->values[0]; const number2 *v_ptr; - for (unsigned int row=0; row::matrix_scalar_product (const Vector &u, Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); number2 sum = 0.; - const unsigned int n_rows = m(); - const unsigned int n_cols = n(); + const size_type n_rows = m(); + const size_type n_cols = n(); const number *val_ptr = &this->values[0]; const number2 *v_ptr; - for (unsigned int row=0; row::symmetrize () { Assert (m() == n(), ExcNotQuadratic()); - const unsigned int N = m(); - for (unsigned int i=0; i::l1_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type sum=0, max=0; - const unsigned int n_rows = m(), n_cols = n(); + const size_type n_rows = m(), n_cols = n(); - for (unsigned int col=0; col max) max = sum; @@ -1045,12 +1045,12 @@ FullMatrix::linfty_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type sum=0, max=0; - const unsigned int n_rows = m(), n_cols = n(); + const size_type n_rows = m(), n_cols = n(); - for (unsigned int row=0; row max) max = sum; @@ -1071,8 +1071,8 @@ FullMatrix::add (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i::add (const number a, Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m())); Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n())); - for (unsigned int i=0; i::add (const number a, Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n())); - for (unsigned int i=0; i template void FullMatrix::add (const FullMatrix &src, const number factor, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -1147,13 +1147,11 @@ void FullMatrix::add (const FullMatrix &src, ExcIndexRange (src_offset_j, 0, src.n())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, - src.m() - src_offset_i); - const unsigned int cols = std::min (n() - dst_offset_j, - src.n() - src_offset_j); + const size_type rows = std::min (m() - dst_offset_i, src.m() - src_offset_i); + const size_type cols = std::min (n() - dst_offset_j, src.n() - src_offset_j); - for (unsigned int i=0; i template void FullMatrix::Tadd (const FullMatrix &src, const number factor, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j) + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j) { Assert (dst_offset_i < m(), ExcIndexRange (dst_offset_i, 0, m())); @@ -1179,14 +1177,13 @@ void FullMatrix::Tadd (const FullMatrix &src, ExcIndexRange (src_offset_j, 0, src.m())); // Compute maximal size of copied block - const unsigned int rows = std::min (m() - dst_offset_i, - src.n() - src_offset_j); - const unsigned int cols = std::min (n() - dst_offset_j, + const size_type rows = std::min (m() - dst_offset_i, src.n() - src_offset_j); + const size_type cols = std::min (n() - dst_offset_j, src.m() - src_offset_i); - for (unsigned int i=0; i::Tadd (const number a, Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m())); Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n())); - for (unsigned int i=0; i::trace () const ExcDimensionMismatch(this->n_cols(), this->n_rows())); number tr = 0; - for (unsigned int i=0; in_rows(); ++i) + for (size_type i=0; in_rows(); ++i) tr += (*this)(i,i); return tr; @@ -1275,7 +1272,7 @@ FullMatrix::frobenius_norm () const Assert (!this->empty(), ExcEmptyMatrix()); real_type s = 0.; - for (unsigned int i=0; in_rows()*this->n_cols(); ++i) + for (size_type i=0; in_rows()*this->n_cols(); ++i) s += numbers::NumberTraits::abs_square(this->values[i]); return std::sqrt(s); } @@ -1290,8 +1287,8 @@ FullMatrix::relative_symmetry_norm2 () const real_type s = 0.; real_type a = 0.; - for (unsigned int i=0; in_rows(); ++i) - for (unsigned int j=0; jn_cols(); ++j) + for (size_type i=0; in_rows(); ++i) + for (size_type j=0; jn_cols(); ++j) { const number x_ij = (*this)(i,j); const number x_ji = (*this)(j,i); @@ -1505,13 +1502,13 @@ FullMatrix::cholesky (const FullMatrix &A) this->reinit(A.m(), A.n()); double SLik2 = 0.0, SLikLjk = 0.0; - for (unsigned int i=0; i< this->n_cols(); i++) + for (size_type i=0; i< this->n_cols(); i++) { SLik2 = 0.0; - for (unsigned int j = 0; j < i; j++) + for (size_type j = 0; j < i; j++) { SLikLjk = 0.0; - for (unsigned int k =0; k::outer_product (const Vector &V, Assert (V.size() == W.size(), ExcMessage("Vectors V, W must be the same size.")); this->reinit(V.size(), V.size()); - for (unsigned int i = 0; in(); i++) + for (size_type i = 0; in(); i++) { - for (unsigned int j = 0; j< this->n(); j++) + for (size_type j = 0; j< this->n(); j++) { (*this)(i,j) = V(i)*W(j); } @@ -1607,12 +1604,12 @@ template template void FullMatrix::copy_from (const Tensor<2,dim> &T, - const unsigned int src_r_i, - const unsigned int src_r_j, - const unsigned int src_c_i, - const unsigned int src_c_j, - const unsigned int dst_r, - const unsigned int dst_c) + const size_type src_r_i, + const size_type src_r_j, + const size_type src_c_i, + const size_type src_c_j, + const size_type dst_r, + const size_type dst_c) { Assert (!this->empty(), ExcEmptyMatrix()); @@ -1625,8 +1622,8 @@ FullMatrix::copy_from (const Tensor<2,dim> &T, Assert(src_r_j>=src_r_i, ExcIndexRange(src_r_j,0,src_r_i)); Assert(src_c_j>=src_c_i, ExcIndexRange(src_r_j,0,src_r_i)); - for (unsigned int i=0; i template void FullMatrix::copy_to (Tensor<2,dim> &T, - const unsigned int src_r_i, - const unsigned int src_r_j, - const unsigned int src_c_i, - const unsigned int src_c_j, - const unsigned int dst_r, - const unsigned int dst_c) const + const size_type src_r_i, + const size_type src_r_j, + const size_type src_c_i, + const size_type src_c_j, + const size_type dst_r, + const size_type dst_c) const { Assert (!this->empty(), ExcEmptyMatrix()); Assert(dim-dst_r>src_r_j-src_r_i, @@ -1654,8 +1651,8 @@ FullMatrix::copy_to (Tensor<2,dim> &T, Assert(src_c_j>=src_c_i, ExcIndexRange(src_r_j,0,src_r_i)); - for (unsigned int i=0; i::precondition_Jacobi (Vector &dst, Assert (dst.size() == n(), ExcDimensionMismatch (dst.size(), n())); Assert (src.size() == n(), ExcDimensionMismatch (src.size(), n())); - const unsigned int n = src.size(); - somenumber *dst_ptr = dst.begin(); - const somenumber *src_ptr = src.begin(); + const size_t n = src.size(); + somenumber *dst_ptr = dst.begin(); + const somenumber *src_ptr = src.begin(); - for (unsigned int i=0; i::print_formatted ( width = precision+2; } - for (unsigned int i=0; i threshold) out << std::setw(width) << (*this)(i,j) * number(denominator) << ' '; @@ -1805,7 +1802,7 @@ FullMatrix::gauss_jordan () // Gauss-Jordan-Algorithmus from // Stoer & Bulirsch I (4th Edition) // p. 153 - const unsigned int N = n(); + const size_type N = n(); // first get an estimate of the // size of the elements of this @@ -1815,26 +1812,26 @@ FullMatrix::gauss_jordan () // fear that the matrix is not // regular double diagonal_sum = 0; - for (unsigned int i=0; i p(N); - for (unsigned int i=0; i p(N); + for (size_type i=0; i max) { @@ -1850,7 +1847,7 @@ FullMatrix::gauss_jordan () // row interchange if (r>j) { - for (unsigned int k=0; k::gauss_jordan () // transformation const number hr = number(1.)/(*this)(j,j); (*this)(j,j) = hr; - for (unsigned int k=0; k::gauss_jordan () } // column interchange std::vector hv(N); - for (unsigned int i=0; i class Householder : private FullMatrix { public: + /** + * Declare type of container size. + */ + typedef types::global_dof_index size_type; + /** * Create an empty object. */ @@ -139,7 +144,7 @@ template void Householder::initialize(const FullMatrix &M) { - const unsigned int m = M.n_rows(), n = M.n_cols(); + const size_type m = M.n_rows(), n = M.n_cols(); this->reinit(m, n); this->fill(M); Assert (!this->empty(), typename FullMatrix::ExcEmptyMatrix()); @@ -149,10 +154,10 @@ Householder::initialize(const FullMatrix &M) Assert (this->n_cols() <= this->n_rows(), ExcDimensionMismatch(this->n_cols(), this->n_rows())); - for (unsigned int j=0 ; jel(i,j)*this->el(i,j); @@ -176,7 +181,7 @@ Householder::initialize(const FullMatrix &M) // For all subsequent columns do // the Householder reflexion - for (unsigned int k=j+1 ; kel(j,k); for (i=j+1 ; i::least_squares (Vector &dst, AssertDimension(dst.size(), this->n()); AssertDimension(src.size(), this->m()); - const unsigned int m = this->m(), n = this->n(); + const size_type m = this->m(), n = this->n(); GrowingVectorMemory > mem; Vector *aux = mem.alloc(); @@ -218,20 +223,20 @@ Householder::least_squares (Vector &dst, // Multiply Q_n ... Q_2 Q_1 src // Where Q_i = I-v_i v_i^T - for (unsigned int j=0; jel(i,j)*(*aux)(i); // dst -= v * sum (*aux)(j) -= sum*diagonal[j]; - for (unsigned int i=j+1 ; iel(i,j); } // Compute norm of residual number2 sum = 0.; - for (unsigned int i=n ; i::least_squares (BlockVector &dst, AssertDimension(dst.size(), this->n()); AssertDimension(src.size(), this->m()); - const unsigned int m = this->m(), n = this->n(); + const size_type m = this->m(), n = this->n(); GrowingVectorMemory > mem; BlockVector *aux = mem.alloc(); @@ -263,20 +268,20 @@ Householder::least_squares (BlockVector &dst, // Multiply Q_n ... Q_2 Q_1 src // Where Q_i = I-v_i v_i^T - for (unsigned int j=0; jel(i,j)*(*aux)(i); // dst -= v * sum (*aux)(j) -= sum*diagonal[j]; - for (unsigned int i=j+1 ; iel(i,j); } // Compute norm of residual number2 sum = 0.; - for (unsigned int i=n ; i class LAPACKFullMatrix : public TransposeTable { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Initialize the * matrix as a square matrix with @@ -63,15 +68,15 @@ public: * By default, no memory is * allocated. */ - explicit LAPACKFullMatrix (const unsigned int n = 0); + explicit LAPACKFullMatrix (const size_type n = 0); /** * Constructor. Initialize the * matrix as a rectangular * matrix. */ - LAPACKFullMatrix (const unsigned int rows, - const unsigned int cols); + LAPACKFullMatrix (const size_type rows, + const size_type cols); /** * Copy constructor. This @@ -158,10 +163,10 @@ public: */ template void fill (const MATRIX &src, - const unsigned int dst_offset_i = 0, - const unsigned int dst_offset_j = 0, - const unsigned int src_offset_i = 0, - const unsigned int src_offset_j = 0, + const size_type dst_offset_i = 0, + const size_type dst_offset_j = 0, + const size_type src_offset_i = 0, + const size_type src_offset_j = 0, const number factor = 1., const bool transpose = false); @@ -526,7 +531,7 @@ public: * called. */ std::complex - eigenvalue (const unsigned int i) const; + eigenvalue (const size_type i) const; /** * Retrieve singular values after @@ -535,7 +540,7 @@ public: * called. */ number - singular_value (const unsigned int i) const; + singular_value (const size_type i) const; /** * Print the matrix and allow @@ -709,7 +714,7 @@ LAPACKFullMatrix::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.m(); ++row) + for (size_type row = 0; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); @@ -727,26 +732,26 @@ template inline void LAPACKFullMatrix::fill ( const MATRIX &M, - const unsigned int dst_offset_i, - const unsigned int dst_offset_j, - const unsigned int src_offset_i, - const unsigned int src_offset_j, + const size_type dst_offset_i, + const size_type dst_offset_j, + const size_type src_offset_i, + const size_type src_offset_j, const number factor, const bool transpose) { // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class - for (unsigned int row = src_offset_i; row < M.m(); ++row) + for (size_type row = src_offset_i; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); entry != end_row; ++entry) { - const unsigned int i = transpose ? entry->column() : row; - const unsigned int j = transpose ? row : entry->column(); + const size_type i = transpose ? entry->column() : row; + const size_type j = transpose ? row : entry->column(); - const unsigned int dst_i=dst_offset_i+i-src_offset_i; - const unsigned int dst_j=dst_offset_j+j-src_offset_j; + const size_type dst_i=dst_offset_i+i-src_offset_i; + const size_type dst_j=dst_offset_j+j-src_offset_j; if (dst_in_rows() && dst_jn_cols()) (*this)(dst_i, dst_j) = factor * entry->value(); } @@ -794,7 +799,7 @@ LAPACKFullMatrix::Tvmult_add(VECTOR &, const VECTOR &) const template inline std::complex -LAPACKFullMatrix::eigenvalue (const unsigned int i) const +LAPACKFullMatrix::eigenvalue (const size_type i) const { Assert (state & LAPACKSupport::eigenvalues, ExcInvalidState()); Assert (wr.size() == this->n_rows(), ExcInternalError()); @@ -807,7 +812,7 @@ LAPACKFullMatrix::eigenvalue (const unsigned int i) const template inline number -LAPACKFullMatrix::singular_value (const unsigned int i) const +LAPACKFullMatrix::singular_value (const size_type i) const { Assert (state == LAPACKSupport::svd || state == LAPACKSupport::inverse_svd, LAPACKSupport::ExcState(state)); AssertIndexRange(i,wr.size()); diff --git a/deal.II/include/deal.II/lac/matrix_block.h b/deal.II/include/deal.II/lac/matrix_block.h index eb44751866..b039686734 100644 --- a/deal.II/include/deal.II/lac/matrix_block.h +++ b/deal.II/include/deal.II/lac/matrix_block.h @@ -77,7 +77,7 @@ namespace internal * * BlockMatrixArray matrix (n_blocks, n_blocks); * - * for (unsigned int i=0;i - 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); /** * Add all elements in a @@ -212,8 +217,8 @@ public: * into the matrix. */ template - void add (const std::vector &row_indices, - const std::vector &col_indices, + void add (const std::vector &row_indices, + const std::vector &col_indices, const FullMatrix &full_matrix, const bool elide_zero_values = true); @@ -252,10 +257,10 @@ public: * into the matrix. */ template - void add (const unsigned int row_index, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values = true); + void add (const size_type row_index, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values = true); /** * Add an array of values given by @@ -275,12 +280,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); /** * Matrix-vector-multiplication, @@ -338,7 +343,7 @@ public: * the block coordinates stored * in this object. */ - DeclException2(ExcBlockIndexMismatch, unsigned int, unsigned int, + DeclException2(ExcBlockIndexMismatch, size_type, size_type, << "Block index " << arg1 << " does not match " << arg2); /** @@ -346,14 +351,14 @@ public: * position of the data member * matrix on the global matrix. */ - unsigned int row; + size_type row; /** * Column coordinate. This is * the position of the data * member matrix on the global * matrix. */ - unsigned int column; + size_type column; /** * The matrix itself @@ -397,6 +402,11 @@ class MatrixBlockVector private NamedData > > { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * The type of object stored. */ @@ -407,7 +417,7 @@ public: * position (row,column) * in the block system. */ - void add(unsigned int row, unsigned int column, const std::string &name); + void add(size_type row, size_type column, const std::string &name); /** * For matrices using a @@ -446,20 +456,20 @@ public: * Access a constant reference to * the block at position i. */ - const value_type &block(unsigned int i) const; + const value_type &block(size_type i) const; /** * Access a reference to * the block at position i. */ - value_type &block(unsigned int i); + value_type &block(size_type i); /** * Access the matrix at position * i for read and write * access. */ - MATRIX &matrix(unsigned int i); + MATRIX &matrix(size_type i); /** * import functions from private base class @@ -485,6 +495,11 @@ class MGMatrixBlockVector : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * The type of object stored. */ @@ -520,8 +535,7 @@ public: * matrix a name for later * identification. */ - void add(unsigned int row, unsigned int column, - const std::string &name); + void add(size_type row, size_type column, const std::string &name); /** * For matrices using a @@ -582,61 +596,61 @@ public: * Access a constant reference to * the matrix block at position i. */ - const value_type &block(unsigned int i) const; + const value_type &block(size_type i) const; /** * Access a reference to * the matrix block at position i. */ - value_type &block(unsigned int i); + value_type &block(size_type i); /** * Access a constant reference to * the edge matrix block at position i. */ - const value_type &block_in(unsigned int i) const; + const value_type &block_in(size_type i) const; /** * Access a reference to * the edge matrix block at position i. */ - value_type &block_in(unsigned int i); + value_type &block_in(size_type i); /** * Access a constant reference to * the edge matrix block at position i. */ - const value_type &block_out(unsigned int i) const; + const value_type &block_out(size_type i) const; /** * Access a reference to * the edge matrix block at position i. */ - value_type &block_out(unsigned int i); + value_type &block_out(size_type i); /** * Access a constant reference to * the edge flux matrix block at position i. */ - const value_type &block_up(unsigned int i) const; + const value_type &block_up(size_type i) const; /** * Access a reference to * the edge flux matrix block at position i. */ - value_type &block_up(unsigned int i); + value_type &block_up(size_type i); /** * Access a constant reference to * the edge flux matrix block at position i. */ - const value_type &block_down(unsigned int i) const; + const value_type &block_down(size_type i) const; /** * Access a reference to * the edge flux matrix block at position i. */ - value_type &block_down(unsigned int i); + value_type &block_down(size_type i); /** * The memory used by this object. @@ -713,7 +727,7 @@ MatrixBlock::MatrixBlock(const MatrixBlock &M) template inline -MatrixBlock::MatrixBlock(unsigned int i, unsigned int j) +MatrixBlock::MatrixBlock(size_type i, size_type j) : row(i), column(j) {} @@ -747,16 +761,16 @@ MatrixBlock::operator const MATRIX &() const template inline void MatrixBlock::add ( - const unsigned int gi, - const unsigned int gj, + const size_type gi, + const size_type gj, const typename MATRIX::value_type value) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); - const std::pair bi + const std::pair bi = row_indices.global_to_local(gi); - const std::pair bj + const std::pair bj = column_indices.global_to_local(gj); Assert (bi.first == row, ExcBlockIndexMismatch(bi.first, row)); @@ -770,10 +784,10 @@ template template inline void -MatrixBlock::add (const std::vector &r_indices, - const std::vector &c_indices, - const FullMatrix &values, - const bool elide_zero_values) +MatrixBlock::add (const std::vector &r_indices, + const std::vector &c_indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -781,7 +795,7 @@ MatrixBlock::add (const std::vector &r_indices, AssertDimension (r_indices.size(), values.m()); AssertDimension (c_indices.size(), values.n()); - for (unsigned int i=0; i template inline void -MatrixBlock::add (const unsigned int b_row, - const unsigned int n_cols, - const unsigned int *col_indices, - const number *values, +MatrixBlock::add (const size_type b_row, + const size_type n_cols, + const size_type *col_indices, + const number *values, const bool, const bool) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); - const std::pair bi + const std::pair bi = row_indices.global_to_local(b_row); // In debug mode, we check whether @@ -815,9 +829,9 @@ MatrixBlock::add (const unsigned int b_row, //#ifdef DEBUG Assert(bi.first == row, ExcBlockIndexMismatch(bi.first, row)); - for (unsigned int j=0; j bj + const std::pair bj = column_indices.global_to_local(col_indices[j]); Assert(bj.first == column, ExcBlockIndexMismatch(bj.first, column)); @@ -831,9 +845,9 @@ template template inline void -MatrixBlock::add (const std::vector &indices, - const FullMatrix &values, - const bool elide_zero_values) +MatrixBlock::add (const std::vector &indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -841,7 +855,7 @@ MatrixBlock::add (const std::vector &indices, AssertDimension (indices.size(), values.m()); Assert (values.n() == values.m(), ExcNotQuadratic()); - for (unsigned int i=0; i template inline void -MatrixBlock::add (const unsigned int row, - const std::vector &col_indices, - const std::vector &values, - const bool elide_zero_values) +MatrixBlock::add (const size_type row, + const std::vector &col_indices, + const std::vector &values, + const bool elide_zero_values) { Assert(row_indices.size() != 0, ExcNotInitialized()); Assert(column_indices.size() != 0, ExcNotInitialized()); @@ -921,7 +935,7 @@ MatrixBlock::memory_consumption () const template inline void MatrixBlockVector::add( - unsigned int row, unsigned int column, + size_type row, size_type column, const std::string &name) { std_cxx1x::shared_ptr p(new value_type(row, column)); @@ -933,7 +947,7 @@ template inline void MatrixBlockVector::reinit(const BlockSparsityPattern &sparsity) { - for (unsigned int i=0; isize(); ++i) + for (size_type i=0; isize(); ++i) { block(i).reinit(sparsity); } @@ -950,7 +964,7 @@ MatrixBlockVector::clear(bool really_clean) } else { - for (unsigned int i=0; isize(); ++i) + for (size_type i=0; isize(); ++i) matrix(i).clear(); } } @@ -959,7 +973,7 @@ MatrixBlockVector::clear(bool really_clean) template inline const MatrixBlock & -MatrixBlockVector::block(unsigned int i) const +MatrixBlockVector::block(size_type i) const { return *this->read(i); } @@ -967,7 +981,7 @@ MatrixBlockVector::block(unsigned int i) const template inline MatrixBlock & -MatrixBlockVector::block(unsigned int i) +MatrixBlockVector::block(size_type i) { return *(*this)(i); } @@ -975,7 +989,7 @@ MatrixBlockVector::block(unsigned int i) template inline MATRIX & -MatrixBlockVector::matrix(unsigned int i) +MatrixBlockVector::matrix(size_type i) { return (*this)(i)->matrix; } @@ -1006,7 +1020,7 @@ MGMatrixBlockVector::size () const template inline void MGMatrixBlockVector::add( - unsigned int row, unsigned int column, + size_type row, size_type column, const std::string &name) { MGLevelObject > p(0, 1); @@ -1029,7 +1043,7 @@ MGMatrixBlockVector::add( template inline const MGLevelObject > & -MGMatrixBlockVector::block(unsigned int i) const +MGMatrixBlockVector::block(size_type i) const { return matrices.read(i); } @@ -1037,7 +1051,7 @@ MGMatrixBlockVector::block(unsigned int i) const template inline MGLevelObject > & -MGMatrixBlockVector::block(unsigned int i) +MGMatrixBlockVector::block(size_type i) { return matrices(i); } @@ -1045,7 +1059,7 @@ MGMatrixBlockVector::block(unsigned int i) template inline const MGLevelObject > & -MGMatrixBlockVector::block_in(unsigned int i) const +MGMatrixBlockVector::block_in(size_type i) const { return matrices_in.read(i); } @@ -1053,7 +1067,7 @@ MGMatrixBlockVector::block_in(unsigned int i) const template inline MGLevelObject > & -MGMatrixBlockVector::block_in(unsigned int i) +MGMatrixBlockVector::block_in(size_type i) { return matrices_in(i); } @@ -1061,7 +1075,7 @@ MGMatrixBlockVector::block_in(unsigned int i) template inline const MGLevelObject > & -MGMatrixBlockVector::block_out(unsigned int i) const +MGMatrixBlockVector::block_out(size_type i) const { return matrices_out.read(i); } @@ -1069,7 +1083,7 @@ MGMatrixBlockVector::block_out(unsigned int i) const template inline MGLevelObject > & -MGMatrixBlockVector::block_out(unsigned int i) +MGMatrixBlockVector::block_out(size_type i) { return matrices_out(i); } @@ -1077,7 +1091,7 @@ MGMatrixBlockVector::block_out(unsigned int i) template inline const MGLevelObject > & -MGMatrixBlockVector::block_up(unsigned int i) const +MGMatrixBlockVector::block_up(size_type i) const { return flux_matrices_up.read(i); } @@ -1085,7 +1099,7 @@ MGMatrixBlockVector::block_up(unsigned int i) const template inline MGLevelObject > & -MGMatrixBlockVector::block_up(unsigned int i) +MGMatrixBlockVector::block_up(size_type i) { return flux_matrices_up(i); } @@ -1093,7 +1107,7 @@ MGMatrixBlockVector::block_up(unsigned int i) template inline const MGLevelObject > & -MGMatrixBlockVector::block_down(unsigned int i) const +MGMatrixBlockVector::block_down(size_type i) const { return flux_matrices_down.read(i); } @@ -1101,7 +1115,7 @@ MGMatrixBlockVector::block_down(unsigned int i) const template inline MGLevelObject > & -MGMatrixBlockVector::block_down(unsigned int i) +MGMatrixBlockVector::block_down(size_type i) { return flux_matrices_down(i); } @@ -1111,14 +1125,14 @@ template inline void MGMatrixBlockVector::reinit_matrix(const MGLevelObject &sparsity) { - for (unsigned int i=0; isize(); ++i) + for (size_type i=0; isize(); ++i) { MGLevelObject > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; o.resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { o[level].row = row; o[level].column = col; @@ -1132,15 +1146,15 @@ template inline void MGMatrixBlockVector::reinit_edge(const MGLevelObject &sparsity) { - for (unsigned int i=0; isize(); ++i) + for (size_type i=0; isize(); ++i) { MGLevelObject > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; block_in(i).resize(sparsity.min_level(), sparsity.max_level()); block_out(i).resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { block_in(i)[level].row = row; block_in(i)[level].column = col; @@ -1157,15 +1171,15 @@ template inline void MGMatrixBlockVector::reinit_edge_flux(const MGLevelObject &sparsity) { - for (unsigned int i=0; isize(); ++i) + for (size_type i=0; isize(); ++i) { MGLevelObject > &o = block(i); - const unsigned int row = o[o.min_level()].row; - const unsigned int col = o[o.min_level()].column; + const size_type row = o[o.min_level()].row; + const size_type col = o[o.min_level()].column; block_up(i).resize(sparsity.min_level(), sparsity.max_level()); block_down(i).resize(sparsity.min_level(), sparsity.max_level()); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) { block_up(i)[level].row = row; block_up(i)[level].column = col; @@ -1183,10 +1197,10 @@ template inline void MGMatrixBlockVector::clear_object(NamedData > > &mo) { - for (unsigned int i=0; i > &o = mo(i); - for (unsigned int level = o.min_level(); level <= o.max_level(); ++level) + for (size_type level = o.min_level(); level <= o.max_level(); ++level) o[level].matrix.clear(); } } diff --git a/deal.II/include/deal.II/lac/matrix_iterator.h b/deal.II/include/deal.II/lac/matrix_iterator.h index 03e67432cd..6b56b79580 100644 --- a/deal.II/include/deal.II/lac/matrix_iterator.h +++ b/deal.II/include/deal.II/lac/matrix_iterator.h @@ -33,6 +33,11 @@ template class MatrixIterator { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef for the matrix type * (including constness) we are to @@ -47,9 +52,9 @@ public: * row and the * index within it. */ - MatrixIterator (MatrixType *matrix, - const unsigned int row = 0, - const unsigned int index = 0); + MatrixIterator (MatrixType *matrix, + const size_type row = 0, + const size_type index = 0); /** * Copy from another matrix @@ -136,9 +141,9 @@ private: template inline MatrixIterator:: -MatrixIterator (MatrixType *matrix, - const unsigned int r, - const unsigned int i) +MatrixIterator (MatrixType *matrix, + const size_type r, + const size_type i) : accessor(matrix, r, i) {} diff --git a/deal.II/include/deal.II/lac/matrix_lib.h b/deal.II/include/deal.II/lac/matrix_lib.h index 06b1df2e1a..2a430b31b7 100644 --- a/deal.II/include/deal.II/lac/matrix_lib.h +++ b/deal.II/include/deal.II/lac/matrix_lib.h @@ -326,11 +326,16 @@ private: class MeanValueFilter : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor, optionally * selecting a component. */ - MeanValueFilter(unsigned int component = numbers::invalid_unsigned_int); + MeanValueFilter(size_type component = numbers::invalid_size_type); /** * Subtract mean value from @p v. @@ -395,7 +400,7 @@ private: /** * Component for filtering block vectors. */ - unsigned int component; + size_type component; }; diff --git a/deal.II/include/deal.II/lac/matrix_lib.templates.h b/deal.II/include/deal.II/lac/matrix_lib.templates.h index 63fd1d83c8..71c37a67c1 100644 --- a/deal.II/include/deal.II/lac/matrix_lib.templates.h +++ b/deal.II/include/deal.II/lac/matrix_lib.templates.h @@ -24,7 +24,7 @@ MeanValueFilter::filter(Vector &v) const { number mean = v.mean_value(); - for (unsigned int i=0; i &dst, number mean = src.mean_value(); - for (unsigned int i=0; i &dst, number mean = src.mean_value(); - for (unsigned int i=0; i { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Class holding various * variables which are used to @@ -124,7 +129,7 @@ public: * * Default value is one. */ - unsigned int block_size; + size_type block_size; /** * If true, plot @@ -139,9 +144,9 @@ public: * structure to their default * values. */ - Options (const bool show_absolute_values = false, - const unsigned int block_size = 1, - const bool discontinuous = false); + Options (const bool show_absolute_values = false, + const size_type block_size = 1, + const bool discontinuous = false); }; /** @@ -250,8 +255,8 @@ private: */ template static double get_element (const SparseMatrix &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Return the element with given @@ -260,8 +265,8 @@ private: */ template static double get_element (const BlockSparseMatrix &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Return the element with given @@ -273,8 +278,8 @@ private: */ template static double get_element (const Matrix &matrix, - const unsigned int i, - const unsigned int j); + const size_type i, + const size_type j); /** * Get the value of the matrix at @@ -291,8 +296,8 @@ private: */ template static double get_gridpoint_value (const Matrix &matrix, - const unsigned int i, - const unsigned int j, + const size_type i, + const size_type j, const Options &options); }; @@ -304,8 +309,8 @@ template inline double MatrixOut::get_element (const SparseMatrix &matrix, - const unsigned int i, - const unsigned int j) + const size_type i, + const size_type j) { return matrix.el(i,j); } @@ -317,8 +322,8 @@ template inline double MatrixOut::get_element (const BlockSparseMatrix &matrix, - const unsigned int i, - const unsigned int j) + const size_type i, + const size_type j) { return matrix.el(i,j); } @@ -329,9 +334,9 @@ MatrixOut::get_element (const BlockSparseMatrix &matrix, template inline double -MatrixOut::get_element (const Matrix &matrix, - const unsigned int i, - const unsigned int j) +MatrixOut::get_element (const Matrix &matrix, + const size_type i, + const size_type j) { return matrix(i,j); } @@ -341,10 +346,10 @@ MatrixOut::get_element (const Matrix &matrix, template inline double -MatrixOut::get_gridpoint_value (const Matrix &matrix, - const unsigned int i, - const unsigned int j, - const Options &options) +MatrixOut::get_gridpoint_value (const Matrix &matrix, + const size_type i, + const size_type j, + const Options &options) { // special case if block size is // one since we then don't need all @@ -360,10 +365,10 @@ MatrixOut::get_gridpoint_value (const Matrix &matrix, // if blocksize greater than one, // then compute average of elements double average = 0; - unsigned int n_elements = 0; - for (unsigned int row=i*options.block_size; + size_type n_elements = 0; + for (size_type row=i*options.block_size; row < std::min(matrix.m(), (i+1)*options.block_size); ++row) - for (unsigned int col=j*options.block_size; + for (size_type col=j*options.block_size; col < std::min(matrix.m(), (j+1)*options.block_size); ++col, ++n_elements) if (options.show_absolute_values == true) average += std::fabs(get_element (matrix, row, col)); @@ -381,7 +386,7 @@ MatrixOut::build_patches (const Matrix &matrix, const std::string &name, const Options options) { - unsigned int + size_type gridpoints_x = (matrix.n() / options.block_size + (matrix.n() % options.block_size != 0 ? 1 : 0)), @@ -403,9 +408,9 @@ MatrixOut::build_patches (const Matrix &matrix, patches.resize ((gridpoints_x) * (gridpoints_y)); // now build the patches - unsigned int index=0; - for (unsigned int i=0; in_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; diff --git a/deal.II/include/deal.II/lac/petsc_block_vector.h b/deal.II/include/deal.II/lac/petsc_block_vector.h index 07ea7dd923..0e50ffc97c 100644 --- a/deal.II/include/deal.II/lac/petsc_block_vector.h +++ b/deal.II/include/deal.II/lac/petsc_block_vector.h @@ -91,7 +91,7 @@ namespace PETScWrappers * sizes. */ explicit BlockVector (const unsigned int num_blocks = 0, - const unsigned int block_size = 0); + const size_type block_size = 0); /** * Copy-Constructor. Dimension set to @@ -192,7 +192,7 @@ namespace PETScWrappers * is filled with zeros. */ void reinit (const unsigned int num_blocks, - const unsigned int block_size, + const size_type block_size, const bool fast = false); /** @@ -227,8 +227,8 @@ namespace PETScWrappers * 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 @@ -317,7 +317,7 @@ namespace PETScWrappers inline BlockVector::BlockVector (const unsigned int n_blocks, - const unsigned int block_size) + const size_type block_size) { reinit (n_blocks, block_size); } @@ -325,7 +325,7 @@ namespace PETScWrappers inline - BlockVector::BlockVector (const std::vector &n) + BlockVector::BlockVector (const std::vector &n) { reinit (n, false); } @@ -360,9 +360,9 @@ namespace PETScWrappers template - BlockVector::BlockVector (const std::vector &n, - const InputIterator first, - const InputIterator end) + BlockVector::BlockVector (const std::vector &n, + const InputIterator first, + const InputIterator end) { // first set sizes of blocks, but // don't initialize them as we will @@ -374,7 +374,7 @@ namespace PETScWrappers InputIterator end = start; std::advance (end, static_cast(n[b])); - for (unsigned int i=0; iblock(b)(i) = *start; } Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize()); @@ -420,10 +420,10 @@ namespace PETScWrappers inline void BlockVector::reinit (const unsigned int n_bl, - const unsigned int bl_sz, + 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); } @@ -431,8 +431,8 @@ namespace PETScWrappers inline void - BlockVector::reinit (const std::vector &n, - const bool fast) + BlockVector::reinit (const std::vector &n, + const bool fast) { block_indices.reinit (n); if (this->components.size() != this->n_blocks()) diff --git a/deal.II/include/deal.II/lac/petsc_full_matrix.h b/deal.II/include/deal.II/lac/petsc_full_matrix.h index b9575a75dc..e15a5c20c6 100644 --- a/deal.II/include/deal.II/lac/petsc_full_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_full_matrix.h @@ -45,12 +45,17 @@ namespace PETScWrappers class FullMatrix : public MatrixBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Create a full matrix of dimensions * @p m times @p n. */ - FullMatrix (const unsigned int m, - const unsigned int n); + FullMatrix (const size_type m, + const size_type n); /** * Return a reference to the MPI diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index a8f137b846..2b08f13812 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -70,30 +70,30 @@ namespace PETScWrappers * access, a const matrix * pointer is sufficient. */ - Accessor (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index); + Accessor (const MatrixBase *matrix, + const size_type row, + const size_type index); /** * Row number of the element * represented by this * object. */ - unsigned int row() const; + size_type row() const; /** * Index in row of the element * represented by this * object. */ - unsigned int index() const; + size_type index() const; /** * Column number of the * element represented by * this object. */ - unsigned int column() const; + size_type column() const; /** * Value of this matrix entry. @@ -123,12 +123,12 @@ namespace PETScWrappers /** * Current row number. */ - unsigned int a_row; + size_type a_row; /** * Current index in row. */ - unsigned int a_index; + size_type a_index; /** * Cache where we store the @@ -154,7 +154,7 @@ namespace PETScWrappers * accessor can access this data * if necessary. */ - std_cxx1x::shared_ptr > colnum_cache; + std_cxx1x::shared_ptr > colnum_cache; /** * Similar cache for the values @@ -179,15 +179,19 @@ namespace PETScWrappers }; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * Constructor. Create an iterator * into the matrix @p matrix for the * given row and the index within it. */ - const_iterator (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index); + const_iterator (const MatrixBase *matrix, + const size_type row, + const size_type index); /** * Prefix increment. @@ -350,8 +354,8 @@ namespace PETScWrappers * If value is not a finite * number an exception is thrown. */ - void set (const unsigned int i, - const unsigned int j, + void set (const size_type i, + const size_type j, const PetscScalar value); /** @@ -389,9 +393,9 @@ namespace PETScWrappers * false, i.e., even zero * values are inserted/replaced. */ - 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 @@ -400,10 +404,10 @@ namespace PETScWrappers * different local-to-global indexing * on rows and columns, respectively. */ - 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 @@ -431,10 +435,10 @@ namespace PETScWrappers * false, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const std::vector &col_indices, + void set (const size_type row, + const std::vector &col_indices, const std::vector &values, - const bool elide_zero_values = false); + const bool elide_zero_values = false); /** * Set several elements to values @@ -462,11 +466,11 @@ namespace PETScWrappers * false, i.e., even zero * values are inserted/replaced. */ - void set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values = false); + const bool elide_zero_values = false); /** * Add @p value to the element @@ -483,8 +487,8 @@ namespace PETScWrappers * If value is not a finite * number an exception is thrown. */ - void add (const unsigned int i, - const unsigned int j, + void add (const size_type i, + const size_type j, const PetscScalar value); /** @@ -524,9 +528,9 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - 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 @@ -535,10 +539,10 @@ namespace PETScWrappers * different local-to-global indexing * on rows and columns, respectively. */ - 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 @@ -567,10 +571,10 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const std::vector &col_indices, + void add (const size_type row, + const std::vector &col_indices, const std::vector &values, - const bool elide_zero_values = true); + const bool elide_zero_values = true); /** * Add an array of values given by @@ -599,12 +603,12 @@ namespace PETScWrappers * i.e., zero values won't be added * into the matrix. */ - void add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + void add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values = true, - const bool col_indices_are_sorted = false); + const bool elide_zero_values = true, + const bool col_indices_are_sorted = false); /** * Remove all elements from @@ -636,8 +640,8 @@ namespace PETScWrappers * to a value different from zero. The * default is to set it to zero. */ - void clear_row (const unsigned int row, - const PetscScalar new_diag_value = 0); + void clear_row (const size_type row, + const PetscScalar new_diag_value = 0); /** * Same as clear_row(), except that it @@ -652,8 +656,8 @@ namespace PETScWrappers * the diagonal entries, you have to * set them by hand. */ - void clear_rows (const std::vector &rows, - const PetscScalar new_diag_value = 0); + void clear_rows (const std::vector &rows, + const PetscScalar new_diag_value = 0); /** * PETSc matrices store their own @@ -690,8 +694,8 @@ namespace PETScWrappers * This function is therefore exactly * equivalent to the el() function. */ - PetscScalar operator () (const unsigned int i, - const unsigned int j) const; + PetscScalar operator () (const size_type i, + const size_type j) const; /** * Return the value of the matrix entry @@ -704,8 +708,8 @@ namespace PETScWrappers * solution, since the sparsity of the * matrix is not used. */ - PetscScalar el (const unsigned int i, - const unsigned int j) const; + PetscScalar el (const size_type i, + const size_type j) const; /** * Return the main diagonal @@ -722,19 +726,19 @@ namespace PETScWrappers * function for compatibility with the * SparseMatrix class. */ - PetscScalar diag_element (const unsigned int i) const; + PetscScalar diag_element (const size_type i) const; /** * Return the number of rows in this * matrix. */ - unsigned int m () const; + size_type m () const; /** * Return the number of columns in this * matrix. */ - unsigned int n () const; + size_type n () const; /** * Return the local dimension of the @@ -749,7 +753,7 @@ namespace PETScWrappers * exactly are stored locally, * use local_range(). */ - unsigned int local_size () const; + size_type local_size () const; /** * Return a pair of indices @@ -767,7 +771,7 @@ namespace PETScWrappers * a pair (i,i+n), where * n=local_size(). */ - std::pair + std::pair local_range () const; /** @@ -775,7 +779,7 @@ namespace PETScWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return a reference to the MPI @@ -794,12 +798,12 @@ namespace PETScWrappers * the entries should happen to * be zero, it is counted anyway. */ - unsigned int n_nonzero_elements () const; + size_type n_nonzero_elements () const; /** * Number of entries in a specific row. */ - unsigned int row_length (const unsigned int row) const; + size_type row_length (const size_type row) const; /** * Return the l1-norm of the matrix, that is @@ -1072,7 +1076,7 @@ namespace PETScWrappers * iterator may not be dereferencable in * that case. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row r. It @@ -1085,7 +1089,7 @@ namespace PETScWrappers * particular the case if it is the end * iterator for the last row of a matrix. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; /** * Conversion operator to gain access @@ -1308,9 +1312,9 @@ namespace PETScWrappers inline const_iterator::Accessor:: - Accessor (const MatrixBase *matrix, - const unsigned int row, - const unsigned int index) + Accessor (const MatrixBase *matrix, + const size_type row, + const size_type index) : matrix(const_cast(matrix)), a_row(row), @@ -1321,7 +1325,7 @@ namespace PETScWrappers inline - unsigned int + size_type const_iterator::Accessor::row() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1330,7 +1334,7 @@ namespace PETScWrappers inline - unsigned int + size_type const_iterator::Accessor::column() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1339,7 +1343,7 @@ namespace PETScWrappers inline - unsigned int + size_type const_iterator::Accessor::index() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1358,9 +1362,9 @@ namespace PETScWrappers inline const_iterator:: - const_iterator(const MatrixBase *matrix, - const unsigned int row, - const unsigned int index) + const_iterator(const MatrixBase *matrix, + const size_type row, + const size_type index) : accessor(matrix, row, index) {} @@ -1462,9 +1466,9 @@ namespace PETScWrappers // compile time. inline void - MatrixBase::set (const unsigned int i, - const unsigned int j, - const PetscScalar value) + MatrixBase::set (const size_type i, + const size_type j, + const PetscScalar value) { Assert (numbers::is_finite(value), ExcNumberNotFinite()); @@ -1475,15 +1479,15 @@ namespace PETScWrappers inline void - MatrixBase::set (const std::vector &indices, - const FullMatrix &values, - const bool elide_zero_values) + MatrixBase::set (const std::vector &indices, + const FullMatrix &values, + const bool elide_zero_values) { Assert (indices.size() == values.m(), ExcDimensionMismatch(indices.size(), values.m())); Assert (values.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i &row_indices, - const std::vector &col_indices, - const FullMatrix &values, - const bool elide_zero_values) + MatrixBase::set (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 &col_indices, + MatrixBase::set (const size_type row, + const std::vector &col_indices, const std::vector &values, - const bool elide_zero_values) + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1527,11 +1531,11 @@ namespace PETScWrappers inline void - MatrixBase::set (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + MatrixBase::set (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values) + const bool elide_zero_values) { prepare_action(LastAction::insert); @@ -1566,7 +1570,7 @@ namespace PETScWrappers } n_columns = 0; - for (unsigned int j=0; j &indices, - const FullMatrix &values, - const bool elide_zero_values) + MatrixBase::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.m() == values.n(), ExcNotQuadratic()); - for (unsigned int i=0; i &row_indices, - const std::vector &col_indices, - const FullMatrix &values, - const bool elide_zero_values) + MatrixBase::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 &col_indices, + MatrixBase::add (const size_type row, + const std::vector &col_indices, const std::vector &values, - const bool elide_zero_values) + const bool elide_zero_values) { Assert (col_indices.size() == values.size(), ExcDimensionMismatch(col_indices.size(), values.size())); @@ -1676,11 +1680,11 @@ namespace PETScWrappers inline void - MatrixBase::add (const unsigned int row, - const unsigned int n_cols, - const unsigned int *col_indices, + MatrixBase::add (const size_type row, + const size_type n_cols, + const size_type *col_indices, const PetscScalar *values, - const bool elide_zero_values, + const bool elide_zero_values, const bool /*col_indices_are_sorted*/) { prepare_action(LastAction::add); @@ -1716,7 +1720,7 @@ namespace PETScWrappers } n_columns = 0; - for (unsigned int j=0; j 0) @@ -1784,14 +1788,14 @@ namespace PETScWrappers inline MatrixBase::const_iterator - MatrixBase::end(const unsigned int r) const + MatrixBase::end(const size_type r) const { Assert (r < m(), ExcIndexRange(r, 0, m())); // place the iterator on the first entry // past this line, or at the end of the // matrix - for (unsigned int i=r+1; i 0) return const_iterator(this, i, 0); @@ -1804,7 +1808,7 @@ namespace PETScWrappers inline bool - MatrixBase::in_local_range (const unsigned int index) const + MatrixBase::in_local_range (const size_type index) const { #ifdef PETSC_USE_64BIT_INDICES PetscInt begin, end; @@ -1815,8 +1819,8 @@ namespace PETScWrappers &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return ((index >= static_cast(begin)) && - (index < static_cast(end))); + return ((index >= static_cast(begin)) && + (index < static_cast(end))); } diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h index 92bb6151c4..4e50f1735e 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h @@ -62,6 +62,11 @@ namespace PETScWrappers class BlockSparseMatrix : public BlockMatrixBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Typedef the base class for simpler * access to its own typedefs. @@ -169,8 +174,8 @@ namespace PETScWrappers * 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); /** * Matrix-vector multiplication: @@ -292,8 +297,8 @@ namespace PETScWrappers { 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; diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h index e17ce5b484..88192e1ae7 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h @@ -99,8 +99,8 @@ namespace PETScWrappers */ explicit BlockVector (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size); + const size_type block_size, + const size_type local_size); /** * Copy-Constructor. Set all the @@ -122,9 +122,9 @@ namespace PETScWrappers * local_elements[i] * elements on the present process. */ - BlockVector (const std::vector &block_sizes, - const MPI_Comm &communicator, - const std::vector &local_elements); + BlockVector (const std::vector &block_sizes, + const MPI_Comm &communicator, + const std::vector &local_elements); /** * Destructor. Clears memory @@ -192,8 +192,8 @@ namespace PETScWrappers */ void reinit (const unsigned int n_blocks, const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size, + const size_type block_size, + const size_type local_size, const bool fast = false); /** @@ -231,10 +231,10 @@ namespace PETScWrappers * since they may be routed to * the wrong block. */ - void reinit (const std::vector &block_sizes, - const MPI_Comm &communicator, - const std::vector &local_sizes, - const bool fast=false); + void reinit (const std::vector &block_sizes, + const MPI_Comm &communicator, + const std::vector &local_sizes, + const bool fast=false); /** * Change the dimension to that @@ -334,10 +334,10 @@ namespace PETScWrappers inline - BlockVector::BlockVector (const unsigned int n_blocks, - const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size) + BlockVector::BlockVector (const size_type n_blocks, + const MPI_Comm &communicator, + const size_type block_size, + const size_type local_size) { reinit (n_blocks, communicator, block_size, local_size); } @@ -345,9 +345,9 @@ namespace PETScWrappers inline - BlockVector::BlockVector (const std::vector &block_sizes, + BlockVector::BlockVector (const std::vector &block_sizes, const MPI_Comm &communicator, - const std::vector &local_elements) + const std::vector &local_elements) { reinit (block_sizes, communicator, local_elements, false); } @@ -394,15 +394,15 @@ namespace PETScWrappers inline void - BlockVector::reinit (const unsigned int n_blocks, - const MPI_Comm &communicator, - const unsigned int block_size, - const unsigned int local_size, + BlockVector::reinit (const size_type n_blocks, + const MPI_Comm &communicator, + const size_type block_size, + const size_type local_size, const bool fast) { - reinit(std::vector(n_blocks, block_size), + reinit(std::vector(n_blocks, block_size), communicator, - std::vector(n_blocks, local_size), + std::vector(n_blocks, local_size), fast); } @@ -410,10 +410,10 @@ namespace PETScWrappers inline void - BlockVector::reinit (const std::vector &block_sizes, - const MPI_Comm &communicator, - const std::vector &local_sizes, - const bool fast) + BlockVector::reinit (const std::vector &block_sizes, + const MPI_Comm &communicator, + const std::vector &local_sizes, + const bool fast) { this->block_indices.reinit (block_sizes); if (this->components.size() != this->n_blocks()) diff --git a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h index d3eb3a5780..16f13c96eb 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h @@ -112,6 +112,10 @@ namespace PETScWrappers class SparseMatrix : public MatrixBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * A structure that describes some of @@ -179,13 +183,13 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Initialize a rectangular matrix @@ -220,13 +224,13 @@ namespace PETScWrappers * true, only an ICC. The default * value of this flag is @p false. */ - SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric = false); + SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Initialize using the given @@ -269,12 +273,12 @@ namespace PETScWrappers * the start. */ template - SparseMatrix (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations = true); + SparseMatrix (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const size_type this_process, + const bool preset_nonzero_locations = true); /** * This operator assigns a scalar to @@ -303,12 +307,12 @@ namespace PETScWrappers * present function. */ void reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Throw away the present matrix and @@ -318,13 +322,13 @@ namespace PETScWrappers * the same argument list as the * present function. */ - void reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric = false); + void reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Initialize using the given @@ -361,12 +365,12 @@ namespace PETScWrappers * the start. */ template - void reinit (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations = true); + void reinit (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations = true); /** * Return a reference to the MPI @@ -445,32 +449,32 @@ namespace PETScWrappers * of the previous matrix is left to * the caller. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Same as previous function. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Same as previous functions. */ template - void do_reinit (const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations); + void do_reinit (const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations); /** * To allow calling protected diff --git a/deal.II/include/deal.II/lac/petsc_parallel_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_vector.h index ed195adf15..2214cb504f 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_vector.h @@ -153,6 +153,11 @@ namespace PETScWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. Initialize the * vector as empty. @@ -183,9 +188,9 @@ namespace PETScWrappers * vector is replaced by one of * length zero. */ - explicit Vector (const MPI_Comm &communicator, - const unsigned int n, - const unsigned int local_size); + explicit Vector (const MPI_Comm &communicator, + const size_type n, + const size_type local_size); /** @@ -204,9 +209,9 @@ namespace PETScWrappers * shall communicate */ template - explicit Vector (const MPI_Comm &communicator, + explicit Vector (const MPI_Comm &communicator, const dealii::Vector &v, - const unsigned int local_size); + const size_type local_size); /** @@ -225,7 +230,7 @@ namespace PETScWrappers */ explicit Vector (const MPI_Comm &communicator, const VectorBase &v, - const unsigned int local_size); + const size_type local_size); /** @@ -362,10 +367,10 @@ namespace PETScWrappers * elements are left an unspecified * state. */ - void reinit (const MPI_Comm &communicator, - const unsigned int N, - const unsigned int local_size, - const bool fast = false); + void reinit (const MPI_Comm &communicator, + const size_type N, + const size_type local_size, + const bool fast = false); /** * Change the dimension to that of @@ -442,8 +447,8 @@ namespace PETScWrappers * how many of these elements shall * be stored locally. */ - virtual void create_vector (const unsigned int n, - const unsigned int local_size); + virtual void create_vector (const size_type n, + const size_type local_size); @@ -455,8 +460,8 @@ namespace PETScWrappers * call update_ghost_values() before * accessing those. */ - virtual void create_vector (const unsigned int n, - const unsigned int local_size, + virtual void create_vector (const size_type n, + const size_type local_size, const IndexSet &ghostnodes); @@ -492,7 +497,7 @@ namespace PETScWrappers template Vector::Vector (const MPI_Comm &communicator, const dealii::Vector &v, - const unsigned int local_size) + const size_type local_size) : communicator (communicator) { @@ -583,7 +588,7 @@ namespace PETScWrappers // that would take a pointer to an array // of PetscScalar values and simply copy // n elements verbatim into the vector... - for (unsigned int i=0; iB^m where B * has been sparsified from the given * matrix A, n_level diff --git a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h index ebd378ae75..e6ee2292c4 100644 --- a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h @@ -97,10 +97,10 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + SparseMatrix (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Initialize a rectangular matrix with @@ -130,10 +130,10 @@ namespace PETScWrappers * ICC. The default value of this flag * is @p false. */ - SparseMatrix (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric = false); + SparseMatrix (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Initialize a sparse matrix using the @@ -197,10 +197,10 @@ namespace PETScWrappers * the same argument list as the * present function. */ - void reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Throw away the present matrix and @@ -209,11 +209,11 @@ namespace PETScWrappers * the constructor of this class with * the same argument list as the * present function. - */ - void reinit (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric = false); + */ + void reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Initialize a sparse matrix using the @@ -285,18 +285,18 @@ namespace PETScWrappers * matrix. Getting rid of the previous * matrix is left to the caller. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric = false); /** * Same as previous function. */ - void do_reinit (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric = false); + void do_reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric = false); /** * Same as previous function. diff --git a/deal.II/include/deal.II/lac/petsc_vector.h b/deal.II/include/deal.II/lac/petsc_vector.h index 3d1f9984a7..eb80eee641 100644 --- a/deal.II/include/deal.II/lac/petsc_vector.h +++ b/deal.II/include/deal.II/lac/petsc_vector.h @@ -47,6 +47,11 @@ namespace PETScWrappers class Vector : public VectorBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. Initialize the * vector as empty. @@ -67,7 +72,7 @@ namespace PETScWrappers * i.e. the vector is replaced by one of * length zero. */ - explicit Vector (const unsigned int n); + explicit Vector (const size_type n); /** * Copy-constructor from deal.II @@ -180,8 +185,8 @@ namespace PETScWrappers * elements are left an unspecified * state. */ - void reinit (const unsigned int N, - const bool fast = false); + void reinit (const size_type N, + const bool fast = false); /** * Change the dimension to that of the @@ -204,7 +209,7 @@ namespace PETScWrappers * size of the vector to be * created. */ - void create_vector (const unsigned int n); + void create_vector (const size_type n); }; /*@}*/ @@ -396,7 +401,7 @@ namespace PETScWrappers // that would take a pointer to an array // of PetscScalar values and simply copy // n elements verbatim into the vector... - for (unsigned int i=0; in=local_size(). */ - std::pair + std::pair local_range () const; /** @@ -390,7 +395,7 @@ namespace PETScWrappers * in the local range or not, * see also local_range(). */ - bool in_local_range (const unsigned int index) const; + bool in_local_range (const size_type index) const; /** * Return if the vector contains ghost @@ -403,14 +408,14 @@ namespace PETScWrappers * both read and write. */ reference - operator () (const unsigned int index); + operator () (const size_type index); /** * Provide read-only access to an * element. */ PetscScalar - operator () (const unsigned int index) const; + operator () (const size_type index) const; /** * Provide access to a given @@ -419,7 +424,7 @@ namespace PETScWrappers * Exactly the same as operator(). */ reference - operator [] (const unsigned int index); + operator [] (const size_type index); /** * Provide read-only access to an @@ -429,7 +434,7 @@ namespace PETScWrappers * Exactly the same as operator(). */ PetscScalar - operator [] (const unsigned int index) const; + operator [] (const size_type index) const; /** * A collective set operation: instead @@ -441,7 +446,7 @@ namespace PETScWrappers * the corresponding values in the * second. */ - void set (const std::vector &indices, + void set (const std::vector &indices, const std::vector &values); /** @@ -450,7 +455,7 @@ namespace PETScWrappers * stored in @p values to the vector * components specified by @p indices. */ - void add (const std::vector &indices, + void add (const std::vector &indices, const std::vector &values); /** @@ -460,7 +465,7 @@ namespace PETScWrappers * takes a deal.II vector of * values. */ - void add (const std::vector &indices, + void add (const std::vector &indices, const ::dealii::Vector &values); /** @@ -472,8 +477,8 @@ namespace PETScWrappers * other two add() * functions above. */ - void add (const unsigned int n_elements, - const unsigned int *indices, + void add (const size_type n_elements, + const size_type *indices, const PetscScalar *values); /** @@ -879,10 +884,10 @@ namespace PETScWrappers * @p add_values flag set to the * corresponding value. */ - void do_set_add_operation (const unsigned int n_elements, - const unsigned int *indices, + void do_set_add_operation (const size_type n_elements, + const size_type *indices, const PetscScalar *values, - const bool add_values); + const bool add_values); }; @@ -910,7 +915,7 @@ namespace PETScWrappers { inline VectorReference::VectorReference (const VectorBase &vector, - const unsigned int index) + const size_type index) : vector (vector), index (index) @@ -1144,7 +1149,7 @@ namespace PETScWrappers inline bool - VectorBase::in_local_range (const unsigned int index) const + VectorBase::in_local_range (const size_type index) const { #ifdef PETSC_USE_64BIT_INDICES PetscInt begin, end; @@ -1156,8 +1161,8 @@ namespace PETScWrappers &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return ((index >= static_cast(begin)) && - (index < static_cast(end))); + return ((index >= static_cast(begin)) && + (index < static_cast(end))); } inline @@ -1171,7 +1176,7 @@ namespace PETScWrappers inline internal::VectorReference - VectorBase::operator () (const unsigned int index) + VectorBase::operator () (const size_type index) { return internal::VectorReference (*this, index); } @@ -1180,7 +1185,7 @@ namespace PETScWrappers inline PetscScalar - VectorBase::operator () (const unsigned int index) const + VectorBase::operator () (const size_type index) const { return static_cast(internal::VectorReference (*this, index)); } @@ -1189,7 +1194,7 @@ namespace PETScWrappers inline internal::VectorReference - VectorBase::operator [] (const unsigned int index) + VectorBase::operator [] (const size_type index) { return operator()(index); } @@ -1198,7 +1203,7 @@ namespace PETScWrappers inline PetscScalar - VectorBase::operator [] (const unsigned int index) const + VectorBase::operator [] (const size_type index) const { return operator()(index); } diff --git a/deal.II/include/deal.II/lac/precondition.h b/deal.II/include/deal.II/lac/precondition.h index a2603c8498..deaf2e8604 100644 --- a/deal.II/include/deal.II/lac/precondition.h +++ b/deal.II/include/deal.II/lac/precondition.h @@ -63,7 +63,6 @@ namespace parallel class PreconditionIdentity : public Subscriptor { public: - /** * This function is only * present to @@ -568,6 +567,10 @@ template > class PreconditionSSOR : public PreconditionRelaxation { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * A typedef to the base class. @@ -666,6 +669,11 @@ template > class PreconditionPSOR : public PreconditionRelaxation { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Initialize matrix and * relaxation parameter. The @@ -686,8 +694,8 @@ public: * reasons. It defaults to 1. */ void initialize (const MATRIX &A, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const typename PreconditionRelaxation::AdditionalData & parameters = typename PreconditionRelaxation::AdditionalData()); @@ -707,12 +715,12 @@ private: /** * Storage for the permutation vector. */ - const std::vector *permutation; + const std::vector *permutation; /** * Storage for the inverse * permutation vector. */ - const std::vector *inverse_permutation; + const std::vector *inverse_permutation; }; @@ -892,6 +900,11 @@ template , class VECTOR=Vector > class PreconditionChebyshev : public Subscriptor { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Standardized data struct to * pipe additional parameters @@ -1327,9 +1340,9 @@ PreconditionSSOR::initialize (const MATRIX &rA, // calculate the positions first after the diagonal. if (mat != 0) { - const unsigned int n = this->A->n(); + const size_type n = this->A->n(); pos_right_of_diagonal.resize(n, static_cast(-1)); - for (unsigned int row=0; row inline void PreconditionPSOR::initialize ( const MATRIX &rA, - const std::vector &p, - const std::vector &ip, + const std::vector &p, + const std::vector &ip, const typename PreconditionRelaxation::AdditionalData ¶meters) { permutation = &p; @@ -1599,7 +1612,7 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, if (data.matrix_diagonal_inverse.size() != matrix.m()) { data.matrix_diagonal_inverse.reinit(matrix.m()); - for (unsigned int i=0; i::initialize (const MATRIX &matrix, else { TridiagonalMatrix T(diagonal.size(), true); - for (unsigned int i=0; i struct VectorUpdatesRange : public parallel::ParallelForInteger { + typedef types::global_dof_index size_type; + VectorUpdatesRange (const size_t size, const Number *src, const Number *matrix_diagonal_inverse, @@ -1776,13 +1791,13 @@ namespace internal if (factor1 == Number()) { if (start_zero) - for (unsigned int i=begin; i &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const AdditionalData parameters); /** @@ -250,8 +255,8 @@ protected: * order is only admissible for * block permutation. */ - void set_permutation(const std::vector &permutation, - const std::vector &inverse_permutation); + void set_permutation(const std::vector &permutation, + const std::vector &inverse_permutation); /** * Replacement of @@ -259,8 +264,8 @@ protected: * permuted preconditioning. */ void invert_permuted_diagblocks( - const std::vector &permutation, - const std::vector &inverse_permutation); + const std::vector &permutation, + const std::vector &inverse_permutation); public: /** * Deletes the inverse diagonal @@ -283,8 +288,8 @@ public: * if the inverse diagonal blocks * are stored. */ - value_type el(unsigned int i, - unsigned int j) const; + value_type el(size_type i, + size_type j) const; /** * Stores the inverse of the @@ -367,7 +372,7 @@ public: /** * Return the size of the blocks. */ - unsigned int block_size () const; + size_type block_size () const; /** * @deprecated Use size() @@ -414,7 +419,7 @@ protected: * diagonal block is assumed to * be of the same size. */ - unsigned int blocksize; + size_type blocksize; /** * Pointer to the matrix. Make @@ -438,12 +443,12 @@ protected: /** * The permutation vector */ - std::vector permutation; + std::vector permutation; /** * The inverse permutation vector */ - std::vector inverse_permutation; + std::vector inverse_permutation; /** * Flag for diagonal compression. @@ -474,6 +479,11 @@ private: typedef typename MATRIX::value_type number; public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * STL conforming iterator. */ @@ -493,21 +503,21 @@ public: * pointer is sufficient. */ Accessor (const PreconditionBlockJacobi *matrix, - const unsigned int row); + const size_type row); /** * 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 this matrix entry. @@ -524,12 +534,12 @@ public: * Save block size here * for further reference. */ - unsigned int bs; + size_type bs; /** * Current block number. */ - unsigned int a_block; + size_type a_block; /** * Iterator inside block. @@ -553,7 +563,7 @@ public: * Constructor. */ const_iterator(const PreconditionBlockJacobi *matrix, - const unsigned int row); + const size_type row); /** * Prefix increment. @@ -698,12 +708,12 @@ public: * STL-like iterator with the * first entry of row @p r. */ - const_iterator begin (const unsigned int r) const; + const_iterator begin (const size_type r) const; /** * Final iterator of row @p r. */ - const_iterator end (const unsigned int r) const; + const_iterator end (const size_type r) const; private: @@ -767,6 +777,11 @@ class PreconditionBlockSOR : public virtual Subscriptor, protected PreconditionBlock { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Default constructor. */ @@ -955,6 +970,11 @@ class PreconditionBlockSSOR : public virtual Subscriptor, private PreconditionBlockSOR { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Define number type of matrix. */ @@ -1051,16 +1071,16 @@ PreconditionBlock::n_blocks () const template inline inverse_type PreconditionBlock::el ( - unsigned int i, - unsigned int j) const + size_type i, + size_type j) const { - const unsigned int bs = blocksize; + const size_type bs = blocksize; const unsigned int nb = i/bs; const FullMatrix &B = this->inverse(nb); - const unsigned int ib = i % bs; - const unsigned int jb = j % bs; + const size_type ib = i % bs; + const size_type jb = j % bs; if (jb + nb*bs != j) { @@ -1076,7 +1096,7 @@ template inline PreconditionBlockJacobi::const_iterator::Accessor:: Accessor (const PreconditionBlockJacobi *matrix, - const unsigned int row) + const size_type row) : matrix(matrix), b_iterator(&matrix->inverse(0), 0, 0), @@ -1090,7 +1110,7 @@ Accessor (const PreconditionBlockJacobi *matrix, if (a_block == matrix->size()) return; - const unsigned int r = row % bs; + const size_type r = row % bs; b_iterator = matrix->inverse(a_block).begin(r); b_end = matrix->inverse(a_block).end(); @@ -1102,7 +1122,7 @@ Accessor (const PreconditionBlockJacobi *matrix, template inline -unsigned int +typename PreconditionBlockJacobi::size_type PreconditionBlockJacobi::const_iterator::Accessor::row() const { Assert (a_block < matrix->size(), @@ -1114,7 +1134,7 @@ PreconditionBlockJacobi::const_iterator::Accessor::row() c template inline -unsigned int +typename PreconditionBlockJacobi::size_type PreconditionBlockJacobi::const_iterator::Accessor::column() const { Assert (a_block < matrix->size(), @@ -1140,7 +1160,7 @@ template inline PreconditionBlockJacobi::const_iterator:: const_iterator(const PreconditionBlockJacobi *matrix, - const unsigned int row) + const size_type row) : accessor(matrix, row) {} @@ -1248,7 +1268,7 @@ template inline typename PreconditionBlockJacobi::const_iterator PreconditionBlockJacobi::begin ( - const unsigned int r) const + const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); return const_iterator(this, r); @@ -1260,7 +1280,7 @@ template inline typename PreconditionBlockJacobi::const_iterator PreconditionBlockJacobi::end ( - const unsigned int r) const + const size_type r) const { Assert (r < this->A->m(), ExcIndexRange(r, 0, this->A->m())); return const_iterator(this, r+1); diff --git a/deal.II/include/deal.II/lac/precondition_block.templates.h b/deal.II/include/deal.II/lac/precondition_block.templates.h index 41fc24ad95..fd784c4628 100644 --- a/deal.II/include/deal.II/lac/precondition_block.templates.h +++ b/deal.II/include/deal.II/lac/precondition_block.templates.h @@ -27,7 +27,7 @@ DEAL_II_NAMESPACE_OPEN template PreconditionBlock::AdditionalData:: -AdditionalData (const unsigned int block_size, +AdditionalData (const size_type block_size, const double relaxation, const bool invert_diagonal, const bool same_diagonal) @@ -73,7 +73,7 @@ void PreconditionBlock::initialize ( const MATRIX &M, const AdditionalData parameters) { - const unsigned int bsize = parameters.block_size; + const size_type bsize = parameters.block_size; clear(); Assert (M.m() == M.n(), ExcNotQuadratic()); @@ -99,8 +99,8 @@ void PreconditionBlock::initialize ( template void PreconditionBlock::initialize ( const MATRIX &M, - const std::vector &permutation, - const std::vector &inverse_permutation, + const std::vector &permutation, + const std::vector &inverse_permutation, const AdditionalData parameters) { set_permutation(permutation, inverse_permutation); @@ -109,8 +109,8 @@ void PreconditionBlock::initialize ( template void PreconditionBlock::invert_permuted_diagblocks( - const std::vector &permutation, - const std::vector &inverse_permutation) + const std::vector &permutation, + const std::vector &inverse_permutation) { Assert (A!=0, ExcNotInitialized()); Assert (blocksize!=0, ExcNotInitialized()); @@ -126,7 +126,7 @@ void PreconditionBlock::invert_permuted_diagblocks( { deallog << "PreconditionBlock uses only one diagonal block" << std::endl; - for (unsigned int row_cell=0; row_cell::invert_permuted_diagblocks( for (unsigned int cell=0; cellsize(); ++cell) { - const unsigned int cell_start = cell*blocksize; - for (unsigned int row_cell=0; row_cell::invert_permuted_diagblocks( if (inverse_permutation[entry->column()]column()]-cell_start; + const size_type column_cell = inverse_permutation[entry->column()]-cell_start; if (column_cell >= blocksize) continue; M_cell(row_cell, column_cell) = entry->value(); @@ -250,7 +250,7 @@ void PreconditionBlock::forward_step ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; + size_type row, row_cell; number2 b_cell_row; // The diagonal block if the // inverses were not precomputed @@ -260,10 +260,10 @@ void PreconditionBlock::forward_step ( for (unsigned int rawcell=0; rawcell < this->size(); ++rawcell) { const unsigned int cell = cell_permuted ? permutation[rawcell] : rawcell; - const unsigned int block_start = cell*this->blocksize; - const unsigned int permuted_block_start = permuted - ? permutation[block_start] - : block_start; + const size_type block_start = cell*this->blocksize; + const size_type permuted_block_start = permuted + ? permutation[block_start] + : block_start; // deallog << std::endl << cell << '-' << block_start // << '-' << permuted_block_start << (permuted ? 't' : 'f') << '\t'; @@ -279,17 +279,17 @@ void PreconditionBlock::forward_step ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? inverse_permutation[column] + : column; b_cell_row -= entry->value() * prev(column); //TODO:[GK] Find out if this is really once column and once permuted if (!this->inverses_ready() && inverse_permuted_column >= block_start && inverse_permuted_column < block_start + this->blocksize) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; if (transpose_diagonal) M_cell(column_cell, row_cell) = entry->value(); else @@ -348,7 +348,7 @@ void PreconditionBlock::backward_step ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; + size_type row, row_cell; number2 b_cell_row; FullMatrix M_cell(this->blocksize); @@ -356,11 +356,11 @@ void PreconditionBlock::backward_step ( { --rawcell; const unsigned int cell = cell_permuted ? permutation[rawcell] : rawcell; - const unsigned int block_start = cell*this->blocksize; - const unsigned int block_end = block_start + this->blocksize; - const unsigned int permuted_block_start = permuted - ? permutation[block_start] - : block_start; + const size_type block_start = cell*this->blocksize; + const size_type block_end = block_start + this->blocksize; + const size_type permuted_block_start = permuted + ? permutation[block_start] + : block_start; for (row = permuted_block_start, row_cell = 0; row_cellblocksize; ++row_cell, ++row) @@ -371,16 +371,16 @@ void PreconditionBlock::backward_step ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? inverse_permutation[column] + : column; b_cell_row -= entry->value() * prev(column); if (!this->inverses_ready() && inverse_permuted_column < block_end && column >= block_start) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; // We need the // transpose of the // diagonal block, @@ -419,7 +419,8 @@ void PreconditionBlock::backward_step ( template -unsigned int PreconditionBlock::block_size() const +typename PreconditionBlock::size_type +PreconditionBlock::block_size() const { return blocksize; } @@ -439,7 +440,7 @@ void PreconditionBlock::invert_diagblocks() if (this->same_diagonal()) { deallog << "PreconditionBlock uses only one diagonal block" << std::endl; - for (unsigned int row_cell=0; row_cell::invert_diagblocks() for (unsigned int cell=0; cellsize(); ++cell) { - const unsigned int cell_start = cell*blocksize; - for (unsigned int row_cell=0; row_cell::invert_diagblocks() if (entry->column()column()-cell_start; + const size_type column_cell = entry->column()-cell_start; if (column_cell >= blocksize) continue; M_cell(row_cell, column_cell) = entry->value(); @@ -519,8 +520,8 @@ void PreconditionBlock::invert_diagblocks() template void PreconditionBlock::set_permutation ( - const std::vector &p, - const std::vector &i) + const std::vector &p, + const std::vector &i) { Assert (p.size() == i.size(), ExcDimensionMismatch(p.size(), i.size())); @@ -574,7 +575,7 @@ void PreconditionBlockJacobi // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell, begin_diag_block=0; + size_type row, row_cell, begin_diag_block=0; if (!this->inverses_ready()) { @@ -586,7 +587,7 @@ void PreconditionBlockJacobi ++row_cell, ++row) { b_cell(row_cell)=src(row); - for (unsigned int column_cell=0, column=cell*this->blocksize; + for (size_type column_cell=0, column=cell*this->blocksize; column_cellblocksize; ++column_cell, ++column) M_cell(row_cell,column_cell)=M(row,column); } @@ -742,7 +743,7 @@ void PreconditionBlockSOR::forward ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell, block_start=0; + size_type row, row_cell, block_start=0; number2 b_cell_row; // The diagonal block if the // inverses were not precomputed @@ -750,9 +751,9 @@ void PreconditionBlockSOR::forward ( for (unsigned int cell=0; cell < this->size(); ++cell) { - const unsigned int permuted_block_start = permuted - ? this->permutation[block_start] - :block_start; + const size_type permuted_block_start = permuted + ? this->permutation[block_start] + :block_start; for (row = permuted_block_start, row_cell = 0; row_cell < this->blocksize; @@ -764,16 +765,16 @@ void PreconditionBlockSOR::forward ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted - ? this->inverse_permutation[column] - : column; + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted + ? this->inverse_permutation[column] + : column; if (inverse_permuted_column < block_start) b_cell_row -= entry->value() * dst(column); else if (!this->inverses_ready() && column < block_start + this->blocksize) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; if (transpose_diagonal) M_cell(column_cell, row_cell) = entry->value(); else @@ -832,19 +833,19 @@ void PreconditionBlockSOR::backward ( // blocks. // row, column are the global numbering // of the unkowns. - unsigned int row, row_cell; - unsigned int block_end=this->blocksize * this->size(); + size_type row, row_cell; + size_type block_end=this->blocksize * this->size(); number2 b_cell_row; FullMatrix M_cell(this->blocksize); for (unsigned int cell=this->size(); cell!=0 ;) { --cell; - const unsigned int block_start = block_end - this->blocksize; + const size_type block_start = block_end - this->blocksize; // Collect upper triangle - const unsigned int permuted_block_start = (this->permutation.size() != 0) - ? this->permutation[block_start] - :block_start; + const size_type permuted_block_start = (this->permutation.size() != 0) + ? this->permutation[block_start] + : block_start; for (row = permuted_block_start, row_cell = 0; row_cellblocksize; ++row_cell, ++row) @@ -855,15 +856,15 @@ void PreconditionBlockSOR::backward ( b_cell_row=src(row); for (; entry != row_end; ++entry) { - const unsigned int column = entry->column(); - const unsigned int inverse_permuted_column = permuted + const size_type column = entry->column(); + const size_type inverse_permuted_column = permuted ? this->inverse_permutation[column] : column; if (inverse_permuted_column >= block_end) b_cell_row -= entry->value() * dst(column); else if (!this->inverses_ready() && column >= block_start) { - const unsigned int column_cell = column - block_start; + const size_type column_cell = column - block_start; // We need the // transpose of the // diagonal block, @@ -993,14 +994,14 @@ void PreconditionBlockSSOR::vmult (Vector &d // Multiply with diagonal blocks for (unsigned int cell=0; cell < this->size(); ++cell) { - unsigned int row = cell*this->blocksize; + size_type row = cell*this->blocksize; - for (unsigned int row_cell=0; row_cellblocksize; ++row_cell) + for (size_type row_cell=0; row_cellblocksize; ++row_cell) cell_src(row_cell)=help(row+row_cell); this->diagonal(cell).vmult(cell_dst, cell_src); - for (unsigned int row_cell=0; row_cellblocksize; ++row_cell) + for (size_type row_cell=0; row_cellblocksize; ++row_cell) help(row+row_cell) = scaling * cell_dst(row_cell); } @@ -1024,14 +1025,14 @@ void PreconditionBlockSSOR::Tvmult (Vector & // Multiply with diagonal blocks for (unsigned int cell=0; cell < this->size(); ++cell) { - unsigned int row = cell*this->blocksize; + size_type row = cell*this->blocksize; - for (unsigned int row_cell=0; row_cellblocksize; ++row_cell) + for (size_type row_cell=0; row_cellblocksize; ++row_cell) cell_src(row_cell)=help(row+row_cell); this->diagonal(cell).Tvmult(cell_dst, cell_src); - for (unsigned int row_cell=0; row_cellblocksize; ++row_cell) + for (size_type row_cell=0; row_cellblocksize; ++row_cell) help(row+row_cell) = scaling * cell_dst(row_cell); } diff --git a/deal.II/include/deal.II/lac/precondition_block_base.h b/deal.II/include/deal.II/lac/precondition_block_base.h index be37ffdd52..ed33f34c22 100644 --- a/deal.II/include/deal.II/lac/precondition_block_base.h +++ b/deal.II/include/deal.II/lac/precondition_block_base.h @@ -51,6 +51,11 @@ template class PreconditionBlockBase { public: + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Choose a method for inverting * the blocks, and thus the data @@ -105,7 +110,7 @@ public: * then only one block will be * stored. */ - void reinit(unsigned int nblocks, unsigned int blocksize, bool compress, + void reinit(unsigned int nblocks, size_type blocksize, bool compress, Inversion method = gauss_jordan); /** @@ -164,69 +169,69 @@ public: * if the inverse diagonal blocks * are stored. */ - number el(unsigned int i, unsigned int j) const; + number el(size_type i, size_type j) const; /** * Multiply with the inverse * block at position i. */ template - void inverse_vmult(unsigned int i, Vector &dst, const Vector &src) const; + void inverse_vmult(size_type i, Vector &dst, const Vector &src) const; /** * Multiply with the transposed inverse * block at position i. */ template - void inverse_Tvmult(unsigned int i, Vector &dst, const Vector &src) const; + void inverse_Tvmult(size_type i, Vector &dst, const Vector &src) const; /** * Access to the inverse diagonal * blocks if Inversion is #gauss_jordan. */ - FullMatrix &inverse (unsigned int i); + FullMatrix &inverse (size_type i); /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - Householder &inverse_householder (unsigned int i); + Householder &inverse_householder (size_type i); /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - LAPACKFullMatrix &inverse_svd (unsigned int i); + LAPACKFullMatrix &inverse_svd (size_type i); /** * Access to the inverse diagonal * blocks. */ - const FullMatrix &inverse (unsigned int i) const; + const FullMatrix &inverse (size_type i) const; /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - const Householder &inverse_householder (unsigned int i) const; + const Householder &inverse_householder (size_type i) const; /** * Access to the inverse diagonal * blocks if Inversion is #householder. */ - const LAPACKFullMatrix &inverse_svd (unsigned int i) const; + const LAPACKFullMatrix &inverse_svd (size_type i) const; /** * Access to the diagonal * blocks. */ - FullMatrix &diagonal (unsigned int i); + FullMatrix &diagonal (size_type i); /** * Access to the diagonal * blocks. */ - const FullMatrix &diagonal (unsigned int i) const; + const FullMatrix &diagonal (size_type i) const; /** * Print some statistics about @@ -383,7 +388,7 @@ PreconditionBlockBase::clear() template inline void -PreconditionBlockBase::reinit(unsigned int n, unsigned int b, bool compress, +PreconditionBlockBase::reinit(unsigned int n, size_type b, bool compress, Inversion method) { inversion = method; @@ -472,9 +477,9 @@ template inline void PreconditionBlockBase::inverse_vmult( - unsigned int i, Vector &dst, const Vector &src) const + size_type i, Vector &dst, const Vector &src) const { - const unsigned int ii = same_diagonal() ? 0U : i; + const size_type ii = same_diagonal() ? 0U : i; switch (inversion) { @@ -501,9 +506,9 @@ template inline void PreconditionBlockBase::inverse_Tvmult( - unsigned int i, Vector &dst, const Vector &src) const + size_type i, Vector &dst, const Vector &src) const { - const unsigned int ii = same_diagonal() ? 0U : i; + const size_type ii = same_diagonal() ? 0U : i; switch (inversion) { @@ -528,7 +533,7 @@ PreconditionBlockBase::inverse_Tvmult( template inline const FullMatrix & -PreconditionBlockBase::inverse(unsigned int i) const +PreconditionBlockBase::inverse(size_type i) const { if (same_diagonal()) return var_inverse_full[0]; @@ -541,7 +546,7 @@ PreconditionBlockBase::inverse(unsigned int i) const template inline const Householder & -PreconditionBlockBase::inverse_householder(unsigned int i) const +PreconditionBlockBase::inverse_householder(size_type i) const { if (same_diagonal()) return var_inverse_householder[0]; @@ -554,7 +559,7 @@ PreconditionBlockBase::inverse_householder(unsigned int i) const template inline const LAPACKFullMatrix & -PreconditionBlockBase::inverse_svd(unsigned int i) const +PreconditionBlockBase::inverse_svd(size_type i) const { if (same_diagonal()) return var_inverse_svd[0]; @@ -567,7 +572,7 @@ PreconditionBlockBase::inverse_svd(unsigned int i) const template inline const FullMatrix & -PreconditionBlockBase::diagonal(unsigned int i) const +PreconditionBlockBase::diagonal(size_type i) const { Assert(store_diagonals(), ExcDiagonalsNotStored()); @@ -582,7 +587,7 @@ PreconditionBlockBase::diagonal(unsigned int i) const template inline FullMatrix & -PreconditionBlockBase::inverse(unsigned int i) +PreconditionBlockBase::inverse(size_type i) { Assert(var_inverse_full.size() != 0, ExcInverseNotAvailable()); @@ -597,7 +602,7 @@ PreconditionBlockBase::inverse(unsigned int i) template inline Householder & -PreconditionBlockBase::inverse_householder(unsigned int i) +PreconditionBlockBase::inverse_householder(size_type i) { Assert(var_inverse_householder.size() != 0, ExcInverseNotAvailable()); @@ -612,7 +617,7 @@ PreconditionBlockBase::inverse_householder(unsigned int i) template inline LAPACKFullMatrix & -PreconditionBlockBase::inverse_svd(unsigned int i) +PreconditionBlockBase::inverse_svd(size_type i) { Assert(var_inverse_svd.size() != 0, ExcInverseNotAvailable()); @@ -627,7 +632,7 @@ PreconditionBlockBase::inverse_svd(unsigned int i) template inline FullMatrix & -PreconditionBlockBase::diagonal(unsigned int i) +PreconditionBlockBase::diagonal(size_type i) { Assert(store_diagonals(), ExcDiagonalsNotStored()); @@ -683,10 +688,10 @@ PreconditionBlockBase::log_statistics () const double sigmin = 1.e300, sigmax= -1.e300; double kappamin = 1.e300, kappamax= -1.e300; - for (unsigned int b=0; b &matrix = inverse_svd(b); - unsigned int k=1; + size_type k=1; while (k <= matrix.n_cols() && matrix.singular_value(matrix.n_cols()-k) == 0) ++k; const double s0 = matrix.singular_value(0); @@ -724,9 +729,9 @@ std::size_t PreconditionBlockBase::memory_consumption () const { std::size_t mem = sizeof(*this); - for (unsigned int i=0; i::invert_diagblocks () } else { - for (unsigned int block=0; blockblock_list.n_rows(); ++block) + for (size_type block=0; blockblock_list.n_rows(); ++block) { - const unsigned int bs = additional_data->block_list.row_length(block); + const size_type bs = additional_data->block_list.row_length(block); M_cell.reinit(bs, bs); // Copy rows for this block @@ -121,14 +121,14 @@ RelaxationBlock::invert_diagblocks () // diagonal block SparsityPattern::iterator row = additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cellcolumn()); entry != M.end(row->column()); ++entry) { - const unsigned int column = entry->column(); - const unsigned int col_cell = additional_data->block_list.row_position(block, column); + const size_type column = entry->column(); + const size_type col_cell = additional_data->block_list.row_position(block, column); if (col_cell != numbers::invalid_unsigned_int) M_cell(row_cell, col_cell) = entry->value(); } @@ -183,7 +183,7 @@ RelaxationBlock::do_step ( const bool permutation_empty = additional_data->order.size() == 0; const unsigned int n_permutations = (permutation_empty) ? 1U : additional_data->order.size(); - const unsigned int n_blocks = additional_data->block_list.n_rows(); + const size_type n_blocks = additional_data->block_list.n_rows(); if (!permutation_empty) for (unsigned int i=0; iorder.size(); ++i) @@ -200,13 +200,13 @@ RelaxationBlock::do_step ( ? (additional_data->order[n_permutations-1-perm][raw_block]) : (additional_data->order[perm][raw_block])); - const unsigned int bs = additional_data->block_list.row_length(block); + const size_type bs = additional_data->block_list.row_length(block); b_cell.reinit(bs); x_cell.reinit(bs); // Collect off-diagonal parts SparsityPattern::iterator row = additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cellcolumn()); for (typename MATRIX::const_iterator entry = M.begin(row->column()); @@ -217,7 +217,7 @@ RelaxationBlock::do_step ( this->inverse_vmult(block, x_cell, b_cell); // Store in result vector row=additional_data->block_list.begin(block); - for (unsigned int row_cell=0; row_cellcolumn()) = prev(row->column()) + additional_data->relaxation * x_cell(row_cell); } } diff --git a/deal.II/source/lac/lapack_full_matrix.cc b/deal.II/source/lac/lapack_full_matrix.cc index 5582ef2b5a..024afcf99d 100644 --- a/deal.II/source/lac/lapack_full_matrix.cc +++ b/deal.II/source/lac/lapack_full_matrix.cc @@ -26,7 +26,7 @@ DEAL_II_NAMESPACE_OPEN using namespace LAPACKSupport; template -LAPACKFullMatrix::LAPACKFullMatrix(const unsigned int n) +LAPACKFullMatrix::LAPACKFullMatrix(const size_type n) : TransposeTable (n,n), state(matrix) @@ -35,8 +35,8 @@ LAPACKFullMatrix::LAPACKFullMatrix(const unsigned int n) template LAPACKFullMatrix::LAPACKFullMatrix( - const unsigned int m, - const unsigned int n) + const size_type m, + const size_type n) : TransposeTable (m,n), state(matrix) @@ -68,8 +68,8 @@ LAPACKFullMatrix::operator = (const FullMatrix &M) { Assert (this->n_rows() == M.m(), ExcDimensionMismatch(this->n_rows(), M.m())); Assert (this->n_cols() == M.n(), ExcDimensionMismatch(this->n_cols(), M.n())); - for (unsigned int i=0; in_rows(); ++i) - for (unsigned int j=0; jn_cols(); ++j) + for (size_type i=0; in_rows(); ++i) + for (size_type j=0; jn_cols(); ++j) (*this)(i,j) = M(i,j); state = LAPACKSupport::matrix; @@ -123,7 +123,7 @@ LAPACKFullMatrix::vmult ( work.resize(std::max(mm,nn)); gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; ivalues[0], &mm, &work[0], &one, &beta, w.val, &one); @@ -137,7 +137,7 @@ LAPACKFullMatrix::vmult ( work.resize(std::max(mm,nn)); gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; ivalues[0], &nn, &work[0], &one, &beta, w.val, &one); @@ -182,7 +182,7 @@ LAPACKFullMatrix::Tvmult ( work.resize(std::max(mm,nn)); gemv("T", &mm, &mm, &alpha, &svd_u->values[0], &mm, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; ivalues[0], &nn, &work[0], &one, &beta, w.val, &one); @@ -196,7 +196,7 @@ LAPACKFullMatrix::Tvmult ( work.resize(std::max(mm,nn)); gemv("N", &nn, &nn, &alpha, &svd_vt->values[0], &nn, v.val, &one, &null, &work[0], &one); // Multiply by singular values - for (unsigned int i=0; ivalues[0], &mm, &work[0], &one, &beta, w.val, &one); @@ -290,7 +290,7 @@ LAPACKFullMatrix::compute_inverse_svd(const double threshold) Assert (state==LAPACKSupport::svd, ExcState(state)); const double lim = wr[0]*threshold; - for (unsigned int i=0; i lim) wr[i] = 1./wr[i]; @@ -414,7 +414,7 @@ LAPACKFullMatrix::compute_eigenvalues( lwork = 4*nn; // no query mode #endif // resize workspace array - work.resize((unsigned int) lwork); + work.resize((size_type ) lwork); // Finally compute the eigenvalues. geev(jobvl, jobvr, &nn, values, &nn, @@ -445,7 +445,7 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric( { Assert(state == matrix, ExcState(state)); const int nn = (this->n_cols() > 0 ? this->n_cols() : 1); - Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); wr.resize(nn); LAPACKFullMatrix matrix_eigenvectors(nn, nn); @@ -460,8 +460,8 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric( const char *const uplo(&U); const char *const range(&V); const int *const dummy(&one); - std::vector iwork(static_cast (5*nn)); - std::vector ifail(static_cast (nn)); + std::vector iwork(static_cast (5*nn)); + std::vector ifail(static_cast (nn)); // Optimal workspace query: @@ -507,7 +507,7 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric( lwork = 8*nn > 1 ? 8*nn : 1; // no query mode #endif // resize workspace arrays - work.resize(static_cast (lwork)); + work.resize(static_cast (lwork)); // Finally compute the eigenvalues. syevx (jobz, range, @@ -527,11 +527,11 @@ LAPACKFullMatrix::compute_eigenvalues_symmetric( eigenvalues.reinit(n_eigenpairs); eigenvectors.reinit(nn, n_eigenpairs, true); - for (unsigned int i=0; i < static_cast (n_eigenpairs); ++i) + for (size_type i=0; i < static_cast (n_eigenpairs); ++i) { eigenvalues(i) = wr[i]; - unsigned int col_begin(i*nn); - for (unsigned int j=0; j < static_cast (nn); ++j) + size_type col_begin(i*nn); + for (size_type j=0; j < static_cast (nn); ++j) { eigenvectors(j,i) = values_eigenvectors[col_begin+j]; } @@ -554,9 +554,9 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( { Assert(state == matrix, ExcState(state)); const int nn = (this->n_cols() > 0 ? this->n_cols() : 1); - Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic()); - Assert(static_cast(nn) == B.n_cols(), + Assert(static_cast(nn) == B.n_cols(), ExcDimensionMismatch (nn, B.n_cols())); wr.resize(nn); @@ -573,8 +573,8 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( const char *const uplo(&U); const char *const range(&V); const int *const dummy(&one); - std::vector iwork(static_cast (5*nn)); - std::vector ifail(static_cast (nn)); + std::vector iwork(static_cast (5*nn)); + std::vector ifail(static_cast (nn)); // Optimal workspace query: @@ -618,7 +618,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( lwork = 8*nn > 1 ? 8*nn : 1; // no query mode #endif // resize workspace arrays - work.resize(static_cast (lwork)); + work.resize(static_cast (lwork)); // Finally compute the generalized // eigenvalues. @@ -637,12 +637,12 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric( eigenvalues.reinit(n_eigenpairs); eigenvectors.resize(n_eigenpairs); - for (unsigned int i=0; i < static_cast (n_eigenpairs); ++i) + for (size_type i=0; i < static_cast (n_eigenpairs); ++i) { eigenvalues(i) = wr[i]; - unsigned int col_begin(i*nn); + size_type col_begin(i*nn); eigenvectors[i].reinit(nn, true); - for (unsigned int j=0; j < static_cast (nn); ++j) + for (size_type j=0; j < static_cast (nn); ++j) { eigenvectors[i](j) = values_eigenvectors[col_begin+j]; } @@ -661,11 +661,11 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( { Assert(state == matrix, ExcState(state)); const int nn = this->n_cols(); - Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); + Assert(static_cast(nn) == this->n_rows(), ExcNotQuadratic()); Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic()); - Assert(static_cast(nn) == B.n_cols(), + Assert(static_cast(nn) == B.n_cols(), ExcDimensionMismatch (nn, B.n_cols())); - Assert(eigenvectors.size() <= static_cast(nn), + Assert(eigenvectors.size() <= static_cast(nn), ExcMessage ("eigenvectors.size() > matrix.n_cols()")); wr.resize(nn); @@ -719,7 +719,7 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( lwork = 3*nn-1 > 1 ? 3*nn-1 : 1; // no query mode #endif // resize workspace array - work.resize((unsigned int) lwork); + work.resize((size_type) lwork); // Finally compute the generalized // eigenvalues. @@ -734,11 +734,11 @@ LAPACKFullMatrix::compute_generalized_eigenvalues_symmetric ( if (info != 0) std::cerr << "LAPACK error in sygv" << std::endl; - for (unsigned int i=0; i < eigenvectors.size(); ++i) + for (size_type i=0; i < eigenvectors.size(); ++i) { - unsigned int col_begin(i*nn); + size_type col_begin(i*nn); eigenvectors[i].reinit(nn, true); - for (unsigned int j=0; j < static_cast(nn); ++j) + for (size_type j=0; j < static_cast(nn); ++j) { eigenvectors[i](j) = values_A[col_begin+j]; } @@ -805,9 +805,9 @@ LAPACKFullMatrix::print_formatted ( width = precision+2; } - for (unsigned int i=0; in_rows(); ++i) + for (size_type i=0; in_rows(); ++i) { - for (unsigned int j=0; jn_cols(); ++j) + for (size_type j=0; jn_cols(); ++j) if (std::fabs(this->el(i,j)) > threshold) out << std::setw(width) << this->el(i,j) * denominator << ' '; diff --git a/deal.II/source/lac/matrix_lib.cc b/deal.II/source/lac/matrix_lib.cc index 174d6c3b82..3a42ff1a4d 100644 --- a/deal.II/source/lac/matrix_lib.cc +++ b/deal.II/source/lac/matrix_lib.cc @@ -17,7 +17,7 @@ DEAL_II_NAMESPACE_OPEN -MeanValueFilter::MeanValueFilter(unsigned int component) +MeanValueFilter::MeanValueFilter(size_type component) : component(component) {} diff --git a/deal.II/source/lac/matrix_out.cc b/deal.II/source/lac/matrix_out.cc index 95a74f15d2..bb0790c3ed 100644 --- a/deal.II/source/lac/matrix_out.cc +++ b/deal.II/source/lac/matrix_out.cc @@ -17,9 +17,9 @@ DEAL_II_NAMESPACE_OPEN -MatrixOut::Options::Options (const bool show_absolute_values, - const unsigned int block_size, - const bool discontinuous) +MatrixOut::Options::Options (const bool show_absolute_values, + const size_type block_size, + const bool discontinuous) : show_absolute_values (show_absolute_values), block_size (block_size), diff --git a/deal.II/source/lac/petsc_block_sparse_matrix.cc b/deal.II/source/lac/petsc_block_sparse_matrix.cc index b05b5fd4d7..29cf44c234 100644 --- a/deal.II/source/lac/petsc_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_block_sparse_matrix.cc @@ -41,8 +41,8 @@ namespace PETScWrappers void BlockSparseMatrix:: - 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) { // first delete previous content of // the subobjects array @@ -57,8 +57,8 @@ namespace PETScWrappers this->column_block_indices.reinit (n_block_columns, 0); // 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 BlockType(); this->sub_objects[r][c] = p; diff --git a/deal.II/source/lac/petsc_full_matrix.cc b/deal.II/source/lac/petsc_full_matrix.cc index 50a1da2298..81746030d1 100644 --- a/deal.II/source/lac/petsc_full_matrix.cc +++ b/deal.II/source/lac/petsc_full_matrix.cc @@ -22,8 +22,8 @@ DEAL_II_NAMESPACE_OPEN namespace PETScWrappers { - FullMatrix::FullMatrix (const unsigned int m, - const unsigned int n) + FullMatrix::FullMatrix (const size_type m, + const size_type n) { const int ierr = MatCreateSeqDense(PETSC_COMM_SELF, m, n, PETSC_NULL, diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index c8a3d456c1..0a6144e6d5 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -63,8 +63,7 @@ namespace PETScWrappers // iterator for an empty line (what // would it point to?) Assert (ncols != 0, ExcInternalError()); - colnum_cache.reset (new std::vector (colnums, - colnums+ncols)); + colnum_cache.reset (new std::vector (colnums, colnums+ncols)); value_cache.reset (new std::vector (values, values+ncols)); // and finally restore the matrix @@ -134,8 +133,8 @@ namespace PETScWrappers void - MatrixBase::clear_row (const unsigned int row, - const PetscScalar new_diag_value) + MatrixBase::clear_row (const size_type row, + const PetscScalar new_diag_value) { compress (); @@ -171,8 +170,8 @@ namespace PETScWrappers void - MatrixBase::clear_rows (const std::vector &rows, - const PetscScalar new_diag_value) + MatrixBase::clear_rows (const std::vector &rows, + const PetscScalar new_diag_value) { compress (); @@ -214,8 +213,8 @@ namespace PETScWrappers PetscScalar - MatrixBase::el (const unsigned int i, - const unsigned int j) const + MatrixBase::el (const size_type i, + const size_type j) const { #ifdef PETSC_USE_64BIT_INDICES PetscInt @@ -236,7 +235,7 @@ namespace PETScWrappers PetscScalar - MatrixBase::diag_element (const unsigned int i) const + MatrixBase::diag_element (const size_type i) const { Assert (m() == n(), ExcNotQuadratic()); @@ -263,7 +262,7 @@ namespace PETScWrappers - unsigned int + size_type MatrixBase::m () const { #ifdef PETSC_USE_64BIT_INDICES @@ -280,7 +279,7 @@ namespace PETScWrappers - unsigned int + size_type MatrixBase::n () const { #ifdef PETSC_USE_64BIT_INDICES @@ -297,7 +296,7 @@ namespace PETScWrappers - unsigned int + size_type MatrixBase::local_size () const { #ifdef PETSC_USE_64BIT_INDICES @@ -314,7 +313,7 @@ namespace PETScWrappers - std::pair + std::pair MatrixBase::local_range () const { #ifdef PETSC_USE_64BIT_INDICES @@ -332,7 +331,7 @@ namespace PETScWrappers - unsigned int + size_type MatrixBase::n_nonzero_elements () const { MatInfo mat_info; @@ -340,14 +339,14 @@ namespace PETScWrappers = MatGetInfo (matrix, MAT_GLOBAL_SUM, &mat_info); AssertThrow (ierr == 0, ExcPETScError(ierr)); - return static_cast(mat_info.nz_used); + return static_cast(mat_info.nz_used); } - unsigned int + size_type MatrixBase:: - row_length (const unsigned int row) const + row_length (const size_type row) const { //TODO: this function will probably only work if compress() was called on the //matrix previously. however, we can't do this here, since it would impose @@ -616,7 +615,7 @@ namespace PETScWrappers MatInfo info; MatGetInfo(matrix, MAT_LOCAL, &info); - return sizeof(*this) + static_cast(info.memory); + return sizeof(*this) + static_cast(info.memory); } } diff --git a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc index 5b46603bdb..7bbb59c184 100644 --- a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc @@ -42,8 +42,8 @@ namespace PETScWrappers void BlockSparseMatrix:: - 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) { // first delete previous content of // the subobjects array @@ -58,8 +58,8 @@ namespace PETScWrappers this->column_block_indices.reinit (n_block_columns, 0); // 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 BlockType(); this->sub_objects[r][c] = p; diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index 6fc035b56c..a1fa31752a 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -42,13 +42,13 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) : communicator (communicator) { @@ -58,13 +58,13 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric) : communicator (communicator) { @@ -76,12 +76,12 @@ namespace PETScWrappers template SparseMatrix:: - SparseMatrix (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + SparseMatrix (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) : communicator (communicator) { @@ -102,13 +102,13 @@ namespace PETScWrappers void - SparseMatrix::reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) { this->communicator = communicator; @@ -128,13 +128,13 @@ namespace PETScWrappers void - SparseMatrix::reinit (const MPI_Comm &communicator, - const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::reinit (const MPI_Comm &communicator, + const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric) { this->communicator = communicator; @@ -155,12 +155,12 @@ namespace PETScWrappers template void SparseMatrix:: - reinit (const MPI_Comm &communicator, - const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + reinit (const MPI_Comm &communicator, + const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) { this->communicator = communicator; @@ -181,12 +181,12 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const size_type n_nonzero_per_row, + const bool is_symmetric) { Assert (local_rows <= m, ExcLocalRowsTooLarge (local_rows, m)); @@ -233,12 +233,12 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int local_rows, - const unsigned int local_columns, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type local_rows, + const size_type local_columns, + const std::vector &row_lengths, + const bool is_symmetric) { Assert (local_rows <= m, ExcLocalRowsTooLarge (local_rows, m)); @@ -251,7 +251,7 @@ namespace PETScWrappers // MatCreateMPIAIJ throws an // error. In this case use a // PETScWrappers::SparseMatrix - for (unsigned int i=0; i void SparseMatrix:: - do_reinit (const SparsityType &sparsity_pattern, - const std::vector &local_rows_per_process, - const std::vector &local_columns_per_process, - const unsigned int this_process, - const bool preset_nonzero_locations) + do_reinit (const SparsityType &sparsity_pattern, + const std::vector &local_rows_per_process, + const std::vector &local_columns_per_process, + const unsigned int this_process, + const bool preset_nonzero_locations) { Assert (local_rows_per_process.size() == local_columns_per_process.size(), ExcDimensionMismatch (local_rows_per_process.size(), @@ -335,14 +335,14 @@ namespace PETScWrappers // and how many arent. for this, we // first have to know which areas are // ours - unsigned int local_row_start = 0; - unsigned int local_col_start = 0; + size_type local_row_start = 0; + size_type local_col_start = 0; for (unsigned int p=0; p= local_col_start) && (column < local_col_end)) @@ -447,11 +447,11 @@ namespace PETScWrappers #endif row_entries; std::vector row_values; - for (unsigned int i=0; i &, - const std::vector &, + const std::vector &, const unsigned int, const bool); template SparseMatrix::SparseMatrix (const MPI_Comm &, const CompressedSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int, const bool); template SparseMatrix::SparseMatrix (const MPI_Comm &, const CompressedSimpleSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const SparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const CompressedSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int, const bool); template void SparseMatrix::reinit (const MPI_Comm &, const CompressedSimpleSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int, const bool); template void SparseMatrix::do_reinit (const SparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int , const bool); template void SparseMatrix::do_reinit (const CompressedSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int , const bool); template void SparseMatrix::do_reinit (const CompressedSimpleSparsityPattern &, - const std::vector &, - const std::vector &, + const std::vector &, + const std::vector &, const unsigned int , const bool); diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index d790c40613..5f8bc77c80 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -41,9 +41,9 @@ namespace PETScWrappers - Vector::Vector (const MPI_Comm &communicator, - const unsigned int n, - const unsigned int local_size) + Vector::Vector (const MPI_Comm &communicator, + const size_type n, + const size_type local_size) : communicator (communicator) { @@ -52,9 +52,9 @@ namespace PETScWrappers - Vector::Vector (const MPI_Comm &communicator, + Vector::Vector (const MPI_Comm &communicator, const VectorBase &v, - const unsigned int local_size) + const size_type local_size) : communicator (communicator) { @@ -89,10 +89,10 @@ namespace PETScWrappers } void - Vector::reinit (const MPI_Comm &comm, - const unsigned int n, - const unsigned int local_sz, - const bool fast) + Vector::reinit (const MPI_Comm &comm, + const size_type n, + const size_type local_sz, + const bool fast) { communicator = comm; @@ -194,7 +194,7 @@ namespace PETScWrappers AssertThrow (ierr == 0, ExcPETScError(ierr)); // then copy: - const std::pair + const std::pair local_elements = local_range (); std::copy (src_array + local_elements.first, src_array + local_elements.second, @@ -214,8 +214,8 @@ namespace PETScWrappers void - Vector::create_vector (const unsigned int n, - const unsigned int local_size) + Vector::create_vector (const size_type n, + const size_type local_size) { Assert (local_size <= n, ExcIndexRange (local_size, 0, n)); ghosted = false; @@ -232,19 +232,15 @@ namespace PETScWrappers void - Vector::create_vector (const unsigned int n, - const unsigned int local_size, + Vector::create_vector (const size_type n, + const size_type local_size, const IndexSet &ghostnodes) { Assert (local_size <= n, ExcIndexRange (local_size, 0, n)); ghosted = true; ghost_indices = ghostnodes; - //64bit indices won't work yet: - Assert (sizeof(unsigned int)==sizeof(PetscInt), ExcInternalError()); - - - std::vector ghostindices; + std::vector ghostindices; ghostnodes.fill_index_vector(ghostindices); const PetscInt *ptr @@ -279,7 +275,7 @@ namespace PETScWrappers ierr = VecGetOwnershipRange (vector, &begin, &end); - Assert(local_size==(unsigned int)(end-begin), ExcInternalError()); + Assert(local_size==(size_type)(end-begin), ExcInternalError()); Vec l; ierr = VecGhostGetLocalForm(vector, &l); diff --git a/deal.II/source/lac/petsc_sparse_matrix.cc b/deal.II/source/lac/petsc_sparse_matrix.cc index 53b734e816..e2662618f1 100644 --- a/deal.II/source/lac/petsc_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_sparse_matrix.cc @@ -37,20 +37,20 @@ namespace PETScWrappers - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { do_reinit (m, n, n_nonzero_per_row, is_symmetric); } - SparseMatrix::SparseMatrix (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::SparseMatrix (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric) { do_reinit (m, n, row_lengths, is_symmetric); } @@ -77,10 +77,10 @@ namespace PETScWrappers void - SparseMatrix::reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { // get rid of old matrix and generate a // new one @@ -97,10 +97,10 @@ namespace PETScWrappers void - SparseMatrix::reinit (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric) { // get rid of old matrix and generate a // new one @@ -147,10 +147,10 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const unsigned int n_nonzero_per_row, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const size_type n_nonzero_per_row, + const bool is_symmetric) { // use the call sequence indicating only // a maximal number of elements per row @@ -178,10 +178,10 @@ namespace PETScWrappers void - SparseMatrix::do_reinit (const unsigned int m, - const unsigned int n, - const std::vector &row_lengths, - const bool is_symmetric) + SparseMatrix::do_reinit (const size_type m, + const size_type n, + const std::vector &row_lengths, + const bool is_symmetric) { Assert (row_lengths.size() == m, ExcDimensionMismatch (row_lengths.size(), m)); @@ -227,8 +227,8 @@ namespace PETScWrappers SparseMatrix::do_reinit (const SparsityType &sparsity_pattern, const bool preset_nonzero_locations) { - std::vector row_lengths (sparsity_pattern.n_rows()); - for (unsigned int i=0; i row_lengths (sparsity_pattern.n_rows()); + for (size_type i=0; i row_values; - for (unsigned int i=0; i=static_cast(begin) - && index(end) ) + if ( index>=static_cast(begin) + && index(end) ) { //local entry value = *(ptr+index-begin); @@ -99,10 +99,10 @@ namespace PETScWrappers else { //ghost entry - const unsigned int ghostidx + const size_type ghostidx = vector.ghost_indices.index_within_set(index); - Assert(ghostidx+end-begin<(unsigned int)lsize, ExcInternalError()); + Assert(ghostidx+end-begin<(size_type)lsize, ExcInternalError()); value = *(ptr+ghostidx+end-begin); } @@ -131,8 +131,8 @@ namespace PETScWrappers - AssertThrow ((index >= static_cast(begin)) && - (index < static_cast(end)), + AssertThrow ((index >= static_cast(begin)) && + (index < static_cast(end)), ExcAccessToNonlocalElement (index, begin, end-1)); // old version which only work with @@ -263,7 +263,7 @@ namespace PETScWrappers - unsigned int + size_type VectorBase::size () const { #ifdef PETSC_USE_64BIT_INDICES @@ -280,7 +280,7 @@ namespace PETScWrappers - unsigned int + size_type VectorBase::local_size () const { #ifdef PETSC_USE_64BIT_INDICES @@ -297,7 +297,7 @@ namespace PETScWrappers - std::pair + std::pair VectorBase::local_range () const { #ifdef PETSC_USE_64BIT_INDICES @@ -316,7 +316,7 @@ namespace PETScWrappers void - VectorBase::set (const std::vector &indices, + VectorBase::set (const std::vector &indices, const std::vector &values) { Assert (indices.size() == values.size(), @@ -327,7 +327,7 @@ namespace PETScWrappers void - VectorBase::add (const std::vector &indices, + VectorBase::add (const std::vector &indices, const std::vector &values) { Assert (indices.size() == values.size(), @@ -338,7 +338,7 @@ namespace PETScWrappers void - VectorBase::add (const std::vector &indices, + VectorBase::add (const std::vector &indices, const ::dealii::Vector &values) { Assert (indices.size() == values.size(), @@ -349,9 +349,9 @@ namespace PETScWrappers void - VectorBase::add (const unsigned int n_elements, - const unsigned int *indices, - const PetscScalar *values) + VectorBase::add (const size_type n_elements, + const size_type *indices, + const PetscScalar *values) { do_set_add_operation(n_elements, indices, values, true); } @@ -1040,10 +1040,10 @@ namespace PETScWrappers out.setf (std::ios::fixed, std::ios::floatfield); if (across) - for (unsigned int i=0; i petsc_ind (n_elements); - for (unsigned int i=0; i