:
iterators (i)
{}
-
+
template <typename Iterators>
inline
std::advance (std_cxx1x::get<2>(t), n);
std::advance (std_cxx1x::get<3>(t), n);
}
-
+
/**
++std_cxx1x::get<1>(t);
++std_cxx1x::get<2>(t);
}
-
+
/**
* Advance a tuple of iterators by 1.
*/
++std_cxx1x::get<2>(t);
++std_cxx1x::get<3>(t);
}
-
+
/**
return (std_cxx1x::get<0>(a.iterators) !=
std_cxx1x::get<0>(b.iterators));
}
-
+
/**
* Convert a function object of type F
p != range.end(); ++p)
apply (f, p.iterators);
}
-
+
private:
/**
* The stored function object.
return Body<F>(f);
}
}
-
+
/**
* An algorithm that performs the action
* <code>*out++ = predicate(*in++)</code>
}
-
+
namespace internal
- {
+ {
#if DEAL_II_USE_MT == 1
/**
* A class that conforms to the Body
neutral_element (r.neutral_element),
reductor (r.reductor)
{}
-
+
/**
* Join operation: merge the results
* from computations on different
{
result = reductor(result, r.result);
}
-
+
/**
* Execute the given function on the
* specified range.
* every sub-range.
*/
const Function f;
-
+
/**
* The neutral element with respect
* to the reduction operation. This
*/
const std_cxx1x::function<ResultType (ResultType, ResultType)> reductor;
};
-#endif
+#endif
}
-
+
/**
* This function works a lot like the
return reductor.result;
#endif
}
-
+
}
+namespace internal
+{
+ namespace Vector
+ {
+ /**
+ * If we do computations on vectors in
+ * parallel (say, we add two vectors to
+ * get a third, and we do the loop over
+ * all elements in parallel), then this
+ * variable determines the minimum number
+ * of elements for which it is profitable
+ * to split a range of elements any
+ * further to distribute to different
+ * threads.
+ *
+ * This variable is available as
+ * a global writable variable in
+ * order to allow the testsuite
+ * to also test the parallel
+ * case. By default, it is set to
+ * several thousand elements,
+ * which is a case that the
+ * testsuite would not normally
+ * encounter. As a consequence,
+ * in the testsuite we set it to
+ * one -- a value that's hugely
+ * unprofitable but definitely
+ * tests parallel operations.
+ */
+ extern unsigned int minimum_parallel_grain_size;
+ }
+
+
+ namespace SparseMatrix
+ {
+ /**
+ * Like
+ * internal::Vector::minimum_parallel_grain_size,
+ * but now denoting the number of rows of
+ * a matrix that should be worked on as a
+ * minimum.
+ */
+ extern unsigned int minimum_parallel_grain_size;
+ }
+}
+
DEAL_II_NAMESPACE_CLOSE
#endif
--- /dev/null
+//---------------------------------------------------------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2009 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------------------------------------------------------
+
+#include <base/parallel.h>
+
+
+DEAL_II_NAMESPACE_OPEN
+
+namespace internal
+{
+ namespace Vector
+ {
+ // set minimum grain size. this value is
+ // roughly in accordance with the curve
+ // in the TBB book (fig 3.2) that shows
+ // run time as a function of grain size
+ // -- there, values from 200 upward are
+ // so that the scheduling overhead
+ // amortizes well (for very large values
+ // in that example, the grain size is too
+ // large to split the work load into
+ // enough chunks and the problem becomes
+ // badly balanced)
+ unsigned int minimum_parallel_grain_size = 1000;
+ }
+
+
+ namespace SparseMatrix
+ {
+ // set this value to 1/5 of the value of
+ // the minimum grain size of
+ // vectors. this rests on the fact that
+ // we have to do a lot more work per row
+ // of a matrix than per element of a
+ // vector. it could possibly be reduced
+ // even further but that doesn't appear
+ // worth it any more for anything but
+ // very small matrices that we don't care
+ // that much about anyway.
+ unsigned int minimum_parallel_grain_size = 200;
+ }
+}
+
+
+
+
+DEAL_II_NAMESPACE_CLOSE
*@{
*/
-namespace internal
-{
- namespace SparseMatrix
- {
- /**
- * Like
- * internal::Vector::minimum_parallel_grain_size,
- * but now denoting the number of rows of
- * a matrix that should be worked on as a
- * minimum.
- */
- extern unsigned int minimum_parallel_grain_size;
- }
-}
namespace SparseMatrixIterators
{
// forward declaration
template <typename number, bool Constness>
class Iterator;
-
+
/**
* General template for sparse matrix
* accessors. The first template argument
* Value of this matrix entry.
*/
number value() const;
-
+
/**
* Value of this matrix entry.
*/
number& value();
-
+
/**
* Return a reference to the matrix
* into which this accessor
*/
const SparseMatrix<number>& get_matrix () const;
};
-
-
-
+
+
+
/**
* Accessor class for constant matrices,
* used in the const_iterators. This
* used here.
*/
typedef const SparseMatrix<number> MatrixType;
-
+
/**
* Constructor.
*/
Accessor (MatrixType *matrix,
const unsigned int row,
const unsigned int index);
-
+
/**
* Constructor. Construct the end
* accessor for the given matrix.
*/
Accessor (MatrixType *matrix);
-
+
/**
* Copy constructor to get from a
* non-const accessor to a const
* accessor.
*/
Accessor (const SparseMatrixIterators::Accessor<number,false> &a);
-
+
/**
* Value of this matrix entry.
*/
number value() const;
-
+
/**
* Return a reference to the matrix
* into which this accessor
* reference.
*/
MatrixType & get_matrix () const;
-
+
private:
/**
* Pointer to the matrix we use.
*/
MatrixType *matrix;
-
+
/**
* Make the advance function of the
* base class available.
*/
using SparsityPatternIterators::Accessor::advance;
-
+
/**
* Make iterator class a friend.
*/
template <typename, bool>
friend class Iterator;
};
-
-
+
+
/**
* Accessor class for non-constant
* matrices, used in the iterators. This
* The testcase oliver_01 checks that
* this actually works as intended.
*/
- class Reference
+ class Reference
{
public:
/**
* matrix we presently point to.
*/
const Reference & operator += (const number n) const;
-
+
/**
* Subtract @p n from the element
* of the matrix we presently
* point to.
*/
const Reference & operator -= (const number n) const;
-
+
/**
* Multiply the element of the
* matrix we presently point to
* by @p n.
*/
const Reference & operator *= (const number n) const;
-
+
/**
* Divide the element of the
* matrix we presently point to
* by @p n.
*/
const Reference & operator /= (const number n) const;
-
+
private:
/**
* Pointer to the accessor that
Accessor (MatrixType *matrix,
const unsigned int row,
const unsigned int index);
-
+
/**
* Constructor. Construct the end
* accessor for the given matrix.
* reference.
*/
Reference value() const;
-
+
/**
* Return a reference to the matrix
* into which this accessor
*/
template <typename, bool>
friend class Iterator;
-
+
/**
* Make the inner reference class a
* friend if the compiler has a bug
friend class Reference;
#endif
};
-
+
/**
* Constructor. Create an iterator
* into the matrix @p matrix for the
* given row and the index within it.
- */
+ */
Iterator (MatrixType *matrix,
const unsigned int row,
const unsigned int index);
* iterator for the given matrix.
*/
Iterator (MatrixType *matrix);
-
+
/**
* Conversion constructor to get from
* a non-const iterator to a const
* iterator.
*/
Iterator (const SparseMatrixIterators::Iterator<number,false> &i);
-
+
/**
* Prefix increment.
*/
* the other way round.
*/
bool operator > (const Iterator &) const;
-
+
private:
/**
* Store an object of the
*/
Accessor<number,Constness> accessor;
};
-
+
}
* norms.
*/
typedef typename numbers::NumberTraits<number>::real_type real_type;
-
+
/**
* Typedef of an STL conforming iterator
* class walking over all the nonzero
*/
static const bool zero_addition_can_be_elided = true;
};
-
+
/**
* @name Constructors and initalization.
*/
*/
SparseMatrix (const SparsityPattern &sparsity,
const IdentityMatrix &id);
-
+
/**
* Destructor. Free all memory, but do not
* release the memory of the sparsity
*/
virtual ~SparseMatrix ();
- /**
+ /**
* Copy operator. Since copying
* entire sparse matrices is a
* very expensive operation, we
*/
SparseMatrix<number> &
operator= (const IdentityMatrix &id);
-
+
/**
* This operator assigns a scalar to
* a matrix. Since this does usually
* previously tied to.
*/
virtual void clear ();
-//@}
+//@}
/**
* @name Information on the matrix
*/
* $m \times n$.
*/
unsigned int m () const;
-
+
/**
* Return the dimension of the
* range space. To remember: the
* value is greater than threshold).
*/
unsigned int n_actually_nonzero_elements (const double threshold = 0.) const;
-
+
/**
* Return a (constant) reference
* to the underlying sparsity
* MemoryConsumption.
*/
unsigned int memory_consumption () const;
-
+
//@}
/**
* @name Modifying entries
* fixed factor.
*/
SparseMatrix & operator *= (const number factor);
-
+
/**
* Divide the entire matrix by a
* fixed factor.
*/
SparseMatrix & operator /= (const number factor);
-
+
/**
* Symmetrize the matrix by
* forming the mean value between
* SparsityPattern::symmetrize().
*/
void symmetrize ();
-
+
/**
* Copy the given matrix to this
* one. The operation throws an
*/
template <typename ForwardIterator>
void copy_from (const ForwardIterator begin,
- const ForwardIterator end);
+ const ForwardIterator end);
/**
* Copy the nonzero entries of a
*/
template <typename somenumber>
void copy_from (const FullMatrix<somenumber> &matrix);
-
+
/**
* Add <tt>matrix</tt> scaled by
* <tt>factor</tt> to this matrix,
*/
template <typename somenumber>
void add (const number factor,
- const SparseMatrix<somenumber> &matrix);
-
+ const SparseMatrix<somenumber> &matrix);
+
//@}
/**
* @name Entry Access
*/
//@{
-
+
/**
* Return the value of the entry
* (<i>i,j</i>). This may be an
*/
number raw_entry (const unsigned int row,
const unsigned int index) const;
-
+
/**
* @internal @deprecated Use iterator or
* const_iterator instead!
* with BlockVector objects, you should
* consider using a BlockSparseMatrix as
* well.
- *
+ *
* Source and destination must
* not be the same vector.
*/
template <class OutVector, class InVector>
void vmult (OutVector& dst,
const InVector& src) const;
-
+
/**
* Matrix-vector multiplication:
* let <i>dst = M<sup>T</sup>*src</i> with
* with BlockVector objects, you should
* consider using a BlockSparseMatrix as
* well.
- *
+ *
* Source and destination must
* not be the same vector.
*/
template <class OutVector, class InVector>
void Tvmult (OutVector& dst,
const InVector& src) const;
-
+
/**
* Adding Matrix-vector
* multiplication. Add
* with BlockVector objects, you should
* consider using a BlockSparseMatrix as
* well.
- *
+ *
* Source and destination must
* not be the same vector.
*/
template <class OutVector, class InVector>
void vmult_add (OutVector& dst,
const InVector& src) const;
-
+
/**
* Adding Matrix-vector
* multiplication. Add
* with BlockVector objects, you should
* consider using a BlockSparseMatrix as
* well.
- *
+ *
* Source and destination must
* not be the same vector.
*/
template <class OutVector, class InVector>
void Tvmult_add (OutVector& dst,
const InVector& src) const;
-
+
/**
* Return the square of the norm
* of the vector $v$ with respect
template <typename somenumber>
somenumber matrix_scalar_product (const Vector<somenumber> &u,
const Vector<somenumber> &v) const;
-
+
/**
* Compute the residual of an
* equation <i>Mx=b</i>, where
const SparseMatrix<numberB> &B,
const Vector<numberV> &V = Vector<numberV>(),
const bool rebuild_sparsity_pattern = true) const;
-
+
/**
* Perform the matrix-matrix
* multiplication with the transpose of
const SparseMatrix<numberB> &B,
const Vector<numberV> &V = Vector<numberV>(),
const bool rebuild_sparsity_pattern = true) const;
-
+
//@}
/**
* @name Matrix norms
*/
//@{
-
+
/**
* Return the $l_1$-norm of the matrix,
* that is $|M|_1=\max_{\mathrm{all\
* @name Preconditioning methods
*/
//@{
-
+
/**
* Apply the Jacobi
* preconditioner, which
void precondition_SOR (Vector<somenumber> &dst,
const Vector<somenumber> &src,
const number om = 1.) const;
-
+
/**
* Apply transpose SOR
* preconditioning matrix to
void precondition_TSOR (Vector<somenumber> &dst,
const Vector<somenumber> &src,
const number om = 1.) const;
-
+
/**
* Perform SSOR preconditioning
* in-place. Apply the
* non-constant matrices.
*/
iterator end ();
-
+
/**
* STL-like iterator with the first entry
* of row <tt>r</tt>. This is the version
* iterator for the last row of a matrix.
*/
const_iterator end (const unsigned int r) const;
-
+
/**
* STL-like iterator with the first entry
* of row <tt>r</tt>. This is the version
*/
void print_pattern(std::ostream& out,
const double threshold = 0.) const;
-
+
/**
* Write the data of this object
* en bloc to a file. This is
* requires such an operation.
*/
void prepare_set();
-
+
private:
/**
* Pointer to the sparsity
template <typename somenumber> friend class SparseMatrix;
template <typename somenumber> friend class SparseLUDecomposition;
template <typename> friend class SparseILU;
-
+
/**
* To allow it calling private
* prepare_add() and
* prepare_set().
- */
+ */
template <typename> friend class BlockMatrixBase;
};
// Inline the set() and add()
- // functions, since they will be
+ // functions, since they will be
// called frequently.
-template <typename number>
+template <typename number>
inline
void
SparseMatrix<number>::set (const unsigned int i,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::set (const std::vector<unsigned int> &indices,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::set (const std::vector<unsigned int> &row_indices,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::set (const unsigned int row,
-template <typename number>
+template <typename number>
inline
void
SparseMatrix<number>::add (const unsigned int i,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::add (const std::vector<unsigned int> &indices,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::add (const std::vector<unsigned int> &row_indices,
-template <typename number>
-template <typename number2>
+template <typename number>
+template <typename number2>
inline
void
SparseMatrix<number>::add (const unsigned int row,
Assert (cols != 0, ExcNotInitialized());
Assert (cols->optimize_diagonal(), ExcNotQuadratic());
Assert (i<m(), ExcInvalidIndex1(i));
-
+
// Use that the first element in each
// row of a quadratic matrix is the main
// diagonal
Assert (cols != 0, ExcNotInitialized());
Assert (cols->optimize_diagonal(), ExcNotQuadratic());
Assert (i<m(), ExcInvalidIndex1(i));
-
+
// Use that the first element in each
// row of a quadratic matrix is the main
// diagonal
Assert (cols != 0, ExcNotInitialized());
Assert (j < cols->n_nonzero_elements(),
ExcIndexRange (j, 0, cols->n_nonzero_elements()));
-
+
return val[j];
}
SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()),
matrix (matrix)
{}
-
+
template <typename number>
SparsityPatternIterators::Accessor (a),
matrix (&a.get_matrix())
{}
-
+
template <typename number>
}
-
+
template <typename number>
inline
typename Accessor<number, true>::MatrixType &
}
-
+
template <typename number>
inline
Accessor<number, false>::Reference::
:
accessor (accessor)
{}
-
-
+
+
template <typename number>
inline
Accessor<number, false>::Reference::operator number() const
return accessor->matrix->raw_entry(accessor->a_row,
accessor->a_index);
}
-
-
+
+
template <typename number>
inline
const typename Accessor<number, false>::Reference &
accessor->matrix->set (accessor->row(), accessor->column(), n);
return *this;
}
-
-
+
+
template <typename number>
inline
const typename Accessor<number, false>::Reference &
static_cast<number>(*this) + n);
return *this;
}
-
-
+
+
template <typename number>
inline
const typename Accessor<number, false>::Reference &
static_cast<number>(*this)*n);
return *this;
}
-
-
+
+
template <typename number>
inline
const typename Accessor<number, false>::Reference &
static_cast<number>(*this)/n);
return *this;
}
-
-
+
+
template <typename number>
inline
Accessor<number,false>::
SparsityPatternIterators::Accessor (&matrix->get_sparsity_pattern()),
matrix (matrix)
{}
-
+
template <typename number>
-
+
template <typename number>
inline
typename Accessor<number, false>::MatrixType &
}
-
+
template <typename number, bool Constness>
inline
Iterator<number, Constness>::
:
accessor(*i)
{}
-
-
+
+
template <typename number, bool Constness>
inline
{
Assert (&accessor.get_matrix() == &other.accessor.get_matrix(),
ExcInternalError());
-
+
return (accessor < other.accessor);
}
{
return (other < *this);
}
-
+
}
template <typename> class VectorView;
-namespace internal
-{
- namespace Vector
- {
- /**
- * If we do computations on vectors in
- * parallel (say, we add two vectors to
- * get a third, and we do the loop over
- * all elements in parallel), then this
- * variable determines the minimum number
- * of elements for which it is profitable
- * to split a range of elements any
- * further to distribute to different
- * threads.
- *
- * This variable is available as a global
- * writable variable in order to allow
- * the testsuite to also test the
- * parallel case. By default, it is set
- * to several thousand elements, which is
- * a case that the testsuite would not
- * normally encounter.
- */
- extern unsigned int minimum_parallel_grain_size;
- }
-}
* @<std::complex@<long double@>@></tt>; others can be generated in
* application programs (see the section on @ref Instantiations in the
* manual).
- *
+ *
* @author Guido Kanschat, Franz-Theo Suttmeier, Wolfgang Bangerth
*/
template <typename Number>
typedef typename numbers::NumberTraits<Number>::real_type real_type;
public:
-
+
/**
- * @name 1: Basic Object-handling
+ * @name 1: Basic Object-handling
*/
//@{
/**
* dimension zero.
*/
Vector ();
-
+
/**
* Copy-constructor. Sets the dimension
* to that of the given vector, and
Vector (const Vector<Number> &v);
-#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
+#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
/**
* Copy constructor taking a vector of
* another data type. This will fail if
explicit
Vector (const Vector<OtherNumber> &v);
#endif
-
+
#ifdef DEAL_II_USE_PETSC
/**
* Another copy constructor: copy the
*/
Vector (const TrilinosWrappers::Vector &v);
#endif
-
+
/**
* Constructor. Set dimension to
* @p n and initialize all
template <typename InputIterator>
Vector (const InputIterator first,
const InputIterator last);
-
+
/**
* Destructor, deallocates
* memory. Made virtual to allow
* This function does nothing but is
* there for compatibility with the
* @p PETScWrappers::Vector class.
- *
+ *
* For the PETSc vector wrapper class,
* thios function compresses the
* underlying representation of the PETSc
* order to allow for derived
* classes to handle memory
* separately.
- */
+ */
virtual void reinit (const unsigned int N,
const bool fast=false);
-
+
/**
* Change the dimension to that of the
* vector @p V. The same applies as for
* order to allow for derived
* classes to handle memory
* separately.
- */
+ */
virtual void swap (Vector<Number> &v);
-
+
/**
* Set all components of the vector to
* the given number @p s. Simply pass
* be disallowed in the future.
*/
Vector<Number> & operator = (const Number s);
-
+
/**
* Copy the given vector. Resize the
* present vector if necessary.
*/
Vector<Number> & operator= (const Vector<Number> &c);
-
+
/**
* Copy the given vector. Resize the
* present vector if necessary.
* vector.
*/
Vector<Number> & operator= (const BlockVector<Number> &v);
-
+
#ifdef DEAL_II_USE_PETSC
/**
* Another copy operator: copy the
*/
template <typename Number2>
bool operator == (const Vector<Number2> &v) const;
-
+
/**
* Test for inequality. This function
* assumes that the present vector and
*/
template <typename Number2>
bool operator != (const Vector<Number2> &v) const;
-
+
/**
* Return the scalar product of
* two vectors. The return type
* thrown.
*/
bool is_non_negative () const;
-
+
/**
* Make the @p Vector class a bit like
* the <tt>vector<></tt> class of the C++
* Return a constant iterator pointing to
* the element past the end of the array.
*/
- const_iterator end () const;
+ const_iterator end () const;
//@}
* component.
*/
Number operator() (const unsigned int i) const;
-
+
/**
* Access the @p ith component
* as a writeable reference.
* @name 3: Modification of vectors
*/
//@{
-
+
/**
* Add the given vector to the present
* one.
* scalar and not a vector.
*/
void add (const Number s);
-
+
/**
* Simple vector addition, equal to the
* <tt>operator +=</tt>.
*/
void add (const Vector<Number> &V);
-
+
/**
* Simple addition of a multiple of a
* vector, i.e. <tt>*this += a*V</tt>.
*/
void add (const Number a, const Vector<Number> &V);
-
+
/**
* Multiple addition of scaled vectors,
* i.e. <tt>*this += a*V+b*W</tt>.
*/
void add (const Number a, const Vector<Number> &V,
const Number b, const Vector<Number> &W);
-
+
/**
* Scaling and simple vector addition,
* i.e.
*/
void sadd (const Number s,
const Vector<Number> &V);
-
+
/**
* Scaling and simple addition, i.e.
* <tt>*this = s*(*this)+a*V</tt>.
void sadd (const Number s,
const Number a,
const Vector<Number> &V);
-
+
/**
* Scaling and multiple addition.
*/
const Vector<Number> &V,
const Number b,
const Vector<Number> &W);
-
+
/**
* Scaling and multiple addition.
* <tt>*this = s*(*this)+a*V + b*W + c*X</tt>.
const Number a,
const Vector<Number> &V,
const Number b,
- const Vector<Number> &W,
+ const Vector<Number> &W,
const Number c,
const Vector<Number> &X);
-
+
/**
* Scale each element of the
* vector by the given factor.
*/
void scale (const Number factor);
-
+
/**
* Scale each element of the
* vector by a constant
* given value.
*/
Vector<Number> & operator /= (const Number factor);
-
+
/**
* Scale each element of this
* vector by the corresponding
* diagonal scaling matrix.
*/
void scale (const Vector<Number> &scaling_factors);
-
+
/**
* Scale each element of this
* vector by the corresponding
*/
template <typename Number2>
void equ (const Number a, const Vector<Number2>& u);
-
+
/**
* Assignment <tt>*this = a*u + b*v</tt>.
*/
void equ (const Number a, const Vector<Number>& u,
const Number b, const Vector<Number>& v);
-
+
/**
* Assignment <tt>*this = a*u + b*v + b*w</tt>.
*/
inline
void Vector<Number>::reinit (const unsigned int n, const bool fast)
{
- if (n==0)
+ if (n==0)
{
if (val) delete[] val;
val = 0;
max_vec_size = vec_size = 0;
return;
};
-
+
if (n>max_vec_size)
{
if (val) delete[] val;
inline
Vector<Number> & Vector<Number>::operator = (const Number s)
{
- Assert (numbers::is_finite(s),
+ Assert (numbers::is_finite(s),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
-
+
if (s != Number())
Assert (vec_size!=0, ExcEmptyObject());
if (vec_size!=0)
- parallel::apply_to_subranges (begin(), end(),
+ parallel::apply_to_subranges (begin(), end(),
std_cxx1x::bind(&std::fill<Number*,Number>,
_1, _2, s),
internal::Vector::minimum_parallel_grain_size);
template <typename Number>
inline
-typename Vector<Number>::iterator
-Vector<Number>::begin ()
+typename Vector<Number>::iterator
+Vector<Number>::begin ()
{
return &val[0];
}
template <typename Number>
inline
-typename Vector<Number>::const_iterator
-Vector<Number>::begin () const
+typename Vector<Number>::const_iterator
+Vector<Number>::begin () const
{
return &val[0];
}
template <typename Number>
inline
typename Vector<Number>::iterator
-Vector<Number>::end ()
+Vector<Number>::end ()
{
return &val[vec_size];
}
Vector<Number> & Vector<Number>::operator *= (const Number factor)
{
- Assert (numbers::is_finite(factor),
+ Assert (numbers::is_finite(factor),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
scale (factor);
Vector<Number> &
Vector<Number>::operator /= (const Number factor)
{
- Assert (numbers::is_finite(factor),
+ Assert (numbers::is_finite(factor),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
Assert (factor != Number(0.), ExcZero() );
void
Vector<Number>::scale (const Number factor)
{
- Assert (numbers::is_finite(factor),
+ Assert (numbers::is_finite(factor),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
Assert (vec_size!=0, ExcEmptyObject());
Vector<Number>::add (const Number a,
const Vector<Number>& v)
{
- Assert (numbers::is_finite(a),
+ Assert (numbers::is_finite(a),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
Assert (vec_size!=0, ExcEmptyObject());
const Number a,
const Vector<Number>& v)
{
- Assert (numbers::is_finite(x),
+ Assert (numbers::is_finite(x),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
- Assert (numbers::is_finite(a),
+ Assert (numbers::is_finite(a),
ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)"));
Assert (vec_size!=0, ExcEmptyObject());
DEAL_II_NAMESPACE_OPEN
-namespace internal
-{
- namespace SparseMatrix
- {
- // set this value to 1/5 of the value of
- // the minimum grain size of
- // vectors. this rests on the fact that
- // we have to do a lot more work per row
- // of a matrix than per element of a
- // vector. it could possibly be reduced
- // even further but that doesn't appear
- // worth it any more for anything but
- // very small matrices that we don't care
- // that much about anyway.
- unsigned int minimum_parallel_grain_size = 200;
- }
-}
-
-
#include "sparse_matrix.inst"
DEAL_II_NAMESPACE_CLOSE
DEAL_II_NAMESPACE_OPEN
-
-namespace internal
-{
- namespace Vector
- {
- // set minimum grain size. this value is
- // roughly in accordance with the curve
- // in the TBB book (fig 3.2) that shows
- // run time as a function of grain size
- // -- there, values from 200 upward are
- // so that the scheduling overhead
- // amortizes well (for very large values
- // in that example, the grain size is too
- // large to split the work load into
- // enough chunks and the problem becomes
- // badly balanced)
- unsigned int minimum_parallel_grain_size = 1000;
- }
-}
-
-
#include "vector.inst"
// do a few functions that currently don't fit the scheme because they have
#define TEMPL_COPY_CONSTRUCTOR(S1,S2) \
template Vector<S1>::Vector (const Vector<S2> &)
-#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
+#ifndef DEAL_II_EXPLICIT_CONSTRUCTOR_BUG
TEMPL_COPY_CONSTRUCTOR(double,float);
TEMPL_COPY_CONSTRUCTOR(float,double);
Vector<S1>::DEAL_II_MEMBER_OP_TEMPLATE_INST \
operator=<S2>(const Vector<S2>&); \
template void Vector<S1>::scale (const Vector<S2>&); \
- template void Vector<S1>::equ (const S1, const Vector<S2>&)
+ template void Vector<S1>::equ (const S1, const Vector<S2>&)
TEMPL_OP_EQ(double,float);
TEMPL_OP_EQ(float,double);