From bbc6915fdfa1f3069c7cc3b0987156e1d2fbc94b Mon Sep 17 00:00:00 2001 From: bangerth Date: Fri, 4 Jun 2010 16:36:34 +0000 Subject: [PATCH] Use the proper name for a typedef and include appropriate header file. git-svn-id: https://svn.dealii.org/trunk@21151 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/block_vector_base.h | 211 ++++++++++---------- 1 file changed, 106 insertions(+), 105 deletions(-) diff --git a/deal.II/lac/include/lac/block_vector_base.h b/deal.II/lac/include/lac/block_vector_base.h index c6a50e180d..632b8d1e6f 100644 --- a/deal.II/lac/include/lac/block_vector_base.h +++ b/deal.II/lac/include/lac/block_vector_base.h @@ -24,6 +24,7 @@ #include #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -55,7 +56,7 @@ namespace internal }; - + /** * Declaration of a specialized * template of a structure which is @@ -103,7 +104,7 @@ namespace internal }; - + /** * Declaration of a specialized * template of a structure which is @@ -217,12 +218,12 @@ namespace internal */ template class Iterator : -#ifdef HAVE_STD_ITERATOR_CLASS +#ifdef HAVE_STD_ITERATOR_CLASS public std::iterator::value_type> #else random_access_iterator::value_type,int> -#endif +#endif { private: /** @@ -246,7 +247,7 @@ namespace internal typedef typename Types::value_type value_type; - + /** * Declare some typedefs which * are standard for iterators @@ -256,14 +257,14 @@ namespace internal * they work on. */ typedef std::random_access_iterator_tag iterator_type; - typedef ptrdiff_t difference_type; + typedef std::ptrdiff_t difference_type; typedef typename BlockVectorType::reference reference; typedef value_type *pointer; typedef typename Types::dereference_type dereference_type; - + /** * Typedef the type of the * block vector (which differs @@ -291,7 +292,7 @@ namespace internal */ Iterator (BlockVector &parent, const unsigned int global_index); - + /** * Copy constructor. */ @@ -323,9 +324,9 @@ namespace internal const unsigned int index_within_block, const unsigned int next_break_forward, const unsigned int next_break_backward); - + public: - + /** * Copy operator. */ @@ -348,7 +349,7 @@ namespace internal * presently pointed to. */ dereference_type operator [] (const difference_type d) const; - + /** * Prefix increment operator. This * operator advances the iterator to @@ -394,7 +395,7 @@ namespace internal * exception. */ bool operator == (const Iterator &i) const; - + /** * Same, but compare with an * iterator of different @@ -417,7 +418,7 @@ namespace internal * iterator of different * constness. */ - bool operator != (const InverseConstnessIterator &i) const; + bool operator != (const InverseConstnessIterator &i) const; /** * Check whether this @@ -437,7 +438,7 @@ namespace internal * iterator of different * constness. */ - bool operator < (const InverseConstnessIterator &i) const; + bool operator < (const InverseConstnessIterator &i) const; /** * Comparison operator alike @@ -450,7 +451,7 @@ namespace internal * iterator of different * constness. */ - bool operator <= (const InverseConstnessIterator &i) const; + bool operator <= (const InverseConstnessIterator &i) const; /** * Comparison operator alike @@ -463,7 +464,7 @@ namespace internal * iterator of different * constness. */ - bool operator > (const InverseConstnessIterator &i) const; + bool operator > (const InverseConstnessIterator &i) const; /** * Comparison operator alike @@ -497,7 +498,7 @@ namespace internal * in front of the present one. */ Iterator operator + (const difference_type &d) const; - + /** * Return an iterator which is * the given number of elements @@ -518,10 +519,10 @@ namespace internal * and return the result. */ Iterator & operator -= (const difference_type &d); - + /** @addtogroup Exceptions * @{ */ - + /** * Exception. */ @@ -530,7 +531,7 @@ namespace internal * Exception. */ DeclException0 (ExcCastingAwayConstness); - //@} + //@} private: /** * Pointer to the block @@ -585,7 +586,7 @@ namespace internal */ void move_backward (); - + #ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG /** * Mark all other instances of @@ -634,7 +635,7 @@ namespace internal * operators and reinit() functions of derived classes are responsible. This * class only handles the common part that is independent of the actual vector * type the block vector is built on. - * + * * *

Accessing individual blocks, and resizing vectors

* @@ -661,7 +662,7 @@ class BlockVectorBase : public Subscriptor * vector. */ typedef VectorType BlockType; - + /* * Declare standard types used in * all containers. These types @@ -702,7 +703,7 @@ class BlockVectorBase : public Subscriptor * norms. */ typedef typename BlockType::real_type real_type; - + /** * Default constructor. */ @@ -720,7 +721,7 @@ class BlockVectorBase : public Subscriptor * size. */ void collect_sizes (); - + /** * Call the compress() function on all * the subblocks of the matrix. @@ -732,7 +733,7 @@ class BlockVectorBase : public Subscriptor */ BlockType & block (const unsigned int i); - + /** * Read-only access to a single block. */ @@ -750,13 +751,13 @@ class BlockVectorBase : public Subscriptor * versions */ const BlockIndices & - get_block_indices () const; + get_block_indices () const; /** * Number of blocks. */ unsigned int n_blocks () const; - + /** * Return dimension of the vector. This * is the sum of the dimensions of all @@ -776,7 +777,7 @@ class BlockVectorBase : public Subscriptor * constant block vector. */ const_iterator begin () const; - + /** * Return an iterator pointing to * the element past the end. @@ -788,13 +789,13 @@ class BlockVectorBase : public Subscriptor * the element past the end of a * constant block vector. */ - const_iterator end () const; + const_iterator end () const; /** * Access components, returns U(i). */ value_type operator() (const unsigned int i) const; - + /** * Access components, returns U(i) * as a writeable reference. @@ -829,7 +830,7 @@ class BlockVectorBase : public Subscriptor */ BlockVectorBase & operator = (const VectorType &v); - + /** * Check for equality of two block vector * types. This operation is only allowed @@ -839,7 +840,7 @@ class BlockVectorBase : public Subscriptor template bool operator == (const BlockVectorBase &v) const; - + /** * $U = U * V$: scalar product. */ @@ -885,7 +886,7 @@ class BlockVectorBase : public Subscriptor * some time. */ bool all_zero () const; - + /** * Return @p true if the vector has no * negative entries, i.e. all entries are @@ -955,39 +956,39 @@ class BlockVectorBase : public Subscriptor * vector. */ void add (const value_type s); - + /** * U+=V. * Simple vector addition, equal to the * operator +=. */ void add (const BlockVectorBase& V); - + /** * U+=a*V. * Simple addition of a scaled vector. */ void add (const value_type a, const BlockVectorBase& V); - + /** * U+=a*V+b*W. * Multiple addition of scaled vectors. */ void add (const value_type a, const BlockVectorBase& V, const value_type b, const BlockVectorBase& W); - + /** * U=s*U+V. * Scaling and simple vector addition. */ void sadd (const value_type s, const BlockVectorBase& V); - + /** * U=s*U+a*V. * Scaling and simple addition. */ void sadd (const value_type s, const value_type a, const BlockVectorBase& V); - + /** * U=s*U+a*V+b*W. * Scaling and multiple addition. @@ -995,16 +996,16 @@ class BlockVectorBase : public Subscriptor void sadd (const value_type s, const value_type a, const BlockVectorBase& V, const value_type b, const BlockVectorBase& W); - + /** * U=s*U+a*V+b*W+c*X. * Scaling and multiple addition. */ void sadd (const value_type s, const value_type a, const BlockVectorBase& V, - const value_type b, const BlockVectorBase& W, + const value_type b, const BlockVectorBase& W, const value_type c, const BlockVectorBase& X); - + /** * Scale each element of the * vector by a constant @@ -1018,7 +1019,7 @@ class BlockVectorBase : public Subscriptor * given value. */ BlockVectorBase & operator /= (const value_type factor); - + /** * Multiply each element of this * vector by the corresponding @@ -1026,13 +1027,13 @@ class BlockVectorBase : public Subscriptor */ template void scale (const BlockVector2 &v); - + /** * U=a*V. Assignment. */ template void equ (const value_type a, const BlockVector2 &V); - + /** * U=a*V+b*W. * Replacing by sum. @@ -1046,7 +1047,7 @@ class BlockVectorBase : public Subscriptor * of this object. */ unsigned int memory_consumption () const; - + protected: /** * Pointer to the array of components. @@ -1073,7 +1074,7 @@ class BlockVectorBase : public Subscriptor friend class iterator; friend class const_iterator; #endif - + template friend class BlockVectorBase; }; @@ -1123,7 +1124,7 @@ namespace internal // constness. disallow this Assert (constness==true, ExcCastingAwayConstness()); } - + template @@ -1144,7 +1145,7 @@ namespace internal next_break_backward (next_break_backward) { } - + template @@ -1188,7 +1189,7 @@ namespace internal if ((global_index+d >= next_break_backward) && (global_index+d <= next_break_forward)) return parent->block(current_block)(index_within_block + d); - + // if the index is not within the // block of the block vector into // which we presently point, then @@ -1270,7 +1271,7 @@ namespace internal return (global_index == i.global_index); } - + template @@ -1296,7 +1297,7 @@ namespace internal return (global_index != i.global_index); } - + template @@ -1387,7 +1388,7 @@ namespace internal return (global_index >= i.global_index); } - + template @@ -1556,7 +1557,7 @@ namespace internal indices = parent.block_indices.global_to_local(global_index); current_block = indices.first; index_within_block = indices.second; - + next_break_backward = parent.block_indices.local_to_global (current_block, 0); next_break_forward @@ -1575,7 +1576,7 @@ namespace internal }; } - + template void @@ -1605,7 +1606,7 @@ namespace internal // away next_break_forward = numbers::invalid_unsigned_int; }; - + ++global_index; } @@ -1624,11 +1625,11 @@ namespace internal // between blocks: --current_block; index_within_block = parent->block_indices.block_size(current_block)-1; - + // break forwards is now old // break backward next_break_forward = next_break_backward-1; - + // compute new break forward next_break_backward -= parent->block_indices.block_size (current_block); @@ -1642,11 +1643,11 @@ namespace internal next_break_forward = 0; next_break_backward = 0; }; - + --global_index; } - + } // namespace BlockVectorIterators } //namespace internal @@ -1809,11 +1810,11 @@ operator * (const BlockVectorBase& v) const { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + value_type sum = 0.; for (unsigned int i=0;i::norm_sqr () const real_type sum = 0.; for (unsigned int i=0;i::mean_value () const value_type sum = 0.; for (unsigned int i=0;i::l1_norm () const real_type sum = 0.; for (unsigned int i=0;i::operator -= (const BlockVectorBase& v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i @@ -1955,7 +1956,7 @@ BlockVectorBase::add (const unsigned int n_indices, template void BlockVectorBase::add (const value_type a) { - 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)")); for (unsigned int i=0;i::add (const BlockVectorBase& v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i::add (const value_type a, const BlockVectorBase& 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 (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i::add (const value_type a, const BlockVectorBase& w) { - 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 (numbers::is_finite(b), + Assert (numbers::is_finite(b), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - - + + for (unsigned int i=0;i::sadd (const value_type x, const BlockVectorBase& 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 (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i::sadd (const value_type x, const value_type a, const BlockVectorBase& 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 (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i::sadd (const value_type x, const value_type a, const BlockVectorBase& w) { - 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 (numbers::is_finite(b), + Assert (numbers::is_finite(b), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); - + for (unsigned int i=0;i::sadd (const value_type x, const value_type a, const BlockVectorBase& y) { - 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 (numbers::is_finite(b), + Assert (numbers::is_finite(b), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); - Assert (numbers::is_finite(c), + Assert (numbers::is_finite(c), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); Assert (n_blocks() == v.n_blocks(), - ExcDimensionMismatch(n_blocks(), v.n_blocks())); + ExcDimensionMismatch(n_blocks(), v.n_blocks())); Assert (n_blocks() == w.n_blocks(), ExcDimensionMismatch(n_blocks(), w.n_blocks())); Assert (n_blocks() == y.n_blocks(), ExcDimensionMismatch(n_blocks(), y.n_blocks())); - + for (unsigned int i=0;i::equ (const value_type a, const BlockVectorBase& w) { - 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 (numbers::is_finite(b), + Assert (numbers::is_finite(b), ExcMessage("The given value is not finite but either infinite or Not A Number (NaN)")); Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); Assert (n_blocks() == w.n_blocks(), - ExcDimensionMismatch(n_blocks(), w.n_blocks())); - + ExcDimensionMismatch(n_blocks(), w.n_blocks())); + for (unsigned int i=0;i::equ (const value_type a, const BlockVector2 &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 (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i& BlockVectorBase::operator = (const value_type 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)")); for (unsigned int i=0;i::operator = (const BlockVectorBase& v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i::operator = (const BlockVectorBase &v) { Assert (n_blocks() == v.n_blocks(), ExcDimensionMismatch(n_blocks(), v.n_blocks())); - + for (unsigned int i=0;i &v) const { Assert (block_indices == v.block_indices, ExcDifferentBlockIndices()); - + for (unsigned int i=0;i & BlockVectorBase::operator *= (const value_type 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)")); for (unsigned int i=0;i & BlockVectorBase::operator /= (const value_type 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 > 0., ExcZero() ); -- 2.39.5