-
/**
* Base class for an array of indices of fixed size used for the
* @ref{TableBase} class. Actually, this class serves a dual purpose,
*
* @author Wolfgang Bangerth, 2002
*/
-template <int N>
-class TableIndicesBase
-{
- public:
- /**
- * Access the value of the
- * @p{i}th index.
- */
- unsigned int operator[] (const unsigned int i) const;
+ template <int N>
+ class TableIndicesBase
+ {
+ public:
+ /**
+ * Access the value of the
+ * @p{i}th index.
+ */
+ unsigned int operator[] (const unsigned int i) const;
- protected:
- /**
- * Store the indices in an array.
- */
- unsigned indices[N];
-};
+ protected:
+ /**
+ * Store the indices in an array.
+ */
+ unsigned indices[N];
+ };
/**
*
* @author Wolfgang Bangerth, 2002
*/
-template <int N>
-class TableIndices
-{};
+ template <int N>
+ class TableIndices
+ {
+ };
*
* @author Wolfgang Bangerth, 2002
*/
-template <>
-class TableIndices<1> : public TableIndicesBase<1>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<1> : public TableIndicesBase<1>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1);
-};
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1);
+ };
*
* @author Wolfgang Bangerth, 2002
*/
-template <>
-class TableIndices<2> : public TableIndicesBase<2>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<2> : public TableIndicesBase<2>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1,
- const unsigned int index2);
-};
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1,
+ const unsigned int index2);
+ };
*
* @author Wolfgang Bangerth, 2002
*/
-template <>
-class TableIndices<3> : public TableIndicesBase<3>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<3> : public TableIndicesBase<3>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1,
- const unsigned int index2,
- const unsigned int index3);
-};
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1,
+ const unsigned int index2,
+ const unsigned int index3);
+ };
/**
*
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
-template <>
-class TableIndices<4> : public TableIndicesBase<4>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<4> : public TableIndicesBase<4>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1,
- const unsigned int index2,
- const unsigned int index3,
- const unsigned int index4);
-};
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1,
+ const unsigned int index2,
+ const unsigned int index3,
+ const unsigned int index4);
+ };
/**
*
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
-template <>
-class TableIndices<5> : public TableIndicesBase<5>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<5> : public TableIndicesBase<5>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1,
- const unsigned int index2,
- const unsigned int index3,
- const unsigned int index4,
- const unsigned int index5);
-};
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1,
+ const unsigned int index2,
+ const unsigned int index3,
+ const unsigned int index4,
+ const unsigned int index5);
+ };
/**
*
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
-template <>
-class TableIndices<6> : public TableIndicesBase<6>
-{
- public:
- /**
- * Default constructor. Set all
- * indices to zero.
- */
- TableIndices ();
+ template <>
+ class TableIndices<6> : public TableIndicesBase<6>
+ {
+ public:
+ /**
+ * Default constructor. Set all
+ * indices to zero.
+ */
+ TableIndices ();
+
+ /**
+ * Constructor. Set indices to
+ * the given values.
+ */
+ TableIndices (const unsigned int index1,
+ const unsigned int index2,
+ const unsigned int index3,
+ const unsigned int index4,
+ const unsigned int index5,
+ const unsigned int index6);
+ };
- /**
- * Constructor. Set indices to
- * the given values.
- */
- TableIndices (const unsigned int index1,
- const unsigned int index2,
- const unsigned int index3,
- const unsigned int index4,
- const unsigned int index5,
- const unsigned int index6);
-};
+namespace internal
+{
/**
* Have a namespace in which we declare some classes that are used to
*
* @author Wolfgang Bangerth, 2002
*/
-namespace TableBaseAccessors
-{
+ namespace TableBaseAccessors
+ {
/**
* Have a class which declares some nested typedefs, depending on its
* template parameters. The general template declares nothing, but
* indicating constness of the table for which accessor objects are to
* be generated in this namespace.
*/
- template <int N, typename T, bool Constness>
- class Types
- {};
+ template <int N, typename T, bool Constness>
+ class Types
+ {};
/**
* Have a class which declares some nested typedefs, depending on its
* template parameters. Specialization for accessors to constant
* objects.
*/
- template <int N, typename T> struct Types<N,T,true>
- {
- typedef const T value_type;
- typedef const TableBase<N,T> TableType;
- };
+ template <int N, typename T> struct Types<N,T,true>
+ {
+ typedef const T value_type;
+ typedef const TableBase<N,T> TableType;
+ };
/**
* Have a class which declares some nested typedefs, depending on its
* template parameters. Specialization for accessors to non-constant
* objects.
*/
- template <int N, typename T> struct Types<N,T,false>
- {
- typedef T value_type;
- typedef TableBase<N,T> TableType;
- };
+ template <int N, typename T> struct Types<N,T,false>
+ {
+ typedef T value_type;
+ typedef TableBase<N,T> TableType;
+ };
/**
*
* @author Wolfgang Bangerth, 2002
*/
- template <int N, typename T, bool C, unsigned int P>
- class Accessor
- {
- public:
- /**
- * Import two typedefs from the
- * switch class above.
- */
- typedef typename Types<N,T,C>::value_type * pointer;
- typedef typename Types<N,T,C>::TableType TableType;
-
- private:
- /**
- * Constructor. Take a pointer
- * to the table object to know
- * about the sizes of the
- * various dimensions, and a
- * pointer to the subset of
- * data we may access.
- *
- * The constructor is made
- * private in order to prevent
- * you having such objects
- * around. The only way to
- * create such objects is via
- * the @p{Table} class, which
- * only generates them as
- * temporary objects. This
- * guarantees that the accessor
- * objects go out of scope
- * earlier than the mother
- * object, avoid problems with
- * data consistency.
- */
- Accessor (const TableType &table,
- const pointer data);
-
- /**
- * Default constructor. Not
- * needed, and invisible, so
- * private.
- */
- Accessor ();
- /**
- * Copy constructor. Not
- * needed, and invisible, so
- * private.
- */
- Accessor (const Accessor &a);
-
- public:
+ template <int N, typename T, bool C, unsigned int P>
+ class Accessor
+ {
+ public:
+ /**
+ * Import two typedefs from the
+ * switch class above.
+ */
+ typedef typename Types<N,T,C>::value_type * pointer;
+ typedef typename Types<N,T,C>::TableType TableType;
+
+ private:
+ /**
+ * Constructor. Take a pointer
+ * to the table object to know
+ * about the sizes of the
+ * various dimensions, and a
+ * pointer to the subset of
+ * data we may access.
+ *
+ * The constructor is made
+ * private in order to prevent
+ * you having such objects
+ * around. The only way to
+ * create such objects is via
+ * the @p{Table} class, which
+ * only generates them as
+ * temporary objects. This
+ * guarantees that the accessor
+ * objects go out of scope
+ * earlier than the mother
+ * object, avoid problems with
+ * data consistency.
+ */
+ Accessor (const TableType &table,
+ const pointer data);
+
+ /**
+ * Default constructor. Not
+ * needed, and invisible, so
+ * private.
+ */
+ Accessor ();
+ /**
+ * Copy constructor. Not
+ * needed, and invisible, so
+ * private.
+ */
+ Accessor (const Accessor &a);
+
+ public:
- /**
- * Index operator. Performs a
- * range check.
- */
- Accessor<N,T,C,P-1> operator [] (const unsigned int i) const;
-
- /**
- * Exception for range
- * check. Do not use global
- * exception since this way we
- * can output which index is
- * the wrong one.
- */
- DeclException3 (ExcIndexRange, int, int, int,
- << "The " << N-P+1 << "th index has a value of "
- << arg1 << " but needs to be in the range ["
- << arg2 << "," << arg3 << "[");
- private:
- /**
- * Store the data given to the
- * constructor. There are no
- * non-const member functions
- * of this class, so there is
- * no reason not to make these
- * elements constant.
- */
- const TableType &table;
- const pointer data;
-
- // declare some other classes
- // as friends. make sure to
- // work around bugs in some
- // compilers
+ /**
+ * Index operator. Performs a
+ * range check.
+ */
+ Accessor<N,T,C,P-1> operator [] (const unsigned int i) const;
+
+ /**
+ * Exception for range
+ * check. Do not use global
+ * exception since this way we
+ * can output which index is
+ * the wrong one.
+ */
+ DeclException3 (ExcIndexRange, int, int, int,
+ << "The " << N-P+1 << "th index has a value of "
+ << arg1 << " but needs to be in the range ["
+ << arg2 << "," << arg3 << "[");
+ private:
+ /**
+ * Store the data given to the
+ * constructor. There are no
+ * non-const member functions
+ * of this class, so there is
+ * no reason not to make these
+ * elements constant.
+ */
+ const TableType &table;
+ const pointer data;
+
+ // declare some other classes
+ // as friends. make sure to
+ // work around bugs in some
+ // compilers
#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG
- template <int N1, typename T1> friend class Table;
- template <int N1, typename T1, bool C1, unsigned int P1>
- friend class Accessor;
+ template <int N1, typename T1> friend class Table;
+ template <int N1, typename T1, bool C1, unsigned int P1>
+ friend class Accessor;
# ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
- friend class Table<N,T>;
- friend class Accessor<N,T,C,P+1>;
+ friend class Table<N,T>;
+ friend class Accessor<N,T,C,P+1>;
# endif
#else
- friend class Table<N,T>;
- friend class Accessor<N,T,C,P+1>;
+ friend class Table<N,T>;
+ friend class Accessor<N,T,C,P+1>;
#endif
- };
+ };
*
* @author Wolfgang Bangerth, 2002
*/
- template <int N, typename T, bool C>
- class Accessor<N,T,C,1>
- {
- public:
- /**
- * Typedef constant and
- * non-constant iterator
- * types to the elements of
- * this row, as well as all
- * the other types usually
- * required for the standard
- * library algorithms.
- */
- typedef typename Types<N,T,C>::value_type value_type;
- typedef value_type* pointer;
- typedef const value_type* const_pointer;
- typedef value_type* iterator;
- typedef const value_type* const_iterator;
- typedef value_type& reference;
- typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- /**
- * Import a typedef from the
- * switch class above.
- */
- typedef typename Types<N,T,C>::TableType TableType;
-
- private:
+ template <int N, typename T, bool C>
+ class Accessor<N,T,C,1>
+ {
+ public:
+ /**
+ * Typedef constant and
+ * non-constant iterator
+ * types to the elements of
+ * this row, as well as all
+ * the other types usually
+ * required for the standard
+ * library algorithms.
+ */
+ typedef typename Types<N,T,C>::value_type value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type* iterator;
+ typedef const value_type* const_iterator;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+
+ /**
+ * Import a typedef from the
+ * switch class above.
+ */
+ typedef typename Types<N,T,C>::TableType TableType;
+
+ private:
- /**
- * Constructor. Take a pointer
- * to the table object to know
- * about the sizes of the
- * various dimensions, and a
- * pointer to the subset of
- * data we may access (which in
- * this particular case is only
- * one row).
- *
- * The constructor is made
- * private in order to prevent
- * you having such objects
- * around. The only way to
- * create such objects is via
- * the @p{Table} class, which
- * only generates them as
- * temporary objects. This
- * guarantees that the accessor
- * objects go out of scope
- * earlier than the mother
- * object, avoid problems with
- * data consistency.
- */
- Accessor (const TableType &table,
- const pointer data);
-
- /**
- * Default constructor. Not
- * needed, and invisible, so
- * private.
- */
- Accessor ();
-
- /**
- * Copy constructor. Not
- * needed, and invisible, so
- * private.
- */
- Accessor (const Accessor &a);
-
- public:
+ /**
+ * Constructor. Take a pointer
+ * to the table object to know
+ * about the sizes of the
+ * various dimensions, and a
+ * pointer to the subset of
+ * data we may access (which in
+ * this particular case is only
+ * one row).
+ *
+ * The constructor is made
+ * private in order to prevent
+ * you having such objects
+ * around. The only way to
+ * create such objects is via
+ * the @p{Table} class, which
+ * only generates them as
+ * temporary objects. This
+ * guarantees that the accessor
+ * objects go out of scope
+ * earlier than the mother
+ * object, avoid problems with
+ * data consistency.
+ */
+ Accessor (const TableType &table,
+ const pointer data);
+
+ /**
+ * Default constructor. Not
+ * needed, and invisible, so
+ * private.
+ */
+ Accessor ();
+
+ /**
+ * Copy constructor. Not
+ * needed, and invisible, so
+ * private.
+ */
+ Accessor (const Accessor &a);
+
+ public:
- /**
- * Index operator. Performs a
- * range check.
- */
- reference operator [] (const unsigned int) const;
+ /**
+ * Index operator. Performs a
+ * range check.
+ */
+ reference operator [] (const unsigned int) const;
- /**
- * Return the length of one row,
- * i.e. the number of elements
- * corresponding to the last
- * index of the table object.
- */
- unsigned int size () const;
+ /**
+ * Return the length of one row,
+ * i.e. the number of elements
+ * corresponding to the last
+ * index of the table object.
+ */
+ unsigned int size () const;
- /**
- * Return an iterator to the
- * first element of this
- * row.
- */
- iterator begin () const;
+ /**
+ * Return an iterator to the
+ * first element of this
+ * row.
+ */
+ iterator begin () const;
- /**
- * Return an interator to the
- * element past the end of
- * this row.
- */
- iterator end () const;
+ /**
+ * Return an interator to the
+ * element past the end of
+ * this row.
+ */
+ iterator end () const;
- /**
- * Exception for range
- * check. Do not use global
- * exception since this way we
- * can output which index is
- * the wrong one.
- */
- DeclException3 (ExcIndexRange, int, int, int,
- << "The " << N << "th index has a value of "
- << arg1 << " but needs to be in the range ["
- << arg2 << "," << arg3 << "[");
- private:
- /**
- * Store the data given to the
- * constructor. There are no
- * non-const member functions
- * of this class, so there is
- * no reason not to make these
- * elements constant.
- */
- const TableType &table;
- const pointer data;
-
- // declare some other classes
- // as friends. make sure to
- // work around bugs in some
- // compilers
+ /**
+ * Exception for range
+ * check. Do not use global
+ * exception since this way we
+ * can output which index is
+ * the wrong one.
+ */
+ DeclException3 (ExcIndexRange, int, int, int,
+ << "The " << N << "th index has a value of "
+ << arg1 << " but needs to be in the range ["
+ << arg2 << "," << arg3 << "[");
+ private:
+ /**
+ * Store the data given to the
+ * constructor. There are no
+ * non-const member functions
+ * of this class, so there is
+ * no reason not to make these
+ * elements constant.
+ */
+ const TableType &table;
+ const pointer data;
+
+ // declare some other classes
+ // as friends. make sure to
+ // work around bugs in some
+ // compilers
#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG
- template <int N1, typename T1> friend class Table;
- template <int N1, typename T1, bool C1, unsigned int P1>
- friend class Accessor;
+ template <int N1, typename T1> friend class Table;
+ template <int N1, typename T1, bool C1, unsigned int P1>
+ friend class Accessor;
# ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
- friend class Table<2,T>;
- friend class Accessor<N,T,C,2>;
+ friend class Table<2,T>;
+ friend class Accessor<N,T,C,2>;
# endif
#else
- friend class Table<2,T>;
- friend class Accessor<N,T,C,2>;
+ friend class Table<2,T>;
+ friend class Accessor<N,T,C,2>;
#endif
- };
-}
+ };
+ }
+} // namespace internal
* This version of the function
* only allows read access.
*/
- TableBaseAccessors::Accessor<2,T,true,1>
+ internal::TableBaseAccessors::Accessor<2,T,true,1>
operator [] (const unsigned int i) const;
/**
* This version of the function
* allows read-write access.
*/
- TableBaseAccessors::Accessor<2,T,false,1>
+ internal::TableBaseAccessors::Accessor<2,T,false,1>
operator [] (const unsigned int i);
/**
* This version of the function
* only allows read access.
*/
- TableBaseAccessors::Accessor<3,T,true,2>
+ internal::TableBaseAccessors::Accessor<3,T,true,2>
operator [] (const unsigned int i) const;
/**
* This version of the function
* allows read-write access.
*/
- TableBaseAccessors::Accessor<3,T,false,2>
+ internal::TableBaseAccessors::Accessor<3,T,false,2>
operator [] (const unsigned int i);
/**
* This version of the function
* only allows read access.
*/
- TableBaseAccessors::Accessor<4,T,true,3>
+ internal::TableBaseAccessors::Accessor<4,T,true,3>
operator [] (const unsigned int i) const;
/**
* This version of the function
* allows read-write access.
*/
- TableBaseAccessors::Accessor<4,T,false,3>
+ internal::TableBaseAccessors::Accessor<4,T,false,3>
operator [] (const unsigned int i);
/**
* This version of the function
* only allows read access.
*/
- TableBaseAccessors::Accessor<5,T,true,4>
+ internal::TableBaseAccessors::Accessor<5,T,true,4>
operator [] (const unsigned int i) const;
/**
* This version of the function
* allows read-write access.
*/
- TableBaseAccessors::Accessor<5,T,false,4>
+ internal::TableBaseAccessors::Accessor<5,T,false,4>
operator [] (const unsigned int i);
/**
* This version of the function
* only allows read access.
*/
- TableBaseAccessors::Accessor<6,T,true,5>
+ internal::TableBaseAccessors::Accessor<6,T,true,5>
operator [] (const unsigned int i) const;
/**
* This version of the function
* allows read-write access.
*/
- TableBaseAccessors::Accessor<6,T,false,5>
+ internal::TableBaseAccessors::Accessor<6,T,false,5>
operator [] (const unsigned int i);
/**
-namespace TableBaseAccessors
+namespace internal
{
- template <int N, typename T, bool C, unsigned int P>
- inline
- Accessor<N,T,C,P>::Accessor (const TableType &table,
- const pointer data)
- :
- table (table),
- data (data)
- {}
-
-
-
- template <int N, typename T, bool C, unsigned int P>
- inline
- Accessor<N,T,C,P>::Accessor (const Accessor &)
- :
- table (*static_cast<const TableType*>(0)),
- data (0)
+ namespace TableBaseAccessors
{
- // accessor objects are only
- // temporary objects, so should
- // not need to be copied around
- Assert (false, ExcInternalError());
- }
+ template <int N, typename T, bool C, unsigned int P>
+ inline
+ Accessor<N,T,C,P>::Accessor (const TableType &table,
+ const pointer data)
+ :
+ table (table),
+ data (data)
+ {}
+
+
+
+ template <int N, typename T, bool C, unsigned int P>
+ inline
+ Accessor<N,T,C,P>::Accessor (const Accessor &)
+ :
+ table (*static_cast<const TableType*>(0)),
+ data (0)
+ {
+ // accessor objects are only
+ // temporary objects, so should
+ // not need to be copied around
+ Assert (false, ExcInternalError());
+ }
- template <int N, typename T, bool C, unsigned int P>
- inline
- Accessor<N,T,C,P>::Accessor ()
- :
- table (*static_cast<const TableType*>(0)),
- data (0)
- {
- // accessor objects are only
- // temporary objects, so should
- // not need to be copied around
- Assert (false, ExcInternalError());
- }
+ template <int N, typename T, bool C, unsigned int P>
+ inline
+ Accessor<N,T,C,P>::Accessor ()
+ :
+ table (*static_cast<const TableType*>(0)),
+ data (0)
+ {
+ // accessor objects are only
+ // temporary objects, so should
+ // not need to be copied around
+ Assert (false, ExcInternalError());
+ }
- template <int N, typename T, bool C, unsigned int P>
- inline
- Accessor<N,T,C,P-1>
- Accessor<N,T,C,P>::operator [] (const unsigned int i) const
- {
- Assert (i < table.size()[N-P],
- ExcIndexRange (i, 0, table.size()[N-P]));
-
- // access i-th
- // subobject. optimize on the
- // case i==0
- if (i==0)
- return Accessor<N,T,C,P-1> (table, data);
- else
- {
- // note: P>1, otherwise the
- // specialization would have
- // been taken!
- unsigned int subobject_size = table.size()[N-1];
- for (int p=P-1; p>1; --p)
- subobject_size *= table.size()[N-p];
- const pointer new_data = data + i*subobject_size;
- return Accessor<N,T,C,P-1> (table, new_data);
- };
- }
-
-
-
- template <int N, typename T, bool C>
- inline
- Accessor<N,T,C,1>::Accessor (const TableType &table,
- const pointer data)
- :
- table (table),
- data (data)
- {}
-
-
-
- template <int N, typename T, bool C>
- inline
- Accessor<N,T,C,1>::Accessor ()
- :
- table (*static_cast<const TableType*>(0)),
- data (0)
- {
- // accessor objects are only
- // temporary objects, so should
- // not need to be copied around
- Assert (false, ExcInternalError());
- }
+ template <int N, typename T, bool C, unsigned int P>
+ inline
+ Accessor<N,T,C,P-1>
+ Accessor<N,T,C,P>::operator [] (const unsigned int i) const
+ {
+ Assert (i < table.size()[N-P],
+ ExcIndexRange (i, 0, table.size()[N-P]));
+
+ // access i-th
+ // subobject. optimize on the
+ // case i==0
+ if (i==0)
+ return Accessor<N,T,C,P-1> (table, data);
+ else
+ {
+ // note: P>1, otherwise the
+ // specialization would have
+ // been taken!
+ unsigned int subobject_size = table.size()[N-1];
+ for (int p=P-1; p>1; --p)
+ subobject_size *= table.size()[N-p];
+ const pointer new_data = data + i*subobject_size;
+ return Accessor<N,T,C,P-1> (table, new_data);
+ };
+ }
+
+
+
+ template <int N, typename T, bool C>
+ inline
+ Accessor<N,T,C,1>::Accessor (const TableType &table,
+ const pointer data)
+ :
+ table (table),
+ data (data)
+ {}
+
+
+
+ template <int N, typename T, bool C>
+ inline
+ Accessor<N,T,C,1>::Accessor ()
+ :
+ table (*static_cast<const TableType*>(0)),
+ data (0)
+ {
+ // accessor objects are only
+ // temporary objects, so should
+ // not need to be copied around
+ Assert (false, ExcInternalError());
+ }
- template <int N, typename T, bool C>
- inline
- Accessor<N,T,C,1>::Accessor (const Accessor &)
- :
- table (*static_cast<const TableType*>(0)),
- data (0)
- {
- // accessor objects are only
- // temporary objects, so should
- // not need to be copied around
- Assert (false, ExcInternalError());
- }
+ template <int N, typename T, bool C>
+ inline
+ Accessor<N,T,C,1>::Accessor (const Accessor &)
+ :
+ table (*static_cast<const TableType*>(0)),
+ data (0)
+ {
+ // accessor objects are only
+ // temporary objects, so should
+ // not need to be copied around
+ Assert (false, ExcInternalError());
+ }
- template <int N, typename T, bool C>
- inline
- typename Accessor<N,T,C,1>::reference
- Accessor<N,T,C,1>::operator [] (const unsigned int i) const
- {
- Assert (i < table.size()[N-1],
- ExcIndexRange (i, 0, table.size()[N-1]));
- return data[i];
- }
+ template <int N, typename T, bool C>
+ inline
+ typename Accessor<N,T,C,1>::reference
+ Accessor<N,T,C,1>::operator [] (const unsigned int i) const
+ {
+ Assert (i < table.size()[N-1],
+ ExcIndexRange (i, 0, table.size()[N-1]));
+ return data[i];
+ }
- template <int N, typename T, bool C>
- inline
- unsigned int
- Accessor<N,T,C,1>::size () const
- {
- return table.size()[N-1];
- }
+ template <int N, typename T, bool C>
+ inline
+ unsigned int
+ Accessor<N,T,C,1>::size () const
+ {
+ return table.size()[N-1];
+ }
- template <int N, typename T, bool C>
- inline
- typename Accessor<N,T,C,1>::iterator
- Accessor<N,T,C,1>::begin () const
- {
- return data;
- }
+ template <int N, typename T, bool C>
+ inline
+ typename Accessor<N,T,C,1>::iterator
+ Accessor<N,T,C,1>::begin () const
+ {
+ return data;
+ }
- template <int N, typename T, bool C>
- inline
- typename Accessor<N,T,C,1>::iterator
- Accessor<N,T,C,1>::end () const
- {
- return data+table.size()[N-1];
+ template <int N, typename T, bool C>
+ inline
+ typename Accessor<N,T,C,1>::iterator
+ Accessor<N,T,C,1>::end () const
+ {
+ return data+table.size()[N-1];
+ }
}
}
template <typename T>
inline
-TableBaseAccessors::Accessor<2,T,true,1>
+internal::TableBaseAccessors::Accessor<2,T,true,1>
Table<2,T>::operator [] (const unsigned int i) const
{
Assert (i < this->table_size[0],
ExcIndexRange (i, 0, this->table_size[0]));
- return TableBaseAccessors::Accessor<2,T,true,1>(*this,
- this->val+i*n_cols());
+ return internal::TableBaseAccessors::Accessor<2,T,true,1>(*this,
+ this->val+i*n_cols());
}
template <typename T>
inline
-TableBaseAccessors::Accessor<2,T,false,1>
+internal::TableBaseAccessors::Accessor<2,T,false,1>
Table<2,T>::operator [] (const unsigned int i)
{
Assert (i < this->table_size[0],
ExcIndexRange (i, 0, this->table_size[0]));
- return TableBaseAccessors::Accessor<2,T,false,1>(*this,
- this->val+i*n_cols());
+ return internal::TableBaseAccessors::Accessor<2,T,false,1>(*this,
+ this->val+i*n_cols());
}
template <typename T>
inline
-TableBaseAccessors::Accessor<3,T,true,2>
+internal::TableBaseAccessors::Accessor<3,T,true,2>
Table<3,T>::operator [] (const unsigned int i) const
{
Assert (i < this->table_size[0],
ExcIndexRange (i, 0, this->table_size[0]));
const unsigned int subobject_size = this->table_size[1] *
this->table_size[2];
- return (TableBaseAccessors::Accessor<3,T,true,2>
+ return (internal::TableBaseAccessors::Accessor<3,T,true,2>
(*this,
this->val+i*subobject_size));
}
template <typename T>
inline
-TableBaseAccessors::Accessor<3,T,false,2>
+internal::TableBaseAccessors::Accessor<3,T,false,2>
Table<3,T>::operator [] (const unsigned int i)
{
Assert (i < this->table_size[0],
ExcIndexRange (i, 0, this->table_size[0]));
const unsigned int subobject_size = this->table_size[1] *
this->table_size[2];
- return (TableBaseAccessors::Accessor<3,T,false,2>
+ return (internal::TableBaseAccessors::Accessor<3,T,false,2>
(*this,
this->val+i*subobject_size));
}
Assert (k < this->table_size[2],
ExcIndexRange (k, 0, this->table_size[2]));
return this->val[(i*this->table_size[1]+j)
- *this->table_size[2] + k];
+ *this->table_size[2] + k];
}
Assert (k < this->table_size[2],
ExcIndexRange (k, 0, this->table_size[2]));
return this->val[(i*this->table_size[1]+j)
- *this->table_size[2] + k];
+ *this->table_size[2] + k];
}
template <typename T>
inline
-TableBaseAccessors::Accessor<4,T,true,3>
+internal::TableBaseAccessors::Accessor<4,T,true,3>
Table<4,T>::operator [] (const unsigned int i) const
{
Assert (i < this->table_size[0],
const unsigned int subobject_size = this->table_size[1] *
this->table_size[2] *
this->table_size[3];
- return (TableBaseAccessors::Accessor<4,T,true,3>
+ return (internal::TableBaseAccessors::Accessor<4,T,true,3>
(*this,
this->val+i*subobject_size));
}
template <typename T>
inline
-TableBaseAccessors::Accessor<4,T,false,3>
+internal::TableBaseAccessors::Accessor<4,T,false,3>
Table<4,T>::operator [] (const unsigned int i)
{
Assert (i < this->table_size[0],
const unsigned int subobject_size = this->table_size[1] *
this->table_size[2] *
this->table_size[3];
- return (TableBaseAccessors::Accessor<4,T,false,3>
+ return (internal::TableBaseAccessors::Accessor<4,T,false,3>
(*this,
this->val+i*subobject_size));
}
ExcIndexRange (l, 0, this->table_size[3]));
return this->val[((i*this->table_size[1]+j)
*this->table_size[2] + k)
- *this->table_size[3] + l];
+ *this->table_size[3] + l];
}
ExcIndexRange (l, 0, this->table_size[3]));
return this->val[((i*this->table_size[1]+j)
*this->table_size[2] + k)
- *this->table_size[3] + l];
+ *this->table_size[3] + l];
}
template <typename T>
inline
-TableBaseAccessors::Accessor<5,T,true,4>
+internal::TableBaseAccessors::Accessor<5,T,true,4>
Table<5,T>::operator [] (const unsigned int i) const
{
Assert (i < this->table_size[0],
this->table_size[2] *
this->table_size[3] *
this->table_size[4];
- return (TableBaseAccessors::Accessor<5,T,true,4>
+ return (internal::TableBaseAccessors::Accessor<5,T,true,4>
(*this,
this->val+i*subobject_size));
}
template <typename T>
inline
-TableBaseAccessors::Accessor<5,T,false,4>
+internal::TableBaseAccessors::Accessor<5,T,false,4>
Table<5,T>::operator [] (const unsigned int i)
{
Assert (i < this->table_size[0],
this->table_size[2] *
this->table_size[3] *
this->table_size[4];
- return (TableBaseAccessors::Accessor<5,T,false,4>
+ return (internal::TableBaseAccessors::Accessor<5,T,false,4>
(*this,
this->val+i*subobject_size));
}
return this->val[(((i*this->table_size[1]+j)
*this->table_size[2] + k)
*this->table_size[3] + l)
- *this->table_size[4] + m];
+ *this->table_size[4] + m];
}
return this->val[(((i*this->table_size[1]+j)
*this->table_size[2] + k)
*this->table_size[3] + l)
- *this->table_size[4] + m];
+ *this->table_size[4] + m];
}
template <typename T>
inline
-TableBaseAccessors::Accessor<6,T,true,5>
+internal::TableBaseAccessors::Accessor<6,T,true,5>
Table<6,T>::operator [] (const unsigned int i) const
{
Assert (i < this->table_size[0],
this->table_size[3] *
this->table_size[4] *
this->table_size[5];
- return (TableBaseAccessors::Accessor<6,T,true,5>
+ return (internal::TableBaseAccessors::Accessor<6,T,true,5>
(*this,
this->val+i*subobject_size));
}
template <typename T>
inline
-TableBaseAccessors::Accessor<6,T,false,5>
+internal::TableBaseAccessors::Accessor<6,T,false,5>
Table<6,T>::operator [] (const unsigned int i)
{
Assert (i < this->table_size[0],
this->table_size[3] *
this->table_size[4] *
this->table_size[5];
- return (TableBaseAccessors::Accessor<6,T,false,5>
+ return (internal::TableBaseAccessors::Accessor<6,T,false,5>
(*this,
this->val+i*subobject_size));
}
*this->table_size[2] + k)
*this->table_size[3] + l)
*this->table_size[4] + m)
- *this->table_size[5] + n];
+ *this->table_size[5] + n];
}
*this->table_size[2] + k)
*this->table_size[3] + l)
*this->table_size[4] + m)
- *this->table_size[5] + n];
+ *this->table_size[5] + n];
}
class BlockVector;
+namespace internal
+{
+
/**
* Namespace in which iterators in block vectors are implemented.
*
* @author Wolfgang Bangerth, 2001
*/
-namespace BlockVectorIterators
-{
- /**
- * Declaration of the general
- * template of a structure which is
- * used to determine some types
- * based on the template arguments
- * of other classes.
- */
- template <typename number, bool constness>
- struct Types
+ namespace BlockVectorIterators
{
- };
+ /**
+ * Declaration of the general
+ * template of a structure which is
+ * used to determine some types
+ * based on the template arguments
+ * of other classes.
+ */
+ template <typename number, bool constness>
+ struct Types
+ {
+ };
- /**
- * Declaration of a specialized
- * template of a structure which is
- * used to determine some types
- * based on the template arguments
- * of other classes.
- *
- * This is for the use of non-const
- * iterators.
- */
- template <typename number>
- struct Types<number,false>
- {
- /**
- * Type of the vector
- * underlying the block vector
- * used in non-const
- * iterators. There, the
- * vector must not be constant.
- */
- typedef ::Vector<number> Vector;
-
- /**
- * Type of the block vector
- * used in non-const
- * iterators. There, the block
- * vector must not be constant.
- */
- typedef ::BlockVector<number> BlockVector;
-
- /**
- * Type of the numbers we point
- * to. Here, they are not
- * constant.
- */
- typedef number NumberType;
- };
+ /**
+ * Declaration of a specialized
+ * template of a structure which is
+ * used to determine some types
+ * based on the template arguments
+ * of other classes.
+ *
+ * This is for the use of non-const
+ * iterators.
+ */
+ template <typename number>
+ struct Types<number,false>
+ {
+ /**
+ * Type of the vector
+ * underlying the block vector
+ * used in non-const
+ * iterators. There, the
+ * vector must not be constant.
+ */
+ typedef ::Vector<number> Vector;
+
+ /**
+ * Type of the block vector
+ * used in non-const
+ * iterators. There, the block
+ * vector must not be constant.
+ */
+ typedef ::BlockVector<number> BlockVector;
+
+ /**
+ * Type of the numbers we point
+ * to. Here, they are not
+ * constant.
+ */
+ typedef number NumberType;
+ };
- /**
- * Declaration of a specialized
- * template of a structure which is
- * used to determine some types
- * based on the template arguments
- * of other classes.
- *
- * This is for the use of
- * @p{const_iterator}s.
- */
- template <typename number>
- struct Types<number,true>
- {
- /**
- * Type of the vector
- * underlying the block vector
- * used in
- * @p{const_iterators}. There,
- * the vector must be
- * constant.
- */
- typedef const ::Vector<number> Vector;
-
- /**
- * Type of the block vector
- * used in
- * @p{const_iterator}s. There,
- * the block vector must be
- * constant.
- */
- typedef const ::BlockVector<number> BlockVector;
-
- /**
- * Type of the numbers we point
- * to. Here, they are constant
- * since the block vector we
- * use is constant.
- */
- typedef const number NumberType;
- };
-
-
- /**
- * General random-access iterator
- * class for block vectors. Since
- * we do not want to have two
- * classes for non-const
- * @p{iterator}s and
- * @p{const_iterator}s, we take a
- * second template argument which
- * denotes whether the vector we
- * point into is a constant object
- * or not. The first template
- * argument is always the number
- * type of the block vector in use.
- *
- * This class satisfies all
- * requirements of random access
- * iterators defined in the C++
- * standard. Operations on these
- * iterators are constant in the
- * number of elements in the block
- * vector. However, they are
- * sometimes linear in the number
- * of blocks in the vector, but
- * since that does rarely change
- * dynamically within an
- * application, this is a constant
- * and we again have that the
- * iterator satisfies the
- * requirements of a random access
- * iterator.
- *
- * The implementation of this class
- * has to work around some problems
- * in compilers and standard
- * libraries. One of these requires
- * us to write all comparison
- * operators twice, once comparison
- * with iterators of the same type
- * and once with iterators pointing
- * to numbers of opposite constness
- * specification. The reason is
- * that if we would have written
- * the comparison operators as a
- * template on the constness of the
- * right hand side, then gcc2.95
- * signals an error that these
- * operators ambiguate operators
- * declared somewhere within the
- * standard library. Likewise, we
- * have to work around some
- * problems with granting other
- * iterators friendship. This makes
- * the implementation somewhat
- * non-optimal at places, but at
- * least everything works.
- *
- * @author Wolfgang Bangerth, 2001
- */
- template <typename number, bool constness>
- class Iterator :
+ /**
+ * Declaration of a specialized
+ * template of a structure which is
+ * used to determine some types
+ * based on the template arguments
+ * of other classes.
+ *
+ * This is for the use of
+ * @p{const_iterator}s.
+ */
+ template <typename number>
+ struct Types<number,true>
+ {
+ /**
+ * Type of the vector
+ * underlying the block vector
+ * used in
+ * @p{const_iterators}. There,
+ * the vector must be
+ * constant.
+ */
+ typedef const ::Vector<number> Vector;
+
+ /**
+ * Type of the block vector
+ * used in
+ * @p{const_iterator}s. There,
+ * the block vector must be
+ * constant.
+ */
+ typedef const ::BlockVector<number> BlockVector;
+
+ /**
+ * Type of the numbers we point
+ * to. Here, they are constant
+ * since the block vector we
+ * use is constant.
+ */
+ typedef const number NumberType;
+ };
+
+
+ /**
+ * General random-access iterator
+ * class for block vectors. Since
+ * we do not want to have two
+ * classes for non-const
+ * @p{iterator}s and
+ * @p{const_iterator}s, we take a
+ * second template argument which
+ * denotes whether the vector we
+ * point into is a constant object
+ * or not. The first template
+ * argument is always the number
+ * type of the block vector in use.
+ *
+ * This class satisfies all
+ * requirements of random access
+ * iterators defined in the C++
+ * standard. Operations on these
+ * iterators are constant in the
+ * number of elements in the block
+ * vector. However, they are
+ * sometimes linear in the number
+ * of blocks in the vector, but
+ * since that does rarely change
+ * dynamically within an
+ * application, this is a constant
+ * and we again have that the
+ * iterator satisfies the
+ * requirements of a random access
+ * iterator.
+ *
+ * The implementation of this class
+ * has to work around some problems
+ * in compilers and standard
+ * libraries. One of these requires
+ * us to write all comparison
+ * operators twice, once comparison
+ * with iterators of the same type
+ * and once with iterators pointing
+ * to numbers of opposite constness
+ * specification. The reason is
+ * that if we would have written
+ * the comparison operators as a
+ * template on the constness of the
+ * right hand side, then gcc2.95
+ * signals an error that these
+ * operators ambiguate operators
+ * declared somewhere within the
+ * standard library. Likewise, we
+ * have to work around some
+ * problems with granting other
+ * iterators friendship. This makes
+ * the implementation somewhat
+ * non-optimal at places, but at
+ * least everything works.
+ *
+ * @author Wolfgang Bangerth, 2001
+ */
+ template <typename number, bool constness>
+ class Iterator :
#ifdef HAVE_STD_ITERATOR_CLASS
- public std::iterator<std::random_access_iterator_tag,
- typename Types<number,constness>::NumberType>
+ public std::iterator<std::random_access_iterator_tag,
+ typename Types<number,constness>::NumberType>
#else
- random_access_iterator<typename Types<number,constness>::NumberType,int>
+ random_access_iterator<typename Types<number,constness>::NumberType,int>
#endif
- {
- private:
- /**
- * Typedef an iterator with
- * opposite constness
- * requirements on the elements
- * it points to.
- */
- typedef Iterator<number,!constness> InverseConstnessIterator;
-
- public:
- /**
- * Declare some typedefs which
- * are standard for iterators
- * and are used by algorithms
- * to enquire about the
- * specifics of the iterators
- * they work on.
- */
- typedef std::random_access_iterator_tag iterator_type;
- typedef typename Types<number,constness>::NumberType value_type;
- typedef ptrdiff_t difference_type;
- typedef value_type &reference;
- typedef value_type *pointer;
+ {
+ private:
+ /**
+ * Typedef an iterator with
+ * opposite constness
+ * requirements on the elements
+ * it points to.
+ */
+ typedef Iterator<number,!constness> InverseConstnessIterator;
+
+ public:
+ /**
+ * Declare some typedefs which
+ * are standard for iterators
+ * and are used by algorithms
+ * to enquire about the
+ * specifics of the iterators
+ * they work on.
+ */
+ typedef std::random_access_iterator_tag iterator_type;
+ typedef typename Types<number,constness>::NumberType value_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type &reference;
+ typedef value_type *pointer;
- /**
- * Typedef the type of the
- * block vector (which differs
- * in constness, depending on
- * the second template
- * parameter).
- */
- typedef typename Types<number,constness>::BlockVector BlockVectorType;
-
- /**
- * Type of the number this
- * iterator points
- * to. Depending on the value
- * of the second template
- * parameter, this is either a
- * constant or non-const
- * number.
- */
- typedef typename Types<number,constness>::NumberType NumberType;
+ /**
+ * Typedef the type of the
+ * block vector (which differs
+ * in constness, depending on
+ * the second template
+ * parameter).
+ */
+ typedef typename Types<number,constness>::BlockVector BlockVectorType;
+
+ /**
+ * Type of the number this
+ * iterator points
+ * to. Depending on the value
+ * of the second template
+ * parameter, this is either a
+ * constant or non-const
+ * number.
+ */
+ typedef typename Types<number,constness>::NumberType NumberType;
- /**
- * Construct an iterator from
- * a vector to which we point
- * and the global index of
- * the element pointed to.
- *
- * Depending on the value of
- * the @p{constness} template
- * argument of this class,
- * the first argument of this
- * constructor is either is a
- * @p{const} or non-@p{const}
- * reference.
- */
- Iterator (BlockVectorType &parent,
- const unsigned int global_index);
+ /**
+ * Construct an iterator from
+ * a vector to which we point
+ * and the global index of
+ * the element pointed to.
+ *
+ * Depending on the value of
+ * the @p{constness} template
+ * argument of this class,
+ * the first argument of this
+ * constructor is either is a
+ * @p{const} or non-@p{const}
+ * reference.
+ */
+ Iterator (BlockVectorType &parent,
+ const unsigned int global_index);
- /**
- * Copy constructor.
- */
- Iterator (const Iterator<number,constness> &c);
-
- /**
- * Copy constructor for
- * conversion between iterators
- * with different constness
- * requirements. This
- * constructor throws an error
- * if an attempt is made at
- * converting a constant to a
- * non-constant iterator.
- */
- Iterator (const InverseConstnessIterator &c);
-
- private:
- /**
- * Constructor used internally
- * in this class. The arguments
- * match exactly the values of
- * the respective member
- * variables.
- */
- Iterator (BlockVectorType &parent,
- const unsigned int global_index,
- const unsigned int current_block,
- const unsigned int index_within_block,
- const unsigned int next_break_forward,
- const unsigned int next_break_backward);
+ /**
+ * Copy constructor.
+ */
+ Iterator (const Iterator<number,constness> &c);
+
+ /**
+ * Copy constructor for
+ * conversion between iterators
+ * with different constness
+ * requirements. This
+ * constructor throws an error
+ * if an attempt is made at
+ * converting a constant to a
+ * non-constant iterator.
+ */
+ Iterator (const InverseConstnessIterator &c);
+
+ private:
+ /**
+ * Constructor used internally
+ * in this class. The arguments
+ * match exactly the values of
+ * the respective member
+ * variables.
+ */
+ Iterator (BlockVectorType &parent,
+ const unsigned int global_index,
+ const unsigned int current_block,
+ const unsigned int index_within_block,
+ const unsigned int next_break_forward,
+ const unsigned int next_break_backward);
- public:
+ public:
- /**
- * Copy operator.
- */
- Iterator & operator = (const Iterator &c);
-
- /**
- * Dereferencing operator. If
- * the template argument
- * @p{constness} is @p{true},
- * then no writing to the
- * result is possible, making
- * this a @p{const_iterator}.
- */
- reference operator * () const;
-
- /**
- * Dereferencing operator. If
- * the template argument
- * @p{constness} is @p{true},
- * then no writing to the
- * result is possible, making
- * this a @p{const_iterator}.
- */
- pointer operator -> () const;
-
- /**
- * Random access operator,
- * grant access to arbitrary
- * elements relative to the one
- * presently pointed to.
- */
- reference operator [] (const difference_type d) const;
+ /**
+ * Copy operator.
+ */
+ Iterator & operator = (const Iterator &c);
+
+ /**
+ * Dereferencing operator. If
+ * the template argument
+ * @p{constness} is @p{true},
+ * then no writing to the
+ * result is possible, making
+ * this a @p{const_iterator}.
+ */
+ reference operator * () const;
+
+ /**
+ * Dereferencing operator. If
+ * the template argument
+ * @p{constness} is @p{true},
+ * then no writing to the
+ * result is possible, making
+ * this a @p{const_iterator}.
+ */
+ pointer operator -> () const;
+
+ /**
+ * Random access operator,
+ * grant access to arbitrary
+ * elements relative to the one
+ * presently pointed to.
+ */
+ reference operator [] (const difference_type d) const;
- /**
- * Prefix @p{++} operator:
- * @p{++i}. This operator
- * advances the iterator to
- * the next element and
- * returns a reference to
- * @p{*this}.
- */
- Iterator & operator ++ ();
-
- /**
- * Postfix @p{++} operator:
- * @p{i++}. This operator
- * advances the iterator to
- * the next element and
- * returns a copy of the old
- * value of this iterator.
- */
- Iterator operator ++ (int);
-
- /**
- * Prefix @p{--} operator:
- * @p{--i}. This operator
- * retracts the iterator to
- * the previous element and
- * returns a reference to
- * @p{*this}.
- */
- Iterator & operator -- ();
-
- /**
- * Postfix @p{--} operator:
- * @p{i--}. This operator
- * retracts the iterator to
- * the previous element and
- * returns a copy of the old
- * value of this iterator.
- */
- Iterator operator -- (int);
-
- /**
- * Compare for equality of
- * iterators. This operator
- * checks whether the vectors
- * pointed to are the same,
- * and if not it throws an
- * exception.
- */
- bool operator == (const Iterator &i) const;
+ /**
+ * Prefix @p{++} operator:
+ * @p{++i}. This operator
+ * advances the iterator to
+ * the next element and
+ * returns a reference to
+ * @p{*this}.
+ */
+ Iterator & operator ++ ();
+
+ /**
+ * Postfix @p{++} operator:
+ * @p{i++}. This operator
+ * advances the iterator to
+ * the next element and
+ * returns a copy of the old
+ * value of this iterator.
+ */
+ Iterator operator ++ (int);
+
+ /**
+ * Prefix @p{--} operator:
+ * @p{--i}. This operator
+ * retracts the iterator to
+ * the previous element and
+ * returns a reference to
+ * @p{*this}.
+ */
+ Iterator & operator -- ();
+
+ /**
+ * Postfix @p{--} operator:
+ * @p{i--}. This operator
+ * retracts the iterator to
+ * the previous element and
+ * returns a copy of the old
+ * value of this iterator.
+ */
+ Iterator operator -- (int);
+
+ /**
+ * Compare for equality of
+ * iterators. This operator
+ * checks whether the vectors
+ * pointed to are the same,
+ * and if not it throws an
+ * exception.
+ */
+ bool operator == (const Iterator &i) const;
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator == (const InverseConstnessIterator &i) const;
-
- /**
- * Compare for inequality of
- * iterators. This operator
- * checks whether the vectors
- * pointed to are the same,
- * and if not it throws an
- * exception.
- */
- bool operator != (const Iterator &i) const;
-
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator != (const InverseConstnessIterator &i) const;
-
- /**
- * Check whether this
- * iterators points to an
- * element previous to the
- * one pointed to by the
- * given argument. This
- * operator checks whether
- * the vectors pointed to are
- * the same, and if not it
- * throws an exception.
- */
- bool operator < (const Iterator &i) const;
-
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator < (const InverseConstnessIterator &i) const;
-
- /**
- * Comparison operator alike
- * to the one above.
- */
- bool operator <= (const Iterator &i) const;
-
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator <= (const InverseConstnessIterator &i) const;
-
- /**
- * Comparison operator alike
- * to the one above.
- */
- bool operator > (const Iterator &i) const;
-
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator > (const InverseConstnessIterator &i) const;
-
- /**
- * Comparison operator alike
- * to the one above.
- */
- bool operator >= (const Iterator &i) const;
-
- /**
- * Same, but compare with an
- * iterator of different
- * constness.
- */
- bool operator >= (const InverseConstnessIterator &i) const;
-
- /**
- * Return the distance between
- * the two iterators, in
- * elements.
- */
- difference_type operator - (const Iterator &i) const;
-
- /**
- * Same, but for iterators of
- * opposite constness.
- */
- difference_type operator - (const InverseConstnessIterator &i) const;
-
- /**
- * Return an iterator which is
- * the given number of elements
- * in front of the present one.
- */
- Iterator operator + (const difference_type &d) const;
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator == (const InverseConstnessIterator &i) const;
+
+ /**
+ * Compare for inequality of
+ * iterators. This operator
+ * checks whether the vectors
+ * pointed to are the same,
+ * and if not it throws an
+ * exception.
+ */
+ bool operator != (const Iterator &i) const;
+
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator != (const InverseConstnessIterator &i) const;
+
+ /**
+ * Check whether this
+ * iterators points to an
+ * element previous to the
+ * one pointed to by the
+ * given argument. This
+ * operator checks whether
+ * the vectors pointed to are
+ * the same, and if not it
+ * throws an exception.
+ */
+ bool operator < (const Iterator &i) const;
+
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator < (const InverseConstnessIterator &i) const;
+
+ /**
+ * Comparison operator alike
+ * to the one above.
+ */
+ bool operator <= (const Iterator &i) const;
+
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator <= (const InverseConstnessIterator &i) const;
+
+ /**
+ * Comparison operator alike
+ * to the one above.
+ */
+ bool operator > (const Iterator &i) const;
+
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator > (const InverseConstnessIterator &i) const;
+
+ /**
+ * Comparison operator alike
+ * to the one above.
+ */
+ bool operator >= (const Iterator &i) const;
+
+ /**
+ * Same, but compare with an
+ * iterator of different
+ * constness.
+ */
+ bool operator >= (const InverseConstnessIterator &i) const;
+
+ /**
+ * Return the distance between
+ * the two iterators, in
+ * elements.
+ */
+ difference_type operator - (const Iterator &i) const;
+
+ /**
+ * Same, but for iterators of
+ * opposite constness.
+ */
+ difference_type operator - (const InverseConstnessIterator &i) const;
+
+ /**
+ * Return an iterator which is
+ * the given number of elements
+ * in front of the present one.
+ */
+ Iterator operator + (const difference_type &d) const;
- /**
- * Return an iterator which is
- * the given number of elements
- * behind the present one.
- */
- Iterator operator - (const difference_type &d) const;
-
- /**
- * Move the iterator @p{d}
- * elements forward at once,
- * and return the result.
- */
- Iterator & operator += (const difference_type &d);
-
- /**
- * Move the iterator @p{d}
- * elements backward at once,
- * and return the result.
- */
- Iterator & operator -= (const difference_type &d);
+ /**
+ * Return an iterator which is
+ * the given number of elements
+ * behind the present one.
+ */
+ Iterator operator - (const difference_type &d) const;
+
+ /**
+ * Move the iterator @p{d}
+ * elements forward at once,
+ * and return the result.
+ */
+ Iterator & operator += (const difference_type &d);
+
+ /**
+ * Move the iterator @p{d}
+ * elements backward at once,
+ * and return the result.
+ */
+ Iterator & operator -= (const difference_type &d);
- /**
- * Exception.
- */
- DeclException0 (ExcPointerToDifferentVectors);
- /**
- * Exception.
- */
- DeclException0 (ExcCastingAwayConstness);
+ /**
+ * Exception.
+ */
+ DeclException0 (ExcPointerToDifferentVectors);
+ /**
+ * Exception.
+ */
+ DeclException0 (ExcCastingAwayConstness);
- private:
- /**
- * Pointer to the block
- * vector object to which
- * this iterator
- * points. Depending on the
- * value of the @p{constness}
- * template argument of this
- * class, this is a @p{const}
- * or non-@p{const} pointer.
- */
- BlockVectorType *parent;
-
- /**
- * Global index of the
- * element to which we
- * presently point.
- */
- unsigned int global_index;
-
- /**
- * Current block and index
- * within this block of the
- * element presently pointed
- * to.
- */
- unsigned int current_block;
- unsigned int index_within_block;
-
- /**
- * Indices of the global
- * element address at which
- * we have to move on to
- * another block when moving
- * forward and
- * backward. These indices
- * are kept as a cache since
- * this is much more
- * efficient than always
- * asking the parent object.
- */
- unsigned int next_break_forward;
- unsigned int next_break_backward;
-
- /**
- * Move forward one element.
- */
- void move_forward ();
-
- /**
- * Move backward one element.
- */
- void move_backward ();
+ private:
+ /**
+ * Pointer to the block
+ * vector object to which
+ * this iterator
+ * points. Depending on the
+ * value of the @p{constness}
+ * template argument of this
+ * class, this is a @p{const}
+ * or non-@p{const} pointer.
+ */
+ BlockVectorType *parent;
+
+ /**
+ * Global index of the
+ * element to which we
+ * presently point.
+ */
+ unsigned int global_index;
+
+ /**
+ * Current block and index
+ * within this block of the
+ * element presently pointed
+ * to.
+ */
+ unsigned int current_block;
+ unsigned int index_within_block;
+
+ /**
+ * Indices of the global
+ * element address at which
+ * we have to move on to
+ * another block when moving
+ * forward and
+ * backward. These indices
+ * are kept as a cache since
+ * this is much more
+ * efficient than always
+ * asking the parent object.
+ */
+ unsigned int next_break_forward;
+ unsigned int next_break_backward;
+
+ /**
+ * Move forward one element.
+ */
+ void move_forward ();
+
+ /**
+ * Move backward one element.
+ */
+ void move_backward ();
#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG
- /**
- * Mark all other instances of
- * this template as friends. In
- * fact, we only need the
- * inverse constness iterator
- * as friend, but this is
- * something that ISO C++ does
- * not allow to specify. If we
- * have detected a compiler bug
- * during configuration of the
- * library, use a workaround
- * that works for this
- * particular compiler, but is
- * not ISO C++ conforming.
- */
- template <typename N, bool C>
- friend class Iterator;
+ /**
+ * Mark all other instances of
+ * this template as friends. In
+ * fact, we only need the
+ * inverse constness iterator
+ * as friend, but this is
+ * something that ISO C++ does
+ * not allow to specify. If we
+ * have detected a compiler bug
+ * during configuration of the
+ * library, use a workaround
+ * that works for this
+ * particular compiler, but is
+ * not ISO C++ conforming.
+ */
+ template <typename N, bool C>
+ friend class Iterator;
#else
- friend class InverseConstnessIterator;
+ friend class InverseConstnessIterator;
#endif
- };
-}
-
-
+ };
+ } // namespace BlockVectorIterators
+} // namespace internal
/**
* A vector composed of several blocks each representing a vector of
typedef Number value_type;
typedef value_type *pointer;
typedef const value_type *const_pointer;
- typedef BlockVectorIterators::Iterator<Number,false> iterator;
- typedef BlockVectorIterators::Iterator<Number,true> const_iterator;
+ typedef internal::BlockVectorIterators::Iterator<Number,false> iterator;
+ typedef internal::BlockVectorIterators::Iterator<Number,true> const_iterator;
typedef value_type &reference;
typedef const value_type &const_reference;
typedef size_t size_type;
*/
#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG
template <typename N, bool C>
- friend class BlockVectorIterators::Iterator;
+ friend class internal::BlockVectorIterators::Iterator;
#else
friend class iterator;
friend class const_iterator;
}
-namespace BlockVectorIterators
+namespace internal
{
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness>::
- Iterator (const Iterator<number,constness> &c)
- :
- parent (c.parent),
- global_index (c.global_index),
- current_block (c.current_block),
- index_within_block (c.index_within_block),
- next_break_forward (c.next_break_forward),
- next_break_backward (c.next_break_backward)
- {}
-
-
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness>::
- Iterator (const InverseConstnessIterator &c)
- :
- parent (const_cast<BlockVectorType*>(c.parent)),
- global_index (c.global_index),
- current_block (c.current_block),
- index_within_block (c.index_within_block),
- next_break_forward (c.next_break_forward),
- next_break_backward (c.next_break_backward)
+ namespace BlockVectorIterators
{
- // if constness==false, then the
- // constness of the iterator we
- // got is true and we are trying
- // to cast away the
- // constness. disallow this
- Assert (constness==true, ExcCastingAwayConstness());
- }
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>::
+ Iterator (const Iterator<number,constness> &c)
+ :
+ parent (c.parent),
+ global_index (c.global_index),
+ current_block (c.current_block),
+ index_within_block (c.index_within_block),
+ next_break_forward (c.next_break_forward),
+ next_break_backward (c.next_break_backward)
+ {}
+
+
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>::
+ Iterator (const InverseConstnessIterator &c)
+ :
+ parent (const_cast<BlockVectorType*>(c.parent)),
+ global_index (c.global_index),
+ current_block (c.current_block),
+ index_within_block (c.index_within_block),
+ next_break_forward (c.next_break_forward),
+ next_break_backward (c.next_break_backward)
+ {
+ // if constness==false, then the
+ // constness of the iterator we
+ // got is true and we are trying
+ // to cast away the
+ // constness. disallow this
+ Assert (constness==true, ExcCastingAwayConstness());
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness>::
- Iterator (BlockVectorType &parent,
- const unsigned int global_index,
- const unsigned int current_block,
- const unsigned int index_within_block,
- const unsigned int next_break_forward,
- const unsigned int next_break_backward)
- :
- parent (&parent),
- global_index (global_index),
- current_block (current_block),
- index_within_block (index_within_block),
- next_break_forward (next_break_forward),
- next_break_backward (next_break_backward)
- {
- }
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>::
+ Iterator (BlockVectorType &parent,
+ const unsigned int global_index,
+ const unsigned int current_block,
+ const unsigned int index_within_block,
+ const unsigned int next_break_forward,
+ const unsigned int next_break_backward)
+ :
+ parent (&parent),
+ global_index (global_index),
+ current_block (current_block),
+ index_within_block (index_within_block),
+ next_break_forward (next_break_forward),
+ next_break_backward (next_break_backward)
+ {
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness> &
- Iterator<number,constness>::
- operator = (const Iterator &c)
- {
- parent = c.parent;
- global_index = c.global_index;
- index_within_block = c.index_within_block;
- current_block = c.current_block;
- next_break_forward = c.next_break_forward;
- next_break_backward = c.next_break_backward;
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness> &
+ Iterator<number,constness>::
+ operator = (const Iterator &c)
+ {
+ parent = c.parent;
+ global_index = c.global_index;
+ index_within_block = c.index_within_block;
+ current_block = c.current_block;
+ next_break_forward = c.next_break_forward;
+ next_break_backward = c.next_break_backward;
- return *this;
- }
+ return *this;
+ }
- template <typename number, bool constness>
- inline
- typename Iterator<number,constness>::reference
- Iterator<number,constness>::operator * () const
- {
- // we might want to return the
- // following directly, but if we do
- // that we run into a gcc bug where
- // it complains that we return a
- // reference to a temporary
- reference p = parent->block(current_block)(index_within_block);
- return p;
- }
+ template <typename number, bool constness>
+ inline
+ typename Iterator<number,constness>::reference
+ Iterator<number,constness>::operator * () const
+ {
+ // we might want to return the
+ // following directly, but if we do
+ // that we run into a gcc bug where
+ // it complains that we return a
+ // reference to a temporary
+ reference p = parent->block(current_block)(index_within_block);
+ return p;
+ }
- template <typename number, bool constness>
- inline
- typename Iterator<number,constness>::pointer
- Iterator<number,constness>::operator -> () const
- {
- // we might want to return the
- // following directly, but if we do
- // that we run into a gcc bug where
- // it complains that we return a
- // reference to a temporary
- reference p = parent->block(current_block)(index_within_block);
- return &p;
- }
+ template <typename number, bool constness>
+ inline
+ typename Iterator<number,constness>::pointer
+ Iterator<number,constness>::operator -> () const
+ {
+ // we might want to return the
+ // following directly, but if we do
+ // that we run into a gcc bug where
+ // it complains that we return a
+ // reference to a temporary
+ reference p = parent->block(current_block)(index_within_block);
+ return &p;
+ }
- template <typename number, bool constness>
- inline
- typename Iterator<number,constness>::reference
- Iterator<number,constness>::operator [] (const difference_type d) const
- {
- // if the index pointed to is
- // still within the block we
- // currently point into, then we
- // can save the computation of
- // the block
- if ((global_index+d >= next_break_backward) &&
- (global_index+d <= next_break_forward))
- {
- reference p = parent->block(current_block)(index_within_block + d);
- return p;
- };
+ template <typename number, bool constness>
+ inline
+ typename Iterator<number,constness>::reference
+ Iterator<number,constness>::operator [] (const difference_type d) const
+ {
+ // if the index pointed to is
+ // still within the block we
+ // currently point into, then we
+ // can save the computation of
+ // the block
+ if ((global_index+d >= next_break_backward) &&
+ (global_index+d <= next_break_forward))
+ {
+ reference p = parent->block(current_block)(index_within_block + d);
+ return p;
+ };
- // if the index is not within the
- // block of the block vector into
- // which we presently point, then
- // there is no way: we have to
- // search for the block. this can
- // be done through the parent
- // class as well.
- reference p = (*parent)(global_index+d);
- return p;
- }
-
-
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness> &
- Iterator<number,constness>::operator ++ ()
- {
- move_forward ();
- return *this;
- }
+ // if the index is not within the
+ // block of the block vector into
+ // which we presently point, then
+ // there is no way: we have to
+ // search for the block. this can
+ // be done through the parent
+ // class as well.
+ reference p = (*parent)(global_index+d);
+ return p;
+ }
+
+
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness> &
+ Iterator<number,constness>::operator ++ ()
+ {
+ move_forward ();
+ return *this;
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness>
- Iterator<number,constness>::operator ++ (int)
- {
- const Iterator old_value = *this;
- move_forward ();
- return old_value;
- }
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>
+ Iterator<number,constness>::operator ++ (int)
+ {
+ const Iterator old_value = *this;
+ move_forward ();
+ return old_value;
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness> &
- Iterator<number,constness>::operator -- ()
- {
- move_backward ();
- return *this;
- }
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness> &
+ Iterator<number,constness>::operator -- ()
+ {
+ move_backward ();
+ return *this;
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness>
- Iterator<number,constness>::operator -- (int)
- {
- const Iterator old_value = *this;
- move_backward ();
- return old_value;
- }
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>
+ Iterator<number,constness>::operator -- (int)
+ {
+ const Iterator old_value = *this;
+ move_backward ();
+ return old_value;
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator == (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator == (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index == i.global_index);
- }
+ return (global_index == i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator == (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator == (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index == i.global_index);
- }
+ return (global_index == i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator != (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator != (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index != i.global_index);
- }
+ return (global_index != i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator != (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator != (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index != i.global_index);
- }
+ return (global_index != i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator < (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator < (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index < i.global_index);
- }
+ return (global_index < i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator < (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator < (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index < i.global_index);
- }
+ return (global_index < i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator <= (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator <= (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index <= i.global_index);
- }
+ return (global_index <= i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator <= (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator <= (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index <= i.global_index);
- }
+ return (global_index <= i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator > (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator > (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index > i.global_index);
- }
+ return (global_index > i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator > (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator > (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index > i.global_index);
- }
+ return (global_index > i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator >= (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator >= (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index >= i.global_index);
- }
+ return (global_index >= i.global_index);
+ }
- template <typename number, bool constness>
- inline
- bool
- Iterator<number,constness>::operator >= (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ bool
+ Iterator<number,constness>::operator >= (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (global_index >= i.global_index);
- }
+ return (global_index >= i.global_index);
+ }
- template <typename number, bool constness>
- inline
- typename Iterator<number,constness>::difference_type
- Iterator<number,constness>::operator - (const Iterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ typename Iterator<number,constness>::difference_type
+ Iterator<number,constness>::operator - (const Iterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (static_cast<signed int>(global_index) -
- static_cast<signed int>(i.global_index));
- }
+ return (static_cast<signed int>(global_index) -
+ static_cast<signed int>(i.global_index));
+ }
- template <typename number, bool constness>
- inline
- typename Iterator<number,constness>::difference_type
- Iterator<number,constness>::operator - (const InverseConstnessIterator &i) const
- {
- Assert (parent == i.parent, ExcPointerToDifferentVectors());
+ template <typename number, bool constness>
+ inline
+ typename Iterator<number,constness>::difference_type
+ Iterator<number,constness>::operator - (const InverseConstnessIterator &i) const
+ {
+ Assert (parent == i.parent, ExcPointerToDifferentVectors());
- return (static_cast<signed int>(global_index) -
- static_cast<signed int>(i.global_index));
- }
+ return (static_cast<signed int>(global_index) -
+ static_cast<signed int>(i.global_index));
+ }
- template <typename number, bool constness>
- inline
- Iterator<number,constness>
- Iterator<number,constness>::operator + (const difference_type &d) const
- {
- // if the index pointed to is
- // still within the block we
- // currently point into, then we
- // can save the computation of
- // the block
- if ((global_index+d >= next_break_backward) &&
- (global_index+d <= next_break_forward))
- return Iterator (*parent, global_index+d, current_block,
- index_within_block+d,
- next_break_forward, next_break_backward);
- else
- // outside present block, so
- // have to seek new block
- // anyway
- return Iterator (*parent, global_index+d);
- }
-
-
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness>
- Iterator<number,constness>::operator - (const difference_type &d) const
- {
- // if the index pointed to is
- // still within the block we
- // currently point into, then we
- // can save the computation of
- // the block
- if ((global_index-d >= next_break_backward) &&
- (global_index-d <= next_break_forward))
- return Iterator (*parent, global_index-d, current_block,
- index_within_block-d,
- next_break_forward, next_break_backward);
- else
- // outside present block, so
- // have to seek new block
- // anyway
- return Iterator (*parent, global_index-d);
- }
-
-
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness> &
- Iterator<number,constness>::operator += (const difference_type &d)
- {
- // if the index pointed to is
- // still within the block we
- // currently point into, then we
- // can save the computation of
- // the block
- if ((global_index+d >= next_break_backward) &&
- (global_index+d <= next_break_forward))
- {
- global_index += d;
- index_within_block += d;
- }
- else
- // outside present block, so
- // have to seek new block
- // anyway
- *this = Iterator (*parent, global_index+d);
-
- return *this;
- }
-
-
-
- template <typename number, bool constness>
- inline
- Iterator<number,constness> &
- Iterator<number,constness>::operator -= (const difference_type &d)
- {
- // if the index pointed to is
- // still within the block we
- // currently point into, then we
- // can save the computation of
- // the block
- if ((global_index-d >= next_break_backward) &&
- (global_index-d <= next_break_forward))
- {
- global_index -= d;
- index_within_block -= d;
- }
- else
- // outside present block, so
- // have to seek new block
- // anyway
- *this = Iterator (*parent, global_index-d);
-
- return *this;
- }
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>
+ Iterator<number,constness>::operator + (const difference_type &d) const
+ {
+ // if the index pointed to is
+ // still within the block we
+ // currently point into, then we
+ // can save the computation of
+ // the block
+ if ((global_index+d >= next_break_backward) &&
+ (global_index+d <= next_break_forward))
+ return Iterator (*parent, global_index+d, current_block,
+ index_within_block+d,
+ next_break_forward, next_break_backward);
+ else
+ // outside present block, so
+ // have to seek new block
+ // anyway
+ return Iterator (*parent, global_index+d);
+ }
+
+
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness>
+ Iterator<number,constness>::operator - (const difference_type &d) const
+ {
+ // if the index pointed to is
+ // still within the block we
+ // currently point into, then we
+ // can save the computation of
+ // the block
+ if ((global_index-d >= next_break_backward) &&
+ (global_index-d <= next_break_forward))
+ return Iterator (*parent, global_index-d, current_block,
+ index_within_block-d,
+ next_break_forward, next_break_backward);
+ else
+ // outside present block, so
+ // have to seek new block
+ // anyway
+ return Iterator (*parent, global_index-d);
+ }
+
+
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness> &
+ Iterator<number,constness>::operator += (const difference_type &d)
+ {
+ // if the index pointed to is
+ // still within the block we
+ // currently point into, then we
+ // can save the computation of
+ // the block
+ if ((global_index+d >= next_break_backward) &&
+ (global_index+d <= next_break_forward))
+ {
+ global_index += d;
+ index_within_block += d;
+ }
+ else
+ // outside present block, so
+ // have to seek new block
+ // anyway
+ *this = Iterator (*parent, global_index+d);
+
+ return *this;
+ }
+
+
+
+ template <typename number, bool constness>
+ inline
+ Iterator<number,constness> &
+ Iterator<number,constness>::operator -= (const difference_type &d)
+ {
+ // if the index pointed to is
+ // still within the block we
+ // currently point into, then we
+ // can save the computation of
+ // the block
+ if ((global_index-d >= next_break_backward) &&
+ (global_index-d <= next_break_forward))
+ {
+ global_index -= d;
+ index_within_block -= d;
+ }
+ else
+ // outside present block, so
+ // have to seek new block
+ // anyway
+ *this = Iterator (*parent, global_index-d);
+
+ return *this;
+ }
-}
+ } // namespace BlockVectorIterators
+
+} //namespace internal
/**