From c1201f7be4f6d1a846497f593ab24a41395f86b9 Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 20 Dec 2005 00:17:42 +0000 Subject: [PATCH] Merged the hp_branch to mainline. git-svn-id: https://svn.dealii.org/trunk@11887 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/dofs/dof_accessor.h | 313 ++- .../include/dofs/dof_accessor.templates.h | 873 ++++-- deal.II/deal.II/include/dofs/dof_handler.h | 338 +-- .../include/dofs/dof_iterator_selector.h | 157 ++ .../deal.II/include/dofs/dof_renumbering.h | 8 +- deal.II/deal.II/include/dofs/dof_tools.h | 115 +- deal.II/deal.II/include/dofs/hp_dof_handler.h | 1151 ++++++++ deal.II/deal.II/include/dofs/hp_dof_levels.h | 222 ++ deal.II/deal.II/include/fe/fe_collection.h | 279 ++ deal.II/deal.II/include/fe/fe_tools.h | 44 +- deal.II/deal.II/include/fe/fe_values.h | 59 +- deal.II/deal.II/include/fe/hp_fe_values.h | 476 ++++ .../deal.II/include/fe/mapping_collection.h | 129 + deal.II/deal.II/include/fe/q_collection.h | 132 + deal.II/deal.II/include/fe/select_fe_values.h | 51 + .../include/multigrid/mg_dof_accessor.h | 7 +- .../include/multigrid/mg_dof_handler.h | 2 +- .../include/multigrid/mg_transfer.templates.h | 27 +- deal.II/deal.II/include/numerics/data_out.h | 81 +- .../deal.II/include/numerics/data_out_faces.h | 15 +- .../include/numerics/data_out_rotation.h | 21 +- .../deal.II/include/numerics/data_out_stack.h | 6 +- .../numerics/derivative_approximation.h | 47 +- deal.II/deal.II/include/numerics/vectors.h | 105 +- .../include/numerics/vectors.templates.h | 211 +- deal.II/deal.II/source/dofs/dof_accessor.cc | 1026 +++++-- deal.II/deal.II/source/dofs/dof_handler.cc | 118 +- deal.II/deal.II/source/dofs/dof_levels.cc | 34 +- .../deal.II/source/dofs/dof_renumbering.cc | 32 +- deal.II/deal.II/source/dofs/dof_tools.cc | 779 ++++-- .../deal.II/source/dofs/hp_dof_accessor.cc | 210 ++ deal.II/deal.II/source/dofs/hp_dof_handler.cc | 2413 +++++++++++++++++ deal.II/deal.II/source/dofs/hp_dof_levels.cc | 44 + deal.II/deal.II/source/fe/fe_collection.cc | 67 + deal.II/deal.II/source/fe/fe_tools.cc | 204 +- deal.II/deal.II/source/fe/fe_values.cc | 114 +- deal.II/deal.II/source/fe/hp_fe_values.cc | 243 ++ .../deal.II/source/fe/mapping_collection.cc | 76 + deal.II/deal.II/source/fe/q_collection.cc | 79 + .../source/multigrid/mg_dof_accessor.cc | 179 +- .../source/multigrid/mg_dof_handler.cc | 415 ++- .../source/multigrid/mg_transfer_block.cc | 2 +- deal.II/deal.II/source/numerics/data_out.cc | 403 +-- .../deal.II/source/numerics/data_out_faces.cc | 46 +- .../source/numerics/data_out_rotation.cc | 54 +- .../deal.II/source/numerics/data_out_stack.cc | 94 +- .../numerics/derivative_approximation.cc | 162 +- deal.II/deal.II/source/numerics/matrices.cc | 33 +- deal.II/deal.II/source/numerics/vectors.cc | 71 + 49 files changed, 9772 insertions(+), 1995 deletions(-) create mode 100644 deal.II/deal.II/include/dofs/dof_iterator_selector.h create mode 100644 deal.II/deal.II/include/dofs/hp_dof_handler.h create mode 100644 deal.II/deal.II/include/dofs/hp_dof_levels.h create mode 100644 deal.II/deal.II/include/fe/fe_collection.h create mode 100644 deal.II/deal.II/include/fe/hp_fe_values.h create mode 100644 deal.II/deal.II/include/fe/mapping_collection.h create mode 100644 deal.II/deal.II/include/fe/q_collection.h create mode 100644 deal.II/deal.II/include/fe/select_fe_values.h create mode 100644 deal.II/deal.II/source/dofs/hp_dof_accessor.cc create mode 100644 deal.II/deal.II/source/dofs/hp_dof_handler.cc create mode 100644 deal.II/deal.II/source/dofs/hp_dof_levels.cc create mode 100644 deal.II/deal.II/source/fe/fe_collection.cc create mode 100644 deal.II/deal.II/source/fe/hp_fe_values.cc create mode 100644 deal.II/deal.II/source/fe/mapping_collection.cc create mode 100644 deal.II/deal.II/source/fe/q_collection.cc diff --git a/deal.II/deal.II/include/dofs/dof_accessor.h b/deal.II/deal.II/include/dofs/dof_accessor.h index 3f486b48d1..374ecda399 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.h @@ -23,13 +23,14 @@ template class SparseMatrix; template class Vector; template class DoFHandler; +template class hpDoFHandler; template class FiniteElement; -template class DoFObjectAccessor; -template class DoFObjectAccessor<0, dim>; -template class DoFObjectAccessor<1, dim>; -template class DoFObjectAccessor<2, dim>; -template class DoFObjectAccessor<3, dim>; +template class DH> class DoFObjectAccessor; +template class DH> class DoFObjectAccessor<0, dim, DH>; +template class DH> class DoFObjectAccessor<1, dim, DH>; +template class DH> class DoFObjectAccessor<2, dim, DH>; +template class DH> class DoFObjectAccessor<3, dim, DH>; template class TriaRawIterator; @@ -67,7 +68,7 @@ template class TriaRawIterator; * @ingroup Accessors * @author Wolfgang Bangerth, 1998 */ -template +template class DH> class DoFAccessor { public: @@ -86,35 +87,27 @@ class DoFAccessor * non-const, even if they preserve * constness. */ - DoFAccessor (const DoFHandler *dof_handler); + DoFAccessor (const DH *dof_handler); /** * Reset the DoF handler pointer. */ - void set_dof_handler (DoFHandler *dh); + void set_dof_handler (DH *dh); /** * Return a handle on the * DoFHandler object which we * are using. */ - const DoFHandler & + const DH & get_dof_handler () const; - /** - * Return the finite element that - * is used on the cell pointed to - * by this iterator. - */ - const FiniteElement & - get_fe () const; - /** * Copy operator. */ - DoFAccessor & - operator = (const DoFAccessor &da); - + DoFAccessor & + operator = (const DoFAccessor &da); + /** * Exception for child classes * @@ -170,7 +163,7 @@ class DoFAccessor * Store the address of the DoFHandler object * to be accessed. */ - DoFHandler *dof_handler; + DH *dof_handler; }; @@ -275,22 +268,23 @@ class DoFObjectAccessor_Inheritance * @ingroup dofs * @ingroup Accessors */ -template -class DoFObjectAccessor : public DoFAccessor, +template class DH> +class DoFObjectAccessor : public DoFAccessor, public TriaObjectAccessor { public: /** * Data type passed by the iterator class. */ - typedef DoFHandler AccessorData; + typedef DH AccessorData; /** * Declare base class as a local typedef * for simpler access. */ typedef TriaObjectAccessor BaseClass; - + + /** * Default constructor. Unused, thus * not implemented. @@ -414,19 +408,47 @@ class DoFObjectAccessor : public DoFAccessor, template void set_dof_values (const Vector &local_values, OutputVector &values) const; + + + /** + * Return the finite element that + * is used on the cell pointed to + * by this iterator. For non-hp + * DoF handlers, this is of + * course always the same + * element, independent of the + * cell we are presently on, but + * for hp DoF handlers, this may + * change from cell to cell. + */ + const FiniteElement & + get_fe () const; + + /** + * Returns the index inside the FECollection + * of the FiniteElement used for this cell. + */ + unsigned int active_fe_index () const; + + /** + * Sets the index of the FiniteElement used for + * this cell. + */ + void set_active_fe_index (const unsigned int i); + /** * Pointer to the ith line * bounding this Object. */ - TriaIterator > + TriaIterator > line (const unsigned int i) const; /** * Pointer to the ith quad * bounding this Object. */ - TriaIterator > + TriaIterator > quad (const unsigned int i) const; /** @@ -436,7 +458,7 @@ class DoFObjectAccessor : public DoFAccessor, * class returns a hex accessor without * access to the DoF data. */ - TriaIterator > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Distribute a local (cell @@ -477,7 +499,7 @@ class DoFObjectAccessor : public DoFAccessor, * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFObjectAccessor &a); + void copy_from (const DoFObjectAccessor &a); protected: /** @@ -504,9 +526,9 @@ class DoFObjectAccessor : public DoFAccessor, * Closure class. * @ingroup dofs */ -template -class DoFObjectAccessor<0, dim> : public DoFAccessor, - public DoFObjectAccessor_Inheritance<0,dim>::BaseClass +template class DH> +class DoFObjectAccessor<0, dim, DH> : public DoFAccessor, + public DoFObjectAccessor_Inheritance<0,dim>::BaseClass { public: typedef void AccessorData; @@ -555,9 +577,9 @@ class DoFObjectAccessor<0, dim> : public DoFAccessor, * @ingroup dofs * @author Wolfgang Bangerth, 1998 */ -template -class DoFObjectAccessor<1, dim> : public DoFAccessor, - public DoFObjectAccessor_Inheritance<1,dim>::BaseClass +template class DH> +class DoFObjectAccessor<1, dim, DH> : public DoFAccessor, + public DoFObjectAccessor_Inheritance<1,dim>::BaseClass { public: /** @@ -565,7 +587,7 @@ class DoFObjectAccessor<1, dim> : public DoFAccessor, * class expects to get passed from the * iterator classes. */ - typedef DoFHandler AccessorData; + typedef DH AccessorData; /** * Declare base class as a local typedef @@ -693,6 +715,33 @@ class DoFObjectAccessor<1, dim> : public DoFAccessor, void set_dof_values (const Vector &local_values, OutputVector &values) const; + + /** + * Return the finite element that + * is used on the cell pointed to + * by this iterator. For non-hp + * DoF handlers, this is of + * course always the same + * element, independent of the + * cell we are presently on, but + * for hp DoF handlers, this may + * change from cell to cell. + */ + const FiniteElement & + get_fe () const; + + /** + * Returns the index inside the FECollection + * of the FiniteElement used for this cell. + */ + unsigned int active_fe_index () const; + + /** + * Sets the index of the FiniteElement used for + * this cell. + */ + void set_active_fe_index (const unsigned int i); + /** * Return the @p ith child as a DoF line * iterator. This function is needed since @@ -700,7 +749,7 @@ class DoFObjectAccessor<1, dim> : public DoFAccessor, * class returns a line accessor without * access to the DoF data. */ - TriaIterator > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Distribute a local (cell based) vector @@ -739,18 +788,18 @@ class DoFObjectAccessor<1, dim> : public DoFAccessor, * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFObjectAccessor<1,dim> &a); + void copy_from (const DoFObjectAccessor<1,dim,DH> &a); protected: /** * Compare for equality. */ - bool operator == (const DoFObjectAccessor<1,dim> &) const; + bool operator == (const DoFObjectAccessor<1,dim,DH> &) const; /** * Compare for inequality. */ - bool operator != (const DoFObjectAccessor<1,dim> &) const; + bool operator != (const DoFObjectAccessor<1,dim,DH> &) const; /** @@ -767,9 +816,9 @@ class DoFObjectAccessor<1, dim> : public DoFAccessor, * * @ingroup dofs */ -template -class DoFObjectAccessor<2, dim> : public DoFAccessor, - public DoFObjectAccessor_Inheritance<2,dim>::BaseClass +template class DH> +class DoFObjectAccessor<2, dim, DH> : public DoFAccessor, + public DoFObjectAccessor_Inheritance<2,dim>::BaseClass { public: /** @@ -777,7 +826,7 @@ class DoFObjectAccessor<2, dim> : public DoFAccessor, * class expects to get passed from the * iterator classes. */ - typedef DoFHandler AccessorData; + typedef DH AccessorData; /** * Declare base class as a local typedef @@ -906,11 +955,38 @@ class DoFObjectAccessor<2, dim> : public DoFAccessor, void set_dof_values (const Vector &local_values, OutputVector &values) const; + + /** + * Return the finite element that + * is used on the cell pointed to + * by this iterator. For non-hp + * DoF handlers, this is of + * course always the same + * element, independent of the + * cell we are presently on, but + * for hp DoF handlers, this may + * change from cell to cell. + */ + const FiniteElement & + get_fe () const; + + /** + * Returns the index inside the FECollection + * of the FiniteElement used for this cell. + */ + unsigned int active_fe_index () const; + + /** + * Sets the index of the FiniteElement used for + * this cell. + */ + void set_active_fe_index (const unsigned int i); + /** * Return a pointer to the @p ith line * bounding this @p Quad. */ - TriaIterator > + TriaIterator > line (const unsigned int i) const; /** @@ -920,7 +996,7 @@ class DoFObjectAccessor<2, dim> : public DoFAccessor, * class returns a quad accessor without * access to the DoF data. */ - TriaIterator > + TriaIterator > child (const unsigned int) const; /** @@ -960,18 +1036,18 @@ class DoFObjectAccessor<2, dim> : public DoFAccessor, * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFObjectAccessor<2, dim> &a); + void copy_from (const DoFObjectAccessor<2, dim, DH> &a); protected: /** * Compare for equality. */ - bool operator == (const DoFObjectAccessor<2,dim> &) const; + bool operator == (const DoFObjectAccessor<2,dim,DH> &) const; /** * Compare for inequality. */ - bool operator != (const DoFObjectAccessor<2,dim> &) const; + bool operator != (const DoFObjectAccessor<2,dim,DH> &) const; /** @@ -988,9 +1064,9 @@ class DoFObjectAccessor<2, dim> : public DoFAccessor, * * @ingroup dofs */ -template -class DoFObjectAccessor<3, dim> : public DoFAccessor, - public DoFObjectAccessor_Inheritance<3,dim>::BaseClass +template class DH> +class DoFObjectAccessor<3, dim, DH> : public DoFAccessor, + public DoFObjectAccessor_Inheritance<3,dim>::BaseClass { public: /** @@ -998,7 +1074,7 @@ class DoFObjectAccessor<3, dim> : public DoFAccessor, * class expects to get passed from the * iterator classes. */ - typedef DoFHandler AccessorData; + typedef DH AccessorData; /** * Declare base class as a local typedef @@ -1127,18 +1203,45 @@ class DoFObjectAccessor<3, dim> : public DoFAccessor, void set_dof_values (const Vector &local_values, OutputVector &values) const; + + /** + * Return the finite element that + * is used on the cell pointed to + * by this iterator. For non-hp + * DoF handlers, this is of + * course always the same + * element, independent of the + * cell we are presently on, but + * for hp DoF handlers, this may + * change from cell to cell. + */ + const FiniteElement & + get_fe () const; + + /** + * Returns the index inside the FECollection + * of the FiniteElement used for this cell. + */ + unsigned int active_fe_index () const; + + /** + * Sets the index of the FiniteElement used for + * this cell. + */ + void set_active_fe_index (const unsigned int i); + /** * Return a pointer to the @p ith line * bounding this @p Hex. */ - TriaIterator > + TriaIterator > line (const unsigned int i) const; /** * Return a pointer to the @p ith quad * bounding this @p Hex. */ - TriaIterator > + TriaIterator > quad (const unsigned int i) const; /** @@ -1148,7 +1251,7 @@ class DoFObjectAccessor<3, dim> : public DoFAccessor, * class returns a hex accessor without * access to the DoF data. */ - TriaIterator > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Distribute a local (cell @@ -1189,18 +1292,18 @@ class DoFObjectAccessor<3, dim> : public DoFAccessor, * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFObjectAccessor<3, dim> &a); + void copy_from (const DoFObjectAccessor<3, dim, DH> &a); protected: /** * Compare for equality. */ - bool operator == (const DoFObjectAccessor<3,dim> &) const; + bool operator == (const DoFObjectAccessor<3,dim,DH> &) const; /** * Compare for inequality. */ - bool operator != (const DoFObjectAccessor<3,dim> &) const; + bool operator != (const DoFObjectAccessor<3,dim,DH> &) const; /** @@ -1232,8 +1335,8 @@ class DoFObjectAccessor<3, dim> : public DoFAccessor, * @ingroup dofs * @author Wolfgang Bangerth, 1998 */ -template -class DoFCellAccessor : public DoFObjectAccessor +template class DH> +class DoFCellAccessor : public DoFObjectAccessor { public: /** @@ -1242,7 +1345,7 @@ class DoFCellAccessor : public DoFObjectAccessor * get passed from the iterator * classes. */ - typedef typename DoFObjectAccessor::AccessorData AccessorData; + typedef typename DoFObjectAccessor::AccessorData AccessorData; /** * Constructor @@ -1261,7 +1364,7 @@ class DoFCellAccessor : public DoFObjectAccessor * without access to the DoF * data. */ - TriaIterator > + TriaIterator > neighbor (const unsigned int) const; /** @@ -1273,20 +1376,21 @@ class DoFCellAccessor : public DoFObjectAccessor * without access to the DoF * data. */ - TriaIterator > + TriaIterator > child (const unsigned int) const; /** * Return an iterator to the @p ith face * of this cell. * - * This function is not implemented in 1D, - * and maps to DoFObjectAccessor<2, dim>::line in 2D. + * This function is not implemented in + * 1D, and maps to DoFObjectAccessor<2, + * dim>::line in 2D. */ - TriaIterator > + TriaIterator > face (const unsigned int i) const; - /** + /** * Return the result of the * @p neighbor_child_on_subface * function of the base class, @@ -1297,7 +1401,7 @@ class DoFCellAccessor : public DoFObjectAccessor * access to the triangulation * data). */ - TriaIterator > + TriaIterator > neighbor_child_on_subface (const unsigned int face_no, const unsigned int subface_no) const; @@ -1334,7 +1438,7 @@ class DoFCellAccessor : public DoFObjectAccessor * child alone, i.e. it should * be possible to compute the * restriction by writing values - * obtained from each child + * obtained from each child * directly into the output * vector, without, for example, * computing an average over all @@ -1463,9 +1567,72 @@ class DoFCellAccessor : public DoFObjectAccessor /* -------------- declaration of explicit specializations ------------- */ -template <> TriaIterator<1, DoFObjectAccessor<0,1> > DoFCellAccessor<1>::face (const unsigned int) const; -template <> TriaIterator<2, DoFObjectAccessor<1,2> > DoFCellAccessor<2>::face (const unsigned int i) const; -template <> TriaIterator<3, DoFObjectAccessor<2,3> > DoFCellAccessor<3>::face (const unsigned int i) const; +template <> +TriaIterator<1, DoFObjectAccessor<0,1, DoFHandler> > +DoFCellAccessor<1, DoFHandler>::face (const unsigned int) const; +template <> +TriaIterator<2, DoFObjectAccessor<1,2, DoFHandler> > +DoFCellAccessor<2, DoFHandler>::face (const unsigned int i) const; +template <> +TriaIterator<3, DoFObjectAccessor<2,3, DoFHandler> > +DoFCellAccessor<3, DoFHandler>::face (const unsigned int i) const; + +template <> +const FiniteElement<1> & +DoFObjectAccessor<1,1,hpDoFHandler>::get_fe () const; +template <> +const FiniteElement<2> & +DoFObjectAccessor<1,2,hpDoFHandler>::get_fe () const; +template <> +const FiniteElement<3> & +DoFObjectAccessor<1,3,hpDoFHandler>::get_fe () const; +template <> +const FiniteElement<2> & +DoFObjectAccessor<2,2,hpDoFHandler>::get_fe () const; +template <> +const FiniteElement<3> & +DoFObjectAccessor<2,3,hpDoFHandler>::get_fe () const; +template <> +const FiniteElement<3> & +DoFObjectAccessor<3,3,hpDoFHandler>::get_fe () const; + +template <> +unsigned int +DoFObjectAccessor<1,1,hpDoFHandler>::active_fe_index () const; +template <> +unsigned int +DoFObjectAccessor<1,2,hpDoFHandler>::active_fe_index () const; +template <> +unsigned int +DoFObjectAccessor<1,3,hpDoFHandler>::active_fe_index () const; +template <> +unsigned int +DoFObjectAccessor<2,2,hpDoFHandler>::active_fe_index () const; +template <> +unsigned int +DoFObjectAccessor<2,3,hpDoFHandler>::active_fe_index () const; +template <> +unsigned int +DoFObjectAccessor<3,3,hpDoFHandler>::active_fe_index () const; + +template <> +void +DoFObjectAccessor<1,1,hpDoFHandler>::set_active_fe_index (const unsigned int i); +template <> +void +DoFObjectAccessor<1,2,hpDoFHandler>::set_active_fe_index (const unsigned int i); +template <> +void +DoFObjectAccessor<1,3,hpDoFHandler>::set_active_fe_index (const unsigned int i); +template <> +void +DoFObjectAccessor<2,2,hpDoFHandler>::set_active_fe_index (const unsigned int i); +template <> +void +DoFObjectAccessor<2,3,hpDoFHandler>::set_active_fe_index (const unsigned int i); +template <> +void +DoFObjectAccessor<3,3,hpDoFHandler>::set_active_fe_index (const unsigned int i); // include more templates diff --git a/deal.II/deal.II/include/dofs/dof_accessor.templates.h b/deal.II/deal.II/include/dofs/dof_accessor.templates.h index 982a7bcb25..22e75dd93c 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include #include #include @@ -27,8 +29,8 @@ /*------------------------- Functions: DoFAccessor ---------------------------*/ -template -DoFAccessor::DoFAccessor () +template class DH> +DoFAccessor::DoFAccessor () : dof_handler(0) { @@ -37,17 +39,17 @@ DoFAccessor::DoFAccessor () -template +template class DH> inline -DoFAccessor::DoFAccessor (const DoFHandler *dof_handler) : - dof_handler(const_cast*>(dof_handler)) +DoFAccessor::DoFAccessor (const DH *dof_handler) : + dof_handler(const_cast*>(dof_handler)) {} -template +template class DH> void -DoFAccessor::set_dof_handler (DoFHandler *dh) +DoFAccessor::set_dof_handler (DH *dh) { Assert (dh != 0, ExcInvalidObject()); dof_handler = dh; @@ -55,30 +57,19 @@ DoFAccessor::set_dof_handler (DoFHandler *dh) -template +template class DH> inline -const DoFHandler & -DoFAccessor::get_dof_handler () const +const DH & +DoFAccessor::get_dof_handler () const { - return *dof_handler; + return *this->dof_handler; } - -template -inline -const FiniteElement & -DoFAccessor::get_fe () const -{ - return *dof_handler->selected_fe; -} - - - -template +template class DH> inline -DoFAccessor & -DoFAccessor::operator = (const DoFAccessor &da) +DoFAccessor & +DoFAccessor::operator = (const DoFAccessor &da) { this->set_dof_handler (da.dof_handler); return *this; @@ -86,10 +77,10 @@ DoFAccessor::operator = (const DoFAccessor &da) -template +template class DH> inline bool -DoFAccessor::operator == (const DoFAccessor &a) const +DoFAccessor::operator == (const DoFAccessor &a) const { Assert (dof_handler == a.dof_handler, ExcCantCompareIterators()); @@ -101,10 +92,10 @@ DoFAccessor::operator == (const DoFAccessor &a) const -template +template class DH> inline bool -DoFAccessor::operator != (const DoFAccessor &a) const +DoFAccessor::operator != (const DoFAccessor &a) const { Assert (dof_handler == a.dof_handler, ExcCantCompareIterators()); @@ -123,16 +114,15 @@ DoFAccessor::operator != (const DoFAccessor &a) const /*------------------------- Functions: DoFObjectAccessor<1,dim> -----------------------*/ - -template +template class DH> inline -DoFObjectAccessor<1,dim>:: +DoFObjectAccessor<1,dim,DH>:: DoFObjectAccessor (const Triangulation *tria, const int level, const int index, const AccessorData *local_data) : - DoFAccessor (local_data), + DoFAccessor (local_data), DoFObjectAccessor_Inheritance<1,dim>::BaseClass (tria, level, index) @@ -140,10 +130,10 @@ DoFObjectAccessor (const Triangulation *tria, -template +template class DH> inline unsigned int -DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const +DoFObjectAccessor<1,dim,DH>::dof_index (const unsigned int i) const { // since the exception classes are // from a template dependent base @@ -154,7 +144,7 @@ DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); // make sure a FE has been selected @@ -168,12 +158,11 @@ DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const } - -template +template class DH> inline unsigned int -DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const +DoFObjectAccessor<1,dim,DH>::vertex_dof_index (const unsigned int vertex, + const unsigned int i) const { // since the exception classes are // from a template dependent base @@ -184,7 +173,7 @@ DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, typename BaseClass::ExcInvalidObject()); @@ -199,11 +188,10 @@ DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex, } - -template +template class DH> inline void -DoFObjectAccessor<1,dim>::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<1,dim,DH>::get_dof_indices (std::vector &dof_indices) const { // since the exception classes are // from a template dependent base @@ -214,12 +202,12 @@ DoFObjectAccessor<1,dim>::get_dof_indices (std::vector &dof_indice // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, typename BaseClass::ExcInvalidObject()); - Assert (dof_indices.size() == (2*this->dof_handler->get_fe().dofs_per_vertex + - this->dof_handler->get_fe().dofs_per_line), + Assert (dof_indices.size() == (2*this->get_fe().dofs_per_vertex + + this->get_fe().dofs_per_line), typename BaseClass::ExcVectorDoesNotMatch()); // this function really only makes @@ -231,12 +219,12 @@ DoFObjectAccessor<1,dim>::get_dof_indices (std::vector &dof_indice // not allocated for this // non-active thing Assert (!this->has_children() || - (this->dof_handler->get_fe().dofs_per_cell == - 2*this->dof_handler->get_fe().dofs_per_vertex), - typename DoFAccessor::ExcNotActive()); + (this->get_fe().dofs_per_cell == + 2*this->get_fe().dofs_per_vertex), + typename BaseClass::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line; + const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex, + dofs_per_line = this->get_fe().dofs_per_line; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d::get_dof_indices (std::vector &dof_indice -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<1,dim>::child (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<1,dim,DH>::child (const unsigned int i) const { - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); + TriaIterator > q (this->tria, + this->present_level+1, + this->child_index (i), + this->dof_handler); #ifdef DEBUG if (q.state() != IteratorState::past_the_end) @@ -266,11 +254,39 @@ DoFObjectAccessor<1,dim>::child (const unsigned int i) const -template +template class DH> +inline +const FiniteElement & +DoFObjectAccessor<1,dim,DH>::get_fe () const +{ + return *this->dof_handler->selected_fe; +} + + +template class DH> +inline +unsigned int +DoFObjectAccessor<1,dim,DH>::active_fe_index () const +{ + return 0; +} + + +template class DH> +inline +void +DoFObjectAccessor<1,dim,DH>::set_active_fe_index (const unsigned int i) +{ + typedef DoFAccessor BaseClass; + Assert (i == 0, typename BaseClass::ExcInvalidObject()); +} + + +template class DH> template inline void -DoFObjectAccessor<1, dim>:: +DoFObjectAccessor<1, dim, DH>:: distribute_local_to_global (const Vector &local_source, OutputVector &global_destination) const { @@ -283,7 +299,7 @@ distribute_local_to_global (const Vector &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -310,11 +326,11 @@ distribute_local_to_global (const Vector &local_source, -template +template class DH> template inline void -DoFObjectAccessor<1, dim>:: +DoFObjectAccessor<1, dim, DH>:: distribute_local_to_global (const FullMatrix &local_source, OutputMatrix &global_destination) const { @@ -327,7 +343,7 @@ distribute_local_to_global (const FullMatrix &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -359,10 +375,10 @@ distribute_local_to_global (const FullMatrix &local_source, -template +template class DH> inline void -DoFObjectAccessor<1,dim>::copy_from (const DoFObjectAccessor<1,dim> &a) +DoFObjectAccessor<1,dim,DH>::copy_from (const DoFObjectAccessor<1,dim,DH> &a) { BaseClass::copy_from (a); this->set_dof_handler (a.dof_handler); @@ -370,39 +386,38 @@ DoFObjectAccessor<1,dim>::copy_from (const DoFObjectAccessor<1,dim> &a) -template +template class DH> inline bool -DoFObjectAccessor<1,dim>::operator == (const DoFObjectAccessor<1,dim> &a) const +DoFObjectAccessor<1,dim,DH>::operator == (const DoFObjectAccessor<1,dim,DH> &a) const { return (TriaObjectAccessor<1,dim>::operator == (a) && - DoFAccessor::operator == (a)); + DoFAccessor::operator == (a)); } -template +template class DH> inline bool -DoFObjectAccessor<1,dim>::operator != (const DoFObjectAccessor<1,dim> &a) const +DoFObjectAccessor<1,dim,DH>::operator != (const DoFObjectAccessor<1,dim,DH> &a) const { return (TriaObjectAccessor<1,dim>::operator != (a) || - DoFAccessor::operator != (a)); + DoFAccessor::operator != (a)); } /*------------------------- Functions: DoFObjectAccessor<2,dim> -----------------------*/ -template -inline -DoFObjectAccessor<2,dim>:: +template class DH> +DoFObjectAccessor<2,dim,DH>:: DoFObjectAccessor (const Triangulation *tria, const int level, const int index, const AccessorData *local_data) : - DoFAccessor (local_data), + DoFAccessor (local_data), DoFObjectAccessor_Inheritance<2,dim>::BaseClass (tria, level, index) @@ -410,16 +425,19 @@ DoFObjectAccessor (const Triangulation *tria, -template +template class DH> inline -unsigned int DoFObjectAccessor<2,dim>::dof_index (const unsigned int i) const +unsigned int +DoFObjectAccessor<2,dim,DH>::dof_index (const unsigned int i) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (iget_fe().dofs_per_quad, ExcIndexRange (i, 0, this->get_fe().dofs_per_quad)); @@ -428,16 +446,18 @@ unsigned int DoFObjectAccessor<2,dim>::dof_index (const unsigned int i) const } -template +template class DH> inline unsigned int -DoFObjectAccessor<2,dim>::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const +DoFObjectAccessor<2,dim,DH>::vertex_dof_index (const unsigned int vertex, + const unsigned int i) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (vertex<4, ExcIndexRange (i,0,4)); Assert (iget_fe().dofs_per_vertex, ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex)); @@ -450,19 +470,21 @@ DoFObjectAccessor<2,dim>::vertex_dof_index (const unsigned int vertex, -template +template class DH> inline void -DoFObjectAccessor<2,dim>::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<2,dim,DH>::get_dof_indices (std::vector &dof_indices) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); - Assert (dof_indices.size() == (4*this->dof_handler->get_fe().dofs_per_vertex + - 4*this->dof_handler->get_fe().dofs_per_line + - this->dof_handler->get_fe().dofs_per_quad), - typename DoFAccessor::ExcVectorDoesNotMatch()); + typename BaseClass::ExcInvalidObject()); + Assert (dof_indices.size() == (4*this->get_fe().dofs_per_vertex + + 4*this->get_fe().dofs_per_line + + this->get_fe().dofs_per_quad), + typename BaseClass::ExcVectorDoesNotMatch()); // this function really only makes // sense on non-active objects if @@ -473,14 +495,14 @@ DoFObjectAccessor<2,dim>::get_dof_indices (std::vector &dof_indice // not allocated for this // non-active thing Assert (!this->has_children() || - (this->dof_handler->get_fe().dofs_per_cell == - 4*this->dof_handler->get_fe().dofs_per_vertex), - typename DoFAccessor::ExcNotActive()); + (this->get_fe().dofs_per_cell == + 4*this->get_fe().dofs_per_vertex), + typename BaseClass::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad; + const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex, + dofs_per_line = this->get_fe().dofs_per_line, + dofs_per_quad = this->get_fe().dofs_per_quad; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; d::get_dof_indices (std::vector &dof_indice } - -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<2,dim>::line (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<2,dim,DH>::line (const unsigned int i) const { Assert (i<4, ExcIndexRange (i, 0, 4)); - return TriaIterator > + return TriaIterator > ( this->tria, this->present_level, @@ -511,13 +532,12 @@ DoFObjectAccessor<2,dim>::line (const unsigned int i) const } - -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<2,dim>::child (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<2,dim,DH>::child (const unsigned int i) const { - TriaIterator > q (this->tria, + TriaIterator > q (this->tria, this->present_level+1, this->child_index (i), this->dof_handler); @@ -530,12 +550,40 @@ DoFObjectAccessor<2,dim>::child (const unsigned int i) const } +template class DH> +inline +const FiniteElement & +DoFObjectAccessor<2,dim,DH>::get_fe () const +{ + return *this->dof_handler->selected_fe; +} + + +template class DH> +inline +unsigned int +DoFObjectAccessor<2,dim,DH>::active_fe_index () const +{ + return 0; +} + + +template class DH> +inline +void +DoFObjectAccessor<2,dim,DH>::set_active_fe_index (const unsigned int i) +{ + typedef DoFAccessor BaseClass; + Assert (i == 0, typename BaseClass::ExcInvalidObject()); +} + + -template +template class DH> template inline void -DoFObjectAccessor<2, dim>:: +DoFObjectAccessor<2, dim, DH>:: distribute_local_to_global (const Vector &local_source, OutputVector &global_destination) const { @@ -548,7 +596,7 @@ distribute_local_to_global (const Vector &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -576,11 +624,11 @@ distribute_local_to_global (const Vector &local_source, -template +template class DH> template inline void -DoFObjectAccessor<2, dim>:: +DoFObjectAccessor<2, dim, DH>:: distribute_local_to_global (const FullMatrix &local_source, OutputMatrix &global_destination) const { @@ -593,7 +641,7 @@ distribute_local_to_global (const FullMatrix &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -626,10 +674,10 @@ distribute_local_to_global (const FullMatrix &local_source, -template +template class DH> inline void -DoFObjectAccessor<2,dim>::copy_from (const DoFObjectAccessor<2,dim> &a) +DoFObjectAccessor<2,dim,DH>::copy_from (const DoFObjectAccessor<2,dim,DH> &a) { BaseClass::copy_from (a); this->set_dof_handler (a.dof_handler); @@ -637,41 +685,40 @@ DoFObjectAccessor<2,dim>::copy_from (const DoFObjectAccessor<2,dim> &a) -template +template class DH> inline bool -DoFObjectAccessor<2,dim>::operator == (const DoFObjectAccessor<2,dim> &a) const +DoFObjectAccessor<2,dim,DH>::operator == (const DoFObjectAccessor<2,dim,DH> &a) const { return (TriaObjectAccessor<2,dim>::operator == (a) && - DoFAccessor::operator == (a)); + DoFAccessor::operator == (a)); } -template +template class DH> inline bool -DoFObjectAccessor<2,dim>::operator != (const DoFObjectAccessor<2,dim> &a) const +DoFObjectAccessor<2,dim,DH>::operator != (const DoFObjectAccessor<2,dim,DH> &a) const { return (TriaObjectAccessor<2,dim>::operator != (a) || - DoFAccessor::operator != (a)); + DoFAccessor::operator != (a)); } /*------------------------- Functions: DoFObjectAccessor<3,dim> -----------------------*/ - -template +template class DH> inline -DoFObjectAccessor<3,dim>:: +DoFObjectAccessor<3,dim,DH>:: DoFObjectAccessor (const Triangulation *tria, const int level, const int index, const AccessorData *local_data) : - DoFAccessor (local_data), + DoFAccessor (local_data), DoFObjectAccessor_Inheritance<3,dim>::BaseClass (tria, level, index) @@ -679,17 +726,19 @@ DoFObjectAccessor (const Triangulation *tria, -template +template class DH> inline unsigned int -DoFObjectAccessor<3,dim>::dof_index (const unsigned int i) const +DoFObjectAccessor<3,dim,DH>::dof_index (const unsigned int i) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (iget_fe().dofs_per_hex, ExcIndexRange (i, 0, this->get_fe().dofs_per_hex)); @@ -698,17 +747,18 @@ DoFObjectAccessor<3,dim>::dof_index (const unsigned int i) const } - -template +template class DH> inline unsigned int -DoFObjectAccessor<3,dim>::vertex_dof_index (const unsigned int vertex, - const unsigned int i) const +DoFObjectAccessor<3,dim,DH>::vertex_dof_index (const unsigned int vertex, + const unsigned int i) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (vertex<8, ExcIndexRange (i,0,8)); Assert (iget_fe().dofs_per_vertex, ExcIndexRange (i, 0, this->get_fe().dofs_per_vertex)); @@ -720,21 +770,22 @@ DoFObjectAccessor<3,dim>::vertex_dof_index (const unsigned int vertex, } - -template +template class DH> inline void -DoFObjectAccessor<3,dim>::get_dof_indices (std::vector &dof_indices) const +DoFObjectAccessor<3,dim,DH>::get_dof_indices (std::vector &dof_indices) const { + typedef DoFAccessor BaseClass; + Assert (this->dof_handler != 0, - typename DoFAccessor::ExcInvalidObject()); + typename BaseClass::ExcInvalidObject()); Assert (&this->get_fe() != 0, - typename DoFAccessor::ExcInvalidObject()); - Assert (dof_indices.size() == (8*this->dof_handler->get_fe().dofs_per_vertex + - 12*this->dof_handler->get_fe().dofs_per_line + - 6*this->dof_handler->get_fe().dofs_per_quad + - this->dof_handler->get_fe().dofs_per_hex), - typename DoFAccessor::ExcVectorDoesNotMatch()); + typename BaseClass::ExcInvalidObject()); + Assert (dof_indices.size() == (8*this->get_fe().dofs_per_vertex + + 12*this->get_fe().dofs_per_line + + 6*this->get_fe().dofs_per_quad + + this->get_fe().dofs_per_hex), + typename BaseClass::ExcVectorDoesNotMatch()); // this function really only makes // sense on non-active objects if @@ -745,14 +796,14 @@ DoFObjectAccessor<3,dim>::get_dof_indices (std::vector &dof_indice // not allocated for this // non-active thing Assert (!this->has_children() || - (this->dof_handler->get_fe().dofs_per_cell == - 8*this->dof_handler->get_fe().dofs_per_vertex), - typename DoFAccessor::ExcNotActive()); + (this->get_fe().dofs_per_cell == + 8*this->get_fe().dofs_per_vertex), + typename BaseClass::ExcNotActive()); - const unsigned int dofs_per_vertex = this->dof_handler->get_fe().dofs_per_vertex, - dofs_per_line = this->dof_handler->get_fe().dofs_per_line, - dofs_per_quad = this->dof_handler->get_fe().dofs_per_quad, - dofs_per_hex = this->dof_handler->get_fe().dofs_per_hex; + const unsigned int dofs_per_vertex = this->get_fe().dofs_per_vertex, + dofs_per_line = this->get_fe().dofs_per_line, + dofs_per_quad = this->get_fe().dofs_per_quad, + dofs_per_hex = this->get_fe().dofs_per_hex; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; d::get_dof_indices (std::vector &dof_indice -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<3,dim>::line (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<3,dim,DH>::line (const unsigned int i) const { TriaIterator > l = BaseClass::line(i); - return TriaIterator > + return TriaIterator > ( this->tria, this->present_level, @@ -785,15 +836,14 @@ DoFObjectAccessor<3,dim>::line (const unsigned int i) const } - -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<3,dim>::quad (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<3,dim,DH>::quad (const unsigned int i) const { Assert (i<6, ExcIndexRange (i, 0, 6)); - return TriaIterator > + return TriaIterator > ( this->tria, this->present_level, @@ -803,16 +853,15 @@ DoFObjectAccessor<3,dim>::quad (const unsigned int i) const } - -template +template class DH> inline -TriaIterator > -DoFObjectAccessor<3,dim>::child (const unsigned int i) const +TriaIterator > +DoFObjectAccessor<3,dim,DH>::child (const unsigned int i) const { - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); + TriaIterator > q (this->tria, + this->present_level+1, + this->child_index (i), + this->dof_handler); #ifdef DEBUG if (q.state() != IteratorState::past_the_end) @@ -822,12 +871,39 @@ DoFObjectAccessor<3,dim>::child (const unsigned int i) const } +template class DH> +inline +const FiniteElement & +DoFObjectAccessor<3,dim,DH>::get_fe () const +{ + return *this->dof_handler->selected_fe; +} + + +template class DH> +inline +unsigned int +DoFObjectAccessor<3,dim,DH>::active_fe_index () const +{ + return 0; +} + + +template class DH> +inline +void +DoFObjectAccessor<3,dim,DH>::set_active_fe_index (const unsigned int i) +{ + typedef DoFAccessor BaseClass; + Assert (i == 0, typename BaseClass::ExcInvalidObject()); +} + -template +template class DH> template inline void -DoFObjectAccessor<3, dim>:: +DoFObjectAccessor<3, dim, DH>:: distribute_local_to_global (const Vector &local_source, OutputVector &global_destination) const { @@ -840,7 +916,7 @@ distribute_local_to_global (const Vector &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -869,11 +945,11 @@ distribute_local_to_global (const Vector &local_source, -template +template class DH> template inline void -DoFObjectAccessor<3, dim>:: +DoFObjectAccessor<3, dim, DH>:: distribute_local_to_global (const FullMatrix &local_source, OutputMatrix &global_destination) const { @@ -886,7 +962,7 @@ distribute_local_to_global (const FullMatrix &local_source, // non-template dependent name and // use that to specify the // qualified exception names - typedef DoFAccessor BaseClass; + typedef DoFAccessor BaseClass; Assert (this->dof_handler != 0, typename BaseClass::ExcInvalidObject()); @@ -920,8 +996,8 @@ distribute_local_to_global (const FullMatrix &local_source, -template -void DoFObjectAccessor<3,dim>::copy_from (const DoFObjectAccessor<3,dim> &a) +template class DH> +void DoFObjectAccessor<3,dim,DH>::copy_from (const DoFObjectAccessor<3,dim,DH> &a) { BaseClass::copy_from (a); this->set_dof_handler (a.dof_handler); @@ -929,52 +1005,51 @@ void DoFObjectAccessor<3,dim>::copy_from (const DoFObjectAccessor<3,dim> &a) -template +template class DH> inline bool -DoFObjectAccessor<3,dim>::operator == (const DoFObjectAccessor<3,dim> &a) const +DoFObjectAccessor<3,dim,DH>::operator == (const DoFObjectAccessor<3,dim,DH> &a) const { return (TriaObjectAccessor<3,dim>::operator == (a) && - DoFAccessor::operator == (a)); + DoFAccessor::operator == (a)); } -template +template class DH> inline bool -DoFObjectAccessor<3,dim>::operator != (const DoFObjectAccessor<3,dim> &a) const +DoFObjectAccessor<3,dim,DH>::operator != (const DoFObjectAccessor<3,dim,DH> &a) const { return (TriaObjectAccessor<3,dim>::operator != (a) || - DoFAccessor::operator != (a)); + DoFAccessor::operator != (a)); } /*------------------------- Functions: DoFCellAccessor -----------------------*/ - -template +template class DH> inline -DoFCellAccessor:: +DoFCellAccessor:: DoFCellAccessor (const Triangulation *tria, const int level, const int index, const AccessorData *local_data) : - DoFObjectAccessor (tria,level,index,local_data) + DoFObjectAccessor (tria,level,index,local_data) {} -template +template class DH> inline -TriaIterator > -DoFCellAccessor::neighbor (const unsigned int i) const +TriaIterator > +DoFCellAccessor::neighbor (const unsigned int i) const { - TriaIterator > q (this->tria, - this->neighbor_level (i), - this->neighbor_index (i), - this->dof_handler); + TriaIterator > q (this->tria, + this->neighbor_level (i), + this->neighbor_index (i), + this->dof_handler); #ifdef DEBUG if (q.state() != IteratorState::past_the_end) @@ -984,15 +1059,15 @@ DoFCellAccessor::neighbor (const unsigned int i) const } -template +template class DH> inline -TriaIterator > -DoFCellAccessor::child (const unsigned int i) const +TriaIterator > +DoFCellAccessor::child (const unsigned int i) const { - TriaIterator > q (this->tria, - this->present_level+1, - this->child_index (i), - this->dof_handler); + TriaIterator > q (this->tria, + this->present_level+1, + this->child_index (i), + this->dof_handler); #ifdef DEBUG if (q.state() != IteratorState::past_the_end) @@ -1002,4 +1077,394 @@ DoFCellAccessor::child (const unsigned int i) const } +/*--------------- Functions: DoFObjectAccessor<1,dim,hpDoFHandler> -----------*/ + +template <> +inline +unsigned int +DoFObjectAccessor<1,1,hpDoFHandler>::dof_index (const unsigned int i) const +{ + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor<1, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_line, + ExcIndexRange (i, 0, this->get_fe().dofs_per_line)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_line_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->line_dofs[offset+i]; +} + + +template <> +inline +unsigned int +DoFObjectAccessor<1,2,hpDoFHandler>::dof_index (const unsigned int i) const +{ + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor<2, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_line, + ExcIndexRange (i, 0, this->get_fe().dofs_per_line)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_line_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->line_dofs[offset+i]; +} + + +template <> +inline +unsigned int +DoFObjectAccessor<1,3,hpDoFHandler>::dof_index (const unsigned int i) const +{ + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor<3, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_line, + ExcIndexRange (i, 0, this->get_fe().dofs_per_line)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_line_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->line_dofs[offset+i]; +} + + +template <> +inline +const FiniteElement<1> & +DoFObjectAccessor<1,1,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} +template <> +inline +const FiniteElement<2> & +DoFObjectAccessor<1,2,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} +template <> +inline +const FiniteElement<3> & +DoFObjectAccessor<1,3,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} + + +template <> +inline +unsigned int +DoFObjectAccessor<1,1,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} +template <> +inline +unsigned int +DoFObjectAccessor<1,2,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} +template <> +inline +unsigned int +DoFObjectAccessor<1,3,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} + + +template <> +inline +void +DoFObjectAccessor<1,1,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} +template <> +inline +void +DoFObjectAccessor<1,2,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} +template <> +inline +void +DoFObjectAccessor<1,3,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} + + +/*------------- Functions: DoFObjectAccessor<2,dim,hpDoFHandler> -------------*/ + +template <> +inline +unsigned int DoFObjectAccessor<2,2,hpDoFHandler>::dof_index (const unsigned int i) const +{ + typedef DoFAccessor<2, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, + BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, + BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_quad, + ExcIndexRange (i, 0, this->get_fe().dofs_per_quad)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_quad_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->quad_dofs[offset+i]; +} + +template <> +inline +unsigned int DoFObjectAccessor<2,3,hpDoFHandler>::dof_index (const unsigned int i) const +{ + typedef DoFAccessor<3, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, + BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, + BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_quad, + ExcIndexRange (i, 0, this->get_fe().dofs_per_quad)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_quad_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->quad_dofs[offset+i]; +} + + +template <> +inline +const FiniteElement<2> & +DoFObjectAccessor<2,2,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} +template <> +inline +const FiniteElement<3> & +DoFObjectAccessor<2,3,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} + + +template <> +inline +unsigned int +DoFObjectAccessor<2,2,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} + + + +template <> +inline +unsigned int +DoFObjectAccessor<2,3,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} + + +template <> +inline +void +DoFObjectAccessor<2,2,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} + + + +template <> +inline +void +DoFObjectAccessor<2,3,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} + + +/*------------- Functions: DoFObjectAccessor<3,dim,hpDoFHandler> -------------*/ + +template <> +inline +unsigned int +DoFObjectAccessor<3,3,hpDoFHandler>::dof_index (const unsigned int i) const +{ + typedef DoFAccessor<3, hpDoFHandler> BaseClass; + + Assert (this->dof_handler != 0, + BaseClass::ExcInvalidObject()); + // make sure a FE has been selected + // and enough room was reserved + Assert (&this->get_fe() != 0, + BaseClass::ExcInvalidObject()); + Assert (iget_fe().dofs_per_hex, + ExcIndexRange (i, 0, this->get_fe().dofs_per_hex)); + + const unsigned int offset = this->dof_handler->levels[this->present_level] + ->dof_hex_index_offset[this->present_index]; + return this->dof_handler->levels[this->present_level] + ->hex_dofs[offset+i]; +} + + +template <> +inline +const FiniteElement<3> & +DoFObjectAccessor<3,3,hpDoFHandler>::get_fe () const +{ + return dof_handler->finite_elements->get_fe(active_fe_index ()); +} + + +template <> +inline +unsigned int +DoFObjectAccessor<3,3,hpDoFHandler>::active_fe_index () const +{ + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); + return dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index]; +} + + +template <> +inline +void +DoFObjectAccessor<3,3,hpDoFHandler>::set_active_fe_index (const unsigned int i) +{ + Assert (dof_handler != 0, ExcInvalidObject()); + Assert (static_cast::size_type>(this->present_index) < + dof_handler->levels[this->present_level]->active_fe_indices.size (), + ExcIndexRange (this->present_index, 0, + dof_handler->levels[this->present_level]->active_fe_indices.size ())); +//TODO: dof_handler->finite_elements not always defined, when this method is called +// Assert (i < dof_handler->finite_elements->n_finite_elements (), ExcInvalidObject()); + dof_handler->levels[this->present_level] + ->active_fe_indices[this->present_index] = i; +} + + #endif diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index a2fe4b2187..4e12d819c9 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -18,239 +18,14 @@ #include #include #include +#include #include + #include #include #include -template class DoFAccessor; -template class DoFCellAccessor; template class DoFLevel; -template class DoFObjectAccessor; -template class DoFObjectAccessor<0, dim>; -template class DoFObjectAccessor<1, dim>; -template class DoFObjectAccessor<2, dim>; -template class DoFObjectAccessor<3, dim>; -template class FiniteElement; -template class TriaRawIterator; -template class TriaIterator; -template class TriaActiveIterator; -template class Triangulation; - - -/** - * Define some types which differ between the dimensions. - * - * @ref DoFDimensionInfo<1> - * @ref DoFDimensionInfo<2> - * @ref DoFDimensionInfo<3> - * - * @ingroup dofs - * @author Wolfgang Bangerth, 1998 - */ -template -class DoFDimensionInfo -{ - public: - /** - * For internal use only - */ - typedef void * raw_line_iterator; - /** - * Iterator for lines in the - * DoFHandler - */ - typedef void * line_iterator; - /** - * Iterator skipping all refined - * lines - */ - typedef void * active_line_iterator; - - /** - * For internal use only - */ - typedef void * raw_quad_iterator; - /** - * Iterator for quadrilaterals in - * the DoFHandler - */ - typedef void * quad_iterator; - /** - * Iterator skipping all refined - * quadrilaterals - */ - typedef void * active_quad_iterator; - - /** - * For internal use only - */ - typedef void * raw_hex_iterator; - /** - * Iterator for hexahedra in the - * DoFHandler - */ - typedef void * hex_iterator; - /** - * Iterator skipping all refined - * hexahedra - */ - typedef void * active_hex_iterator; - - /** - * For internal use only - */ - typedef void * raw_cell_iterator; - /** - * All cells of the DoFHandler; - * depending on the dimension - * this is typedefed to - *
    - *
  1. #line_iterator - *
  2. #quad_iterator - *
  3. #hex_iterator - *
- */ - typedef void * cell_iterator; - /** - * All active cells of the DoFHandler - * Depending on the dimension - * this is typedefed to - *
    - *
  1. #active_line_iterator - *
  2. #active_quad_iterator - *
  3. #active_hex_iterator - *
- */ - typedef void * active_cell_iterator; - - /** - * For internal use only - */ - typedef void * raw_face_iterator; - /** - * All faces of the DoFHandler - * Depending on the dimension - * this is typedefed to - *
    - *
  1. void* - *
  2. #line_iterator - *
  3. #quad_iterator - *
- */ - typedef void * face_iterator; - /** - * All active faces of the DoFHandler - * Depending on the dimension - * this is typedefed to - *
    - *
  1. void* - *
  2. #active_line_iterator - *
  3. #active_quad_iterator - *
- */ - typedef void * active_face_iterator; -}; - - - -/** - * Define some types for the DoF handling in one dimension. - * - * @ingroup dofs - * @author Wolfgang Bangerth, 1998 - */ -template <> -class DoFDimensionInfo<1> -{ - public: - typedef TriaRawIterator<1,DoFCellAccessor<1> > raw_line_iterator; - typedef TriaIterator<1,DoFCellAccessor<1> > line_iterator; - typedef TriaActiveIterator<1,DoFCellAccessor<1> > active_line_iterator; - - typedef void * raw_quad_iterator; - typedef void * quad_iterator; - typedef void * active_quad_iterator; - - typedef void * raw_hex_iterator; - typedef void * hex_iterator; - typedef void * active_hex_iterator; - - typedef raw_line_iterator raw_cell_iterator; - typedef line_iterator cell_iterator; - typedef active_line_iterator active_cell_iterator; - - typedef void * raw_face_iterator; - typedef void * face_iterator; - typedef void * active_face_iterator; -}; - - - -/** - * Define some types for the DoF handling in two dimensions. - * - * @ingroup dofs - * @author Wolfgang Bangerth, 1998 - */ -template <> -class DoFDimensionInfo<2> -{ - public: - typedef TriaRawIterator<2,DoFObjectAccessor<1, 2> > raw_line_iterator; - typedef TriaIterator<2,DoFObjectAccessor<1, 2> > line_iterator; - typedef TriaActiveIterator<2,DoFObjectAccessor<1, 2> > active_line_iterator; - - typedef TriaRawIterator<2,DoFCellAccessor<2> > raw_quad_iterator; - typedef TriaIterator<2,DoFCellAccessor<2> > quad_iterator; - typedef TriaActiveIterator<2,DoFCellAccessor<2> > active_quad_iterator; - - typedef void * raw_hex_iterator; - typedef void * hex_iterator; - typedef void * active_hex_iterator; - - typedef raw_quad_iterator raw_cell_iterator; - typedef quad_iterator cell_iterator; - typedef active_quad_iterator active_cell_iterator; - - typedef raw_line_iterator raw_face_iterator; - typedef line_iterator face_iterator; - typedef active_line_iterator active_face_iterator; -}; - - - -/** - * Define some types for the DoF handling in two dimensions. - * - * @ingroup dofs - * @author Wolfgang Bangerth, 1998 - */ -template <> -class DoFDimensionInfo<3> -{ - public: - typedef TriaRawIterator<3,DoFObjectAccessor<1, 3> > raw_line_iterator; - typedef TriaIterator<3,DoFObjectAccessor<1, 3> > line_iterator; - typedef TriaActiveIterator<3,DoFObjectAccessor<1, 3> > active_line_iterator; - - typedef TriaRawIterator<3,DoFObjectAccessor<2, 3> > raw_quad_iterator; - typedef TriaIterator<3,DoFObjectAccessor<2, 3> > quad_iterator; - typedef TriaActiveIterator<3,DoFObjectAccessor<2, 3> > active_quad_iterator; - - typedef TriaRawIterator<3,DoFCellAccessor<3> > raw_hex_iterator; - typedef TriaIterator<3,DoFCellAccessor<3> > hex_iterator; - typedef TriaActiveIterator<3,DoFCellAccessor<3> > active_hex_iterator; - - typedef raw_hex_iterator raw_cell_iterator; - typedef hex_iterator cell_iterator; - typedef active_hex_iterator active_cell_iterator; - - typedef raw_quad_iterator raw_face_iterator; - typedef quad_iterator face_iterator; - typedef active_quad_iterator active_face_iterator; -}; - /** @@ -321,29 +96,29 @@ class DoFDimensionInfo<3> * @author Wolfgang Bangerth, 1998 */ template -class DoFHandler : public Subscriptor, - public DoFDimensionInfo +class DoFHandler : public Subscriptor { + typedef internal::DoFIteratorSelector > IteratorSelector; public: - typedef typename DoFDimensionInfo::raw_line_iterator raw_line_iterator; - typedef typename DoFDimensionInfo::line_iterator line_iterator; - typedef typename DoFDimensionInfo::active_line_iterator active_line_iterator; + typedef typename IteratorSelector::raw_line_iterator raw_line_iterator; + typedef typename IteratorSelector::line_iterator line_iterator; + typedef typename IteratorSelector::active_line_iterator active_line_iterator; - typedef typename DoFDimensionInfo::raw_quad_iterator raw_quad_iterator; - typedef typename DoFDimensionInfo::quad_iterator quad_iterator; - typedef typename DoFDimensionInfo::active_quad_iterator active_quad_iterator; + typedef typename IteratorSelector::raw_quad_iterator raw_quad_iterator; + typedef typename IteratorSelector::quad_iterator quad_iterator; + typedef typename IteratorSelector::active_quad_iterator active_quad_iterator; - typedef typename DoFDimensionInfo::raw_hex_iterator raw_hex_iterator; - typedef typename DoFDimensionInfo::hex_iterator hex_iterator; - typedef typename DoFDimensionInfo::active_hex_iterator active_hex_iterator; + typedef typename IteratorSelector::raw_hex_iterator raw_hex_iterator; + typedef typename IteratorSelector::hex_iterator hex_iterator; + typedef typename IteratorSelector::active_hex_iterator active_hex_iterator; - typedef typename DoFDimensionInfo::raw_cell_iterator raw_cell_iterator; - typedef typename DoFDimensionInfo::cell_iterator cell_iterator; - typedef typename DoFDimensionInfo::active_cell_iterator active_cell_iterator; + typedef typename IteratorSelector::raw_cell_iterator raw_cell_iterator; + typedef typename IteratorSelector::cell_iterator cell_iterator; + typedef typename IteratorSelector::active_cell_iterator active_cell_iterator; - typedef typename DoFDimensionInfo::raw_face_iterator raw_face_iterator; - typedef typename DoFDimensionInfo::face_iterator face_iterator; - typedef typename DoFDimensionInfo::active_face_iterator active_face_iterator; + typedef typename IteratorSelector::raw_face_iterator raw_face_iterator; + typedef typename IteratorSelector::face_iterator face_iterator; + typedef typename IteratorSelector::active_face_iterator active_face_iterator; /** * Alias the @p FunctionMap type @@ -1099,16 +874,16 @@ class DoFHandler : public Subscriptor, n_boundary_dofs (const std::set &boundary_indicators) const; /** - * Return a constant reference to the - * selected finite element object. This - * function is inline, so it should - * be reasonably fast. + * Return a constant reference to + * the selected finite element + * object. */ const FiniteElement & get_fe () const; /** - * Return a constant reference to the - * triangulation underlying this object. + * Return a constant reference to + * the triangulation underlying + * this object. */ const Triangulation & get_tria () const; @@ -1262,12 +1037,12 @@ class DoFHandler : public Subscriptor, /* * Make accessor objects friends. */ - template friend class DoFAccessor; + template class DH> friend class DoFAccessor; /* * Make accessor objects friends. */ - template friend class DoFObjectAccessor; + template class DH> friend class DoFObjectAccessor; }; @@ -1295,16 +1070,16 @@ template <> DoFHandler<1>::cell_iterator DoFHandler<1>::last () const; template <> DoFHandler<1>::cell_iterator DoFHandler<1>::last (const unsigned int level) const; template <> DoFHandler<1>::active_cell_iterator DoFHandler<1>::last_active () const; template <> DoFHandler<1>::active_cell_iterator DoFHandler<1>::last_active (const unsigned int level) const; -template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::begin_raw_face (const unsigned int) const; -template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::begin_face (const unsigned int) const; -template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::begin_active_face (const unsigned int) const; -template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::end_face () const; -template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::last_raw_face () const; -template <> DoFDimensionInfo<1>::raw_face_iterator DoFHandler<1>::last_raw_face (const unsigned int) const; -template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::last_face () const; -template <> DoFDimensionInfo<1>::face_iterator DoFHandler<1>::last_face (const unsigned int) const; -template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::last_active_face () const; -template <> DoFDimensionInfo<1>::active_face_iterator DoFHandler<1>::last_active_face (const unsigned int) const; +template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::begin_raw_face (const unsigned int) const; +template <> DoFHandler<1>::face_iterator DoFHandler<1>::begin_face (const unsigned int) const; +template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::begin_active_face (const unsigned int) const; +template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::end_face () const; +template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::last_raw_face () const; +template <> DoFHandler<1>::raw_face_iterator DoFHandler<1>::last_raw_face (const unsigned int) const; +template <> DoFHandler<1>::face_iterator DoFHandler<1>::last_face () const; +template <> DoFHandler<1>::face_iterator DoFHandler<1>::last_face (const unsigned int) const; +template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::last_active_face () const; +template <> DoFHandler<1>::active_face_iterator DoFHandler<1>::last_active_face (const unsigned int) const; template <> DoFHandler<1>::raw_quad_iterator DoFHandler<1>::begin_raw_quad (const unsigned int) const; template <> DoFHandler<1>::quad_iterator DoFHandler<1>::begin_quad (const unsigned int) const; template <> DoFHandler<1>::active_quad_iterator DoFHandler<1>::begin_active_quad (const unsigned int) const; @@ -1335,16 +1110,16 @@ template <> DoFHandler<2>::cell_iterator DoFHandler<2>::last () const; template <> DoFHandler<2>::cell_iterator DoFHandler<2>::last (const unsigned int level) const; template <> DoFHandler<2>::active_cell_iterator DoFHandler<2>::last_active () const; template <> DoFHandler<2>::active_cell_iterator DoFHandler<2>::last_active (const unsigned int level) const; -template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::begin_raw_face (const unsigned int level) const; -template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::begin_face (const unsigned int level) const; -template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::begin_active_face (const unsigned int level) const; -template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::end_face () const; -template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::last_raw_face () const; -template <> DoFDimensionInfo<2>::raw_face_iterator DoFHandler<2>::last_raw_face (const unsigned int level) const; -template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::last_face () const; -template <> DoFDimensionInfo<2>::face_iterator DoFHandler<2>::last_face (const unsigned int level) const; -template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::last_active_face () const; -template <> DoFDimensionInfo<2>::active_face_iterator DoFHandler<2>::last_active_face (const unsigned int level) const; +template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::begin_raw_face (const unsigned int level) const; +template <> DoFHandler<2>::face_iterator DoFHandler<2>::begin_face (const unsigned int level) const; +template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::begin_active_face (const unsigned int level) const; +template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::end_face () const; +template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::last_raw_face () const; +template <> DoFHandler<2>::raw_face_iterator DoFHandler<2>::last_raw_face (const unsigned int level) const; +template <> DoFHandler<2>::face_iterator DoFHandler<2>::last_face () const; +template <> DoFHandler<2>::face_iterator DoFHandler<2>::last_face (const unsigned int level) const; +template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::last_active_face () const; +template <> DoFHandler<2>::active_face_iterator DoFHandler<2>::last_active_face (const unsigned int level) const; template <> DoFHandler<2>::raw_hex_iterator DoFHandler<2>::begin_raw_hex (const unsigned int) const; template <> DoFHandler<2>::hex_iterator DoFHandler<2>::begin_hex (const unsigned int) const; template <> DoFHandler<2>::active_hex_iterator DoFHandler<2>::begin_active_hex (const unsigned int) const; @@ -1397,7 +1172,8 @@ template <> void DoFHandler<3>::reserve_space (); template inline -unsigned int DoFHandler::n_dofs () const +unsigned int +DoFHandler::n_dofs () const { return used_dofs; } @@ -1406,14 +1182,24 @@ unsigned int DoFHandler::n_dofs () const template inline -const FiniteElement & DoFHandler::get_fe () const +const FiniteElement & +DoFHandler::get_fe () const { Assert(selected_fe!=0, ExcNoFESelected()); return *selected_fe; } -/*---------------------------- dof.h ---------------------------*/ +template +inline +const Triangulation & +DoFHandler::get_tria () const +{ + return *tria; +} + + +/*---------------------------- dof_handler.h ---------------------------*/ #endif -/*---------------------------- dof.h ---------------------------*/ +/*---------------------------- dof_handler.h ---------------------------*/ diff --git a/deal.II/deal.II/include/dofs/dof_iterator_selector.h b/deal.II/deal.II/include/dofs/dof_iterator_selector.h new file mode 100644 index 0000000000..19e4012c62 --- /dev/null +++ b/deal.II/deal.II/include/dofs/dof_iterator_selector.h @@ -0,0 +1,157 @@ +//---------------------------- dof_iterator_selector.h --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- dof_iterator_selector.h --------------------------- +#ifndef __deal2__dof_iterator_selector_h +#define __deal2__dof_iterator_selector_h + +template class DH> class DoFAccessor; +template class DH> class DoFCellAccessor; +template class DH> class DoFObjectAccessor; +template class DH> class DoFObjectAccessor<0, dim, DH>; +template class DH> class DoFObjectAccessor<1, dim, DH>; +template class DH> class DoFObjectAccessor<2, dim, DH>; +template class DH> class DoFObjectAccessor<3, dim, DH>; +template class FiniteElement; +template class TriaRawIterator; +template class TriaIterator; +template class TriaActiveIterator; +template class Triangulation; +template class DoFHandler; + + +namespace internal +{ +/** + * Define some types which differ between the dimensions. This class + * is analogous to the TriaDimensionInfo class hierarchy. + * + * @ref DoFIteratorSelector<1> + * @ref DoFIteratorSelector<2> + * @ref DoFIteratorSelector<3> + * + * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003 + */ + template + struct DoFIteratorSelector + { + }; + + + +/** + * Define some types for the DoF handling in one dimension. + * + * The types have the same meaning as those declared in + * TriaDimensionInfo<2>, only the treatment of templates is a + * little more complicated since the @p DoFAccessor classes want a + * template template argument. + * + * @author Wolfgang Bangerth, 1998; Oliver Kayser-Herold and Wolfgang Bangerth, 2003 + */ + template