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
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
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
template <typename number>
inline
-types::global_dof_index
+typename FullMatrix<number>::size_type
FullMatrix<number>::m() const
{
return this->n_rows();
template <typename number>
inline
-types::global_dof_index
+typename FullMatrix<number>::size_type
FullMatrix<number>::n() const
{
return this->n_cols();
// 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);
// 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);
template <typename number>
inline
-types::global_dof_index
+typename FullMatrix<number>::size_type
FullMatrix<number>::Accessor::row() const
{
return a_row;
template <typename number>
inline
-types::global_dof_index
+typename FullMatrix<number>::size_type
FullMatrix<number>::Accessor::column() const
{
return a_col;
template <typename number>
-FullMatrix<number>::FullMatrix (const unsigned int n)
+FullMatrix<number>::FullMatrix (const size_type n)
:
Table<2,number> (n,n)
{}
template <typename number>
-FullMatrix<number>::FullMatrix (const unsigned int m,
- const unsigned int n)
+FullMatrix<number>::FullMatrix (const size_type m,
+ const size_type n)
:
Table<2,number> (m, n)
{}
template <typename number>
-FullMatrix<number>::FullMatrix (const unsigned int m,
- const unsigned int n,
+FullMatrix<number>::FullMatrix (const size_type m,
+ const size_type n,
const number *entries)
:
Table<2,number> (m, n)
:
Table<2,number> (id.m(), id.n())
{
- for (unsigned int i=0; i<id.m(); ++i)
+ for (size_type i=0; i<id.m(); ++i)
(*this)(i,i) = 1;
}
FullMatrix<number>::operator = (const IdentityMatrix &id)
{
this->reinit (id.m(), id.n());
- for (unsigned int i=0; i<id.m(); ++i)
+ for (size_type i=0; i<id.m(); ++i)
(*this)(i,i) = 1.;
return *this;
{
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; i<this->m(); ++i)
- for (unsigned int j=0; j<this->n(); ++j)
+ for (size_type i=0; i<this->m(); ++i)
+ for (size_type j=0; j<this->n(); ++j)
(*this)(i,j) = M(i,j);
return *this;
// avoid copying it when using the ()
// operator
const number2 *src_ptr = &(*const_cast<Vector<number2>*>(&src))(0);
- const unsigned int size_m = m(), size_n = n();
- for (unsigned int i=0; i<size_m; ++i)
+ const size_type size_m = m(), size_n = n();
+ for (size_type i=0; i<size_m; ++i)
{
number2 s = adding ? dst(i) : 0.;
- for (unsigned int j=0; j<size_n; ++j)
+ for (size_type j=0; j<size_n; ++j)
s += src_ptr[j] * number2(*(e++));
dst(i) = s;
}
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<size_n; ++j)
+ for (size_type j=0; j<size_n; ++j)
dst_ptr[j] = 0.;
// write the loop in a way that we can
// access the data contiguously
- for (unsigned int i=0; i<size_m; ++i)
+ for (size_type i=0; i<size_m; ++i)
{
const number2 d = src(i);
- for (unsigned int j=0; j<size_n; ++j)
+ for (size_type j=0; j<size_n; ++j)
dst_ptr[j] += d * number2(*(e++));
};
}
Assert (&src != &dst, ExcSourceEqualsDestination());
number res = 0.;
- const unsigned int size_m = m(),
- size_n = n();
- for (unsigned int i=0; i<size_n; ++i)
+ const size_type size_m = m(),
+ size_n = n();
+ for (size_type i=0; i<size_n; ++i)
{
number s = number(right(i));
- for (unsigned int j=0; j<size_m; ++j)
+ for (size_type j=0; j<size_m; ++j)
s -= number(src(j)) * (*this)(i,j);
dst(i) = s;
res += s*s;
Assert (dst.size() == m(), ExcDimensionMismatch(dst.size(), m()));
Assert (src.size() == n(), ExcDimensionMismatch(src.size(), n()));
- unsigned int i,j;
- unsigned int nu = ( (m()<n()) ? m() : n());
+ size_type i,j;
+ size_type nu = ( (m()<n()) ? m() : n());
for (i=0; i<nu; ++i)
{
number s = number(src(i));
{
Assert (!this->empty(), ExcEmptyMatrix());
- unsigned int j;
- unsigned int nu = (m()<n() ? m() : n());
+ size_type j;
+ size_type nu = (m()<n() ? m() : n());
for (int i=nu-1; i>=0; --i)
{
number2 s = src(i);
template <typename number>
template <typename number2>
void FullMatrix<number>::fill (const FullMatrix<number2> &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()));
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<rows ; ++i)
- for (unsigned int j=0; j<cols ; ++j)
+ for (size_type i=0; i<rows ; ++i)
+ for (size_type j=0; j<cols ; ++j)
(*this)(dst_offset_i+i,dst_offset_j+j)
= src(src_offset_i+i,src_offset_j+j);
}
template <typename number>
template <typename number2>
void FullMatrix<number>::fill_permutation (const FullMatrix<number2> &src,
- const std::vector<unsigned int> &p_rows,
- const std::vector<unsigned int> &p_cols)
+ const std::vector<size_type> &p_rows,
+ const std::vector<size_type> &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; i<this->n_rows(); ++i)
- for (unsigned int j=0; j<this->n_cols(); ++j)
+ for (size_type i=0; i<this->n_rows(); ++i)
+ for (size_type j=0; j<this->n_cols(); ++j)
(*this)(i,j) = src(p_rows[i], p_cols[j]);
}
template <typename number>
-void FullMatrix<number>::add_row (const unsigned int i,
+void FullMatrix<number>::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<m(); ++k)
+ for (size_type k=0; k<m(); ++k)
(*this)(i,k) += s*(*this)(j,k);
}
template <typename number>
-void FullMatrix<number>::add_row (const unsigned int i,
+void FullMatrix<number>::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<size_m; ++l)
+ const size_type size_m = m();
+ for (size_type l=0; l<size_m; ++l)
(*this)(i,l) += s*(*this)(j,l) + t*(*this)(k,l);
}
template <typename number>
-void FullMatrix<number>::add_col (const unsigned int i, const number s,
- const unsigned int j)
+void FullMatrix<number>::add_col (const size_type i, const number s,
+ const size_type j)
{
Assert (!this->empty(), ExcEmptyMatrix());
- for (unsigned int k=0; k<n(); ++k)
+ for (size_type k=0; k<n(); ++k)
(*this)(k,i) += s*(*this)(k,j);
}
template <typename number>
-void FullMatrix<number>::add_col (const unsigned int i, const number s,
- const unsigned int j, const number t,
- const unsigned int k)
+void FullMatrix<number>::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<n(); ++l)
+ for (size_t l=0; l<n(); ++l)
(*this)(l,i) += s*(*this)(l,j) + t*(*this)(l,k);
}
template <typename number>
-void FullMatrix<number>::swap_row (const unsigned int i,
- const unsigned int j)
+void FullMatrix<number>::swap_row (const size_type i,
+ const size_type j)
{
Assert (!this->empty(), ExcEmptyMatrix());
- for (unsigned int k=0; k<n(); ++k)
+ for (size_type k=0; k<n(); ++k)
std::swap ((*this)(i,k),
(*this)(j,k));
}
template <typename number>
-void FullMatrix<number>::swap_col (const unsigned int i,
- const unsigned int j)
+void FullMatrix<number>::swap_col (const size_type i,
+ const size_type j)
{
Assert (!this->empty(), ExcEmptyMatrix());
- for (unsigned int k=0; k<m(); ++k)
+ for (size_type k=0; k<m(); ++k)
std::swap ((*this)(k,i),
(*this)(k,j));
}
Assert (!this->empty(), ExcEmptyMatrix());
Assert (m() == n(), ExcDimensionMismatch(m(),n()));
- for (unsigned int i=0; i<n(); ++i)
+ for (size_type i=0; i<n(); ++i)
(*this)(i,i) += src;
}
Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m()));
Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) = a * number(A(i,j));
}
Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m()));
Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) = a * number(A(i,j)) + b * number(B(i,j));
}
Assert (m() == C.m(), ExcDimensionMismatch(m(), C.m()));
Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) = a * number(A(i,j)) +
b * number(B(i,j)) +
c * number(C(i,j));
#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,
// than reading), even though we
// need to access the data in src
// not in a contiguous way.
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(i,k) * (number2)(src(k,j));
dst(i,j) = add_value;
}
#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,
// optimized gemm operation in case
// the matrix is big, so this
// shouldn't be too bad.
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(k,i) * (number2)(src(k,j));
dst(i,j) = add_value;
}
#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<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(i,k) * (number2)(src(j,k));
dst(i,j) = add_value;
}
#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,
// optimized gemm operation in case
// the matrix is big, so this
// shouldn't be too bad.
- for (unsigned int i=0; i<m; i++)
- for (unsigned int j=0; j<n; j++)
+ for (size_type i=0; i<m; i++)
+ for (size_type j=0; j<n; j++)
{
number2 add_value = adding ? dst(i,j) : 0.;
- for (unsigned int k=0; k<l; k++)
+ for (size_type k=0; k<l; k++)
add_value += (number2)(*this)(k,i) * (number2)(src(j,k));
dst(i,j) = add_value;
}
// For all entries of the product
// AD
- for (unsigned int i=0; i<A.m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<A.m(); ++i)
+ for (size_type j=0; j<n(); ++j)
{
// Compute the entry
number ADij = 0.;
if (transpose_D)
- for (unsigned int k=0; k<A.n(); ++k)
+ for (size_type k=0; k<A.n(); ++k)
ADij += A(i,k)*D(j,k);
else
- for (unsigned int k=0; k<A.n(); ++k)
+ for (size_type k=0; k<A.n(); ++k)
ADij += A(i,k)*D(k,j);
// And add it to this after
// multiplying with the right
// factor from B
if (transpose_B)
- for (unsigned int k=0; k<m(); ++k)
+ for (size_type k=0; k<m(); ++k)
this->operator()(k,j) += scaling * ADij * B(i,k);
else
- for (unsigned int k=0; k<m(); ++k)
+ for (size_type k=0; k<m(); ++k)
this->operator()(k,j) += scaling * ADij * B(k,i);
}
}
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<n_rows; ++row)
+ for (size_type row=0; row<n_rows; ++row)
{
number s = 0.;
const number *const val_end_of_row = val_ptr+n_rows;
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<n_rows; ++row)
+ for (size_type row=0; row<n_rows; ++row)
{
number s = 0.;
const number *const val_end_of_row = val_ptr+n_cols;
{
Assert (m() == n(), ExcNotQuadratic());
- const unsigned int N = m();
- for (unsigned int i=0; i<N; ++i)
- for (unsigned int j=i+1; j<N; ++j)
+ const size_type N = m();
+ for (size_type i=0; i<N; ++i)
+ for (size_type j=i+1; j<N; ++j)
{
const number t = ((*this)(i,j) + (*this)(j,i)) / number(2.);
(*this)(i,j) = (*this)(j,i) = t;
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<n_cols; ++col)
+ for (size_type col=0; col<n_cols; ++col)
{
sum=0;
- for (unsigned int row=0; row<n_rows; ++row)
+ for (size_type row=0; row<n_rows; ++row)
sum += std::abs((*this)(row,col));
if (sum > max)
max = sum;
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<n_rows; ++row)
+ for (size_type row=0; row<n_rows; ++row)
{
sum=0;
- for (unsigned int col=0; col<n_cols; ++col)
+ for (size_type col=0; col<n_cols; ++col)
sum += std::abs((*this)(row,col));
if (sum > max)
max = sum;
Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m()));
Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) += a * number(A(i,j));
}
Assert (m() == B.m(), ExcDimensionMismatch(m(), B.m()));
Assert (n() == B.n(), ExcDimensionMismatch(n(), B.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) += a * number(A(i,j)) + b * number(B(i,j));
}
Assert (n() == C.n(), ExcDimensionMismatch(n(), C.n()));
- for (unsigned int i=0; i<m(); ++i)
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type i=0; i<m(); ++i)
+ for (size_type j=0; j<n(); ++j)
(*this)(i,j) += a * number(A(i,j)) +
b * number(B(i,j)) +
c * number(C(i,j));
template <typename number2>
void FullMatrix<number>::add (const FullMatrix<number2> &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()));
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<rows ; ++i)
- for (unsigned int j=0; j<cols ; ++j)
+ for (size_type i=0; i<rows ; ++i)
+ for (size_type j=0; j<cols ; ++j)
(*this)(dst_offset_i+i,dst_offset_j+j)
+= factor * number(src(src_offset_i+i,src_offset_j+j));
}
template <typename number2>
void FullMatrix<number>::Tadd (const FullMatrix<number2> &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()));
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<rows ; ++i)
- for (unsigned int j=0; j<cols ; ++j)
+ for (size_type i=0; i<rows ; ++i)
+ for (size_type j=0; j<cols ; ++j)
(*this)(dst_offset_i+i,dst_offset_j+j)
+= factor * number(src(src_offset_i+j,src_offset_j+i));
}
Assert (m() == A.m(), ExcDimensionMismatch(m(), A.m()));
Assert (n() == A.n(), ExcDimensionMismatch(n(), A.n()));
- for (unsigned int i=0; i<n(); ++i)
- for (unsigned int j=0; j<m(); ++j)
+ for (size_type i=0; i<n(); ++i)
+ for (size_type j=0; j<m(); ++j)
(*this)(i,j) += a * number(A(j,i));
}
ExcDimensionMismatch(this->n_cols(), this->n_rows()));
number tr = 0;
- for (unsigned int i=0; i<this->n_rows(); ++i)
+ for (size_type i=0; i<this->n_rows(); ++i)
tr += (*this)(i,i);
return tr;
Assert (!this->empty(), ExcEmptyMatrix());
real_type s = 0.;
- for (unsigned int i=0; i<this->n_rows()*this->n_cols(); ++i)
+ for (size_type i=0; i<this->n_rows()*this->n_cols(); ++i)
s += numbers::NumberTraits<number>::abs_square(this->values[i]);
return std::sqrt(s);
}
real_type s = 0.;
real_type a = 0.;
- for (unsigned int i=0; i<this->n_rows(); ++i)
- for (unsigned int j=0; j<this->n_cols(); ++j)
+ for (size_type i=0; i<this->n_rows(); ++i)
+ for (size_type j=0; j<this->n_cols(); ++j)
{
const number x_ij = (*this)(i,j);
const number x_ji = (*this)(j,i);
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<j; k++)
+ for (size_type k =0; k<j; k++)
{
SLikLjk += (*this)(i,k)*(*this)(j,k);
};
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; i<this->n(); i++)
+ for (size_type i = 0; i<this->n(); 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);
}
template <int dim>
void
FullMatrix<number>::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());
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<src_r_j-src_r_i+1; i++)
- for (unsigned int j=0; j<src_c_j-src_c_i+1; j++)
+ for (size_type i=0; i<src_r_j-src_r_i+1; i++)
+ for (size_type j=0; j<src_c_j-src_c_i+1; j++)
(*this)(i+dst_r,j+dst_c) = number(T[i+src_r_i][j+src_c_i]);
}
template <int dim>
void
FullMatrix<number>::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,
Assert(src_c_j>=src_c_i, ExcIndexRange(src_r_j,0,src_r_i));
- for (unsigned int i=0; i<src_r_j-src_r_i+1; i++)
- for (unsigned int j=0; j<src_c_j-src_c_i+1; j++)
+ for (size_type i=0; i<src_r_j-src_r_i+1; i++)
+ for (size_type j=0; j<src_c_j-src_c_i+1; j++)
T[i+dst_r][j+dst_c] = double ((*this)(i+src_r_i,j+src_c_i));
}
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<n; ++i, ++dst_ptr, ++src_ptr)
+ for (size_type i=0; i<n; ++i, ++dst_ptr, ++src_ptr)
*dst_ptr = somenumber(om) * *src_ptr / somenumber((*this)(i,i));
}
width = precision+2;
}
- for (unsigned int i=0; i<m(); ++i)
+ for (size_type i=0; i<m(); ++i)
{
- for (unsigned int j=0; j<n(); ++j)
+ for (size_type j=0; j<n(); ++j)
if (std::abs((*this)(i,j)) > threshold)
out << std::setw(width)
<< (*this)(i,j) * number(denominator) << ' ';
// 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
// fear that the matrix is not
// regular
double diagonal_sum = 0;
- for (unsigned int i=0; i<N; ++i)
+ for (size_type i=0; i<N; ++i)
diagonal_sum += std::abs((*this)(i,i));
const double typical_diagonal_element = diagonal_sum/N;
// initialize the array that holds
// the permutations that we find
// during pivot search
- std::vector<unsigned int> p(N);
- for (unsigned int i=0; i<N; ++i)
+ std::vector<size_type> p(N);
+ for (size_type i=0; i<N; ++i)
p[i] = i;
- for (unsigned int j=0; j<N; ++j)
+ for (size_type j=0; j<N; ++j)
{
// pivot search: search that
// part of the line on and
// right of the diagonal for
// the largest element
real_type max = std::abs((*this)(j,j));
- unsigned int r = j;
- for (unsigned int i=j+1; i<N; ++i)
+ size_type r = j;
+ for (size_type i=j+1; i<N; ++i)
{
if (std::abs((*this)(i,j)) > max)
{
// row interchange
if (r>j)
{
- for (unsigned int k=0; k<N; ++k)
+ for (size_type k=0; k<N; ++k)
std::swap ((*this)(j,k), (*this)(r,k));
std::swap (p[j], p[r]);
// transformation
const number hr = number(1.)/(*this)(j,j);
(*this)(j,j) = hr;
- for (unsigned int k=0; k<N; ++k)
+ for (size_type k=0; k<N; ++k)
{
if (k==j) continue;
- for (unsigned int i=0; i<N; ++i)
+ for (size_type i=0; i<N; ++i)
{
if (i==j) continue;
(*this)(i,k) -= (*this)(i,j)*(*this)(j,k)*hr;
}
}
- for (unsigned int i=0; i<N; ++i)
+ for (size_type i=0; i<N; ++i)
{
(*this)(i,j) *= hr;
(*this)(j,i) *= -hr;
}
// column interchange
std::vector<number> hv(N);
- for (unsigned int i=0; i<N; ++i)
+ for (size_type i=0; i<N; ++i)
{
- for (unsigned int k=0; k<N; ++k)
+ for (size_type k=0; k<N; ++k)
hv[p[k]] = (*this)(i,k);
- for (unsigned int k=0; k<N; ++k)
+ for (size_type k=0; k<N; ++k)
(*this)(i,k) = hv[k];
}
}
class Householder : private FullMatrix<number>
{
public:
+ /**
+ * Declare type of container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Create an empty object.
*/
void
Householder<number>::initialize(const FullMatrix<number2> &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<number2>::ExcEmptyMatrix());
Assert (this->n_cols() <= this->n_rows(),
ExcDimensionMismatch(this->n_cols(), this->n_rows()));
- for (unsigned int j=0 ; j<n ; ++j)
+ for (size_type j=0 ; j<n ; ++j)
{
number2 sigma = 0;
- unsigned int i;
+ size_type i;
// sigma = ||v||^2
for (i=j ; i<m ; ++i)
sigma += this->el(i,j)*this->el(i,j);
// For all subsequent columns do
// the Householder reflexion
- for (unsigned int k=j+1 ; k<n ; ++k)
+ for (size_type k=j+1 ; k<n ; ++k)
{
number2 sum = diagonal[j]*this->el(j,k);
for (i=j+1 ; i<m ; ++i)
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<Vector<number2> > mem;
Vector<number2> *aux = mem.alloc();
// Multiply Q_n ... Q_2 Q_1 src
// Where Q_i = I-v_i v_i^T
- for (unsigned int j=0; j<n; ++j)
+ for (size_type j=0; j<n; ++j)
{
// sum = v_i^T dst
number2 sum = diagonal[j]* (*aux)(j);
- for (unsigned int i=j+1 ; i<m ; ++i)
+ for (size_type i=j+1 ; i<m ; ++i)
sum += this->el(i,j)*(*aux)(i);
// dst -= v * sum
(*aux)(j) -= sum*diagonal[j];
- for (unsigned int i=j+1 ; i<m ; ++i)
+ for (size_type i=j+1 ; i<m ; ++i)
(*aux)(i) -= sum*this->el(i,j);
}
// Compute norm of residual
number2 sum = 0.;
- for (unsigned int i=n ; i<m ; ++i)
+ for (size_type i=n ; i<m ; ++i)
sum += (*aux)(i) * (*aux)(i);
Assert(numbers::is_finite(sum), ExcNumberNotFinite());
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<BlockVector<number2> > mem;
BlockVector<number2> *aux = mem.alloc();
// Multiply Q_n ... Q_2 Q_1 src
// Where Q_i = I-v_i v_i^T
- for (unsigned int j=0; j<n; ++j)
+ for (size_type j=0; j<n; ++j)
{
// sum = v_i^T dst
number2 sum = diagonal[j]* (*aux)(j);
- for (unsigned int i=j+1 ; i<m ; ++i)
+ for (size_type i=j+1 ; i<m ; ++i)
sum += this->el(i,j)*(*aux)(i);
// dst -= v * sum
(*aux)(j) -= sum*diagonal[j];
- for (unsigned int i=j+1 ; i<m ; ++i)
+ for (size_type i=j+1 ; i<m ; ++i)
(*aux)(i) -= sum*this->el(i,j);
}
// Compute norm of residual
number2 sum = 0.;
- for (unsigned int i=n ; i<m ; ++i)
+ for (size_type i=n ; i<m ; ++i)
sum += (*aux)(i) * (*aux)(i);
Assert(numbers::is_finite(sum), ExcNumberNotFinite());
class IdentityMatrix
{
public:
+ /**
+ * Declate type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor. Creates a
* zero-sized matrix that should
* Constructor. Creates a
* identity matrix of size #n.
*/
- IdentityMatrix (const unsigned int n);
+ IdentityMatrix (const size_type n);
/**
* Resize the matrix to be of
* size #n by #n.
*/
- void reinit (const unsigned int n);
+ void reinit (const size_type n);
/**
* Number of rows of this
* matrix, the number of rows and
* columns are equal, of course.
*/
- unsigned int m () const;
+ size_type m () const;
/**
* Number of columns of this
* matrix, the number of rows and
* columns are equal, of course.
*/
- unsigned int n () const;
+ size_type n () const;
/**
* Matrix-vector
* Number of rows and columns of
* this matrix.
*/
- unsigned int size;
+ size_type size;
};
inline
-IdentityMatrix::IdentityMatrix (const unsigned int n)
+IdentityMatrix::IdentityMatrix (const size_type n)
:
size (n)
{}
inline
void
-IdentityMatrix::reinit (const unsigned int n)
+IdentityMatrix::reinit (const size_type n)
{
size = n;
}
inline
-unsigned int
+IdentityMatrix::size_type
IdentityMatrix::m () const
{
return size;
inline
-unsigned int
+IdentityMatrix::size_type
IdentityMatrix::n () const
{
return size;
class LAPACKFullMatrix : public TransposeTable<number>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Constructor. Initialize the
* matrix as a square matrix with
* 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
*/
template<class MATRIX>
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);
* called.
*/
std::complex<number>
- eigenvalue (const unsigned int i) const;
+ eigenvalue (const size_type i) const;
/**
* Retrieve singular values after
* called.
*/
number
- singular_value (const unsigned int i) const;
+ singular_value (const size_type i) const;
/**
* Print the matrix and allow
// 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);
inline void
LAPACKFullMatrix<number>::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_i<this->n_rows() && dst_j<this->n_cols())
(*this)(dst_i, dst_j) = factor * entry->value();
}
template <typename number>
inline std::complex<number>
-LAPACKFullMatrix<number>::eigenvalue (const unsigned int i) const
+LAPACKFullMatrix<number>::eigenvalue (const size_type i) const
{
Assert (state & LAPACKSupport::eigenvalues, ExcInvalidState());
Assert (wr.size() == this->n_rows(), ExcInternalError());
template <typename number>
inline number
-LAPACKFullMatrix<number>::singular_value (const unsigned int i) const
+LAPACKFullMatrix<number>::singular_value (const size_type i) const
{
Assert (state == LAPACKSupport::svd || state == LAPACKSupport::inverse_svd, LAPACKSupport::ExcState(state));
AssertIndexRange(i,wr.size());
*
* BlockMatrixArray matrix (n_blocks, n_blocks);
*
- * for (unsigned int i=0;i<blocks.size;++i)
+ * for (size_type i=0;i<blocks.size;++i)
* matrix.enter(blocks.block(i).row, blocks.block(i).column, blocks.matrix(i));
* @endcode
*
: public Subscriptor
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Constructor rendering an
* uninitialized object.
* initializing the matrix.
*/
- MatrixBlock(unsigned int i, unsigned int j);
+ MatrixBlock(size_type i, size_type j);
/**
* Reinitialize the matrix for a
* exist or if it is in a
* different block.
*/
- void add (const unsigned int i,
- const unsigned int j,
+ void add (const size_type i,
+ const size_type j,
const typename MATRIX::value_type value);
/**
* into the matrix.
*/
template <typename number>
- void add (const std::vector<unsigned int> &indices,
- const FullMatrix<number> &full_matrix,
- const bool elide_zero_values = true);
+ void add (const std::vector<size_type> &indices,
+ const FullMatrix<number> &full_matrix,
+ const bool elide_zero_values = true);
/**
* Add all elements in a
* into the matrix.
*/
template <typename number>
- void add (const std::vector<unsigned int> &row_indices,
- const std::vector<unsigned int> &col_indices,
+ void add (const std::vector<size_type> &row_indices,
+ const std::vector<size_type> &col_indices,
const FullMatrix<number> &full_matrix,
const bool elide_zero_values = true);
* into the matrix.
*/
template <typename number>
- void add (const unsigned int row_index,
- const std::vector<unsigned int> &col_indices,
- const std::vector<number> &values,
- const bool elide_zero_values = true);
+ void add (const size_type row_index,
+ const std::vector<size_type> &col_indices,
+ const std::vector<number> &values,
+ const bool elide_zero_values = true);
/**
* Add an array of values given by
* into the matrix.
*/
template <typename number>
- 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,
* 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);
/**
* 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
private NamedData<std_cxx1x::shared_ptr<MatrixBlock<MATRIX> > >
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* The type of object stored.
*/
* position <tt>(row,column)</tt>
* 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
* Access a constant reference to
* the block at position <i>i</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>i</i>.
*/
- value_type &block(unsigned int i);
+ value_type &block(size_type i);
/**
* Access the matrix at position
* <i>i</i> for read and write
* access.
*/
- MATRIX &matrix(unsigned int i);
+ MATRIX &matrix(size_type i);
/**
* import functions from private base class
: public Subscriptor
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* The type of object stored.
*/
* 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
* Access a constant reference to
* the matrix block at position <i>i</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>i</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>i</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>i</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>i</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>i</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>i</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>i</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>i</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>i</i>.
*/
- value_type &block_down(unsigned int i);
+ value_type &block_down(size_type i);
/**
* The memory used by this object.
template <class MATRIX>
inline
-MatrixBlock<MATRIX>::MatrixBlock(unsigned int i, unsigned int j)
+MatrixBlock<MATRIX>::MatrixBlock(size_type i, size_type j)
:
row(i), column(j)
{}
template <class MATRIX>
inline void
MatrixBlock<MATRIX>::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<unsigned int, unsigned int> bi
+ const std::pair<unsigned int, size_type> bi
= row_indices.global_to_local(gi);
- const std::pair<unsigned int, unsigned int> bj
+ const std::pair<unsigned int, size_type> bj
= column_indices.global_to_local(gj);
Assert (bi.first == row, ExcBlockIndexMismatch(bi.first, row));
template <typename number>
inline
void
-MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &r_indices,
- const std::vector<unsigned int> &c_indices,
- const FullMatrix<number> &values,
- const bool elide_zero_values)
+MatrixBlock<MATRIX>::add (const std::vector<size_type> &r_indices,
+ const std::vector<size_type> &c_indices,
+ const FullMatrix<number> &values,
+ const bool elide_zero_values)
{
Assert(row_indices.size() != 0, ExcNotInitialized());
Assert(column_indices.size() != 0, ExcNotInitialized());
AssertDimension (r_indices.size(), values.m());
AssertDimension (c_indices.size(), values.n());
- for (unsigned int i=0; i<row_indices.size(); ++i)
+ for (size_type i=0; i<row_indices.size(); ++i)
add (r_indices[i], c_indices.size(), &c_indices[0], &values(i,0),
elide_zero_values);
}
template <typename number>
inline
void
-MatrixBlock<MATRIX>::add (const unsigned int b_row,
- const unsigned int n_cols,
- const unsigned int *col_indices,
- const number *values,
+MatrixBlock<MATRIX>::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<unsigned int, unsigned int> bi
+ const std::pair<unsigned int, size_type> bi
= row_indices.global_to_local(b_row);
// In debug mode, we check whether
//#ifdef DEBUG
Assert(bi.first == row, ExcBlockIndexMismatch(bi.first, row));
- for (unsigned int j=0; j<n_cols; ++j)
+ for (size_type j=0; j<n_cols; ++j)
{
- const std::pair<unsigned int, unsigned int> bj
+ const std::pair<unsigned int, size_type> bj
= column_indices.global_to_local(col_indices[j]);
Assert(bj.first == column, ExcBlockIndexMismatch(bj.first, column));
template <typename number>
inline
void
-MatrixBlock<MATRIX>::add (const std::vector<unsigned int> &indices,
- const FullMatrix<number> &values,
- const bool elide_zero_values)
+MatrixBlock<MATRIX>::add (const std::vector<size_type> &indices,
+ const FullMatrix<number> &values,
+ const bool elide_zero_values)
{
Assert(row_indices.size() != 0, ExcNotInitialized());
Assert(column_indices.size() != 0, ExcNotInitialized());
AssertDimension (indices.size(), values.m());
Assert (values.n() == values.m(), ExcNotQuadratic());
- for (unsigned int i=0; i<indices.size(); ++i)
+ for (size_type i=0; i<indices.size(); ++i)
add (indices[i], indices.size(), &indices[0], &values(i,0),
elide_zero_values);
}
template <typename number>
inline
void
-MatrixBlock<MATRIX>::add (const unsigned int row,
- const std::vector<unsigned int> &col_indices,
- const std::vector<number> &values,
- const bool elide_zero_values)
+MatrixBlock<MATRIX>::add (const size_type row,
+ const std::vector<size_type> &col_indices,
+ const std::vector<number> &values,
+ const bool elide_zero_values)
{
Assert(row_indices.size() != 0, ExcNotInitialized());
Assert(column_indices.size() != 0, ExcNotInitialized());
template <class MATRIX>
inline void
MatrixBlockVector<MATRIX>::add(
- unsigned int row, unsigned int column,
+ size_type row, size_type column,
const std::string &name)
{
std_cxx1x::shared_ptr<value_type> p(new value_type(row, column));
inline void
MatrixBlockVector<MATRIX>::reinit(const BlockSparsityPattern &sparsity)
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
{
block(i).reinit(sparsity);
}
}
else
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
matrix(i).clear();
}
}
template <class MATRIX>
inline const MatrixBlock<MATRIX> &
-MatrixBlockVector<MATRIX>::block(unsigned int i) const
+MatrixBlockVector<MATRIX>::block(size_type i) const
{
return *this->read(i);
}
template <class MATRIX>
inline MatrixBlock<MATRIX> &
-MatrixBlockVector<MATRIX>::block(unsigned int i)
+MatrixBlockVector<MATRIX>::block(size_type i)
{
return *(*this)(i);
}
template <class MATRIX>
inline MATRIX &
-MatrixBlockVector<MATRIX>::matrix(unsigned int i)
+MatrixBlockVector<MATRIX>::matrix(size_type i)
{
return (*this)(i)->matrix;
}
template <class MATRIX>
inline void
MGMatrixBlockVector<MATRIX>::add(
- unsigned int row, unsigned int column,
+ size_type row, size_type column,
const std::string &name)
{
MGLevelObject<MatrixBlock<MATRIX> > p(0, 1);
template <class MATRIX>
inline const MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block(unsigned int i) const
+MGMatrixBlockVector<MATRIX>::block(size_type i) const
{
return matrices.read(i);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block(size_type i)
{
return matrices(i);
}
template <class MATRIX>
inline const MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_in(unsigned int i) const
+MGMatrixBlockVector<MATRIX>::block_in(size_type i) const
{
return matrices_in.read(i);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_in(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block_in(size_type i)
{
return matrices_in(i);
}
template <class MATRIX>
inline const MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_out(unsigned int i) const
+MGMatrixBlockVector<MATRIX>::block_out(size_type i) const
{
return matrices_out.read(i);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_out(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block_out(size_type i)
{
return matrices_out(i);
}
template <class MATRIX>
inline const MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_up(unsigned int i) const
+MGMatrixBlockVector<MATRIX>::block_up(size_type i) const
{
return flux_matrices_up.read(i);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_up(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block_up(size_type i)
{
return flux_matrices_up(i);
}
template <class MATRIX>
inline const MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_down(unsigned int i) const
+MGMatrixBlockVector<MATRIX>::block_down(size_type i) const
{
return flux_matrices_down.read(i);
}
template <class MATRIX>
inline MGLevelObject<MatrixBlock<MATRIX> > &
-MGMatrixBlockVector<MATRIX>::block_down(unsigned int i)
+MGMatrixBlockVector<MATRIX>::block_down(size_type i)
{
return flux_matrices_down(i);
}
inline void
MGMatrixBlockVector<MATRIX>::reinit_matrix(const MGLevelObject<BlockSparsityPattern> &sparsity)
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
{
MGLevelObject<MatrixBlock<MATRIX> > &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;
inline void
MGMatrixBlockVector<MATRIX>::reinit_edge(const MGLevelObject<BlockSparsityPattern> &sparsity)
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
{
MGLevelObject<MatrixBlock<MATRIX> > &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;
inline void
MGMatrixBlockVector<MATRIX>::reinit_edge_flux(const MGLevelObject<BlockSparsityPattern> &sparsity)
{
- for (unsigned int i=0; i<this->size(); ++i)
+ for (size_type i=0; i<this->size(); ++i)
{
MGLevelObject<MatrixBlock<MATRIX> > &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;
inline void
MGMatrixBlockVector<MATRIX>::clear_object(NamedData<MGLevelObject<MatrixBlock<MATRIX> > > &mo)
{
- for (unsigned int i=0; i<mo.size(); ++i)
+ for (size_type i=0; i<mo.size(); ++i)
{
MGLevelObject<MatrixBlock<MATRIX> > &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();
}
}
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
* <tt>row</tt> and the
* <tt>index</tt> 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
template <class ACCESSOR>
inline
MatrixIterator<ACCESSOR>::
-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)
{}
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.
/**
* Component for filtering block vectors.
*/
- unsigned int component;
+ size_type component;
};
{
number mean = v.mean_value();
- for (unsigned int i=0; i<v.size(); ++i)
+ for (size_type i=0; i<v.size(); ++i)
v(i) -= mean;
}
number mean = src.mean_value();
- for (unsigned int i=0; i<dst.size(); ++i)
+ for (size_type i=0; i<dst.size(); ++i)
dst(i) = src(i) - mean;
}
number mean = src.mean_value();
- for (unsigned int i=0; i<dst.size(); ++i)
+ for (size_type i=0; i<dst.size(); ++i)
dst(i) += src(i) - mean;
}
class MatrixOut : public DataOutInterface<2,2>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Class holding various
* variables which are used to
*
* Default value is one.
*/
- unsigned int block_size;
+ size_type block_size;
/**
* If true, plot
* 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);
};
/**
*/
template <typename number>
static double get_element (const SparseMatrix<number> &matrix,
- const unsigned int i,
- const unsigned int j);
+ const size_type i,
+ const size_type j);
/**
* Return the element with given
*/
template <typename number>
static double get_element (const BlockSparseMatrix<number> &matrix,
- const unsigned int i,
- const unsigned int j);
+ const size_type i,
+ const size_type j);
/**
* Return the element with given
*/
template <class Matrix>
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
*/
template <class Matrix>
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);
};
inline
double
MatrixOut::get_element (const SparseMatrix<number> &matrix,
- const unsigned int i,
- const unsigned int j)
+ const size_type i,
+ const size_type j)
{
return matrix.el(i,j);
}
inline
double
MatrixOut::get_element (const BlockSparseMatrix<number> &matrix,
- const unsigned int i,
- const unsigned int j)
+ const size_type i,
+ const size_type j)
{
return matrix.el(i,j);
}
template <class Matrix>
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);
}
template <class Matrix>
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
// 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));
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)),
patches.resize ((gridpoints_x) * (gridpoints_y));
// now build the patches
- unsigned int index=0;
- for (unsigned int i=0; i<gridpoints_y; ++i)
- for (unsigned int j=0; j<gridpoints_x; ++j, ++index)
+ size_type index=0;
+ for (size_type i=0; i<gridpoints_y; ++i)
+ for (size_type j=0; j<gridpoints_x; ++j, ++index)
{
// within each patch, order
// the points in such a way
* 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);
/**
* This function collects the
{
Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
- for (unsigned int r=0; r<this->n_block_rows(); ++r)
- for (unsigned int c=0; c<this->n_block_cols(); ++c)
+ for (size_type r=0; r<this->n_block_rows(); ++r)
+ for (size_type c=0; c<this->n_block_cols(); ++c)
this->block(r,c) = d;
return *this;
* 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
* 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);
/**
* since they may be routed to
* the wrong block.
*/
- void reinit (const std::vector<unsigned int> &N,
- const bool fast=false);
+ void reinit (const std::vector<size_type> &N,
+ const bool fast=false);
/**
* Change the dimension to that
inline
BlockVector::BlockVector (const unsigned int n_blocks,
- const unsigned int block_size)
+ const size_type block_size)
{
reinit (n_blocks, block_size);
}
inline
- BlockVector::BlockVector (const std::vector<unsigned int> &n)
+ BlockVector::BlockVector (const std::vector<size_type> &n)
{
reinit (n, false);
}
template <typename InputIterator>
- BlockVector::BlockVector (const std::vector<unsigned int> &n,
- const InputIterator first,
- const InputIterator end)
+ BlockVector::BlockVector (const std::vector<size_type> &n,
+ const InputIterator first,
+ const InputIterator end)
{
// first set sizes of blocks, but
// don't initialize them as we will
InputIterator end = start;
std::advance (end, static_cast<signed int>(n[b]));
- for (unsigned int i=0; i<n[b]; ++i, ++start)
+ for (size_type i=0; i<n[b]; ++i, ++start)
this->block(b)(i) = *start;
}
Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize());
inline
void
BlockVector::reinit (const unsigned int n_bl,
- const unsigned int bl_sz,
+ const size_type bl_sz,
const bool fast)
{
- std::vector<unsigned int> n(n_bl, bl_sz);
+ std::vector<size_type> n(n_bl, bl_sz);
reinit(n, fast);
}
inline
void
- BlockVector::reinit (const std::vector<unsigned int> &n,
- const bool fast)
+ BlockVector::reinit (const std::vector<size_type> &n,
+ const bool fast)
{
block_indices.reinit (n);
if (this->components.size() != this->n_blocks())
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
* 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.
/**
* 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
* accessor can access this data
* if necessary.
*/
- std_cxx1x::shared_ptr<const std::vector<unsigned int> > colnum_cache;
+ std_cxx1x::shared_ptr<const std::vector<size_type> > colnum_cache;
/**
* Similar cache for the values
};
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.
* If <tt>value</tt> 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);
/**
* <tt>false</tt>, i.e., even zero
* values are inserted/replaced.
*/
- void set (const std::vector<unsigned int> &indices,
- const FullMatrix<PetscScalar> &full_matrix,
- const bool elide_zero_values = false);
+ void set (const std::vector<size_type> &indices,
+ const FullMatrix<PetscScalar> &full_matrix,
+ const bool elide_zero_values = false);
/**
* Same function as before, but now
* different local-to-global indexing
* on rows and columns, respectively.
*/
- void set (const std::vector<unsigned int> &row_indices,
- const std::vector<unsigned int> &col_indices,
- const FullMatrix<PetscScalar> &full_matrix,
- const bool elide_zero_values = false);
+ void set (const std::vector<size_type> &row_indices,
+ const std::vector<size_type> &col_indices,
+ const FullMatrix<PetscScalar> &full_matrix,
+ const bool elide_zero_values = false);
/**
* Set several elements in the
* <tt>false</tt>, i.e., even zero
* values are inserted/replaced.
*/
- void set (const unsigned int row,
- const std::vector<unsigned int> &col_indices,
+ void set (const size_type row,
+ const std::vector<size_type > &col_indices,
const std::vector<PetscScalar> &values,
- const bool elide_zero_values = false);
+ const bool elide_zero_values = false);
/**
* Set several elements to values
* <tt>false</tt>, 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
* If <tt>value</tt> 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);
/**
* i.e., zero values won't be added
* into the matrix.
*/
- void add (const std::vector<unsigned int> &indices,
- const FullMatrix<PetscScalar> &full_matrix,
- const bool elide_zero_values = true);
+ void add (const std::vector<size_type> &indices,
+ const FullMatrix<PetscScalar> &full_matrix,
+ const bool elide_zero_values = true);
/**
* Same function as before, but now
* different local-to-global indexing
* on rows and columns, respectively.
*/
- void add (const std::vector<unsigned int> &row_indices,
- const std::vector<unsigned int> &col_indices,
- const FullMatrix<PetscScalar> &full_matrix,
- const bool elide_zero_values = true);
+ void add (const std::vector<size_type> &row_indices,
+ const std::vector<size_type> &col_indices,
+ const FullMatrix<PetscScalar> &full_matrix,
+ const bool elide_zero_values = true);
/**
* Set several elements in the
* i.e., zero values won't be added
* into the matrix.
*/
- void add (const unsigned int row,
- const std::vector<unsigned int> &col_indices,
+ void add (const size_type row,
+ const std::vector<size_type> &col_indices,
const std::vector<PetscScalar> &values,
- const bool elide_zero_values = true);
+ const bool elide_zero_values = true);
/**
* Add an array of values given by
* 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
* 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
* the diagonal entries, you have to
* set them by hand.
*/
- void clear_rows (const std::vector<unsigned int> &rows,
- const PetscScalar new_diag_value = 0);
+ void clear_rows (const std::vector<size_type> &rows,
+ const PetscScalar new_diag_value = 0);
/**
* PETSc matrices store their own
* This function is therefore exactly
* equivalent to the <tt>el()</tt> 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
* 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
* 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
* exactly are stored locally,
* use local_range().
*/
- unsigned int local_size () const;
+ size_type local_size () const;
/**
* Return a pair of indices
* a pair (i,i+n), where
* <tt>n=local_size()</tt>.
*/
- std::pair<unsigned int, unsigned int>
+ std::pair<size_type, size_type>
local_range () const;
/**
* 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
* 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
* 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 <tt>r</tt>. It
* 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
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<MatrixBase *>(matrix)),
a_row(row),
inline
- unsigned int
+ size_type
const_iterator::Accessor::row() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ size_type
const_iterator::Accessor::column() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
inline
- unsigned int
+ size_type
const_iterator::Accessor::index() const
{
Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix());
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)
{}
// 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());
inline
void
- MatrixBase::set (const std::vector<unsigned int> &indices,
- const FullMatrix<PetscScalar> &values,
- const bool elide_zero_values)
+ MatrixBase::set (const std::vector<size_type> &indices,
+ const FullMatrix<PetscScalar> &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<indices.size(); ++i)
+ for (size_type i=0; i<indices.size(); ++i)
set (indices[i], indices.size(), &indices[0], &values(i,0),
elide_zero_values);
}
inline
void
- MatrixBase::set (const std::vector<unsigned int> &row_indices,
- const std::vector<unsigned int> &col_indices,
- const FullMatrix<PetscScalar> &values,
- const bool elide_zero_values)
+ MatrixBase::set (const std::vector<size_type> &row_indices,
+ const std::vector<size_type> &col_indices,
+ const FullMatrix<PetscScalar> &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<row_indices.size(); ++i)
+ for (size_type i=0; i<row_indices.size(); ++i)
set (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
elide_zero_values);
}
inline
void
- MatrixBase::set (const unsigned int row,
- const std::vector<unsigned int> &col_indices,
+ MatrixBase::set (const size_type row,
+ const std::vector<size_type> &col_indices,
const std::vector<PetscScalar> &values,
- const bool elide_zero_values)
+ const bool elide_zero_values)
{
Assert (col_indices.size() == values.size(),
ExcDimensionMismatch(col_indices.size(), values.size()));
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);
}
n_columns = 0;
- for (unsigned int j=0; j<n_cols; ++j)
+ for (size_type j=0; j<n_cols; ++j)
{
const PetscScalar value = values[j];
Assert (numbers::is_finite(value), ExcNumberNotFinite());
inline
void
- MatrixBase::add (const unsigned int i,
- const unsigned int j,
- const PetscScalar value)
+ MatrixBase::add (const size_type i,
+ const size_type j,
+ const PetscScalar value)
{
Assert (numbers::is_finite(value), ExcNumberNotFinite());
inline
void
- MatrixBase::add (const std::vector<unsigned int> &indices,
- const FullMatrix<PetscScalar> &values,
- const bool elide_zero_values)
+ MatrixBase::add (const std::vector<size_type> &indices,
+ const FullMatrix<PetscScalar> &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<indices.size(); ++i)
+ for (size_type i=0; i<indices.size(); ++i)
add (indices[i], indices.size(), &indices[0], &values(i,0),
elide_zero_values);
}
inline
void
- MatrixBase::add (const std::vector<unsigned int> &row_indices,
- const std::vector<unsigned int> &col_indices,
- const FullMatrix<PetscScalar> &values,
- const bool elide_zero_values)
+ MatrixBase::add (const std::vector<size_type> &row_indices,
+ const std::vector<size_type> &col_indices,
+ const FullMatrix<PetscScalar> &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<row_indices.size(); ++i)
+ for (size_type i=0; i<row_indices.size(); ++i)
add (row_indices[i], col_indices.size(), &col_indices[0], &values(i,0),
elide_zero_values);
}
inline
void
- MatrixBase::add (const unsigned int row,
- const std::vector<unsigned int> &col_indices,
+ MatrixBase::add (const size_type row,
+ const std::vector<size_type> &col_indices,
const std::vector<PetscScalar> &values,
- const bool elide_zero_values)
+ const bool elide_zero_values)
{
Assert (col_indices.size() == values.size(),
ExcDimensionMismatch(col_indices.size(), values.size()));
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);
}
n_columns = 0;
- for (unsigned int j=0; j<n_cols; ++j)
+ for (size_type j=0; j<n_cols; ++j)
{
const PetscScalar value = values[j];
Assert (numbers::is_finite(value), ExcNumberNotFinite());
inline
PetscScalar
- MatrixBase::operator() (const unsigned int i,
- const unsigned int j) const
+ MatrixBase::operator() (const size_type i,
+ const size_type j) const
{
return el(i,j);
}
inline
MatrixBase::const_iterator
- MatrixBase::begin(const unsigned int r) const
+ MatrixBase::begin(const size_type r) const
{
Assert (r < m(), ExcIndexRange(r, 0, m()));
if (row_length(r) > 0)
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<m(); ++i)
+ for (size_type i=r+1; i<m(); ++i)
if (row_length(i) > 0)
return const_iterator(this, i, 0);
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;
&begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
- return ((index >= static_cast<unsigned int>(begin)) &&
- (index < static_cast<unsigned int>(end)));
+ return ((index >= static_cast<size_type>(begin)) &&
+ (index < static_cast<size_type>(end)));
}
class BlockSparseMatrix : public BlockMatrixBase<SparseMatrix>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Typedef the base class for simpler
* access to its own typedefs.
* 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:
{
Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
- for (unsigned int r=0; r<this->n_block_rows(); ++r)
- for (unsigned int c=0; c<this->n_block_cols(); ++c)
+ for (size_type r=0; r<this->n_block_rows(); ++r)
+ for (size_type c=0; c<this->n_block_cols(); ++c)
this->block(r,c) = d;
return *this;
*/
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
* <tt>local_elements[i]</tt>
* elements on the present process.
*/
- BlockVector (const std::vector<unsigned int> &block_sizes,
- const MPI_Comm &communicator,
- const std::vector<unsigned int> &local_elements);
+ BlockVector (const std::vector<size_type> &block_sizes,
+ const MPI_Comm &communicator,
+ const std::vector<size_type> &local_elements);
/**
* Destructor. Clears memory
*/
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);
/**
* since they may be routed to
* the wrong block.
*/
- void reinit (const std::vector<unsigned int> &block_sizes,
- const MPI_Comm &communicator,
- const std::vector<unsigned int> &local_sizes,
- const bool fast=false);
+ void reinit (const std::vector<size_type> &block_sizes,
+ const MPI_Comm &communicator,
+ const std::vector<size_type> &local_sizes,
+ const bool fast=false);
/**
* Change the dimension to that
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);
}
inline
- BlockVector::BlockVector (const std::vector<unsigned int> &block_sizes,
+ BlockVector::BlockVector (const std::vector<size_type> &block_sizes,
const MPI_Comm &communicator,
- const std::vector<unsigned int> &local_elements)
+ const std::vector<size_type> &local_elements)
{
reinit (block_sizes, communicator, local_elements, false);
}
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<unsigned int>(n_blocks, block_size),
+ reinit(std::vector<size_type>(n_blocks, block_size),
communicator,
- std::vector<unsigned int>(n_blocks, local_size),
+ std::vector<size_type>(n_blocks, local_size),
fast);
}
inline
void
- BlockVector::reinit (const std::vector<unsigned int> &block_sizes,
- const MPI_Comm &communicator,
- const std::vector<unsigned int> &local_sizes,
- const bool fast)
+ BlockVector::reinit (const std::vector<size_type> &block_sizes,
+ const MPI_Comm &communicator,
+ const std::vector<size_type> &local_sizes,
+ const bool fast)
{
this->block_indices.reinit (block_sizes);
if (this->components.size() != this->n_blocks())
class SparseMatrix : public MatrixBase
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* A structure that describes some of
* 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
* 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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Initialize using the given
* the start.
*/
template <typename SparsityType>
- SparseMatrix (const MPI_Comm &communicator,
- const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &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<size_type> &local_rows_per_process,
+ const std::vector<size_type> &local_columns_per_process,
+ const size_type this_process,
+ const bool preset_nonzero_locations = true);
/**
* This operator assigns a scalar to
* 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
* 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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Initialize using the given
* the start.
*/
template <typename SparsityType>
- void reinit (const MPI_Comm &communicator,
- const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &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<size_type> &local_rows_per_process,
+ const std::vector<size_type> &local_columns_per_process,
+ const unsigned int this_process,
+ const bool preset_nonzero_locations = true);
/**
* Return a reference to the MPI
* 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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Same as previous functions.
*/
template <typename SparsityType>
- void do_reinit (const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &local_columns_per_process,
- const unsigned int this_process,
- const bool preset_nonzero_locations);
+ void do_reinit (const SparsityType &sparsity_pattern,
+ const std::vector<size_type> &local_rows_per_process,
+ const std::vector<size_type> &local_columns_per_process,
+ const unsigned int this_process,
+ const bool preset_nonzero_locations);
/**
* To allow calling protected
class Vector : public VectorBase
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor. Initialize the
* vector as empty.
* 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);
/**
* shall communicate
*/
template <typename Number>
- explicit Vector (const MPI_Comm &communicator,
+ explicit Vector (const MPI_Comm &communicator,
const dealii::Vector<Number> &v,
- const unsigned int local_size);
+ const size_type local_size);
/**
*/
explicit Vector (const MPI_Comm &communicator,
const VectorBase &v,
- const unsigned int local_size);
+ const size_type local_size);
/**
* 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
* 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);
* 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);
template <typename number>
Vector::Vector (const MPI_Comm &communicator,
const dealii::Vector<number> &v,
- const unsigned int local_size)
+ const size_type local_size)
:
communicator (communicator)
{
// 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; i<v.size(); ++i)
+ for (size_type i=0; i<v.size(); ++i)
(*this)(i) = v(i);
compress (::dealii::VectorOperation::insert);
unsigned int symmetric;
/**
- * Patterns of powers of sparsified
- * matrices can be approximate the
- * pattern of large entries in the
- * inverse of a matrix. Powers of a
- *
* The sparsity pattern used for the
- * apprximate inverse is the pattern
+ * approximate inverse is the pattern
* of a power <tt>B^m</tt> where <tt>B</tt>
* has been sparsified from the given
* matrix <tt>A</tt>, <tt>n_level</tt>
* 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
* ICC. The default value of this flag
* is @p false.
*/
- SparseMatrix (const unsigned int m,
- const unsigned int n,
- const std::vector<unsigned int> &row_lengths,
- const bool is_symmetric = false);
+ SparseMatrix (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Initialize a sparse matrix using the
* 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
* 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<unsigned int> &row_lengths,
- const bool is_symmetric = false);
+ */
+ void reinit (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Initialize a sparse matrix using the
* 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<unsigned int> &row_lengths,
- const bool is_symmetric = false);
+ void do_reinit (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric = false);
/**
* Same as previous function.
class Vector : public VectorBase
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor. Initialize the
* vector as empty.
* 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
* 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
* size of the vector to be
* created.
*/
- void create_vector (const unsigned int n);
+ void create_vector (const size_type n);
};
/*@}*/
// 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; i<v.size(); ++i)
+ for (size_type i=0; i<v.size(); ++i)
(*this)(i) = v(i);
compress (::dealii::VectorOperation::insert);
* class to create it.
*/
VectorReference (const VectorBase &vector,
- const unsigned int index);
+ const size_type index);
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* This looks like a copy operator,
* but does something different than
* Index of the referenced element of
* the vector.
*/
- const unsigned int index;
+ const size_type index;
/**
* Make the vector class a friend, so
* Return the global dimension of the
* vector.
*/
- unsigned int size () const;
+ size_type size () const;
/**
* Return the local dimension of the
* exactly are stored locally,
* use local_range().
*/
- unsigned int local_size () const;
+ size_type local_size () const;
/**
* Return a pair of indices
* a pair (i,i+n), where
* <tt>n=local_size()</tt>.
*/
- std::pair<unsigned int, unsigned int>
+ std::pair<size_type, size_type>
local_range () const;
/**
* 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
* 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
* Exactly the same as operator().
*/
reference
- operator [] (const unsigned int index);
+ operator [] (const size_type index);
/**
* Provide read-only access to an
* Exactly the same as operator().
*/
PetscScalar
- operator [] (const unsigned int index) const;
+ operator [] (const size_type index) const;
/**
* A collective set operation: instead
* the corresponding values in the
* second.
*/
- void set (const std::vector<unsigned int> &indices,
+ void set (const std::vector<size_type> &indices,
const std::vector<PetscScalar> &values);
/**
* stored in @p values to the vector
* components specified by @p indices.
*/
- void add (const std::vector<unsigned int> &indices,
+ void add (const std::vector<size_type> &indices,
const std::vector<PetscScalar> &values);
/**
* takes a deal.II vector of
* values.
*/
- void add (const std::vector<unsigned int> &indices,
+ void add (const std::vector<size_type> &indices,
const ::dealii::Vector<PetscScalar> &values);
/**
* other two <tt>add()</tt>
* 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);
/**
* @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);
};
{
inline
VectorReference::VectorReference (const VectorBase &vector,
- const unsigned int index)
+ const size_type index)
:
vector (vector),
index (index)
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;
&begin, &end);
AssertThrow (ierr == 0, ExcPETScError(ierr));
- return ((index >= static_cast<unsigned int>(begin)) &&
- (index < static_cast<unsigned int>(end)));
+ return ((index >= static_cast<size_type>(begin)) &&
+ (index < static_cast<size_type>(end)));
}
inline
inline
internal::VectorReference
- VectorBase::operator () (const unsigned int index)
+ VectorBase::operator () (const size_type index)
{
return internal::VectorReference (*this, index);
}
inline
PetscScalar
- VectorBase::operator () (const unsigned int index) const
+ VectorBase::operator () (const size_type index) const
{
return static_cast<PetscScalar>(internal::VectorReference (*this, index));
}
inline
internal::VectorReference
- VectorBase::operator [] (const unsigned int index)
+ VectorBase::operator [] (const size_type index)
{
return operator()(index);
}
inline
PetscScalar
- VectorBase::operator [] (const unsigned int index) const
+ VectorBase::operator [] (const size_type index) const
{
return operator()(index);
}
class PreconditionIdentity : public Subscriptor
{
public:
-
/**
* This function is only
* present to
class PreconditionSSOR : public PreconditionRelaxation<MATRIX>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
/**
* A typedef to the base class.
class PreconditionPSOR : public PreconditionRelaxation<MATRIX>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Initialize matrix and
* relaxation parameter. The
* reasons. It defaults to 1.
*/
void initialize (const MATRIX &A,
- const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation,
+ const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation,
const typename PreconditionRelaxation<MATRIX>::AdditionalData &
parameters = typename PreconditionRelaxation<MATRIX>::AdditionalData());
/**
* Storage for the permutation vector.
*/
- const std::vector<unsigned int> *permutation;
+ const std::vector<size_type> *permutation;
/**
* Storage for the inverse
* permutation vector.
*/
- const std::vector<unsigned int> *inverse_permutation;
+ const std::vector<size_type> *inverse_permutation;
};
class PreconditionChebyshev : public Subscriptor
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Standardized data struct to
* pipe additional parameters
// 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<std::size_t>(-1));
- for (unsigned int row=0; row<n; ++row)
+ for (size_type row=0; row<n; ++row)
{
// find the first element in this line which is on the right of the
// diagonal. we need to precondition with the elements on the left
inline void
PreconditionPSOR<MATRIX>::initialize (
const MATRIX &rA,
- const std::vector<unsigned int> &p,
- const std::vector<unsigned int> &ip,
+ const std::vector<size_type> &p,
+ const std::vector<size_type> &ip,
const typename PreconditionRelaxation<MATRIX>::AdditionalData ¶meters)
{
permutation = &p;
if (data.matrix_diagonal_inverse.size() != matrix.m())
{
data.matrix_diagonal_inverse.reinit(matrix.m());
- for (unsigned int i=0; i<matrix.m(); ++i)
+ for (size_type i=0; i<matrix.m(); ++i)
data.matrix_diagonal_inverse(i) = 1./matrix.el(i,i);
}
update1.reinit (data.matrix_diagonal_inverse, true);
else
{
TridiagonalMatrix<double> T(diagonal.size(), true);
- for (unsigned int i=0; i<diagonal.size(); ++i)
+ for (size_type i=0; i<diagonal.size(); ++i)
{
T(i,i) = diagonal[i];
if (i< diagonal.size()-1)
template <typename Number>
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,
if (factor1 == Number())
{
if (start_zero)
- for (unsigned int i=begin; i<end; ++i)
+ for (size_type i=begin; i<end; ++i)
{
dst[i] = factor2 * src[i] * matrix_diagonal_inverse[i];
update1[i] = -dst[i];
}
else
- for (unsigned int i=begin; i<end; ++i)
+ for (size_type i=begin; i<end; ++i)
{
update1[i] = ((update2[i]-src[i]) *
factor2*matrix_diagonal_inverse[i]);
}
}
else
- for (unsigned int i=begin; i<end; ++i)
+ for (size_type i=begin; i<end; ++i)
{
const Number update2i = ((update2[i] - src[i]) *
matrix_diagonal_inverse[i]);
typedef inverse_type value_type;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Parameters for block preconditioners.
*/
* is no reasonable default
* parameter.
*/
- AdditionalData (const unsigned int block_size,
+ AdditionalData (const size_type block_size,
const double relaxation = 1.,
const bool invert_diagonal = true,
const bool same_diagonal = false);
/**
* Block size.
*/
- unsigned int block_size;
+ size_type block_size;
/**
* Invert diagonal during initialization.
* may be provided.
*/
void initialize (const MATRIX &A,
- const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation,
+ const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation,
const AdditionalData parameters);
/**
* order is only admissible for
* block permutation.
*/
- void set_permutation(const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation);
+ void set_permutation(const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation);
/**
* Replacement of
* permuted preconditioning.
*/
void invert_permuted_diagblocks(
- const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation);
+ const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation);
public:
/**
* Deletes the inverse diagonal
* 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
/**
* Return the size of the blocks.
*/
- unsigned int block_size () const;
+ size_type block_size () const;
/**
* @deprecated Use size()
* diagonal block is assumed to
* be of the same size.
*/
- unsigned int blocksize;
+ size_type blocksize;
/**
* Pointer to the matrix. Make
/**
* The permutation vector
*/
- std::vector<unsigned int> permutation;
+ std::vector<size_type> permutation;
/**
* The inverse permutation vector
*/
- std::vector<unsigned int> inverse_permutation;
+ std::vector<size_type> inverse_permutation;
/**
* Flag for diagonal compression.
typedef typename MATRIX::value_type number;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* STL conforming iterator.
*/
* pointer is sufficient.
*/
Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *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.
* 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.
* Constructor.
*/
const_iterator(const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix,
- const unsigned int row);
+ const size_type row);
/**
* Prefix increment.
* 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:
protected PreconditionBlock<MATRIX, inverse_type>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Default constructor.
*/
private PreconditionBlockSOR<MATRIX, inverse_type>
{
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Define number type of matrix.
*/
template<class MATRIX, typename inverse_type>
inline inverse_type
PreconditionBlock<MATRIX, inverse_type>::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<inverse_type> &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)
{
inline
PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::
Accessor (const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix,
- const unsigned int row)
+ const size_type row)
:
matrix(matrix),
b_iterator(&matrix->inverse(0), 0, 0),
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();
template<class MATRIX, typename inverse_type>
inline
-unsigned int
+typename PreconditionBlockJacobi<MATRIX, inverse_type>::size_type
PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::row() const
{
Assert (a_block < matrix->size(),
template<class MATRIX, typename inverse_type>
inline
-unsigned int
+typename PreconditionBlockJacobi<MATRIX, inverse_type>::size_type
PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::Accessor::column() const
{
Assert (a_block < matrix->size(),
inline
PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator::
const_iterator(const PreconditionBlockJacobi<MATRIX, inverse_type> *matrix,
- const unsigned int row)
+ const size_type row)
:
accessor(matrix, row)
{}
inline
typename PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator
PreconditionBlockJacobi<MATRIX, inverse_type>::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);
inline
typename PreconditionBlockJacobi<MATRIX, inverse_type>::const_iterator
PreconditionBlockJacobi<MATRIX, inverse_type>::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);
template<class MATRIX, typename inverse_type>
PreconditionBlock<MATRIX, inverse_type>::AdditionalData::
-AdditionalData (const unsigned int block_size,
+AdditionalData (const size_type block_size,
const double relaxation,
const bool invert_diagonal,
const bool same_diagonal)
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());
template <class MATRIX, typename inverse_type>
void PreconditionBlock<MATRIX,inverse_type>::initialize (
const MATRIX &M,
- const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation,
+ const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation,
const AdditionalData parameters)
{
set_permutation(permutation, inverse_permutation);
template <class MATRIX, typename inverse_type>
void PreconditionBlock<MATRIX,inverse_type>::invert_permuted_diagblocks(
- const std::vector<unsigned int> &permutation,
- const std::vector<unsigned int> &inverse_permutation)
+ const std::vector<size_type> &permutation,
+ const std::vector<size_type> &inverse_permutation)
{
Assert (A!=0, ExcNotInitialized());
Assert (blocksize!=0, ExcNotInitialized());
{
deallog << "PreconditionBlock uses only one diagonal block" << std::endl;
- for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<blocksize; ++row_cell)
{
typename MATRIX::const_iterator entry = M.begin(row_cell);
const typename MATRIX::const_iterator row_end = M.end(row_cell);
for (unsigned int cell=0; cell<this->size(); ++cell)
{
- const unsigned int cell_start = cell*blocksize;
- for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell)
+ const size_type cell_start = cell*blocksize;
+ for (size_type row_cell=0; row_cell<blocksize; ++row_cell)
{
- const unsigned int urow = row_cell + cell_start;
+ const size_type urow = row_cell + cell_start;
- const unsigned int row = permutation[urow];
+ const size_type row = permutation[urow];
typename MATRIX::const_iterator entry = M.begin(row);
const typename MATRIX::const_iterator row_end = M.end(row);
if (inverse_permutation[entry->column()]<cell_start)
continue;
- const unsigned int column_cell = inverse_permutation[entry->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();
// 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
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';
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
// 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<number> M_cell(this->blocksize);
{
--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_cell<this->blocksize;
++row_cell, ++row)
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,
template <class MATRIX, typename inverse_type>
-unsigned int PreconditionBlock<MATRIX,inverse_type>::block_size() const
+typename PreconditionBlock<MATRIX,inverse_type>::size_type
+PreconditionBlock<MATRIX,inverse_type>::block_size() const
{
return blocksize;
}
if (this->same_diagonal())
{
deallog << "PreconditionBlock uses only one diagonal block" << std::endl;
- for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<blocksize; ++row_cell)
{
typename MATRIX::const_iterator entry = M.begin(row_cell);
const typename MATRIX::const_iterator row_end = M.end(row_cell);
for (unsigned int cell=0; cell<this->size(); ++cell)
{
- const unsigned int cell_start = cell*blocksize;
- for (unsigned int row_cell=0; row_cell<blocksize; ++row_cell)
+ const size_type cell_start = cell*blocksize;
+ for (size_type row_cell=0; row_cell<blocksize; ++row_cell)
{
- const unsigned int row = row_cell + cell_start;
+ const size_type row = row_cell + cell_start;
typename MATRIX::const_iterator entry = M.begin(row);
const typename MATRIX::const_iterator row_end = M.end(row);
if (entry->column()<cell_start)
continue;
- const unsigned int column_cell = entry->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();
template <class MATRIX, typename inverse_type>
void PreconditionBlock<MATRIX,inverse_type>::set_permutation (
- const std::vector<unsigned int> &p,
- const std::vector<unsigned int> &i)
+ const std::vector<size_type> &p,
+ const std::vector<size_type> &i)
{
Assert (p.size() == i.size(), ExcDimensionMismatch(p.size(), i.size()));
// 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())
{
++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_cell<this->blocksize; ++column_cell, ++column)
M_cell(row_cell,column_cell)=M(row,column);
}
// 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
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;
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
// 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<number> 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_cell<this->blocksize;
++row_cell, ++row)
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,
// 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_cell<this->blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<this->blocksize; ++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_cell<this->blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell)
help(row+row_cell) = scaling * cell_dst(row_cell);
}
// 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_cell<this->blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<this->blocksize; ++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_cell<this->blocksize; ++row_cell)
+ for (size_type row_cell=0; row_cell<this->blocksize; ++row_cell)
help(row+row_cell) = scaling * cell_dst(row_cell);
}
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
* 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);
/**
* 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 <tt>i</tt>.
*/
template <typename number2>
- void inverse_vmult(unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const;
+ void inverse_vmult(size_type i, Vector<number2> &dst, const Vector<number2> &src) const;
/**
* Multiply with the transposed inverse
* block at position <tt>i</tt>.
*/
template <typename number2>
- void inverse_Tvmult(unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const;
+ void inverse_Tvmult(size_type i, Vector<number2> &dst, const Vector<number2> &src) const;
/**
* Access to the inverse diagonal
* blocks if Inversion is #gauss_jordan.
*/
- FullMatrix<number> &inverse (unsigned int i);
+ FullMatrix<number> &inverse (size_type i);
/**
* Access to the inverse diagonal
* blocks if Inversion is #householder.
*/
- Householder<number> &inverse_householder (unsigned int i);
+ Householder<number> &inverse_householder (size_type i);
/**
* Access to the inverse diagonal
* blocks if Inversion is #householder.
*/
- LAPACKFullMatrix<number> &inverse_svd (unsigned int i);
+ LAPACKFullMatrix<number> &inverse_svd (size_type i);
/**
* Access to the inverse diagonal
* blocks.
*/
- const FullMatrix<number> &inverse (unsigned int i) const;
+ const FullMatrix<number> &inverse (size_type i) const;
/**
* Access to the inverse diagonal
* blocks if Inversion is #householder.
*/
- const Householder<number> &inverse_householder (unsigned int i) const;
+ const Householder<number> &inverse_householder (size_type i) const;
/**
* Access to the inverse diagonal
* blocks if Inversion is #householder.
*/
- const LAPACKFullMatrix<number> &inverse_svd (unsigned int i) const;
+ const LAPACKFullMatrix<number> &inverse_svd (size_type i) const;
/**
* Access to the diagonal
* blocks.
*/
- FullMatrix<number> &diagonal (unsigned int i);
+ FullMatrix<number> &diagonal (size_type i);
/**
* Access to the diagonal
* blocks.
*/
- const FullMatrix<number> &diagonal (unsigned int i) const;
+ const FullMatrix<number> &diagonal (size_type i) const;
/**
* Print some statistics about
template <typename number>
inline
void
-PreconditionBlockBase<number>::reinit(unsigned int n, unsigned int b, bool compress,
+PreconditionBlockBase<number>::reinit(unsigned int n, size_type b, bool compress,
Inversion method)
{
inversion = method;
inline
void
PreconditionBlockBase<number>::inverse_vmult(
- unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const
+ size_type i, Vector<number2> &dst, const Vector<number2> &src) const
{
- const unsigned int ii = same_diagonal() ? 0U : i;
+ const size_type ii = same_diagonal() ? 0U : i;
switch (inversion)
{
inline
void
PreconditionBlockBase<number>::inverse_Tvmult(
- unsigned int i, Vector<number2> &dst, const Vector<number2> &src) const
+ size_type i, Vector<number2> &dst, const Vector<number2> &src) const
{
- const unsigned int ii = same_diagonal() ? 0U : i;
+ const size_type ii = same_diagonal() ? 0U : i;
switch (inversion)
{
template <typename number>
inline
const FullMatrix<number> &
-PreconditionBlockBase<number>::inverse(unsigned int i) const
+PreconditionBlockBase<number>::inverse(size_type i) const
{
if (same_diagonal())
return var_inverse_full[0];
template <typename number>
inline
const Householder<number> &
-PreconditionBlockBase<number>::inverse_householder(unsigned int i) const
+PreconditionBlockBase<number>::inverse_householder(size_type i) const
{
if (same_diagonal())
return var_inverse_householder[0];
template <typename number>
inline
const LAPACKFullMatrix<number> &
-PreconditionBlockBase<number>::inverse_svd(unsigned int i) const
+PreconditionBlockBase<number>::inverse_svd(size_type i) const
{
if (same_diagonal())
return var_inverse_svd[0];
template <typename number>
inline
const FullMatrix<number> &
-PreconditionBlockBase<number>::diagonal(unsigned int i) const
+PreconditionBlockBase<number>::diagonal(size_type i) const
{
Assert(store_diagonals(), ExcDiagonalsNotStored());
template <typename number>
inline
FullMatrix<number> &
-PreconditionBlockBase<number>::inverse(unsigned int i)
+PreconditionBlockBase<number>::inverse(size_type i)
{
Assert(var_inverse_full.size() != 0, ExcInverseNotAvailable());
template <typename number>
inline
Householder<number> &
-PreconditionBlockBase<number>::inverse_householder(unsigned int i)
+PreconditionBlockBase<number>::inverse_householder(size_type i)
{
Assert(var_inverse_householder.size() != 0, ExcInverseNotAvailable());
template <typename number>
inline
LAPACKFullMatrix<number> &
-PreconditionBlockBase<number>::inverse_svd(unsigned int i)
+PreconditionBlockBase<number>::inverse_svd(size_type i)
{
Assert(var_inverse_svd.size() != 0, ExcInverseNotAvailable());
template <typename number>
inline
FullMatrix<number> &
-PreconditionBlockBase<number>::diagonal(unsigned int i)
+PreconditionBlockBase<number>::diagonal(size_type i)
{
Assert(store_diagonals(), ExcDiagonalsNotStored());
double sigmin = 1.e300, sigmax= -1.e300;
double kappamin = 1.e300, kappamax= -1.e300;
- for (unsigned int b=0; b<size(); ++b)
+ for (size_type b=0; b<size(); ++b)
{
const LAPACKFullMatrix<number> &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);
PreconditionBlockBase<number>::memory_consumption () const
{
std::size_t mem = sizeof(*this);
- for (unsigned int i=0; i<var_inverse_full.size(); ++i)
+ for (size_type i=0; i<var_inverse_full.size(); ++i)
mem += MemoryConsumption::memory_consumption(var_inverse_full[i]);
- for (unsigned int i=0; i<var_diagonal.size(); ++i)
+ for (size_type i=0; i<var_diagonal.size(); ++i)
mem += MemoryConsumption::memory_consumption(var_diagonal[i]);
return mem;
}
typedef inverse_type value_type;
public:
+ /**
+ * Declare type for container size.
+ */
+ typedef types::global_dof_index size_type;
+
/**
* Parameters for block relaxation methods.
*/
* Read-only access to entries. This function is only possible 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 diagonal blocks in @p inverse. This
}
else
{
- for (unsigned int block=0; block<additional_data->block_list.n_rows(); ++block)
+ for (size_type block=0; block<additional_data->block_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
// diagonal block
SparsityPattern::iterator row
= additional_data->block_list.begin(block);
- for (unsigned int row_cell=0; row_cell<bs; ++row_cell, ++row)
+ for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row)
{
//TODO:[GK] Optimize here
for (typename MATRIX::const_iterator entry = M.begin(row->column());
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();
}
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; i<additional_data->order.size(); ++i)
? (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_cell<bs; ++row_cell, ++row)
+ for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row)
{
b_cell(row_cell) = src(row->column());
for (typename MATRIX::const_iterator entry = M.begin(row->column());
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_cell<bs; ++row_cell, ++row)
+ for (size_type row_cell=0; row_cell<bs; ++row_cell, ++row)
dst(row->column()) = prev(row->column()) + additional_data->relaxation * x_cell(row_cell);
}
}
using namespace LAPACKSupport;
template <typename number>
-LAPACKFullMatrix<number>::LAPACKFullMatrix(const unsigned int n)
+LAPACKFullMatrix<number>::LAPACKFullMatrix(const size_type n)
:
TransposeTable<number> (n,n),
state(matrix)
template <typename number>
LAPACKFullMatrix<number>::LAPACKFullMatrix(
- const unsigned int m,
- const unsigned int n)
+ const size_type m,
+ const size_type n)
:
TransposeTable<number> (m,n),
state(matrix)
{
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; i<this->n_rows(); ++i)
- for (unsigned int j=0; j<this->n_cols(); ++j)
+ for (size_type i=0; i<this->n_rows(); ++i)
+ for (size_type j=0; j<this->n_cols(); ++j)
(*this)(i,j) = M(i,j);
state = LAPACKSupport::matrix;
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; i<wr.size(); ++i)
+ for (size_type i=0; i<wr.size(); ++i)
work[i] *= wr[i];
// Multiply with U
gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one);
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; i<wr.size(); ++i)
+ for (size_type i=0; i<wr.size(); ++i)
work[i] *= wr[i];
// Multiply with V
gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one);
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; i<wr.size(); ++i)
+ for (size_type i=0; i<wr.size(); ++i)
work[i] *= wr[i];
// Multiply with V
gemv("T", &nn, &nn, &alpha, &svd_vt->values[0], &nn, &work[0], &one, &beta, w.val, &one);
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; i<wr.size(); ++i)
+ for (size_type i=0; i<wr.size(); ++i)
work[i] *= wr[i];
// Multiply with U
gemv("N", &mm, &mm, &alpha, &svd_u->values[0], &mm, &work[0], &one, &beta, w.val, &one);
Assert (state==LAPACKSupport::svd, ExcState(state));
const double lim = wr[0]*threshold;
- for (unsigned int i=0; i<wr.size(); ++i)
+ for (size_type i=0; i<wr.size(); ++i)
{
if (wr[i] > lim)
wr[i] = 1./wr[i];
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,
{
Assert(state == matrix, ExcState(state));
const int nn = (this->n_cols() > 0 ? this->n_cols() : 1);
- Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic());
+ Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic());
wr.resize(nn);
LAPACKFullMatrix<number> matrix_eigenvectors(nn, nn);
const char *const uplo(&U);
const char *const range(&V);
const int *const dummy(&one);
- std::vector<int> iwork(static_cast<unsigned int> (5*nn));
- std::vector<int> ifail(static_cast<unsigned int> (nn));
+ std::vector<int> iwork(static_cast<size_type> (5*nn));
+ std::vector<int> ifail(static_cast<size_type> (nn));
// Optimal workspace query:
lwork = 8*nn > 1 ? 8*nn : 1; // no query mode
#endif
// resize workspace arrays
- work.resize(static_cast<unsigned int> (lwork));
+ work.resize(static_cast<size_type> (lwork));
// Finally compute the eigenvalues.
syevx (jobz, range,
eigenvalues.reinit(n_eigenpairs);
eigenvectors.reinit(nn, n_eigenpairs, true);
- for (unsigned int i=0; i < static_cast<unsigned int> (n_eigenpairs); ++i)
+ for (size_type i=0; i < static_cast<size_type> (n_eigenpairs); ++i)
{
eigenvalues(i) = wr[i];
- unsigned int col_begin(i*nn);
- for (unsigned int j=0; j < static_cast<unsigned int> (nn); ++j)
+ size_type col_begin(i*nn);
+ for (size_type j=0; j < static_cast<size_type> (nn); ++j)
{
eigenvectors(j,i) = values_eigenvectors[col_begin+j];
}
{
Assert(state == matrix, ExcState(state));
const int nn = (this->n_cols() > 0 ? this->n_cols() : 1);
- Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic());
+ Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic());
Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic());
- Assert(static_cast<unsigned int>(nn) == B.n_cols(),
+ Assert(static_cast<size_type>(nn) == B.n_cols(),
ExcDimensionMismatch (nn, B.n_cols()));
wr.resize(nn);
const char *const uplo(&U);
const char *const range(&V);
const int *const dummy(&one);
- std::vector<int> iwork(static_cast<unsigned int> (5*nn));
- std::vector<int> ifail(static_cast<unsigned int> (nn));
+ std::vector<int> iwork(static_cast<size_type> (5*nn));
+ std::vector<int> ifail(static_cast<size_type> (nn));
// Optimal workspace query:
lwork = 8*nn > 1 ? 8*nn : 1; // no query mode
#endif
// resize workspace arrays
- work.resize(static_cast<unsigned int> (lwork));
+ work.resize(static_cast<size_type> (lwork));
// Finally compute the generalized
// eigenvalues.
eigenvalues.reinit(n_eigenpairs);
eigenvectors.resize(n_eigenpairs);
- for (unsigned int i=0; i < static_cast<unsigned int> (n_eigenpairs); ++i)
+ for (size_type i=0; i < static_cast<size_type> (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<unsigned int> (nn); ++j)
+ for (size_type j=0; j < static_cast<size_type> (nn); ++j)
{
eigenvectors[i](j) = values_eigenvectors[col_begin+j];
}
{
Assert(state == matrix, ExcState(state));
const int nn = this->n_cols();
- Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic());
+ Assert(static_cast<size_type>(nn) == this->n_rows(), ExcNotQuadratic());
Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic());
- Assert(static_cast<unsigned int>(nn) == B.n_cols(),
+ Assert(static_cast<size_type>(nn) == B.n_cols(),
ExcDimensionMismatch (nn, B.n_cols()));
- Assert(eigenvectors.size() <= static_cast<unsigned int>(nn),
+ Assert(eigenvectors.size() <= static_cast<size_type>(nn),
ExcMessage ("eigenvectors.size() > matrix.n_cols()"));
wr.resize(nn);
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.
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<unsigned int>(nn); ++j)
+ for (size_type j=0; j < static_cast<size_type>(nn); ++j)
{
eigenvectors[i](j) = values_A[col_begin+j];
}
width = precision+2;
}
- for (unsigned int i=0; i<this->n_rows(); ++i)
+ for (size_type i=0; i<this->n_rows(); ++i)
{
- for (unsigned int j=0; j<this->n_cols(); ++j)
+ for (size_type j=0; j<this->n_cols(); ++j)
if (std::fabs(this->el(i,j)) > threshold)
out << std::setw(width)
<< this->el(i,j) * denominator << ' ';
DEAL_II_NAMESPACE_OPEN
-MeanValueFilter::MeanValueFilter(unsigned int component)
+MeanValueFilter::MeanValueFilter(size_type component)
:
component(component)
{}
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),
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
this->column_block_indices.reinit (n_block_columns, 0);
// and reinitialize the blocks
- for (unsigned int r=0; r<this->n_block_rows(); ++r)
- for (unsigned int c=0; c<this->n_block_cols(); ++c)
+ for (size_type r=0; r<this->n_block_rows(); ++r)
+ for (size_type c=0; c<this->n_block_cols(); ++c)
{
BlockType *p = new BlockType();
this->sub_objects[r][c] = p;
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,
// iterator for an empty line (what
// would it point to?)
Assert (ncols != 0, ExcInternalError());
- colnum_cache.reset (new std::vector<unsigned int> (colnums,
- colnums+ncols));
+ colnum_cache.reset (new std::vector<size_type> (colnums, colnums+ncols));
value_cache.reset (new std::vector<PetscScalar> (values, values+ncols));
// and finally restore the matrix
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 ();
void
- MatrixBase::clear_rows (const std::vector<unsigned int> &rows,
- const PetscScalar new_diag_value)
+ MatrixBase::clear_rows (const std::vector<size_type> &rows,
+ const PetscScalar new_diag_value)
{
compress ();
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
PetscScalar
- MatrixBase::diag_element (const unsigned int i) const
+ MatrixBase::diag_element (const size_type i) const
{
Assert (m() == n(), ExcNotQuadratic());
- unsigned int
+ size_type
MatrixBase::m () const
{
#ifdef PETSC_USE_64BIT_INDICES
- unsigned int
+ size_type
MatrixBase::n () const
{
#ifdef PETSC_USE_64BIT_INDICES
- unsigned int
+ size_type
MatrixBase::local_size () const
{
#ifdef PETSC_USE_64BIT_INDICES
- std::pair<unsigned int, unsigned int>
+ std::pair<size_type, size_type>
MatrixBase::local_range () const
{
#ifdef PETSC_USE_64BIT_INDICES
- unsigned int
+ size_type
MatrixBase::n_nonzero_elements () const
{
MatInfo mat_info;
= MatGetInfo (matrix, MAT_GLOBAL_SUM, &mat_info);
AssertThrow (ierr == 0, ExcPETScError(ierr));
- return static_cast<unsigned int>(mat_info.nz_used);
+ return static_cast<size_type>(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
MatInfo info;
MatGetInfo(matrix, MAT_LOCAL, &info);
- return sizeof(*this) + static_cast<unsigned int>(info.memory);
+ return sizeof(*this) + static_cast<size_type>(info.memory);
}
}
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
this->column_block_indices.reinit (n_block_columns, 0);
// and reinitialize the blocks
- for (unsigned int r=0; r<this->n_block_rows(); ++r)
- for (unsigned int c=0; c<this->n_block_cols(); ++c)
+ for (size_type r=0; r<this->n_block_rows(); ++r)
+ for (size_type c=0; c<this->n_block_cols(); ++c)
{
BlockType *p = new BlockType();
this->sub_objects[r][c] = p;
- 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)
{
- 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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric)
:
communicator (communicator)
{
template <typename SparsityType>
SparseMatrix::
- SparseMatrix (const MPI_Comm &communicator,
- const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &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<size_type> &local_rows_per_process,
+ const std::vector<size_type> &local_columns_per_process,
+ const unsigned int this_process,
+ const bool preset_nonzero_locations)
:
communicator (communicator)
{
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;
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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric)
{
this->communicator = communicator;
template <typename SparsityType>
void
SparseMatrix::
- reinit (const MPI_Comm &communicator,
- const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &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<size_type> &local_rows_per_process,
+ const std::vector<size_type> &local_columns_per_process,
+ const unsigned int this_process,
+ const bool preset_nonzero_locations)
{
this->communicator = communicator;
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));
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<unsigned int> &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<size_type> &row_lengths,
+ const bool is_symmetric)
{
Assert (local_rows <= m, ExcLocalRowsTooLarge (local_rows, m));
// MatCreateMPIAIJ throws an
// error. In this case use a
// PETScWrappers::SparseMatrix
- for (unsigned int i=0; i<row_lengths.size(); ++i)
+ for (size_type i=0; i<row_lengths.size(); ++i)
Assert(row_lengths[i]<=local_columns,
ExcIndexRange(row_lengths[i], 1, local_columns+1));
template <typename SparsityType>
void
SparseMatrix::
- do_reinit (const SparsityType &sparsity_pattern,
- const std::vector<unsigned int> &local_rows_per_process,
- const std::vector<unsigned int> &local_columns_per_process,
- const unsigned int this_process,
- const bool preset_nonzero_locations)
+ do_reinit (const SparsityType &sparsity_pattern,
+ const std::vector<size_type> &local_rows_per_process,
+ const std::vector<size_type> &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(),
// 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<this_process; ++p)
{
local_row_start += local_rows_per_process[p];
local_col_start += local_columns_per_process[p];
}
- const unsigned int
+ const size_type
local_row_end = local_row_start + local_rows_per_process[this_process];
#if DEAL_II_PETSC_VERSION_LT(2,3,3)
//at least starting from 2.3.3 (tested,
//see below)
- const unsigned int
+ const size_type
local_col_end = local_col_start + local_columns_per_process[this_process];
// then count the elements in- and
#endif
row_lengths_in_window (local_row_end - local_row_start),
row_lengths_out_of_window (local_row_end - local_row_start);
- for (unsigned int row = local_row_start; row<local_row_end; ++row)
- for (unsigned int c=0; c<sparsity_pattern.row_length(row); ++c)
+ for (size_type row = local_row_start; row<local_row_end; ++row)
+ for (size_type c=0; c<sparsity_pattern.row_length(row); ++c)
{
- const unsigned int column = sparsity_pattern.column_number(row,c);
+ const size_type column = sparsity_pattern.column_number(row,c);
if ((column >= local_col_start) &&
(column < local_col_end))
#endif
row_entries;
std::vector<PetscScalar> row_values;
- for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
+ for (size_type i=0; i<sparsity_pattern.n_rows(); ++i)
{
row_entries.resize (sparsity_pattern.row_length(i));
row_values.resize (sparsity_pattern.row_length(i), 0.0);
- for (unsigned int j=0; j<sparsity_pattern.row_length(i); ++j)
+ for (size_type j=0; j<sparsity_pattern.row_length(i); ++j)
row_entries[j] = sparsity_pattern.column_number (i,j);
const int int_row = i;
rowstart_in_window (local_row_end - local_row_start + 1, 0),
colnums_in_window;
{
- unsigned int n_cols = 0;
- for (unsigned int i=local_row_start; i<local_row_end; ++i)
+ size_type n_cols = 0;
+ for (size_type i=local_row_start; i<local_row_end; ++i)
{
- const unsigned int row_length = sparsity_pattern.row_length(i);
+ const size_type row_length = sparsity_pattern.row_length(i);
rowstart_in_window[i+1-local_row_start]
= rowstart_in_window[i-local_row_start] + row_length;
n_cols += row_length;
#endif
* ptr = & colnums_in_window[0];
- for (unsigned int i=local_row_start; i<local_row_end; ++i)
+ for (size_type i=local_row_start; i<local_row_end; ++i)
{
typename SparsityType::row_iterator
row_start = sparsity_pattern.row_begin(i),
values (sparsity_pattern.max_entries_per_row(),
1.);
- for (unsigned int i=local_row_start; i<local_row_end; ++i)
+ for (size_type i=local_row_start; i<local_row_end; ++i)
{
#ifdef PETSC_USE_64BIT_INDICES
PetscInt
template
SparseMatrix::SparseMatrix (const MPI_Comm &,
const SparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template
SparseMatrix::SparseMatrix (const MPI_Comm &,
const CompressedSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template
SparseMatrix::SparseMatrix (const MPI_Comm &,
const CompressedSimpleSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template void
SparseMatrix::reinit (const MPI_Comm &,
const SparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template void
SparseMatrix::reinit (const MPI_Comm &,
const CompressedSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template void
SparseMatrix::reinit (const MPI_Comm &,
const CompressedSimpleSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int,
const bool);
template void
SparseMatrix::do_reinit (const SparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int ,
const bool);
template void
SparseMatrix::do_reinit (const CompressedSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int ,
const bool);
template void
SparseMatrix::do_reinit (const CompressedSimpleSparsityPattern &,
- const std::vector<unsigned int> &,
- const std::vector<unsigned int> &,
+ const std::vector<size_type> &,
+ const std::vector<size_type> &,
const unsigned int ,
const bool);
- 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)
{
- 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)
{
}
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;
AssertThrow (ierr == 0, ExcPETScError(ierr));
// then copy:
- const std::pair<unsigned int, unsigned int>
+ const std::pair<size_type, size_type>
local_elements = local_range ();
std::copy (src_array + local_elements.first,
src_array + local_elements.second,
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;
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<unsigned int> ghostindices;
+ std::vector<size_type> ghostindices;
ghostnodes.fill_index_vector(ghostindices);
const PetscInt *ptr
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);
- 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<unsigned int> &row_lengths,
- const bool is_symmetric)
+ SparseMatrix::SparseMatrix (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric)
{
do_reinit (m, n, row_lengths, is_symmetric);
}
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
void
- SparseMatrix::reinit (const unsigned int m,
- const unsigned int n,
- const std::vector<unsigned int> &row_lengths,
- const bool is_symmetric)
+ SparseMatrix::reinit (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric)
{
// get rid of old matrix and generate a
// new one
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
void
- SparseMatrix::do_reinit (const unsigned int m,
- const unsigned int n,
- const std::vector<unsigned int> &row_lengths,
- const bool is_symmetric)
+ SparseMatrix::do_reinit (const size_type m,
+ const size_type n,
+ const std::vector<size_type> &row_lengths,
+ const bool is_symmetric)
{
Assert (row_lengths.size() == m,
ExcDimensionMismatch (row_lengths.size(), m));
SparseMatrix::do_reinit (const SparsityType &sparsity_pattern,
const bool preset_nonzero_locations)
{
- std::vector<unsigned int> row_lengths (sparsity_pattern.n_rows());
- for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
+ std::vector<size_type> row_lengths (sparsity_pattern.n_rows());
+ for (size_type i=0; i<sparsity_pattern.n_rows(); ++i)
row_lengths[i] = sparsity_pattern.row_length (i);
do_reinit (sparsity_pattern.n_rows(),
#endif
row_entries;
std::vector<PetscScalar> row_values;
- for (unsigned int i=0; i<sparsity_pattern.n_rows(); ++i)
+ for (size_type i=0; i<sparsity_pattern.n_rows(); ++i)
{
row_entries.resize (row_lengths[i]);
row_values.resize (row_lengths[i], 0.0);
- for (unsigned int j=0; j<row_lengths[i]; ++j)
+ for (size_type j=0; j<row_lengths[i]; ++j)
row_entries[j] = sparsity_pattern.column_number (i,j);
#ifdef PETSC_USE_64BIT_INDICES
- Vector::Vector (const unsigned int n)
+ Vector::Vector (const size_type n)
{
Vector::create_vector (n);
}
void
- Vector::reinit (const unsigned int n,
- const bool fast)
+ Vector::reinit (const size_type n,
+ const bool fast)
{
// only do something if the sizes
// mismatch
void
- Vector::create_vector (const unsigned int n)
+ Vector::create_vector (const size_type n)
{
const int ierr
= VecCreateSeq (PETSC_COMM_SELF, n, &vector);
PetscScalar value;
- if ( index>=static_cast<unsigned int>(begin)
- && index<static_cast<unsigned int>(end) )
+ if ( index>=static_cast<size_type>(begin)
+ && index<static_cast<size_type>(end) )
{
//local entry
value = *(ptr+index-begin);
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);
}
- AssertThrow ((index >= static_cast<unsigned int>(begin)) &&
- (index < static_cast<unsigned int>(end)),
+ AssertThrow ((index >= static_cast<size_type>(begin)) &&
+ (index < static_cast<size_type>(end)),
ExcAccessToNonlocalElement (index, begin, end-1));
// old version which only work with
- unsigned int
+ size_type
VectorBase::size () const
{
#ifdef PETSC_USE_64BIT_INDICES
- unsigned int
+ size_type
VectorBase::local_size () const
{
#ifdef PETSC_USE_64BIT_INDICES
- std::pair<unsigned int, unsigned int>
+ std::pair<size_type, size_type>
VectorBase::local_range () const
{
#ifdef PETSC_USE_64BIT_INDICES
void
- VectorBase::set (const std::vector<unsigned int> &indices,
+ VectorBase::set (const std::vector<size_type> &indices,
const std::vector<PetscScalar> &values)
{
Assert (indices.size() == values.size(),
void
- VectorBase::add (const std::vector<unsigned int> &indices,
+ VectorBase::add (const std::vector<size_type> &indices,
const std::vector<PetscScalar> &values)
{
Assert (indices.size() == values.size(),
void
- VectorBase::add (const std::vector<unsigned int> &indices,
+ VectorBase::add (const std::vector<size_type> &indices,
const ::dealii::Vector<PetscScalar> &values)
{
Assert (indices.size() == values.size(),
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);
}
out.setf (std::ios::fixed, std::ios::floatfield);
if (across)
- for (unsigned int i=0; i<size(); ++i)
+ for (size_type i=0; i<size(); ++i)
out << val[i] << ' ';
else
- for (unsigned int i=0; i<size(); ++i)
+ for (size_type i=0; i<size(); ++i)
out << val[i] << std::endl;
out << std::endl;
void
- VectorBase::do_set_add_operation (const unsigned int n_elements,
- const unsigned int *indices,
- const PetscScalar *values,
- const bool add_values)
+ VectorBase::do_set_add_operation (const size_type n_elements,
+ const size_type *indices,
+ const PetscScalar *values,
+ const bool add_values)
{
::dealii::VectorOperation::values action = (add_values ?
::dealii::VectorOperation::add :
{
#ifdef PETSC_USE_64BIT_INDICES
std::vector<PetscInt> petsc_ind (n_elements);
- for (unsigned int i=0; i<n_elements; ++i)
+ for (size_type i=0; i<n_elements; ++i)
petsc_ind[i] = indices[i];
const PetscInt *petsc_indices = &petsc_ind[0];
#else