From: guido Date: Tue, 20 Jul 1999 13:59:49 +0000 (+0000) Subject: towards unification X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab05d4ff759b3135115820ec8ede0084651c7d15;p=dealii-svn.git towards unification git-svn-id: https://svn.dealii.org/trunk@1608 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_accessor.h b/deal.II/deal.II/include/dofs/dof_accessor.h index 6b18d4b5a0..3a7cb0ca62 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.h @@ -109,6 +109,13 @@ class DoFAccessor { +/** + * Common template for line, quad, hex. + */ +template +class DoFObjectAccessor; + + @@ -138,7 +145,7 @@ class DoFAccessor { * Unfortunately, we would run into problems, if we wanted a #DoFLineAccessor# * in one spatial dimension, in which case a line is also a cell. The traditional * solution would be to declare a #DoFCellAccessor<1># which is derived from - * #DoFLineAccessor<1># and #CellAccessor<1># (the #DoFLineAccessor# cannot + * #DoFObjectAccessor<1, 1># and #CellAccessor<1># (the #DoFObjectAccessor<1, dim># cannot * itself be derived from #CellAccessor# since a line is not a cell * unless in one space dimension), but since a #DoFLineAccessor# and a * #CellAccessor# are both derived from #TriaAccessor#, we would have to make @@ -149,11 +156,11 @@ class DoFAccessor { * pass a second template parameter to a #DoFLineAccessor# which tells it * which class to be derived from: if we are in one spatial dimension, the * base class is to be #CellAccessor<1>#, in two or more dimensions it - * is a #LineAccessor#, i.e. am accessor to lines without the missing + * is a #TriaObjectAccessor<1, dim>#, i.e. am accessor to lines without the missing * functionality needed for cells (neighbors, etc.). * * This way we can declare a #DoFCellAccessor# in one dimension by deriving - * from #DoFLineAccessor<1,CellAccessor<1> >#, thus getting the cell + * from #DoFObjectAccessor<1, 1,CellAccessor<1> >#, thus getting the cell * functionality through the #DoFLineAccessor# instead of through a virtual * multiple inheritance of #DoFLineAccessor# and #CellAccessor<1>#. * @@ -162,7 +169,9 @@ class DoFAccessor { * @author Wolfgang Bangerth, 1998 */ template -class DoFLineAccessor : public DoFAccessor, public BaseClass { +class DoFObjectAccessor<1, dim, BaseClass> : public DoFAccessor, + public BaseClass +{ public: /** * Declare the data type that this accessor @@ -175,14 +184,14 @@ class DoFLineAccessor : public DoFAccessor, public BaseClass { * Default constructor, unused thus * not implemented. */ - DoFLineAccessor (); + DoFObjectAccessor (); /** * Constructor. The #local_data# * argument is assumed to be a pointer * to a #DoFHandler# object. */ - DoFLineAccessor (Triangulation *tria, + DoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : @@ -234,7 +243,7 @@ class DoFLineAccessor : public DoFAccessor, public BaseClass { * 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 @@ -266,21 +275,20 @@ class DoFLineAccessor : public DoFAccessor, public BaseClass { * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFLineAccessor &a); + void copy_from (const DoFObjectAccessor<1, dim,BaseClass> &a); }; - - - /** * Grant access to the degrees of freedom located on quads. * * @see DoFLineAccessor */ template -class DoFQuadAccessor : public DoFAccessor, public BaseClass { +class DoFObjectAccessor<2, dim, BaseClass> : public DoFAccessor, + public BaseClass +{ public: /** * Declare the data type that this accessor @@ -293,14 +301,14 @@ class DoFQuadAccessor : public DoFAccessor, public BaseClass { * Default constructor, unused thus * not implemented. */ - DoFQuadAccessor (); + DoFObjectAccessor (); /** * Constructor. The #local_data# * argument is assumed to be a pointer * to a #DoFHandler# object. */ - DoFQuadAccessor (Triangulation *tria, + DoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : @@ -350,7 +358,7 @@ class DoFQuadAccessor : public DoFAccessor, public BaseClass { * Return a pointer to the #i#th line * bounding this #Quad#. */ - TriaIterator > > + TriaIterator > > line (const unsigned int i) const; /** @@ -360,7 +368,7 @@ class DoFQuadAccessor : public DoFAccessor, public BaseClass { * class returns a quad 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 @@ -392,7 +400,7 @@ class DoFQuadAccessor : public DoFAccessor, public BaseClass { * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const DoFQuadAccessor &a); + void copy_from (const DoFObjectAccessor<2, dim,BaseClass> &a); }; @@ -475,14 +483,14 @@ class DoFHexAccessor : public DoFAccessor, public BaseClass { * Return a pointer to the #i#th line * bounding this #Hex#. */ - TriaIterator > > + TriaIterator > > line (const unsigned int i) const; /** * Return a pointer to the #i#th quad * bounding this #Hex#. */ - TriaIterator > > + TriaIterator > > quad (const unsigned int i) const; /** @@ -570,27 +578,27 @@ class DoFSubstructAccessor : public DoFAccessor, * with template parameters. This class and #DoFSubstructAccessor<2># * wrap the following names: * \begin{verbatim} - * DoFSubstructAccessor<1> := DoFLineAccessor<1,CellAccessor<1> >; - * DoFSubstructAccessor<2> := DoFQuadAccessor<2,CellAccessor<2> >; + * DoFSubstructAccessor<1> := DoFObjectAccessor<1, 1,CellAccessor<1> >; + * DoFSubstructAccessor<2> := DoFObjectAccessor<2, 2,CellAccessor<2> >; * \end{verbatim} * We do this rather complex (and needless, provided C++ the needed constructs!) * class hierarchy manipulation, since this way we can declare and implement * the \Ref{DoFCellAccessor} dimension independent as an inheritance from * #DoFSubstructAccessor#. If we had not declared these * types, we would have to write two class declarations, one for - * #DoFCellAccessor<1>#, derived from #DoFLineAccessor<1,CellAccessor<1> ># + * #DoFCellAccessor<1>#, derived from #DoFObjectAccessor<1, 1,CellAccessor<1> ># * and one for #DoFCellAccessor<2>#, derived from - * #DoFQuadAccessor<2,CellAccessor<2> >#. + * #DoFObjectAccessor<2, 2,CellAccessor<2> >#. */ template <> -class DoFSubstructAccessor<1> : public DoFLineAccessor<1,CellAccessor<1> > { +class DoFSubstructAccessor<1> : public DoFObjectAccessor<1, 1,CellAccessor<1> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef DoFLineAccessor<1,CellAccessor<1> >::AccessorData AccessorData; + typedef DoFObjectAccessor<1, 1,CellAccessor<1> >::AccessorData AccessorData; /** * Constructor @@ -599,7 +607,7 @@ class DoFSubstructAccessor<1> : public DoFLineAccessor<1,CellAccessor<1> > { const int level, const int index, const AccessorData *local_data) : - DoFLineAccessor<1,CellAccessor<1> > (tria,level,index,local_data) {}; + DoFObjectAccessor<1, 1,CellAccessor<1> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise @@ -617,14 +625,14 @@ class DoFSubstructAccessor<1> : public DoFLineAccessor<1,CellAccessor<1> > { * @see DoFSubstructAccessor<1> */ template <> -class DoFSubstructAccessor<2> : public DoFQuadAccessor<2,CellAccessor<2> > { +class DoFSubstructAccessor<2> : public DoFObjectAccessor<2, 2,CellAccessor<2> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef DoFQuadAccessor<2,CellAccessor<2> >::AccessorData AccessorData; + typedef DoFObjectAccessor<2, 2,CellAccessor<2> >::AccessorData AccessorData; /** * Constructor @@ -633,14 +641,14 @@ class DoFSubstructAccessor<2> : public DoFQuadAccessor<2,CellAccessor<2> > { const int level, const int index, const AccessorData *local_data) : - DoFQuadAccessor<2,CellAccessor<2> > (tria,level,index,local_data) {}; + DoFObjectAccessor<2, 2,CellAccessor<2> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<2,DoFLineAccessor<2,LineAccessor<2> > > face_iterator; + typedef TriaIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > face_iterator; }; @@ -659,7 +667,7 @@ class DoFSubstructAccessor<3> : public DoFHexAccessor<3,CellAccessor<3> > { * class expects to get passed from the * iterator classes. */ - typedef DoFQuadAccessor<3,CellAccessor<3> >::AccessorData AccessorData; + typedef DoFObjectAccessor<2, 3,CellAccessor<3> >::AccessorData AccessorData; /** * Constructor @@ -675,18 +683,15 @@ class DoFSubstructAccessor<3> : public DoFHexAccessor<3,CellAccessor<3> > { // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > > face_iterator; + typedef TriaIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > face_iterator; }; - - - /** * Grant access to the degrees of freedom on a cell. In fact, since all * access to the degrees of freedom has been enabled by the classes - * #DoFLineAccessor<1># and #DoFQuadAccessor<2># for the space dimension + * #DoFObjectAccessor<1, 1># and #DoFObjectAccessor<2, 2># for the space dimension * one and two, respectively, this class only collects the pieces * together by deriving from the appropriate #DoF*Accessor# and the * right #CellAccessor# and finally adding two functions which give @@ -738,7 +743,7 @@ class DoFCellAccessor : public DoFSubstructAccessor { * of this cell. * * This function is not implemented in 1D, - * and maps to DoFQuadAccessor::line in 2D. + * and maps to DoFObjectAccessor<2, dim>::line in 2D. */ typename DoFSubstructAccessor::face_iterator face (const unsigned int i) const; 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 4f7dd75cce..b92ec6cb37 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -23,7 +23,7 @@ template inline -int DoFLineAccessor::dof_index (const unsigned int i) const { +int DoFObjectAccessor<1, dim,BaseClass>::dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved @@ -40,7 +40,7 @@ int DoFLineAccessor::dof_index (const unsigned int i) const { template inline -int DoFLineAccessor::vertex_dof_index (const unsigned int vertex, +int DoFObjectAccessor<1, dim,BaseClass>::vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); @@ -59,7 +59,7 @@ int DoFLineAccessor::vertex_dof_index (const unsigned int vertex, template inline void -DoFLineAccessor::get_dof_indices (vector &dof_indices) const { +DoFObjectAccessor<1, dim,BaseClass>::get_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); Assert (dof_indices.size() == (2*dof_handler->get_fe().dofs_per_vertex + @@ -80,9 +80,9 @@ DoFLineAccessor::get_dof_indices (vector &dof_indices) const template inline -TriaIterator > -DoFLineAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +DoFObjectAccessor<1, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), dof_handler); @@ -99,7 +99,7 @@ DoFLineAccessor::child (const unsigned int i) const { template inline void -DoFLineAccessor::copy_from (const DoFLineAccessor &a) { +DoFObjectAccessor<1, dim,BaseClass>::copy_from (const DoFObjectAccessor<1, dim,BaseClass> &a) { BaseClass::copy_from (a); set_dof_handler (a.dof_handler); }; @@ -107,11 +107,11 @@ DoFLineAccessor::copy_from (const DoFLineAccessor -/*------------------------- Functions: DoFQuadAccessor -----------------------*/ +/*------------------------- Functions: DoFObjectAccessor<2, dim> -----------------------*/ template inline -int DoFQuadAccessor::dof_index (const unsigned int i) const { +int DoFObjectAccessor<2, dim,BaseClass>::dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved @@ -127,7 +127,7 @@ int DoFQuadAccessor::dof_index (const unsigned int i) const { template inline -int DoFQuadAccessor::vertex_dof_index (const unsigned int vertex, +int DoFObjectAccessor<2, dim,BaseClass>::vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); @@ -146,7 +146,7 @@ int DoFQuadAccessor::vertex_dof_index (const unsigned int vertex, template inline void -DoFQuadAccessor::get_dof_indices (vector &dof_indices) const { +DoFObjectAccessor<2, dim,BaseClass>::get_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); Assert (dof_indices.size() == (4*dof_handler->get_fe().dofs_per_vertex + @@ -172,11 +172,11 @@ DoFQuadAccessor::get_dof_indices (vector &dof_indices) const template inline -TriaIterator > > -DoFQuadAccessor::line (const unsigned int i) const { +TriaIterator > > +DoFObjectAccessor<2, dim,BaseClass>::line (const unsigned int i) const { Assert (i<4, ExcIndexRange (i, 0, 4)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -189,9 +189,9 @@ DoFQuadAccessor::line (const unsigned int i) const { template inline -TriaIterator > -DoFQuadAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +DoFObjectAccessor<2, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), dof_handler); @@ -208,7 +208,7 @@ DoFQuadAccessor::child (const unsigned int i) const { template inline void -DoFQuadAccessor::copy_from (const DoFQuadAccessor &a) { +DoFObjectAccessor<2, dim,BaseClass>::copy_from (const DoFObjectAccessor<2, dim,BaseClass> &a) { BaseClass::copy_from (a); set_dof_handler (a.dof_handler); }; @@ -287,10 +287,10 @@ DoFHexAccessor::get_dof_indices (vector &dof_indices) const template inline -TriaIterator > > +TriaIterator > > DoFHexAccessor::line (const unsigned int i) const { - TriaIterator > l = BaseClass::line(i); - return TriaIterator > > + TriaIterator > l = BaseClass::line(i); + return TriaIterator > > ( tria, present_level, @@ -303,11 +303,11 @@ DoFHexAccessor::line (const unsigned int i) const { template inline -TriaIterator > > +TriaIterator > > DoFHexAccessor::quad (const unsigned int i) const { Assert (i<6, ExcIndexRange (i, 0, 6)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 8b9be0d746..cc4e054094 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -73,9 +73,9 @@ class DoFDimensionInfo<1> { */ class DoFDimensionInfo<2> { public: - typedef TriaRawIterator<2,DoFLineAccessor<2,LineAccessor<2> > > raw_line_iterator; - typedef TriaIterator<2,DoFLineAccessor<2,LineAccessor<2> > > line_iterator; - typedef TriaActiveIterator<2,DoFLineAccessor<2,LineAccessor<2> > > active_line_iterator; + typedef TriaRawIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > raw_line_iterator; + typedef TriaIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > line_iterator; + typedef TriaActiveIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > active_line_iterator; typedef TriaRawIterator<2,DoFCellAccessor<2> > raw_quad_iterator; typedef TriaIterator<2,DoFCellAccessor<2> > quad_iterator; @@ -103,13 +103,13 @@ class DoFDimensionInfo<2> { */ class DoFDimensionInfo<3> { public: - typedef TriaRawIterator<3,DoFLineAccessor<3,LineAccessor<3> > > raw_line_iterator; - typedef TriaIterator<3,DoFLineAccessor<3,LineAccessor<3> > > line_iterator; - typedef TriaActiveIterator<3,DoFLineAccessor<3,LineAccessor<3> > > active_line_iterator; + typedef TriaRawIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > raw_line_iterator; + typedef TriaIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > line_iterator; + typedef TriaActiveIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > active_line_iterator; - typedef TriaRawIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > > raw_quad_iterator; - typedef TriaIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > > quad_iterator; - typedef TriaActiveIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > > active_quad_iterator; + typedef TriaRawIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > raw_quad_iterator; + typedef TriaIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > quad_iterator; + typedef TriaActiveIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > active_quad_iterator; typedef TriaRawIterator<3,DoFCellAccessor<3> > raw_hex_iterator; typedef TriaIterator<3,DoFCellAccessor<3> > hex_iterator; @@ -785,7 +785,7 @@ class DoFHandler : public Subscriptor, */ /*@{*/ /** - * Return iterator to the first cell, used + * Iterator to the first cell, used * or not, on level #level#. If a level * has no cells, a past-the-end iterator * is returned. @@ -796,7 +796,7 @@ class DoFHandler : public Subscriptor, raw_cell_iterator begin_raw (const unsigned int level = 0) const; /** - * Return iterator to the first used cell + * Iterator to the first used cell * on level #level#. * * This function calls #begin_line# @@ -805,7 +805,7 @@ class DoFHandler : public Subscriptor, cell_iterator begin (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * cell on level #level#. * * This function calls #begin_active_line# @@ -814,7 +814,7 @@ class DoFHandler : public Subscriptor, active_cell_iterator begin_active(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -910,7 +910,7 @@ class DoFHandler : public Subscriptor, */ /*@{*/ /** - * Return iterator to the first face, used + * Iterator to the first face, used * or not, on level #level#. If a level * has no faces, a past-the-end iterator * is returned. @@ -921,7 +921,7 @@ class DoFHandler : public Subscriptor, raw_face_iterator begin_raw_face (const unsigned int level = 0) const; /** - * Return iterator to the first used face + * Iterator to the first used face * on level #level#. * * This function calls #begin_line# @@ -930,7 +930,7 @@ class DoFHandler : public Subscriptor, face_iterator begin_face (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * face on level #level#. * * This function calls #begin_active_line# @@ -939,7 +939,7 @@ class DoFHandler : public Subscriptor, active_face_iterator begin_active_face(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -1036,7 +1036,7 @@ class DoFHandler : public Subscriptor, */ /*@{*/ /** - * Return iterator to the first line, used + * Iterator to the first line, used * or not, on level #level#. If a level * has no lines, a past-the-end iterator * is returned. @@ -1044,19 +1044,19 @@ class DoFHandler : public Subscriptor, raw_line_iterator begin_raw_line (const unsigned int level = 0) const; /** - * Return iterator to the first used line + * Iterator to the first used line * on level #level#. */ line_iterator begin_line (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * line on level #level#. */ active_line_iterator begin_active_line(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -1133,7 +1133,7 @@ class DoFHandler : public Subscriptor, /*@{ */ /** - * Return iterator to the first quad, used + * Iterator to the first quad, used * or not, on level #level#. If a level * has no quads, a past-the-end iterator * is returned. @@ -1141,19 +1141,19 @@ class DoFHandler : public Subscriptor, raw_quad_iterator begin_raw_quad (const unsigned int level = 0) const; /** - * Return iterator to the first used quad + * Iterator to the first used quad * on level #level#. */ quad_iterator begin_quad (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * quad on level #level#. */ active_quad_iterator begin_active_quad(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -1230,7 +1230,7 @@ class DoFHandler : public Subscriptor, /*@{ */ /** - * Return iterator to the first hex, used + * Iterator to the first hex, used * or not, on level #level#. If a level * has no hexs, a past-the-end iterator * is returned. @@ -1239,21 +1239,21 @@ class DoFHandler : public Subscriptor, begin_raw_hex (const unsigned int level = 0) const; /** - * Return iterator to the first used hex + * Iterator to the first used hex * on level #level#. */ hex_iterator begin_hex (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * hex on level #level#. */ active_hex_iterator begin_active_hex(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -1564,10 +1564,10 @@ class DoFHandler : public Subscriptor, vector vertex_dofs; - friend class DoFLineAccessor >; - friend class DoFLineAccessor >; - friend class DoFQuadAccessor >; - friend class DoFQuadAccessor >; + friend class DoFObjectAccessor<1, dim, TriaObjectAccessor<1, dim> >; + friend class DoFObjectAccessor<1, dim, CellAccessor >; + friend class DoFObjectAccessor<2, dim, TriaObjectAccessor<2, dim> >; + friend class DoFObjectAccessor<2, dim, CellAccessor >; friend class DoFHexAccessor >; friend class DoFHexAccessor >; }; diff --git a/deal.II/deal.II/include/dofs/mg_dof_accessor.h b/deal.II/deal.II/include/dofs/mg_dof_accessor.h index 774ef28cea..b7fcc566ec 100644 --- a/deal.II/deal.II/include/dofs/mg_dof_accessor.h +++ b/deal.II/deal.II/include/dofs/mg_dof_accessor.h @@ -84,7 +84,8 @@ class MGDoFAccessor { }; - +template +class MGDoFObjectAccessor; /** @@ -113,7 +114,7 @@ class MGDoFAccessor { * Unfortunately, we would run into problems, if we wanted a #DoFLineAccessor# * in one spatial dimension, in which case a line is also a cell. The traditional * solution would be to declare a #DoFCellAccessor<1># which is derived from - * #DoFLineAccessor<1># and #CellAccessor<1># (the #DoFLineAccessor# cannot + * #DoFObjectAccessor<1, 1># and #CellAccessor<1># (the #DoFObjectAccessor<1, dim># cannot * itself be derived from #CellAccessor# since a line is not a cell * unless in one space dimension), but since a #DoFLineAccessor# and a * #CellAccessor# are both derived from #TriaAccessor#, we would have to make @@ -124,20 +125,22 @@ class MGDoFAccessor { * pass a second template parameter to a #DoFLineAccessor# which tells it * which class to be derived from: if we are in one spatial dimension, the * base class is to be #CellAccessor<1>#, in two or more dimensions it - * is a #LineAccessor#, i.e. am accessor to lines without the missing + * is a #TriaObjectAccessor<1, dim>#, i.e. am accessor to lines without the missing * functionality needed for cells (neighbors, etc.). * * This way we can declare a #DoFCellAccessor# in one dimension by deriving - * from #DoFLineAccessor<1,CellAccessor<1> >#, thus getting the cell + * from #DoFObjectAccessor<1, 1,CellAccessor<1> >#, thus getting the cell * functionality through the #DoFLineAccessor# instead of through a virtual * multiple inheritance of #DoFLineAccessor# and #CellAccessor<1>#. * - * The same concept is used with #DoFQuadAccessor# classes etc. + * The same concept is used with #DoFObjectAccessor<2, dim># classes etc. * * @author Wolfgang Bangerth, 1998 */ template -class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor { +class MGDoFObjectAccessor<1, dim, BaseClass> : public MGDoFAccessor, + public DoFObjectAccessor<1, dim, BaseClass> +{ public: /** * Declare the data type that this accessor @@ -150,14 +153,14 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor# object. */ - MGDoFLineAccessor (Triangulation *tria, + MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data); @@ -213,13 +216,13 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const MGDoFLineAccessor &a); + void copy_from (const MGDoFObjectAccessor<1, dim,BaseClass> &a); }; @@ -233,7 +236,7 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor -class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor { +class MGDoFObjectAccessor<2, dim, BaseClass> : public MGDoFAccessor, public DoFObjectAccessor<2, dim, BaseClass> { public: /** * Declare the data type that this accessor @@ -246,14 +249,14 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor# object. */ - MGDoFQuadAccessor (Triangulation *tria, + MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data); @@ -307,7 +310,7 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor > > + TriaIterator > > line (const unsigned int i) const; /** @@ -317,13 +320,13 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const MGDoFQuadAccessor &a); + void copy_from (const MGDoFObjectAccessor<2, dim,BaseClass> &a); }; @@ -409,14 +412,14 @@ class MGDoFHexAccessor : public MGDoFAccessor, public DoFHexAccessor > > + TriaIterator > > line (const unsigned int i) const; /** * Return a pointer to the #i#th quad * bounding this #Hex#. */ - TriaIterator > > + TriaIterator > > quad (const unsigned int i) const; /** @@ -454,7 +457,7 @@ class MGDoFHexAccessor : public MGDoFAccessor, public DoFHexAccessor -class MGDoFSubstructAccessor : public MGDoFLineAccessor<1,CellAccessor<1> > { +class MGDoFSubstructAccessor : public MGDoFObjectAccessor<1, 1,CellAccessor<1> > { public: MGDoFSubstructAccessor () { Assert (false, ExcInternalError()); @@ -475,27 +478,27 @@ class MGDoFSubstructAccessor : public MGDoFLineAccessor<1,CellAccessor<1> > { * with template parameters. This class and #DoFSubstructAccessor<2># * wrap the following names: * \begin{verbatim} - * MGDoFSubstructAccessor<1> := MGDoFLineAccessor<1,CellAccessor<1> >; - * MGDoFSubstructAccessor<2> := MGDoFQuadAccessor<2,CellAccessor<2> >; + * MGDoFSubstructAccessor<1> := MGDoFObjectAccessor<1, 1,CellAccessor<1> >; + * MGDoFSubstructAccessor<2> := MGDoFObjectAccessor<2, 2,CellAccessor<2> >; * \end{verbatim} * We do this rather complex (and needless, provided C++ the needed constructs!) * class hierarchy manipulation, since this way we can declare and implement * the \Ref{DoFCellAccessor} dimension independent as an inheritance from * #DoFSubstructAccessor#. If we had not declared these * types, we would have to write two class declarations, one for - * #DoFCellAccessor<1>#, derived from #DoFLineAccessor<1,CellAccessor<1> ># + * #DoFCellAccessor<1>#, derived from #DoFObjectAccessor<1, 1,CellAccessor<1> ># * and one for #DoFCellAccessor<2>#, derived from - * #DoFQuadAccessor<2,CellAccessor<2> >#. + * #DoFObjectAccessor<2, 2,CellAccessor<2> >#. */ template <> -class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > { +class MGDoFSubstructAccessor<1> : public MGDoFObjectAccessor<1, 1,CellAccessor<1> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef MGDoFLineAccessor<1,CellAccessor<1> >::AccessorData AccessorData; + typedef MGDoFObjectAccessor<1, 1,CellAccessor<1> >::AccessorData AccessorData; /** * Constructor @@ -504,7 +507,7 @@ class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > const int level, const int index, const AccessorData *local_data) : - MGDoFLineAccessor<1,CellAccessor<1> > (tria,level,index,local_data) {}; + MGDoFObjectAccessor<1, 1,CellAccessor<1> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise @@ -522,14 +525,14 @@ class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > * @see MGDoFSubstructAccessor<1> */ template <> -class MGDoFSubstructAccessor<2> : public MGDoFQuadAccessor<2,CellAccessor<2> > { +class MGDoFSubstructAccessor<2> : public MGDoFObjectAccessor<2, 2,CellAccessor<2> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef MGDoFQuadAccessor<2,CellAccessor<2> >::AccessorData AccessorData; + typedef MGDoFObjectAccessor<2, 2,CellAccessor<2> >::AccessorData AccessorData; /** * Constructor @@ -538,14 +541,14 @@ class MGDoFSubstructAccessor<2> : public MGDoFQuadAccessor<2,CellAccessor<2> > { const int level, const int index, const AccessorData *local_data) : - MGDoFQuadAccessor<2,CellAccessor<2> > (tria,level,index,local_data) {}; + MGDoFObjectAccessor<2, 2,CellAccessor<2> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > face_iterator; + typedef TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > face_iterator; }; @@ -579,7 +582,7 @@ class MGDoFSubstructAccessor<3> : public MGDoFHexAccessor<3,CellAccessor<3> > { // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > face_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > face_iterator; }; @@ -590,7 +593,7 @@ class MGDoFSubstructAccessor<3> : public MGDoFHexAccessor<3,CellAccessor<3> > { /** * Grant access to the degrees of freedom on a cell. In fact, since all * access to the degrees of freedom has been enabled by the classes - * #DoFLineAccessor<1># and #DoFQuadAccessor<2># for the space dimension + * #DoFObjectAccessor<1, 1># and #DoFObjectAccessor<2, 2># for the space dimension * one and two, respectively, this class only collects the pieces * together by deriving from the appropriate #DoF*Accessor# and the * right #CellAccessor# and finally adding two functions which give @@ -642,7 +645,7 @@ class MGDoFCellAccessor : public MGDoFSubstructAccessor { * of this cell. * * This function is not implemented in 1D, - * and maps to MGDoFQuadAccessor::line in 2D. + * and maps to MGDoFObjectAccessor<2, dim>::line in 2D. */ typename MGDoFSubstructAccessor::face_iterator face (const unsigned int i) const; diff --git a/deal.II/deal.II/include/dofs/mg_dof_handler.h b/deal.II/deal.II/include/dofs/mg_dof_handler.h index f433d1ce4b..cfc826e904 100644 --- a/deal.II/deal.II/include/dofs/mg_dof_handler.h +++ b/deal.II/deal.II/include/dofs/mg_dof_handler.h @@ -64,9 +64,9 @@ class MGDoFDimensionInfo<1> { */ class MGDoFDimensionInfo<2> { public: - typedef TriaRawIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > raw_line_iterator; - typedef TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > line_iterator; - typedef TriaActiveIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > active_line_iterator; + typedef TriaRawIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > raw_line_iterator; + typedef TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > line_iterator; + typedef TriaActiveIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > active_line_iterator; typedef TriaRawIterator<2,MGDoFCellAccessor<2> > raw_quad_iterator; typedef TriaIterator<2,MGDoFCellAccessor<2> > quad_iterator; @@ -95,13 +95,13 @@ class MGDoFDimensionInfo<2> { */ class MGDoFDimensionInfo<3> { public: - typedef TriaRawIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > raw_line_iterator; - typedef TriaIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > line_iterator; - typedef TriaActiveIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > active_line_iterator; + typedef TriaRawIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > raw_line_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > line_iterator; + typedef TriaActiveIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > active_line_iterator; - typedef TriaRawIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > raw_quad_iterator; - typedef TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > quad_iterator; - typedef TriaActiveIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > active_quad_iterator; + typedef TriaRawIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > raw_quad_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > quad_iterator; + typedef TriaActiveIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > active_quad_iterator; typedef TriaRawIterator<3,MGDoFCellAccessor<3> > raw_hex_iterator; typedef TriaIterator<3,MGDoFCellAccessor<3> > hex_iterator; @@ -218,7 +218,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first cell, used + * Iterator to the first cell, used * or not, on level #level#. If a level * has no cells, a past-the-end iterator * is returned. @@ -229,7 +229,7 @@ class MGDoFHandler raw_cell_iterator begin_raw (const unsigned int level = 0) const; /** - * Return iterator to the first used cell + * Iterator to the first used cell * on level #level#. * * This function calls #begin_line# @@ -238,7 +238,7 @@ class MGDoFHandler cell_iterator begin (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * cell on level #level#. * * This function calls #begin_active_line# @@ -247,7 +247,7 @@ class MGDoFHandler active_cell_iterator begin_active(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -343,7 +343,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first face, used + * Iterator to the first face, used * or not, on level #level#. If a level * has no faces, a past-the-end iterator * is returned. @@ -354,7 +354,7 @@ class MGDoFHandler raw_face_iterator begin_raw_face (const unsigned int level = 0) const; /** - * Return iterator to the first used face + * Iterator to the first used face * on level #level#. * * This function calls #begin_line# @@ -363,7 +363,7 @@ class MGDoFHandler face_iterator begin_face (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * face on level #level#. * * This function calls #begin_active_line# @@ -372,7 +372,7 @@ class MGDoFHandler active_face_iterator begin_active_face(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -469,7 +469,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first line, used + * Iterator to the first line, used * or not, on level #level#. If a level * has no lines, a past-the-end iterator * is returned. @@ -477,19 +477,19 @@ class MGDoFHandler raw_line_iterator begin_raw_line (const unsigned int level = 0) const; /** - * Return iterator to the first used line + * Iterator to the first used line * on level #level#. */ line_iterator begin_line (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * line on level #level#. */ active_line_iterator begin_active_line(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -566,7 +566,7 @@ class MGDoFHandler /*@{ */ /** - * Return iterator to the first quad, used + * Iterator to the first quad, used * or not, on level #level#. If a level * has no quads, a past-the-end iterator * is returned. @@ -574,19 +574,19 @@ class MGDoFHandler raw_quad_iterator begin_raw_quad (const unsigned int level = 0) const; /** - * Return iterator to the first used quad + * Iterator to the first used quad * on level #level#. */ quad_iterator begin_quad (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * quad on level #level#. */ active_quad_iterator begin_active_quad(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -663,7 +663,7 @@ class MGDoFHandler /*@{ */ /** - * Return iterator to the first hex, used + * Iterator to the first hex, used * or not, on level #level#. If a level * has no hexs, a past-the-end iterator * is returned. @@ -671,19 +671,19 @@ class MGDoFHandler raw_hex_iterator begin_raw_hex (const unsigned int level = 0) const; /** - * Return iterator to the first used hex + * Iterator to the first used hex * on level #level#. */ hex_iterator begin_hex (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * hex on level #level#. */ active_hex_iterator begin_active_hex(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -871,11 +871,6 @@ class MGDoFHandler * Exception. */ DeclException0 (ExcNoMemory); - /** - * Exception. - - */ - DeclException0 (ExcInvalidIndex); /** * Exception. */ @@ -963,10 +958,10 @@ class MGDoFHandler */ vector mg_used_dofs; - friend class MGDoFLineAccessor >; - friend class MGDoFLineAccessor >; - friend class MGDoFQuadAccessor >; - friend class MGDoFQuadAccessor >; + friend class MGDoFObjectAccessor<1, dim, TriaObjectAccessor<1, dim> >; + friend class MGDoFObjectAccessor<1, dim, CellAccessor >; + friend class MGDoFObjectAccessor<2, dim, TriaObjectAccessor<2, dim> >; + friend class MGDoFObjectAccessor<2, dim, CellAccessor >; friend class MGDoFHexAccessor >; friend class MGDoFHexAccessor >; }; @@ -988,7 +983,8 @@ void MGDoFHandler::MGVertexDoFs::set_index (const unsigned int level, const unsigned int index) { Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel(level)); - Assert (dof_number < dofs_per_vertex, ExcInvalidIndex ()); + Assert (dof_number < dofs_per_vertex, + ExcIndexRange(dof_number, 0, dofs_per_vertex)); indices[(level-coarsest_level)*dofs_per_vertex + dof_number] = index; }; @@ -1003,7 +999,8 @@ int MGDoFHandler::MGVertexDoFs::get_index (const unsigned int level, const unsigned int dofs_per_vertex) const { Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel(level)); - Assert (dof_number < dofs_per_vertex, ExcInvalidIndex ()); + Assert (dof_number < dofs_per_vertex, + ExcIndexRange (dof_number, 0, dofs_per_vertex)); return indices[(level-coarsest_level)*dofs_per_vertex + dof_number]; }; diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index 54bb895b1b..39618580d9 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -290,12 +290,6 @@ class FiniteElementBase : public Subscriptor, unsigned int component_to_base(unsigned int index) const; - /** - * Exception - */ - DeclException1 (ExcInvalidIndex, - int, - << "Invalid index " << arg1); /** * Exception */ @@ -1461,9 +1455,11 @@ unsigned int FiniteElementBase::component_to_system_index (unsigned int component, unsigned int component_index) const { - Assert(component FiniteElementBase::system_to_component_index (unsigned int index) const { - Assert(index < system_to_component_table.size(), ExcInvalidIndex(index)); + Assert(index < system_to_component_table.size(), + ExcIndexRange(index, 0, system_to_component_table.size())); return system_to_component_table[index]; } @@ -1486,9 +1483,11 @@ unsigned int FiniteElementBase::face_component_to_system_index (unsigned int component, unsigned int component_index) const { - Assert(component FiniteElementBase::face_system_to_component_index (unsigned int index) const { - Assert(index < system_to_component_table.size(), ExcInvalidIndex(index)); + Assert(index < face_system_to_component_table.size(), + ExcIndexRange(index, 0, face_system_to_component_table.size())); return face_system_to_component_table[index]; } @@ -1510,7 +1510,8 @@ FiniteElementBase::component_to_base (unsigned int index) const { if (n_components == 1) return 0; - Assert(index < component_to_base_table.size(), ExcInvalidIndex(index)); + Assert(index < component_to_base_table.size(), + ExcIndexRange(index, 0, component_to_base_table.size())); return component_to_base_table[index]; } diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index bb9810d96f..3107d8d3ea 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -496,13 +496,6 @@ class FEValuesBase */ const FiniteElement & get_fe () const; - /** - * Exception - */ - DeclException2 (ExcInvalidIndex, - int, int, - << "The index " << arg1 - << " is out of range, it should be less than " << arg2); /** * Exception */ @@ -1220,9 +1213,10 @@ class FESubfaceValues : public FEFaceValuesBase template inline -const FullMatrix & FEValuesBase::get_shape_values () const { +const FullMatrix & FEValuesBase::get_shape_values () const +{ Assert (selected_dataset & FEValuesBase::get_shape_values () const { template inline const vector > > & -FEValuesBase::get_shape_grads () const { +FEValuesBase::get_shape_grads () const +{ Assert (update_flags & update_gradients, ExcAccessToUninitializedField()); return shape_gradients; }; @@ -1241,7 +1236,8 @@ FEValuesBase::get_shape_grads () const { template inline const vector > > & -FEValuesBase::get_shape_2nd_derivatives () const { +FEValuesBase::get_shape_2nd_derivatives () const +{ Assert (update_flags & update_second_derivatives, ExcAccessToUninitializedField()); return shape_2nd_derivatives; }; diff --git a/deal.II/deal.II/include/grid/geometry_info.h b/deal.II/deal.II/include/grid/geometry_info.h index b3241e77b9..eec8024104 100644 --- a/deal.II/deal.II/include/grid/geometry_info.h +++ b/deal.II/deal.II/include/grid/geometry_info.h @@ -170,13 +170,6 @@ struct GeometryInfo static unsigned int child_cell_on_face (unsigned int face, unsigned int subface); - /** - * Exception */ - DeclException2 (ExcInvalidIndex, - int, - int, - << "Invalid index " << arg1 - << ", index must be between 0 and " << arg2 << "."); }; @@ -188,8 +181,8 @@ inline unsigned int GeometryInfo<2>::child_cell_on_face (const unsigned int face, const unsigned int subface) { - Assert (face::child_cell_on_face (const unsigned int face, template<> inline unsigned int GeometryInfo<3>::child_cell_on_face (const unsigned int face, - const unsigned int subface) { - Assert (face { template <> class TriaDimensionInfo<2> { public: - typedef TriaRawIterator<2,LineAccessor<2> > raw_line_iterator; - typedef TriaIterator<2,LineAccessor<2> > line_iterator; - typedef TriaActiveIterator<2,LineAccessor<2> > active_line_iterator; + typedef TriaRawIterator<2,TriaObjectAccessor<1, 2> > raw_line_iterator; + typedef TriaIterator<2,TriaObjectAccessor<1, 2> > line_iterator; + typedef TriaActiveIterator<2,TriaObjectAccessor<1, 2> > active_line_iterator; typedef TriaRawIterator<2,CellAccessor<2> > raw_quad_iterator; typedef TriaIterator<2,CellAccessor<2> > quad_iterator; @@ -267,13 +267,13 @@ class TriaDimensionInfo<2> { template <> class TriaDimensionInfo<3> { public: - typedef TriaRawIterator<3,LineAccessor<3> > raw_line_iterator; - typedef TriaIterator<3,LineAccessor<3> > line_iterator; - typedef TriaActiveIterator<3,LineAccessor<3> > active_line_iterator; + typedef TriaRawIterator<3,TriaObjectAccessor<1, 3> > raw_line_iterator; + typedef TriaIterator<3,TriaObjectAccessor<1, 3> > line_iterator; + typedef TriaActiveIterator<3,TriaObjectAccessor<1, 3> > active_line_iterator; - typedef TriaRawIterator<3,QuadAccessor<3> > raw_quad_iterator; - typedef TriaIterator<3,QuadAccessor<3> > quad_iterator; - typedef TriaActiveIterator<3,QuadAccessor<3> > active_quad_iterator; + typedef TriaRawIterator<3,TriaObjectAccessor<2, 3> > raw_quad_iterator; + typedef TriaIterator<3,TriaObjectAccessor<2, 3> > quad_iterator; + typedef TriaActiveIterator<3,TriaObjectAccessor<2, 3> > active_quad_iterator; typedef TriaRawIterator<3,CellAccessor<3> > raw_hex_iterator; typedef TriaIterator<3,CellAccessor<3> > hex_iterator; @@ -1971,7 +1971,7 @@ class Triangulation */ /*@{*/ /** - * Return iterator to the first cell, used + * Iterator to the first cell, used * or not, on level #level#. If a level * has no cells, a past-the-end iterator * is returned. @@ -1982,7 +1982,7 @@ class Triangulation raw_cell_iterator begin_raw (const unsigned int level = 0) const; /** - * Return iterator to the first used cell + * Iterator to the first used cell * on level #level#. * * This function calls #begin_line# @@ -1991,7 +1991,7 @@ class Triangulation cell_iterator begin (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * cell on level #level#. * * This function calls #begin_active_line# @@ -2000,7 +2000,7 @@ class Triangulation active_cell_iterator begin_active(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -2098,7 +2098,7 @@ class Triangulation */ /*@{*/ /** - * Return iterator to the first face, used + * Iterator to the first face, used * or not, on level #level#. If a level * has no faces, a past-the-end iterator * is returned. @@ -2109,7 +2109,7 @@ class Triangulation raw_face_iterator begin_raw_face (const unsigned int level = 0) const; /** - * Return iterator to the first used face + * Iterator to the first used face * on level #level#. * * This function calls #begin_line# @@ -2118,7 +2118,7 @@ class Triangulation face_iterator begin_face (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * face on level #level#. * * This function calls #begin_active_line# @@ -2127,7 +2127,7 @@ class Triangulation active_face_iterator begin_active_face(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -2224,7 +2224,7 @@ class Triangulation */ /*@{*/ /** - * Return iterator to the first line, used + * Iterator to the first line, used * or not, on level #level#. If a level * has no lines, a past-the-end iterator * is returned. @@ -2233,21 +2233,21 @@ class Triangulation begin_raw_line (const unsigned int level = 0) const; /** - * Return iterator to the first used line + * Iterator to the first used line * on level #level#. */ line_iterator begin_line (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * line on level #level#. */ active_line_iterator begin_active_line(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -2330,7 +2330,7 @@ class Triangulation /*@{ */ /** - * Return iterator to the first quad, used + * Iterator to the first quad, used * or not, on level #level#. If a level * has no quads, a past-the-end iterator * is returned. @@ -2339,21 +2339,21 @@ class Triangulation begin_raw_quad (const unsigned int level = 0) const; /** - * Return iterator to the first used quad + * Iterator to the first used quad * on level #level#. */ quad_iterator begin_quad (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * quad on level #level#. */ active_quad_iterator begin_active_quad(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -2436,7 +2436,7 @@ class Triangulation /*@{ */ /** - * Return iterator to the first hex, used + * Iterator to the first hex, used * or not, on level #level#. If a level * has no hexs, a past-the-end iterator * is returned. @@ -2445,21 +2445,21 @@ class Triangulation begin_raw_hex (const unsigned int level = 0) const; /** - * Return iterator to the first used hex + * Iterator to the first used hex * on level #level#. */ hex_iterator begin_hex (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * hex on level #level#. */ active_hex_iterator begin_active_hex(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -3003,21 +3003,21 @@ class Triangulation // Friendship includes local classes. friend class TriaAccessor; - friend class LineAccessor; - friend class QuadAccessor; + friend class TriaObjectAccessor<1, dim>; + friend class TriaObjectAccessor<2, dim>; friend class HexAccessor; friend class CellAccessor; - friend class TriaRawIterator<1,LineAccessor<1> >; + friend class TriaRawIterator<1,TriaObjectAccessor<1, 1> >; friend class TriaRawIterator<1,CellAccessor<1> >; - friend class TriaRawIterator<2,LineAccessor<2> >; - friend class TriaRawIterator<2,QuadAccessor<2> >; + friend class TriaRawIterator<2,TriaObjectAccessor<1, 2> >; + friend class TriaRawIterator<2,TriaObjectAccessor<2, 2> >; friend class TriaRawIterator<2,CellAccessor<2> >; - friend class TriaRawIterator<3,LineAccessor<3> >; - friend class TriaRawIterator<3,QuadAccessor<3> >; + friend class TriaRawIterator<3,TriaObjectAccessor<1, 3> >; + friend class TriaRawIterator<3,TriaObjectAccessor<2, 3> >; friend class TriaRawIterator<3,HexAccessor<3> >; friend class TriaRawIterator<3,CellAccessor<3> >; diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index 716762ba86..500122d15d 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -35,7 +35,8 @@ * @author Wolfgang Bangerth, 1998 */ template -class TriaAccessor { +class TriaAccessor +{ protected: /** * Declare the data type that this accessor @@ -50,6 +51,7 @@ class TriaAccessor { * Constructor. Protected, thus * only callable from friend * classes. + * //TODO: Could be private: check! */ TriaAccessor (Triangulation *parent = 0, const int level = -1, @@ -192,16 +194,6 @@ class TriaAccessor { /** * Exception */ - DeclException3 (ExcInvalidIndex, - int, - int, - int, - << "Invalid index " << arg1 - << ", index must be between " << arg2 - << " and " << arg3 << "."); - /** - * Exception - */ DeclException0 (ExcUncaughtCase); /** * Exception @@ -244,6 +236,13 @@ class TriaAccessor { +/** + * Common template for line, quad, hex. + * @author Guido Kanschat, 1999 + */ +template +class TriaObjectAccessor; + @@ -257,12 +256,13 @@ class TriaAccessor { * @author Wolfgang Bangerth, 1998 */ template -class LineAccessor : public TriaAccessor { +class TriaObjectAccessor<1, dim> : public TriaAccessor +{ public: /** * Constructor. */ - LineAccessor (Triangulation *parent = 0, + TriaObjectAccessor (Triangulation *parent = 0, const int level = -1, const int index = -1, const void *local_data = 0) : @@ -359,7 +359,7 @@ class LineAccessor : public TriaAccessor { * Return a pointer to the #i#th * child. */ - TriaIterator > child (const unsigned int i) const; + TriaIterator > child (const unsigned int i) const; /** * Return the index of the #i#th child. @@ -524,7 +524,7 @@ class LineAccessor : public TriaAccessor { * and will give a linker error if * used anyway. */ - void operator = (const LineAccessor &); + void operator = (const TriaObjectAccessor<1, dim> &); @@ -563,8 +563,6 @@ class LineAccessor : public TriaAccessor { template friend class TriaRawIterator; }; - - /** * Accessor to dereference the data of quads. This accessor is used to * point to quads in #dim# space dimensions (only #dim>=2# seems reasonable @@ -575,12 +573,13 @@ class LineAccessor : public TriaAccessor { * @author Wolfgang Bangerth, 1998 */ template -class QuadAccessor : public TriaAccessor { +class TriaObjectAccessor<2, dim> : public TriaAccessor +{ public: /** * Constructor. */ - QuadAccessor (Triangulation *parent = 0, + TriaObjectAccessor (Triangulation *parent = 0, const int level = -1, const int index = -1, const void *local_data = 0) : @@ -610,7 +609,7 @@ class QuadAccessor : public TriaAccessor { * Return a pointer to the #i#th line * bounding this #Quad#. */ - TriaIterator > line (const unsigned int i) const; + TriaIterator > line (const unsigned int i) const; /** * Return the line index of the #i#th @@ -699,7 +698,7 @@ class QuadAccessor : public TriaAccessor { * Return a pointer to the #i#th * child. */ - TriaIterator > child (const unsigned int i) const; + TriaIterator > child (const unsigned int i) const; /** * Return the index of the #i#th child. @@ -883,7 +882,7 @@ class QuadAccessor : public TriaAccessor { * and will give a linker error if * used anyway. */ - void operator = (const QuadAccessor &); + void operator = (const TriaObjectAccessor<2, dim> &); protected: /**@name Advancement of iterators*/ @@ -966,7 +965,7 @@ class HexAccessor : public TriaAccessor { * Return a pointer to the #i#th line * bounding this #Hex#. */ - TriaIterator > line (const unsigned int i) const; + TriaIterator > line (const unsigned int i) const; /** * Return the line index of the #i#th @@ -979,7 +978,7 @@ class HexAccessor : public TriaAccessor { * Return a pointer to the #i#th quad * bounding this #Hex#. */ - TriaIterator > quad (const unsigned int i) const; + TriaIterator > quad (const unsigned int i) const; /** * Return the quad index of the #i#th @@ -1300,8 +1299,8 @@ class TriaSubstructAccessor; * with template parameters. This class and #TriaSubstructAccessor<2># * wrap the following names: * \begin{verbatim} - * TriaSubstructAccessor<1> := LineAccessor<1>; - * TriaSubstructAccessor<2> := QuadAccessor<2>; + * TriaSubstructAccessor<1> := TriaObjectAccessor<1, 1>; + * TriaSubstructAccessor<2> := TriaObjectAccessor<2, 2>; * TriaSubstructAccessor<3> := HexAccessor<3>; * \end{verbatim} * We do this rather complex (and needless, provided C++ the needed constructs!) @@ -1309,18 +1308,18 @@ class TriaSubstructAccessor; * the \Ref{CellAccessor} dimension independent as an inheritance from * #TriaSubstructAccessor#. If we had not declared these * types, we would have to write two class declarations, one for - * #CellAccessor<1>#, derived from #LineAccessor<1># + * #CellAccessor<1>#, derived from #TriaObjectAccessor<1, 1># * and one for #CellAccessor<2>#, derived from - * #QuadAccessor<2>#. + * #TriaObjectAccessor<2, 2>#. */ template <> -class TriaSubstructAccessor<1> : public LineAccessor<1> { +class TriaSubstructAccessor<1> : public TriaObjectAccessor<1, 1> { public: /** * Propagate the AccessorData type * into the present class. */ - typedef LineAccessor<1>::AccessorData AccessorData; + typedef TriaObjectAccessor<1, 1>::AccessorData AccessorData; /** * Constructor */ @@ -1328,7 +1327,7 @@ class TriaSubstructAccessor<1> : public LineAccessor<1> { const int level, const int index, const void *local_data) : - LineAccessor<1> (tria,level,index,local_data) {}; + TriaObjectAccessor<1, 1> (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know @@ -1347,13 +1346,13 @@ class TriaSubstructAccessor<1> : public LineAccessor<1> { * @see TriaSubstructAccessor<1> */ template <> -class TriaSubstructAccessor<2> : public QuadAccessor<2> { +class TriaSubstructAccessor<2> : public TriaObjectAccessor<2, 2> { public: /** * Propagate the AccessorData type * into the present class. */ - typedef QuadAccessor<2>::AccessorData AccessorData; + typedef TriaObjectAccessor<2, 2>::AccessorData AccessorData; /** * Constructor */ @@ -1361,7 +1360,7 @@ class TriaSubstructAccessor<2> : public QuadAccessor<2> { const int level, const int index, const void *local_data) : - QuadAccessor<2> (tria,level,index,local_data) {}; + TriaObjectAccessor<2, 2> (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know @@ -1369,7 +1368,7 @@ class TriaSubstructAccessor<2> : public QuadAccessor<2> { // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<2,LineAccessor<2> > substruct_iterator; + typedef TriaIterator<2,TriaObjectAccessor<1, 2> > substruct_iterator; }; @@ -1404,7 +1403,7 @@ class TriaSubstructAccessor<3> : public HexAccessor<3> { // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<3,QuadAccessor<3> > substruct_iterator; + typedef TriaIterator<3,TriaObjectAccessor<2, 3> > substruct_iterator; }; diff --git a/deal.II/deal.II/include/grid/tria_accessor.templates.h b/deal.II/deal.II/include/grid/tria_accessor.templates.h index d878540c4d..6a4dd2b89a 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -102,7 +102,7 @@ TriaAccessor::get_triangulation () const template inline bool -LineAccessor::used () const { +TriaObjectAccessor<1, dim>::used () const { Assert (state() == valid, ExcDereferenceInvalidObject()); return tria->levels[present_level]->lines.used[present_index]; }; @@ -113,7 +113,7 @@ LineAccessor::used () const { template inline bool -LineAccessor::user_flag_set () const { +TriaObjectAccessor<1, dim>::user_flag_set () const { Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->lines.user_flags[present_index]; }; @@ -123,7 +123,7 @@ LineAccessor::user_flag_set () const { template inline void -LineAccessor::set_user_flag () const { +TriaObjectAccessor<1, dim>::set_user_flag () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = true; }; @@ -133,7 +133,7 @@ LineAccessor::set_user_flag () const { template inline void -LineAccessor::clear_user_flag () const { +TriaObjectAccessor<1, dim>::clear_user_flag () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = false; }; @@ -143,11 +143,11 @@ LineAccessor::clear_user_flag () const { template inline -TriaIterator > -LineAccessor::child (const unsigned int i) const { +TriaIterator > +TriaObjectAccessor<1, dim>::child (const unsigned int i) const { Assert (i<2, ExcIndexRange(i,0,2)); - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > q (tria, present_level+1, child_index (i)); #ifdef DEBUG if (q.state() != past_the_end) @@ -161,7 +161,7 @@ LineAccessor::child (const unsigned int i) const { template inline int -LineAccessor::child_index (unsigned int i) const { +TriaObjectAccessor<1, dim>::child_index (unsigned int i) const { Assert (i<2, ExcIndexRange(i,0,2)); return tria->levels[present_level]->lines.children[present_index]+i; }; @@ -172,7 +172,7 @@ LineAccessor::child_index (unsigned int i) const { template inline bool -LineAccessor::has_children () const { +TriaObjectAccessor<1, dim>::has_children () const { Assert (state() == valid, ExcDereferenceInvalidObject()); return (tria->levels[present_level]->lines.children[present_index] != -1); } @@ -182,7 +182,7 @@ LineAccessor::has_children () const { template inline unsigned int -LineAccessor::max_refinement_depth () const +TriaObjectAccessor<1, dim>::max_refinement_depth () const { if (!has_children()) return 0; @@ -198,7 +198,7 @@ LineAccessor::max_refinement_depth () const template inline void -LineAccessor::operator ++ () { +TriaObjectAccessor<1, dim>::operator ++ () { ++present_index; // is index still in the range of // the vector? @@ -225,7 +225,7 @@ LineAccessor::operator ++ () { template inline void -LineAccessor::operator -- () { +TriaObjectAccessor<1, dim>::operator -- () { --present_index; // is index still in the range of // the vector? @@ -255,7 +255,7 @@ LineAccessor::operator -- () { template inline bool -QuadAccessor::used () const { +TriaObjectAccessor<2, dim>::used () const { Assert (state() == valid, ExcDereferenceInvalidObject()); return tria->levels[present_level]->quads.used[present_index]; }; @@ -266,7 +266,7 @@ QuadAccessor::used () const { template inline bool -QuadAccessor::user_flag_set () const { +TriaObjectAccessor<2, dim>::user_flag_set () const { Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->quads.user_flags[present_index]; }; @@ -276,7 +276,7 @@ QuadAccessor::user_flag_set () const { template inline void -QuadAccessor::set_user_flag () const { +TriaObjectAccessor<2, dim>::set_user_flag () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = true; }; @@ -286,7 +286,7 @@ QuadAccessor::set_user_flag () const { template inline void -QuadAccessor::clear_user_flag () const { +TriaObjectAccessor<2, dim>::clear_user_flag () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = false; }; @@ -296,10 +296,10 @@ QuadAccessor::clear_user_flag () const { template inline -TriaIterator > -QuadAccessor::line (const unsigned int i) const { +TriaIterator > +TriaObjectAccessor<2, dim>::line (const unsigned int i) const { return - TriaIterator > + TriaIterator > ( tria, present_level, @@ -312,7 +312,7 @@ QuadAccessor::line (const unsigned int i) const { template inline unsigned int -QuadAccessor::line_index (unsigned int i) const { +TriaObjectAccessor<2, dim>::line_index (unsigned int i) const { Assert (i<4, ExcIndexRange(i,0,4)); return tria->levels[present_level]->quads.quads[present_index].line(i); @@ -322,11 +322,11 @@ QuadAccessor::line_index (unsigned int i) const { template inline -TriaIterator > -QuadAccessor::child (const unsigned int i) const { +TriaIterator > +TriaObjectAccessor<2, dim>::child (const unsigned int i) const { Assert (i<4, ExcIndexRange(i,0,4)); - TriaIterator > q (tria, present_level+1, child_index (i)); + TriaIterator > q (tria, present_level+1, child_index (i)); #ifdef DEBUG if (q.state() != past_the_end) @@ -339,7 +339,7 @@ QuadAccessor::child (const unsigned int i) const { template inline -int QuadAccessor::child_index (unsigned int i) const { +int TriaObjectAccessor<2, dim>::child_index (unsigned int i) const { Assert (i<4, ExcIndexRange(i,0,4)); return tria->levels[present_level]->quads.children[present_index]+i; }; @@ -350,7 +350,7 @@ int QuadAccessor::child_index (unsigned int i) const { template inline bool -QuadAccessor::has_children () const { +TriaObjectAccessor<2, dim>::has_children () const { Assert (state() == valid, ExcDereferenceInvalidObject()); return (tria->levels[present_level]->quads.children[present_index] != -1); }; @@ -360,7 +360,7 @@ QuadAccessor::has_children () const { template inline unsigned int -QuadAccessor::max_refinement_depth () const +TriaObjectAccessor<2, dim>::max_refinement_depth () const { if (!has_children()) return 0; @@ -378,7 +378,7 @@ QuadAccessor::max_refinement_depth () const template inline void -QuadAccessor::operator ++ () { +TriaObjectAccessor<2, dim>::operator ++ () { ++present_index; // is index still in the range of // the vector? @@ -404,7 +404,7 @@ QuadAccessor::operator ++ () { template inline void -QuadAccessor::operator -- () { +TriaObjectAccessor<2, dim>::operator -- () { --present_index; // is index still in the range of // the vector? @@ -473,7 +473,7 @@ void HexAccessor::clear_user_flag () const { template inline -TriaIterator > +TriaIterator > HexAccessor::line (const unsigned int i) const { Assert (used(), ExcCellNotUsed()); Assert (i<12, ExcIndexRange (i,0,12)); @@ -496,18 +496,18 @@ HexAccessor::line (const unsigned int i) const { return quad(4)->line(3); }; Assert (false, ExcIndexRange(i,0,12)); - return TriaIterator >(tria, -1, -1, 0); + return TriaIterator >(tria, -1, -1, 0); }; template inline -TriaIterator > +TriaIterator > HexAccessor::quad (const unsigned int i) const { Assert (used(), ExcCellNotUsed()); return - TriaIterator > + TriaIterator > ( tria, present_level, diff --git a/deal.II/deal.II/include/multigrid/mg_dof_accessor.h b/deal.II/deal.II/include/multigrid/mg_dof_accessor.h index 774ef28cea..b7fcc566ec 100644 --- a/deal.II/deal.II/include/multigrid/mg_dof_accessor.h +++ b/deal.II/deal.II/include/multigrid/mg_dof_accessor.h @@ -84,7 +84,8 @@ class MGDoFAccessor { }; - +template +class MGDoFObjectAccessor; /** @@ -113,7 +114,7 @@ class MGDoFAccessor { * Unfortunately, we would run into problems, if we wanted a #DoFLineAccessor# * in one spatial dimension, in which case a line is also a cell. The traditional * solution would be to declare a #DoFCellAccessor<1># which is derived from - * #DoFLineAccessor<1># and #CellAccessor<1># (the #DoFLineAccessor# cannot + * #DoFObjectAccessor<1, 1># and #CellAccessor<1># (the #DoFObjectAccessor<1, dim># cannot * itself be derived from #CellAccessor# since a line is not a cell * unless in one space dimension), but since a #DoFLineAccessor# and a * #CellAccessor# are both derived from #TriaAccessor#, we would have to make @@ -124,20 +125,22 @@ class MGDoFAccessor { * pass a second template parameter to a #DoFLineAccessor# which tells it * which class to be derived from: if we are in one spatial dimension, the * base class is to be #CellAccessor<1>#, in two or more dimensions it - * is a #LineAccessor#, i.e. am accessor to lines without the missing + * is a #TriaObjectAccessor<1, dim>#, i.e. am accessor to lines without the missing * functionality needed for cells (neighbors, etc.). * * This way we can declare a #DoFCellAccessor# in one dimension by deriving - * from #DoFLineAccessor<1,CellAccessor<1> >#, thus getting the cell + * from #DoFObjectAccessor<1, 1,CellAccessor<1> >#, thus getting the cell * functionality through the #DoFLineAccessor# instead of through a virtual * multiple inheritance of #DoFLineAccessor# and #CellAccessor<1>#. * - * The same concept is used with #DoFQuadAccessor# classes etc. + * The same concept is used with #DoFObjectAccessor<2, dim># classes etc. * * @author Wolfgang Bangerth, 1998 */ template -class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor { +class MGDoFObjectAccessor<1, dim, BaseClass> : public MGDoFAccessor, + public DoFObjectAccessor<1, dim, BaseClass> +{ public: /** * Declare the data type that this accessor @@ -150,14 +153,14 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor# object. */ - MGDoFLineAccessor (Triangulation *tria, + MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data); @@ -213,13 +216,13 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const MGDoFLineAccessor &a); + void copy_from (const MGDoFObjectAccessor<1, dim,BaseClass> &a); }; @@ -233,7 +236,7 @@ class MGDoFLineAccessor : public MGDoFAccessor, public DoFLineAccessor -class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor { +class MGDoFObjectAccessor<2, dim, BaseClass> : public MGDoFAccessor, public DoFObjectAccessor<2, dim, BaseClass> { public: /** * Declare the data type that this accessor @@ -246,14 +249,14 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor# object. */ - MGDoFQuadAccessor (Triangulation *tria, + MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data); @@ -307,7 +310,7 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor > > + TriaIterator > > line (const unsigned int i) const; /** @@ -317,13 +320,13 @@ class MGDoFQuadAccessor : public MGDoFAccessor, public DoFQuadAccessor > child (const unsigned int) const; + TriaIterator > child (const unsigned int) const; /** * Implement the copy operator needed * for the iterator classes. */ - void copy_from (const MGDoFQuadAccessor &a); + void copy_from (const MGDoFObjectAccessor<2, dim,BaseClass> &a); }; @@ -409,14 +412,14 @@ class MGDoFHexAccessor : public MGDoFAccessor, public DoFHexAccessor > > + TriaIterator > > line (const unsigned int i) const; /** * Return a pointer to the #i#th quad * bounding this #Hex#. */ - TriaIterator > > + TriaIterator > > quad (const unsigned int i) const; /** @@ -454,7 +457,7 @@ class MGDoFHexAccessor : public MGDoFAccessor, public DoFHexAccessor -class MGDoFSubstructAccessor : public MGDoFLineAccessor<1,CellAccessor<1> > { +class MGDoFSubstructAccessor : public MGDoFObjectAccessor<1, 1,CellAccessor<1> > { public: MGDoFSubstructAccessor () { Assert (false, ExcInternalError()); @@ -475,27 +478,27 @@ class MGDoFSubstructAccessor : public MGDoFLineAccessor<1,CellAccessor<1> > { * with template parameters. This class and #DoFSubstructAccessor<2># * wrap the following names: * \begin{verbatim} - * MGDoFSubstructAccessor<1> := MGDoFLineAccessor<1,CellAccessor<1> >; - * MGDoFSubstructAccessor<2> := MGDoFQuadAccessor<2,CellAccessor<2> >; + * MGDoFSubstructAccessor<1> := MGDoFObjectAccessor<1, 1,CellAccessor<1> >; + * MGDoFSubstructAccessor<2> := MGDoFObjectAccessor<2, 2,CellAccessor<2> >; * \end{verbatim} * We do this rather complex (and needless, provided C++ the needed constructs!) * class hierarchy manipulation, since this way we can declare and implement * the \Ref{DoFCellAccessor} dimension independent as an inheritance from * #DoFSubstructAccessor#. If we had not declared these * types, we would have to write two class declarations, one for - * #DoFCellAccessor<1>#, derived from #DoFLineAccessor<1,CellAccessor<1> ># + * #DoFCellAccessor<1>#, derived from #DoFObjectAccessor<1, 1,CellAccessor<1> ># * and one for #DoFCellAccessor<2>#, derived from - * #DoFQuadAccessor<2,CellAccessor<2> >#. + * #DoFObjectAccessor<2, 2,CellAccessor<2> >#. */ template <> -class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > { +class MGDoFSubstructAccessor<1> : public MGDoFObjectAccessor<1, 1,CellAccessor<1> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef MGDoFLineAccessor<1,CellAccessor<1> >::AccessorData AccessorData; + typedef MGDoFObjectAccessor<1, 1,CellAccessor<1> >::AccessorData AccessorData; /** * Constructor @@ -504,7 +507,7 @@ class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > const int level, const int index, const AccessorData *local_data) : - MGDoFLineAccessor<1,CellAccessor<1> > (tria,level,index,local_data) {}; + MGDoFObjectAccessor<1, 1,CellAccessor<1> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise @@ -522,14 +525,14 @@ class MGDoFSubstructAccessor<1> : public MGDoFLineAccessor<1,CellAccessor<1> > * @see MGDoFSubstructAccessor<1> */ template <> -class MGDoFSubstructAccessor<2> : public MGDoFQuadAccessor<2,CellAccessor<2> > { +class MGDoFSubstructAccessor<2> : public MGDoFObjectAccessor<2, 2,CellAccessor<2> > { public: /** * Declare the data type that this accessor * class expects to get passed from the * iterator classes. */ - typedef MGDoFQuadAccessor<2,CellAccessor<2> >::AccessorData AccessorData; + typedef MGDoFObjectAccessor<2, 2,CellAccessor<2> >::AccessorData AccessorData; /** * Constructor @@ -538,14 +541,14 @@ class MGDoFSubstructAccessor<2> : public MGDoFQuadAccessor<2,CellAccessor<2> > { const int level, const int index, const AccessorData *local_data) : - MGDoFQuadAccessor<2,CellAccessor<2> > (tria,level,index,local_data) {}; + MGDoFObjectAccessor<2, 2,CellAccessor<2> > (tria,level,index,local_data) {}; // do this here, since this way the // CellAccessor has the possibility to know // what a face_iterator is. Otherwise // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > face_iterator; + typedef TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > face_iterator; }; @@ -579,7 +582,7 @@ class MGDoFSubstructAccessor<3> : public MGDoFHexAccessor<3,CellAccessor<3> > { // it would have to ask the DoFHandler // which would need another big include // file and maybe cyclic interdependence - typedef TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > face_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > face_iterator; }; @@ -590,7 +593,7 @@ class MGDoFSubstructAccessor<3> : public MGDoFHexAccessor<3,CellAccessor<3> > { /** * Grant access to the degrees of freedom on a cell. In fact, since all * access to the degrees of freedom has been enabled by the classes - * #DoFLineAccessor<1># and #DoFQuadAccessor<2># for the space dimension + * #DoFObjectAccessor<1, 1># and #DoFObjectAccessor<2, 2># for the space dimension * one and two, respectively, this class only collects the pieces * together by deriving from the appropriate #DoF*Accessor# and the * right #CellAccessor# and finally adding two functions which give @@ -642,7 +645,7 @@ class MGDoFCellAccessor : public MGDoFSubstructAccessor { * of this cell. * * This function is not implemented in 1D, - * and maps to MGDoFQuadAccessor::line in 2D. + * and maps to MGDoFObjectAccessor<2, dim>::line in 2D. */ typename MGDoFSubstructAccessor::face_iterator face (const unsigned int i) const; diff --git a/deal.II/deal.II/include/multigrid/mg_dof_handler.h b/deal.II/deal.II/include/multigrid/mg_dof_handler.h index f433d1ce4b..cfc826e904 100644 --- a/deal.II/deal.II/include/multigrid/mg_dof_handler.h +++ b/deal.II/deal.II/include/multigrid/mg_dof_handler.h @@ -64,9 +64,9 @@ class MGDoFDimensionInfo<1> { */ class MGDoFDimensionInfo<2> { public: - typedef TriaRawIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > raw_line_iterator; - typedef TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > line_iterator; - typedef TriaActiveIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > > active_line_iterator; + typedef TriaRawIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > raw_line_iterator; + typedef TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > line_iterator; + typedef TriaActiveIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > > active_line_iterator; typedef TriaRawIterator<2,MGDoFCellAccessor<2> > raw_quad_iterator; typedef TriaIterator<2,MGDoFCellAccessor<2> > quad_iterator; @@ -95,13 +95,13 @@ class MGDoFDimensionInfo<2> { */ class MGDoFDimensionInfo<3> { public: - typedef TriaRawIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > raw_line_iterator; - typedef TriaIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > line_iterator; - typedef TriaActiveIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > > active_line_iterator; + typedef TriaRawIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > raw_line_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > line_iterator; + typedef TriaActiveIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > > active_line_iterator; - typedef TriaRawIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > raw_quad_iterator; - typedef TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > quad_iterator; - typedef TriaActiveIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > > active_quad_iterator; + typedef TriaRawIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > raw_quad_iterator; + typedef TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > quad_iterator; + typedef TriaActiveIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > > active_quad_iterator; typedef TriaRawIterator<3,MGDoFCellAccessor<3> > raw_hex_iterator; typedef TriaIterator<3,MGDoFCellAccessor<3> > hex_iterator; @@ -218,7 +218,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first cell, used + * Iterator to the first cell, used * or not, on level #level#. If a level * has no cells, a past-the-end iterator * is returned. @@ -229,7 +229,7 @@ class MGDoFHandler raw_cell_iterator begin_raw (const unsigned int level = 0) const; /** - * Return iterator to the first used cell + * Iterator to the first used cell * on level #level#. * * This function calls #begin_line# @@ -238,7 +238,7 @@ class MGDoFHandler cell_iterator begin (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * cell on level #level#. * * This function calls #begin_active_line# @@ -247,7 +247,7 @@ class MGDoFHandler active_cell_iterator begin_active(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -343,7 +343,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first face, used + * Iterator to the first face, used * or not, on level #level#. If a level * has no faces, a past-the-end iterator * is returned. @@ -354,7 +354,7 @@ class MGDoFHandler raw_face_iterator begin_raw_face (const unsigned int level = 0) const; /** - * Return iterator to the first used face + * Iterator to the first used face * on level #level#. * * This function calls #begin_line# @@ -363,7 +363,7 @@ class MGDoFHandler face_iterator begin_face (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * face on level #level#. * * This function calls #begin_active_line# @@ -372,7 +372,7 @@ class MGDoFHandler active_face_iterator begin_active_face(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -469,7 +469,7 @@ class MGDoFHandler */ /*@{*/ /** - * Return iterator to the first line, used + * Iterator to the first line, used * or not, on level #level#. If a level * has no lines, a past-the-end iterator * is returned. @@ -477,19 +477,19 @@ class MGDoFHandler raw_line_iterator begin_raw_line (const unsigned int level = 0) const; /** - * Return iterator to the first used line + * Iterator to the first used line * on level #level#. */ line_iterator begin_line (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * line on level #level#. */ active_line_iterator begin_active_line(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -566,7 +566,7 @@ class MGDoFHandler /*@{ */ /** - * Return iterator to the first quad, used + * Iterator to the first quad, used * or not, on level #level#. If a level * has no quads, a past-the-end iterator * is returned. @@ -574,19 +574,19 @@ class MGDoFHandler raw_quad_iterator begin_raw_quad (const unsigned int level = 0) const; /** - * Return iterator to the first used quad + * Iterator to the first used quad * on level #level#. */ quad_iterator begin_quad (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * quad on level #level#. */ active_quad_iterator begin_active_quad(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -663,7 +663,7 @@ class MGDoFHandler /*@{ */ /** - * Return iterator to the first hex, used + * Iterator to the first hex, used * or not, on level #level#. If a level * has no hexs, a past-the-end iterator * is returned. @@ -671,19 +671,19 @@ class MGDoFHandler raw_hex_iterator begin_raw_hex (const unsigned int level = 0) const; /** - * Return iterator to the first used hex + * Iterator to the first used hex * on level #level#. */ hex_iterator begin_hex (const unsigned int level = 0) const; /** - * Return iterator to the first active + * Iterator to the first active * hex on level #level#. */ active_hex_iterator begin_active_hex(const unsigned int level = 0) const; /** - * Return iterator past the end; this + * Iterator past the end; this * iterator serves for comparisons of * iterators with past-the-end or * before-the-beginning states. @@ -871,11 +871,6 @@ class MGDoFHandler * Exception. */ DeclException0 (ExcNoMemory); - /** - * Exception. - - */ - DeclException0 (ExcInvalidIndex); /** * Exception. */ @@ -963,10 +958,10 @@ class MGDoFHandler */ vector mg_used_dofs; - friend class MGDoFLineAccessor >; - friend class MGDoFLineAccessor >; - friend class MGDoFQuadAccessor >; - friend class MGDoFQuadAccessor >; + friend class MGDoFObjectAccessor<1, dim, TriaObjectAccessor<1, dim> >; + friend class MGDoFObjectAccessor<1, dim, CellAccessor >; + friend class MGDoFObjectAccessor<2, dim, TriaObjectAccessor<2, dim> >; + friend class MGDoFObjectAccessor<2, dim, CellAccessor >; friend class MGDoFHexAccessor >; friend class MGDoFHexAccessor >; }; @@ -988,7 +983,8 @@ void MGDoFHandler::MGVertexDoFs::set_index (const unsigned int level, const unsigned int index) { Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel(level)); - Assert (dof_number < dofs_per_vertex, ExcInvalidIndex ()); + Assert (dof_number < dofs_per_vertex, + ExcIndexRange(dof_number, 0, dofs_per_vertex)); indices[(level-coarsest_level)*dofs_per_vertex + dof_number] = index; }; @@ -1003,7 +999,8 @@ int MGDoFHandler::MGVertexDoFs::get_index (const unsigned int level, const unsigned int dofs_per_vertex) const { Assert ((level >= coarsest_level) && (level <= finest_level), ExcInvalidLevel(level)); - Assert (dof_number < dofs_per_vertex, ExcInvalidIndex ()); + Assert (dof_number < dofs_per_vertex, + ExcIndexRange (dof_number, 0, dofs_per_vertex)); return indices[(level-coarsest_level)*dofs_per_vertex + dof_number]; }; diff --git a/deal.II/deal.II/include/multigrid/multigrid.templates.h b/deal.II/deal.II/include/multigrid/multigrid.templates.h index 13ac996d17..79c42344c0 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.templates.h +++ b/deal.II/deal.II/include/multigrid/multigrid.templates.h @@ -37,25 +37,28 @@ MG::copy_to_mg(const Vector& src) const unsigned int face_dofs = dofs->get_fe().dofs_per_face; d.clear(); - hanging_nodes.condense(src); +// hanging_nodes.condense(src); vector index(fe_dofs); vector mgindex(fe_dofs); vector mgfaceindex(face_dofs); - { - ofstream of("CT"); - DataOut<2> out; - out.attach_dof_handler(*dofs); - out.add_data_vector(src,"solution"); - out.write_gnuplot(of,1); - } +// { +// ofstream of("CT"); +// DataOut<2> out; +// out.attach_dof_handler(*dofs); +// out.add_data_vector(src,"solution"); +// out.write_gnuplot(of,1); +// } for (int level = maxlevel ; level >= (int) minlevel ; --level) { DoFHandler::active_cell_iterator dc = dofs->DoFHandler::begin_active(level); MGDoFHandler::active_cell_iterator c = dofs->begin_active(level); - for (; c != dofs->end(level) ; ++c, ++dc) + +//TODO: Document on difference between #end# and #end_level# + + for (; c != dofs->end_active(level) ; ++c, ++dc) { dc->get_dof_indices(index); c->get_mg_dof_indices(mgindex); @@ -80,13 +83,13 @@ MG::copy_to_mg(const Vector& src) transfer->restrict(level+1, d[level], d[level+1]); } - for (unsigned int i=minlevel; i<= maxlevel; ++i) - { - char name[10]; - sprintf(name,"CT%d",i); - ofstream of(name); - write_gnuplot(*dofs, d[i], i, of); - } +// for (unsigned int i=minlevel; i<= maxlevel; ++i) +// { +// char name[10]; +// sprintf(name,"CT%d",i); +// ofstream of(name); +// write_gnuplot(*dofs, d[i], i, of); +// } } template template @@ -98,13 +101,13 @@ MG::copy_from_mg(Vector& dst) const vector index(fe_dofs); vector mgindex(fe_dofs); - for (unsigned int i=minlevel; i<= maxlevel; ++i) - { - char name[10]; - sprintf(name,"CF%d",i); - ofstream of(name); - write_gnuplot(*dofs, s[i], i, of); - } +// for (unsigned int i=minlevel; i<= maxlevel; ++i) +// { +// char name[10]; +// sprintf(name,"CF%d",i); +// ofstream of(name); +// write_gnuplot(*dofs, s[i], i, of); +// } DoFHandler::active_cell_iterator dc = dofs->DoFHandler::begin_active(); for (MGDoFHandler::active_cell_iterator c = dofs->begin_active() @@ -116,13 +119,13 @@ MG::copy_from_mg(Vector& dst) const dst(index[i]) = s[c->level()](mgindex[i]); } hanging_nodes.set_zero(dst); - { - ofstream of("CF"); - DataOut<2> out; - out.attach_dof_handler(*dofs); - out.add_data_vector(dst,"solution"); - out.write_gnuplot(of,1); - } +// { +// ofstream of("CF"); +// DataOut<2> out; +// out.attach_dof_handler(*dofs); +// out.add_data_vector(dst,"solution"); +// out.write_gnuplot(of,1); +// } } template diff --git a/deal.II/deal.II/include/numerics/multigrid.templates.h b/deal.II/deal.II/include/numerics/multigrid.templates.h index 13ac996d17..79c42344c0 100644 --- a/deal.II/deal.II/include/numerics/multigrid.templates.h +++ b/deal.II/deal.II/include/numerics/multigrid.templates.h @@ -37,25 +37,28 @@ MG::copy_to_mg(const Vector& src) const unsigned int face_dofs = dofs->get_fe().dofs_per_face; d.clear(); - hanging_nodes.condense(src); +// hanging_nodes.condense(src); vector index(fe_dofs); vector mgindex(fe_dofs); vector mgfaceindex(face_dofs); - { - ofstream of("CT"); - DataOut<2> out; - out.attach_dof_handler(*dofs); - out.add_data_vector(src,"solution"); - out.write_gnuplot(of,1); - } +// { +// ofstream of("CT"); +// DataOut<2> out; +// out.attach_dof_handler(*dofs); +// out.add_data_vector(src,"solution"); +// out.write_gnuplot(of,1); +// } for (int level = maxlevel ; level >= (int) minlevel ; --level) { DoFHandler::active_cell_iterator dc = dofs->DoFHandler::begin_active(level); MGDoFHandler::active_cell_iterator c = dofs->begin_active(level); - for (; c != dofs->end(level) ; ++c, ++dc) + +//TODO: Document on difference between #end# and #end_level# + + for (; c != dofs->end_active(level) ; ++c, ++dc) { dc->get_dof_indices(index); c->get_mg_dof_indices(mgindex); @@ -80,13 +83,13 @@ MG::copy_to_mg(const Vector& src) transfer->restrict(level+1, d[level], d[level+1]); } - for (unsigned int i=minlevel; i<= maxlevel; ++i) - { - char name[10]; - sprintf(name,"CT%d",i); - ofstream of(name); - write_gnuplot(*dofs, d[i], i, of); - } +// for (unsigned int i=minlevel; i<= maxlevel; ++i) +// { +// char name[10]; +// sprintf(name,"CT%d",i); +// ofstream of(name); +// write_gnuplot(*dofs, d[i], i, of); +// } } template template @@ -98,13 +101,13 @@ MG::copy_from_mg(Vector& dst) const vector index(fe_dofs); vector mgindex(fe_dofs); - for (unsigned int i=minlevel; i<= maxlevel; ++i) - { - char name[10]; - sprintf(name,"CF%d",i); - ofstream of(name); - write_gnuplot(*dofs, s[i], i, of); - } +// for (unsigned int i=minlevel; i<= maxlevel; ++i) +// { +// char name[10]; +// sprintf(name,"CF%d",i); +// ofstream of(name); +// write_gnuplot(*dofs, s[i], i, of); +// } DoFHandler::active_cell_iterator dc = dofs->DoFHandler::begin_active(); for (MGDoFHandler::active_cell_iterator c = dofs->begin_active() @@ -116,13 +119,13 @@ MG::copy_from_mg(Vector& dst) const dst(index[i]) = s[c->level()](mgindex[i]); } hanging_nodes.set_zero(dst); - { - ofstream of("CF"); - DataOut<2> out; - out.attach_dof_handler(*dofs); - out.add_data_vector(dst,"solution"); - out.write_gnuplot(of,1); - } +// { +// ofstream of("CF"); +// DataOut<2> out; +// out.attach_dof_handler(*dofs); +// out.add_data_vector(dst,"solution"); +// out.write_gnuplot(of,1); +// } } template diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index ab4c0f38f5..2b0163bd0a 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -26,7 +26,7 @@ template -void DoFLineAccessor::set_dof_index (const unsigned int i, +void DoFObjectAccessor<1, dim,BaseClass>::set_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -43,7 +43,7 @@ void DoFLineAccessor::set_dof_index (const unsigned int i, template -void DoFLineAccessor::set_vertex_dof_index (const unsigned int vertex, +void DoFObjectAccessor<1, dim,BaseClass>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -61,7 +61,7 @@ void DoFLineAccessor::set_vertex_dof_index (const unsigned int ve template -void DoFLineAccessor:: +void DoFObjectAccessor<1, dim,BaseClass>:: distribute_local_to_global (const Vector &local_source, Vector &global_destination) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -86,7 +86,7 @@ distribute_local_to_global (const Vector &local_source, template -void DoFLineAccessor:: +void DoFObjectAccessor<1, dim,BaseClass>:: distribute_local_to_global (const FullMatrix &local_source, SparseMatrix &global_destination) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -119,7 +119,7 @@ distribute_local_to_global (const FullMatrix &local_source, template -void DoFQuadAccessor::set_dof_index (const unsigned int i, +void DoFObjectAccessor<2, dim,BaseClass>::set_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -135,7 +135,7 @@ void DoFQuadAccessor::set_dof_index (const unsigned int i, template -void DoFQuadAccessor::set_vertex_dof_index (const unsigned int vertex, +void DoFObjectAccessor<2, dim,BaseClass>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -153,7 +153,7 @@ void DoFQuadAccessor::set_vertex_dof_index (const unsigned int ve template -void DoFQuadAccessor:: +void DoFObjectAccessor<2, dim,BaseClass>:: distribute_local_to_global (const Vector &local_source, Vector &global_destination) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -179,7 +179,7 @@ distribute_local_to_global (const Vector &local_source, template -void DoFQuadAccessor:: +void DoFObjectAccessor<2, dim,BaseClass>:: distribute_local_to_global (const FullMatrix &local_source, SparseMatrix &global_destination) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -785,7 +785,7 @@ DoFCellAccessor::set_dof_values_by_interpolation(const Vector #if deal_II_dimension == 1 -template class DoFLineAccessor<1,CellAccessor<1> >; +template class DoFObjectAccessor<1, 1,CellAccessor<1> >; template class DoFCellAccessor<1>; template class TriaRawIterator<1,DoFCellAccessor<1> >; @@ -794,38 +794,38 @@ template class TriaActiveIterator<1,DoFCellAccessor<1> >; #endif #if deal_II_dimension == 2 -template class DoFLineAccessor<2,LineAccessor<2> >; -template class DoFQuadAccessor<2,QuadAccessor<2> >; -template class DoFQuadAccessor<2,CellAccessor<2> >; +template class DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> >; +template class DoFObjectAccessor<2, 2,TriaObjectAccessor<2, 2> >; +template class DoFObjectAccessor<2, 2,CellAccessor<2> >; template class DoFCellAccessor<2>; -template class TriaRawIterator<2,DoFLineAccessor<2,LineAccessor<2> > >; -template class TriaRawIterator<2,DoFQuadAccessor<2,QuadAccessor<2> > >; +template class TriaRawIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; +template class TriaRawIterator<2,DoFObjectAccessor<2, 2,TriaObjectAccessor<2, 2> > >; template class TriaRawIterator<2,DoFCellAccessor<2> >; -template class TriaIterator<2,DoFLineAccessor<2,LineAccessor<2> > >; +template class TriaIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaIterator<2,DoFCellAccessor<2> >; -template class TriaActiveIterator<2,DoFLineAccessor<2,LineAccessor<2> > >; +template class TriaActiveIterator<2,DoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaActiveIterator<2,DoFCellAccessor<2> >; #endif #if deal_II_dimension == 3 -template class DoFLineAccessor<3,LineAccessor<3> >; -template class DoFQuadAccessor<3,QuadAccessor<3> >; +template class DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> >; +template class DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> >; template class DoFHexAccessor<3,HexAccessor<3> >; template class DoFHexAccessor<3,CellAccessor<3> >; template class DoFCellAccessor<3>; -template class TriaRawIterator<3,DoFLineAccessor<3,LineAccessor<3> > >; -template class TriaRawIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaRawIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaRawIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaRawIterator<3,DoFHexAccessor<3,HexAccessor<3> > >; template class TriaRawIterator<3,DoFCellAccessor<3> >; -template class TriaIterator<3,DoFLineAccessor<3,LineAccessor<3> > >; -template class TriaIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaIterator<3,DoFCellAccessor<3> >; -template class TriaActiveIterator<3,DoFLineAccessor<3,LineAccessor<3> > >; -template class TriaActiveIterator<3,DoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaActiveIterator<3,DoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaActiveIterator<3,DoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaActiveIterator<3,DoFCellAccessor<3> >; #endif diff --git a/deal.II/deal.II/source/dofs/mg_dof_accessor.cc b/deal.II/deal.II/source/dofs/mg_dof_accessor.cc index 29c0c8a297..97b95bfb6b 100644 --- a/deal.II/deal.II/source/dofs/mg_dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/mg_dof_accessor.cc @@ -22,17 +22,17 @@ /* ------------------------ MGDoFLineAccessor --------------------------- */ template -MGDoFLineAccessor::MGDoFLineAccessor (Triangulation *tria, +MGDoFObjectAccessor<1, dim,BaseClass>::MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : MGDoFAccessor (local_data), - DoFLineAccessor(tria,level,index,local_data) {}; + DoFObjectAccessor<1, dim,BaseClass>(tria,level,index,local_data) {}; template -int MGDoFLineAccessor::mg_dof_index (const unsigned int i) const { +int MGDoFObjectAccessor<1, dim,BaseClass>::mg_dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -50,7 +50,7 @@ int MGDoFLineAccessor::mg_dof_index (const unsigned int i) const template -void MGDoFLineAccessor::set_mg_dof_index (const unsigned int i, +void MGDoFObjectAccessor<1, dim,BaseClass>::set_mg_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -68,7 +68,7 @@ void MGDoFLineAccessor::set_mg_dof_index (const unsigned int i, template -int MGDoFLineAccessor::mg_vertex_dof_index (const unsigned int vertex, +int MGDoFObjectAccessor<1, dim,BaseClass>::mg_vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -84,7 +84,7 @@ int MGDoFLineAccessor::mg_vertex_dof_index (const unsigned int ve template -void MGDoFLineAccessor::set_mg_vertex_dof_index (const unsigned int vertex, +void MGDoFObjectAccessor<1, dim,BaseClass>::set_mg_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -102,7 +102,7 @@ void MGDoFLineAccessor::set_mg_vertex_dof_index (const unsigned i template void -MGDoFLineAccessor::get_mg_dof_indices (vector &dof_indices) const { +MGDoFObjectAccessor<1, dim,BaseClass>::get_mg_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); Assert (&dof_handler->get_fe() != 0, ExcInvalidObject()); @@ -123,9 +123,9 @@ MGDoFLineAccessor::get_mg_dof_indices (vector &dof_indices) template -TriaIterator > -MGDoFLineAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +MGDoFObjectAccessor<1, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), mg_dof_handler); @@ -141,8 +141,9 @@ MGDoFLineAccessor::child (const unsigned int i) const { template void -MGDoFLineAccessor::copy_from (const MGDoFLineAccessor &a) { - DoFLineAccessor::copy_from (a); +MGDoFObjectAccessor<1, dim,BaseClass>::copy_from (const MGDoFObjectAccessor<1, dim,BaseClass> &a) +{ + DoFObjectAccessor<1, dim,BaseClass>::copy_from (a); set_mg_dof_handler (a.mg_dof_handler); }; @@ -152,18 +153,19 @@ MGDoFLineAccessor::copy_from (const MGDoFLineAccessor -MGDoFQuadAccessor::MGDoFQuadAccessor (Triangulation *tria, +MGDoFObjectAccessor<2, dim,BaseClass>::MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : MGDoFAccessor (local_data), - DoFQuadAccessor(tria,level,index,local_data) {}; + DoFObjectAccessor<2, dim,BaseClass>(tria,level,index,local_data) +{}; template inline -int MGDoFQuadAccessor::mg_dof_index (const unsigned int i) const { +int MGDoFObjectAccessor<2, dim,BaseClass>::mg_dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -179,7 +181,7 @@ int MGDoFQuadAccessor::mg_dof_index (const unsigned int i) const template -void MGDoFQuadAccessor::set_mg_dof_index (const unsigned int i, +void MGDoFObjectAccessor<2, dim,BaseClass>::set_mg_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -197,7 +199,7 @@ void MGDoFQuadAccessor::set_mg_dof_index (const unsigned int i, template inline -int MGDoFQuadAccessor::mg_vertex_dof_index (const unsigned int vertex, +int MGDoFObjectAccessor<2, dim,BaseClass>::mg_vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -213,7 +215,7 @@ int MGDoFQuadAccessor::mg_vertex_dof_index (const unsigned int ve template -void MGDoFQuadAccessor::set_mg_vertex_dof_index (const unsigned int vertex, +void MGDoFObjectAccessor<2, dim,BaseClass>::set_mg_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -231,7 +233,7 @@ void MGDoFQuadAccessor::set_mg_vertex_dof_index (const unsigned i template void -MGDoFQuadAccessor::get_mg_dof_indices (vector &dof_indices) const { +MGDoFObjectAccessor<2, dim,BaseClass>::get_mg_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); Assert (&dof_handler->get_fe() != 0, ExcInvalidObject()); @@ -257,11 +259,11 @@ MGDoFQuadAccessor::get_mg_dof_indices (vector &dof_indices) template -TriaIterator > > -MGDoFQuadAccessor::line (const unsigned int i) const { +TriaIterator > > +MGDoFObjectAccessor<2, dim,BaseClass>::line (const unsigned int i) const { Assert (i<4, ExcIndexRange (i, 0, 4)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -273,9 +275,9 @@ MGDoFQuadAccessor::line (const unsigned int i) const { template -TriaIterator > -MGDoFQuadAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +MGDoFObjectAccessor<2, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), mg_dof_handler); @@ -291,8 +293,8 @@ MGDoFQuadAccessor::child (const unsigned int i) const { template void -MGDoFQuadAccessor::copy_from (const MGDoFQuadAccessor &a) { - DoFQuadAccessor::copy_from (a); +MGDoFObjectAccessor<2, dim,BaseClass>::copy_from (const MGDoFObjectAccessor<2, dim,BaseClass> &a) { + DoFObjectAccessor<2, dim,BaseClass>::copy_from (a); set_mg_dof_handler (a.mg_dof_handler); }; @@ -412,11 +414,11 @@ MGDoFHexAccessor::get_mg_dof_indices (vector &dof_indices) c template -TriaIterator > > +TriaIterator > > MGDoFHexAccessor::line (const unsigned int i) const { Assert (i<12, ExcIndexRange (i, 0, 12)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -428,11 +430,11 @@ MGDoFHexAccessor::line (const unsigned int i) const { template -TriaIterator > > +TriaIterator > > MGDoFHexAccessor::quad (const unsigned int i) const { Assert (i<12, ExcIndexRange (i, 0, 6)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -588,7 +590,7 @@ MGDoFCellAccessor<2>::get_mg_dof_values (const Vector &values, // explicit instantiations #if deal_II_dimension == 1 -template class MGDoFLineAccessor<1,CellAccessor<1> >; +template class MGDoFObjectAccessor<1, 1,CellAccessor<1> >; template class MGDoFCellAccessor<1>; template class TriaRawIterator<1,MGDoFCellAccessor<1> >; @@ -597,36 +599,36 @@ template class TriaActiveIterator<1,MGDoFCellAccessor<1> >; #endif #if deal_II_dimension == 2 -template class MGDoFLineAccessor<2,LineAccessor<2> >; -template class MGDoFQuadAccessor<2,QuadAccessor<2> >; -template class MGDoFQuadAccessor<2,CellAccessor<2> >; +template class MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> >; +template class MGDoFObjectAccessor<2, 2,TriaObjectAccessor<2, 2> >; +template class MGDoFObjectAccessor<2, 2,CellAccessor<2> >; template class MGDoFCellAccessor<2>; -template class TriaRawIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaRawIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaRawIterator<2,MGDoFCellAccessor<2> >; -template class TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaIterator<2,MGDoFCellAccessor<2> >; -template class TriaActiveIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaActiveIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaActiveIterator<2,MGDoFCellAccessor<2> >; #endif #if deal_II_dimension == 3 -template class MGDoFLineAccessor<3,LineAccessor<3> >; -template class MGDoFQuadAccessor<3,QuadAccessor<3> >; +template class MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> >; +template class MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> >; template class MGDoFHexAccessor<3,HexAccessor<3> >; template class MGDoFHexAccessor<3,CellAccessor<3> >; template class MGDoFCellAccessor<3>; -template class TriaRawIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaRawIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaRawIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaRawIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaRawIterator<3,MGDoFHexAccessor<3,HexAccessor<3> > >; template class TriaRawIterator<3,MGDoFCellAccessor<3> >; -template class TriaIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaIterator<3,MGDoFCellAccessor<3> >; -template class TriaActiveIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaActiveIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaActiveIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaActiveIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaActiveIterator<3,MGDoFCellAccessor<3> >; #endif diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index 48a6c38eeb..ded20956be 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -200,8 +200,10 @@ FiniteElementBase::FiniteElementBase (const FiniteElementData &fe_data template const FullMatrix & -FiniteElementBase::restrict (const unsigned int child) const { - Assert (child::children_per_cell, ExcInvalidIndex(child)); +FiniteElementBase::restrict (const unsigned int child) const +{ + Assert (child::children_per_cell, + ExcIndexRange(child, 0, GeometryInfo::children_per_cell)); return restriction[child]; }; @@ -209,8 +211,10 @@ FiniteElementBase::restrict (const unsigned int child) const { template const FullMatrix & -FiniteElementBase::prolongate (const unsigned int child) const { - Assert (child::children_per_cell, ExcInvalidIndex(child)); +FiniteElementBase::prolongate (const unsigned int child) const +{ + Assert (child::children_per_cell, + ExcIndexRange(child, 0, GeometryInfo::children_per_cell)); return prolongation[child]; }; @@ -218,7 +222,8 @@ FiniteElementBase::prolongate (const unsigned int child) const { template const FullMatrix & -FiniteElementBase::constraints () const { +FiniteElementBase::constraints () const +{ if (dim==1) Assert ((interface_constraints.m()==1) && (interface_constraints.n()==1), ExcWrongInterfaceMatrixSize(interface_constraints.m(), diff --git a/deal.II/deal.II/source/fe/fe_lib.criss_cross.cc b/deal.II/deal.II/source/fe/fe_lib.criss_cross.cc index 538128bd07..b8fab956ff 100644 --- a/deal.II/deal.II/source/fe/fe_lib.criss_cross.cc +++ b/deal.II/deal.II/source/fe/fe_lib.criss_cross.cc @@ -512,8 +512,9 @@ FECrissCross<2>::FECrissCross () : template <> inline double FECrissCross<2>::shape_value (const unsigned int i, - const Point<2> &p) const { - Assert((i &p) const +{ + Assert((i::shape_value (const unsigned int i, template <> inline -Tensor<1,2> FECrissCross<2>::shape_grad (const unsigned int i, const Point<2> &p) const { - Assert((i FECrissCross<2>::shape_grad (const unsigned int i, const Point<2> &p) const +{ + Assert((i FECrissCross<2>::shape_grad_grad (const unsigned int i, const Point<2> &) const { - Assert((i::shape_value (const unsigned int i, const Point<1> &p) const { - Assert((i FEQ3<1>::shape_grad (const unsigned int i, const Point<1> &p) const { - Assert((i, so we @@ -156,7 +156,7 @@ Tensor<2,1> FEQ3<1>::shape_grad_grad (const unsigned int i, const Point<1> &p) const { - Assert (i return_value; @@ -699,7 +699,7 @@ double FEQ3<2>::shape_value (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ3<2>::shape_grad (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ3<2>::shape_grad_grad (const unsigned int i, const Point<2> &p) const { - Assert (i::shape_value (const unsigned int i, const Point<3> &p) const { - Assert (i FEQ3<3>::shape_grad (const unsigned int i, const Point<3> &p) const { - Assert (i FEQ3<3>::shape_grad_grad (const unsigned int i, const Point<3> &p) const { - Assert (i::shape_value(const unsigned int i, const Point<1> &p) const { - Assert((i FEQ1<1>::shape_grad(const unsigned int i, const Point<1>&) const { - Assert((i, so we // still construct it as that. it should @@ -110,7 +110,7 @@ Tensor<2,1> FEQ1<1>::shape_grad_grad (const unsigned int i, const Point<1> &) const { - Assert((i(); @@ -241,7 +241,7 @@ double FEQ1<2>::shape_value (const unsigned int i, const Point<2>& p) const { - Assert((i FEQ1<2>::shape_grad (const unsigned int i, const Point<2>& p) const { - Assert((i, so we // still construct it as that. it should @@ -284,7 +284,7 @@ Tensor<2,2> FEQ1<2>::shape_grad_grad (const unsigned int i, const Point<2> &) const { - Assert((i::shape_value (const unsigned int i, const Point<3>& p) const { - Assert((i FEQ1<3>::shape_grad (const unsigned int i, const Point<3>& p) const { - Assert((i, so we // still construct it as that. it should @@ -767,7 +767,7 @@ Tensor<2,3> FEQ1<3>::shape_grad_grad (const unsigned int i, const Point<3> &p) const { - Assert((i return_value; diff --git a/deal.II/deal.II/source/fe/fe_lib.quadratic.cc b/deal.II/deal.II/source/fe/fe_lib.quadratic.cc index c16f5e83da..430eb71af2 100644 --- a/deal.II/deal.II/source/fe/fe_lib.quadratic.cc +++ b/deal.II/deal.II/source/fe/fe_lib.quadratic.cc @@ -123,7 +123,7 @@ double FEQ2<1>::shape_value(const unsigned int i, const Point<1> &p) const { - Assert((i FEQ2<1>::shape_grad(const unsigned int i, const Point<1> &p) const { - Assert((i, so we @@ -164,7 +164,7 @@ Tensor<2,1> FEQ2<1>::shape_grad_grad (const unsigned int i, const Point<1> &) const { - Assert((i return_value; switch (i) @@ -647,7 +647,7 @@ double FEQ2<2>::shape_value (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ2<2>::shape_grad (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ2<2>::shape_grad_grad (const unsigned int i, const Point<2> &p) const { - Assert (i::shape_value (const unsigned int i, const Point<3> &p) const { - Assert (i FEQ2<3>::shape_grad (const unsigned int i, const Point<3> &p) const { - Assert (i FEQ2<3>::shape_grad_grad (const unsigned int i, const Point<3> &p) const { - Assert (i::shape_value(const unsigned int i, const Point<1> &p) const { - Assert((i FEQ4<1>::shape_grad(const unsigned int i, const Point<1> &p) const { - Assert((i, so we @@ -122,7 +122,7 @@ Tensor<2,1> FEQ4<1>::shape_grad_grad (const unsigned int i, const Point<1> &p) const { - Assert (i return_value; @@ -981,7 +981,7 @@ double FEQ4<2>::shape_value (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ4<2>::shape_grad (const unsigned int i, const Point<2> &p) const { - Assert (i FEQ4<2>::shape_grad_grad (const unsigned int i, const Point<2> &p) const { - Assert (i::get_function_values (const Vector &fe_function, Assert (fe->n_components == 1, ExcWrongNoOfComponents()); Assert (selected_dataset::get_function_values (const Vector &fe_functi Assert (n_quadrature_points == values.size(), ExcWrongVectorSize(values.size(), n_quadrature_points)); Assert (selected_datasetn_components, ExcWrongNoOfComponents()); @@ -127,9 +127,9 @@ FEValuesBase::shape_grad (const unsigned int i, const unsigned int j) const { Assert (i::get_function_grads (const Vector &fe_ Assert (n_quadrature_points == gradients.size(), ExcWrongNoOfComponents()); Assert (selected_datasetn_components, ExcWrongVectorSize(gradients.size(), n_quadrature_points)); @@ -204,9 +204,9 @@ const Tensor<2,dim> & FEValuesBase::shape_2nd_derivative (const unsigned int i, const unsigned int j) const { Assert (i::get_function_2nd_derivatives (const Vector &fe template const Point & -FEValuesBase::quadrature_point (const unsigned int i) const { - Assert (i::quadrature_point (const unsigned int i) const +{ + Assert (i::quadrature_point (const unsigned int i) const { template const Point & -FEValuesBase::support_point (const unsigned int i) const { - Assert (i::support_point (const unsigned int i) const +{ + Assert (i::support_point (const unsigned int i) const { template -double FEValuesBase::JxW (const unsigned int i) const { - Assert (i::JxW (const unsigned int i) const +{ + Assert (i::shape_value_transform (const unsigned int i, const Point<1> &p) const { - Assert((i<2), ExcInvalidIndex(i)); + Assert((i<2), ExcIndexRange(i,0,2)); const double xi = p(0); switch (i) { @@ -59,7 +59,7 @@ Tensor<1,1> FEQ1Mapping<1>::shape_grad_transform(const unsigned int i, const Point<1>&) const { - Assert((i<2), ExcInvalidIndex(i)); + Assert((i<2), ExcIndexRange(i,0,2)); switch (i) { case 0: return Point<1>(-1.); @@ -162,7 +162,7 @@ double FEQ1Mapping<2>::shape_value_transform (const unsigned int i, const Point<2>& p) const { - Assert((i<4), ExcInvalidIndex(i)); + Assert((i<4), ExcIndexRange(i,0,4)); switch (i) { case 0: return (1.-p(0)) * (1.-p(1)); @@ -181,7 +181,7 @@ Tensor<1,2> FEQ1Mapping<2>::shape_grad_transform (const unsigned int i, const Point<2>& p) const { - Assert((i<4), ExcInvalidIndex(i)); + Assert((i<4), ExcIndexRange(i,0,4)); switch (i) { case 0: return Point<2> (p(1)-1., p(0)-1.); @@ -333,7 +333,7 @@ double FEQ1Mapping<3>::shape_value_transform (const unsigned int i, const Point<3>& p) const { - Assert((i<8), ExcInvalidIndex(i)); + Assert((i<8), ExcIndexRange(i,0,8)); switch (i) { case 0: return 1.0-p(0)+(-1.0+p(0))*p(1)+(-1.0+p(0)+(1.0-p(0))*p(1))*p(2); @@ -356,7 +356,7 @@ Tensor<1,3> FEQ1Mapping<3>::shape_grad_transform (const unsigned int i, const Point<3>& p) const { - Assert((i<8), ExcInvalidIndex(i)); + Assert((i<8), ExcIndexRange(i,0,8)); switch (i) { case 0: return Point<3>(-1.0+p(1)+(1.0-p(1))*p(2), diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 86ffd9510f..6cfcf9b19d 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -20,14 +20,14 @@ /*------------------------ Functions: LineAccessor ---------------------------*/ template -void LineAccessor::set (const Line &line) const { +void TriaObjectAccessor<1, dim>::set (const Line &line) const { tria->levels[present_level]->lines.lines[present_index] = line; }; template -int LineAccessor::vertex_index (const unsigned int i) const { +int TriaObjectAccessor<1, dim>::vertex_index (const unsigned int i) const { Assert (i<2, ExcIndexRange(i,0,2)); return tria->levels[present_level]->lines.lines[present_index].vertex (i); }; @@ -36,14 +36,14 @@ int LineAccessor::vertex_index (const unsigned int i) const { template Point & -LineAccessor::vertex (const unsigned int i) const { +TriaObjectAccessor<1, dim>::vertex (const unsigned int i) const { return tria->vertices[vertex_index(i)]; }; template -void LineAccessor::set_used_flag () const { +void TriaObjectAccessor<1, dim>::set_used_flag () const { Assert (state() == valid, ExcDereferenceInvalidObject()); tria->levels[present_level]->lines.used[present_index] = true; }; @@ -51,7 +51,7 @@ void LineAccessor::set_used_flag () const { template -void LineAccessor::clear_used_flag () const { +void TriaObjectAccessor<1, dim>::clear_used_flag () const { Assert (state() == valid, ExcDereferenceInvalidObject()); tria->levels[present_level]->lines.used[present_index] = false; }; @@ -59,7 +59,7 @@ void LineAccessor::clear_used_flag () const { template -void LineAccessor::recursively_set_user_flag () const { +void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const { set_user_flag (); if (has_children()) @@ -70,7 +70,7 @@ void LineAccessor::recursively_set_user_flag () const { template -void LineAccessor::recursively_clear_user_flag () const { +void TriaObjectAccessor<1, dim>::recursively_clear_user_flag () const { clear_user_flag (); if (has_children()) @@ -81,7 +81,7 @@ void LineAccessor::recursively_clear_user_flag () const { template -void LineAccessor::set_user_pointer (void *p) const { +void TriaObjectAccessor<1, dim>::set_user_pointer (void *p) const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.user_pointers[present_index] = p; }; @@ -89,7 +89,7 @@ void LineAccessor::set_user_pointer (void *p) const { template -void LineAccessor::clear_user_pointer () const { +void TriaObjectAccessor<1, dim>::clear_user_pointer () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.user_pointers[present_index] = 0; }; @@ -97,14 +97,14 @@ void LineAccessor::clear_user_pointer () const { template -void * LineAccessor::user_pointer () const { +void * TriaObjectAccessor<1, dim>::user_pointer () const { Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->lines.user_pointers[present_index]; }; template -void LineAccessor::set_children (const int index) const { +void TriaObjectAccessor<1, dim>::set_children (const int index) const { Assert (used(), ExcCellNotUsed()); Assert ((index==-1) || (!has_children() && (index>=0)), ExcCantSetChildren(index)); @@ -115,14 +115,14 @@ void LineAccessor::set_children (const int index) const { template -void LineAccessor::clear_children () const { +void TriaObjectAccessor<1, dim>::clear_children () const { set_children (-1); }; template -unsigned char LineAccessor::boundary_indicator () const { +unsigned char TriaObjectAccessor<1, dim>::boundary_indicator () const { Assert (dim>=2, ExcNotUsefulForThisDimension()); Assert (used(), ExcCellNotUsed()); @@ -132,7 +132,7 @@ unsigned char LineAccessor::boundary_indicator () const { template -void LineAccessor::set_boundary_indicator (unsigned char boundary_ind) const { +void TriaObjectAccessor<1, dim>::set_boundary_indicator (unsigned char boundary_ind) const { Assert (dim>=2, ExcNotUsefulForThisDimension()); Assert (used(), ExcCellNotUsed()); @@ -142,7 +142,7 @@ void LineAccessor::set_boundary_indicator (unsigned char boundary_ind) cons template -bool LineAccessor::at_boundary () const { +bool TriaObjectAccessor<1, dim>::at_boundary () const { // error checking is done // in boundary_indicator() return (boundary_indicator() != 255); @@ -151,35 +151,35 @@ bool LineAccessor::at_boundary () const { template -double LineAccessor::diameter () const { +double TriaObjectAccessor<1, dim>::diameter () const { return sqrt((vertex(1)-vertex(0)).square()); }; template -Point LineAccessor::center () const { +Point TriaObjectAccessor<1, dim>::center () const { return (vertex(1)+vertex(0))/2.; }; template -Point LineAccessor::barycenter () const { +Point TriaObjectAccessor<1, dim>::barycenter () const { return (vertex(1)+vertex(0))/2.; }; template -double LineAccessor::measure () const { +double TriaObjectAccessor<1, dim>::measure () const { return sqrt((vertex(1)-vertex(0)).square()); }; template -unsigned int LineAccessor::number_of_children () const { +unsigned int TriaObjectAccessor<1, dim>::number_of_children () const { if (!has_children()) return 1; else @@ -197,14 +197,14 @@ unsigned int LineAccessor::number_of_children () const { /*------------------------ Functions: QuadAccessor ---------------------------*/ template -void QuadAccessor::set (const Quad &quad) const { +void TriaObjectAccessor<2, dim>::set (const Quad &quad) const { tria->levels[present_level]->quads.quads[present_index] = quad; }; template -int QuadAccessor::vertex_index (const unsigned int corner) const { +int TriaObjectAccessor<2, dim>::vertex_index (const unsigned int corner) const { Assert (corner<4, ExcIndexRange(corner,0,4)); const int corner_convention[4] = { 0,0,1,1 }; @@ -215,7 +215,7 @@ int QuadAccessor::vertex_index (const unsigned int corner) const { template Point & -QuadAccessor::vertex (const unsigned int i) const { +TriaObjectAccessor<2, dim>::vertex (const unsigned int i) const { return tria->vertices[vertex_index(i)]; }; @@ -224,7 +224,7 @@ QuadAccessor::vertex (const unsigned int i) const { template void -QuadAccessor::set_used_flag () const { +TriaObjectAccessor<2, dim>::set_used_flag () const { Assert (state() == valid, ExcDereferenceInvalidObject()); tria->levels[present_level]->quads.used[present_index] = true; }; @@ -232,7 +232,7 @@ QuadAccessor::set_used_flag () const { template -void QuadAccessor::clear_used_flag () const { +void TriaObjectAccessor<2, dim>::clear_used_flag () const { Assert (state() == valid, ExcDereferenceInvalidObject()); tria->levels[present_level]->quads.used[present_index] = false; }; @@ -240,7 +240,7 @@ void QuadAccessor::clear_used_flag () const { template -void QuadAccessor::recursively_set_user_flag () const { +void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const { set_user_flag (); if (has_children()) @@ -251,7 +251,7 @@ void QuadAccessor::recursively_set_user_flag () const { template -void QuadAccessor::recursively_clear_user_flag () const { +void TriaObjectAccessor<2, dim>::recursively_clear_user_flag () const { clear_user_flag (); if (has_children()) @@ -262,7 +262,7 @@ void QuadAccessor::recursively_clear_user_flag () const { template -void QuadAccessor::set_user_pointer (void *p) const { +void TriaObjectAccessor<2, dim>::set_user_pointer (void *p) const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.user_pointers[present_index] = p; }; @@ -270,7 +270,7 @@ void QuadAccessor::set_user_pointer (void *p) const { template -void QuadAccessor::clear_user_pointer () const { +void TriaObjectAccessor<2, dim>::clear_user_pointer () const { Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.user_pointers[present_index] = 0; }; @@ -278,7 +278,7 @@ void QuadAccessor::clear_user_pointer () const { template -void * QuadAccessor::user_pointer () const { +void * TriaObjectAccessor<2, dim>::user_pointer () const { Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->quads.user_pointers[present_index]; }; @@ -286,7 +286,7 @@ void * QuadAccessor::user_pointer () const { template -void QuadAccessor::set_children (const int index) const { +void TriaObjectAccessor<2, dim>::set_children (const int index) const { Assert (used(), ExcCellNotUsed()); Assert ((index==-1) || (!has_children() && (index>=0)), ExcCantSetChildren(index)); @@ -297,14 +297,14 @@ void QuadAccessor::set_children (const int index) const { template -void QuadAccessor::clear_children () const { +void TriaObjectAccessor<2, dim>::clear_children () const { set_children (-1); }; template -unsigned char QuadAccessor::boundary_indicator () const { +unsigned char TriaObjectAccessor<2, dim>::boundary_indicator () const { Assert (dim>=3, ExcNotUsefulForThisDimension()); Assert (used(), ExcCellNotUsed()); @@ -314,7 +314,7 @@ unsigned char QuadAccessor::boundary_indicator () const { template -void QuadAccessor::set_boundary_indicator (unsigned char boundary_ind) const { +void TriaObjectAccessor<2, dim>::set_boundary_indicator (unsigned char boundary_ind) const { Assert (dim>=3, ExcNotUsefulForThisDimension()); Assert (used(), ExcCellNotUsed()); @@ -324,7 +324,7 @@ void QuadAccessor::set_boundary_indicator (unsigned char boundary_ind) cons template -bool QuadAccessor::at_boundary () const { +bool TriaObjectAccessor<2, dim>::at_boundary () const { // error checking is done // in boundary_indicator() return (boundary_indicator() != 255); @@ -333,7 +333,7 @@ bool QuadAccessor::at_boundary () const { template -double QuadAccessor::diameter () const { +double TriaObjectAccessor<2, dim>::diameter () const { return sqrt(max((vertex(2)-vertex(0)).square(), (vertex(3)-vertex(1)).square())); }; @@ -341,7 +341,7 @@ double QuadAccessor::diameter () const { template -Point QuadAccessor::center () const { +Point TriaObjectAccessor<2, dim>::center () const { return (vertex(0)+vertex(1)+vertex(2)+vertex(3))/4.; }; @@ -350,7 +350,7 @@ Point QuadAccessor::center () const { #if deal_II_dimension == 2 template <> -Point<2> QuadAccessor<2>::barycenter () const { +Point<2> TriaObjectAccessor<2, 2>::barycenter () const { // the evaluation of the formulae // is a bit tricky when done dimension // independant, so we write this function @@ -427,7 +427,7 @@ Point<2> QuadAccessor<2>::barycenter () const { template <> -double QuadAccessor<2>::measure () const { +double TriaObjectAccessor<2, 2>::measure () const { // the evaluation of the formulae // is a bit tricky when done dimension // independant, so we write this function @@ -479,7 +479,7 @@ double QuadAccessor<2>::measure () const { #if deal_II_dimension == 3 template <> -Point<3> QuadAccessor<3>::barycenter () const { +Point<3> TriaObjectAccessor<2, 3>::barycenter () const { // the evaluation of the formulae // is a bit tricky when done dimension // independant, so we write this function @@ -535,7 +535,7 @@ Point<3> QuadAccessor<3>::barycenter () const { template <> -double QuadAccessor<3>::measure () const { +double TriaObjectAccessor<2, 3>::measure () const { // the evaluation of the formulae // is a bit tricky when done dimension // independant, so we write this function @@ -551,7 +551,7 @@ double QuadAccessor<3>::measure () const { template -unsigned int QuadAccessor::number_of_children () const { +unsigned int TriaObjectAccessor<2, dim>::number_of_children () const { if (!has_children()) return 1; else @@ -1615,20 +1615,20 @@ bool CellAccessor::at_boundary (const unsigned int i) const { // explicit instantiations template class TriaAccessor; -template class LineAccessor; +template class TriaObjectAccessor<1, deal_II_dimension>; template class CellAccessor; -template class TriaRawIterator >; +template class TriaRawIterator >; template class TriaRawIterator >; -template class TriaIterator >; +template class TriaIterator >; template class TriaIterator >; -template class TriaActiveIterator >; +template class TriaActiveIterator >; template class TriaActiveIterator >; #if deal_II_dimension >= 2 -template class QuadAccessor; -template class TriaRawIterator >; -template class TriaIterator >; -template class TriaActiveIterator >; +template class TriaObjectAccessor<2, deal_II_dimension>; +template class TriaRawIterator >; +template class TriaIterator >; +template class TriaActiveIterator >; #endif #if deal_II_dimension >= 3 diff --git a/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc b/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc index 29c0c8a297..97b95bfb6b 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc @@ -22,17 +22,17 @@ /* ------------------------ MGDoFLineAccessor --------------------------- */ template -MGDoFLineAccessor::MGDoFLineAccessor (Triangulation *tria, +MGDoFObjectAccessor<1, dim,BaseClass>::MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : MGDoFAccessor (local_data), - DoFLineAccessor(tria,level,index,local_data) {}; + DoFObjectAccessor<1, dim,BaseClass>(tria,level,index,local_data) {}; template -int MGDoFLineAccessor::mg_dof_index (const unsigned int i) const { +int MGDoFObjectAccessor<1, dim,BaseClass>::mg_dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -50,7 +50,7 @@ int MGDoFLineAccessor::mg_dof_index (const unsigned int i) const template -void MGDoFLineAccessor::set_mg_dof_index (const unsigned int i, +void MGDoFObjectAccessor<1, dim,BaseClass>::set_mg_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -68,7 +68,7 @@ void MGDoFLineAccessor::set_mg_dof_index (const unsigned int i, template -int MGDoFLineAccessor::mg_vertex_dof_index (const unsigned int vertex, +int MGDoFObjectAccessor<1, dim,BaseClass>::mg_vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -84,7 +84,7 @@ int MGDoFLineAccessor::mg_vertex_dof_index (const unsigned int ve template -void MGDoFLineAccessor::set_mg_vertex_dof_index (const unsigned int vertex, +void MGDoFObjectAccessor<1, dim,BaseClass>::set_mg_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -102,7 +102,7 @@ void MGDoFLineAccessor::set_mg_vertex_dof_index (const unsigned i template void -MGDoFLineAccessor::get_mg_dof_indices (vector &dof_indices) const { +MGDoFObjectAccessor<1, dim,BaseClass>::get_mg_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); Assert (&dof_handler->get_fe() != 0, ExcInvalidObject()); @@ -123,9 +123,9 @@ MGDoFLineAccessor::get_mg_dof_indices (vector &dof_indices) template -TriaIterator > -MGDoFLineAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +MGDoFObjectAccessor<1, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), mg_dof_handler); @@ -141,8 +141,9 @@ MGDoFLineAccessor::child (const unsigned int i) const { template void -MGDoFLineAccessor::copy_from (const MGDoFLineAccessor &a) { - DoFLineAccessor::copy_from (a); +MGDoFObjectAccessor<1, dim,BaseClass>::copy_from (const MGDoFObjectAccessor<1, dim,BaseClass> &a) +{ + DoFObjectAccessor<1, dim,BaseClass>::copy_from (a); set_mg_dof_handler (a.mg_dof_handler); }; @@ -152,18 +153,19 @@ MGDoFLineAccessor::copy_from (const MGDoFLineAccessor -MGDoFQuadAccessor::MGDoFQuadAccessor (Triangulation *tria, +MGDoFObjectAccessor<2, dim,BaseClass>::MGDoFObjectAccessor (Triangulation *tria, const int level, const int index, const AccessorData *local_data) : MGDoFAccessor (local_data), - DoFQuadAccessor(tria,level,index,local_data) {}; + DoFObjectAccessor<2, dim,BaseClass>(tria,level,index,local_data) +{}; template inline -int MGDoFQuadAccessor::mg_dof_index (const unsigned int i) const { +int MGDoFObjectAccessor<2, dim,BaseClass>::mg_dof_index (const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); // make sure a FE has been selected @@ -179,7 +181,7 @@ int MGDoFQuadAccessor::mg_dof_index (const unsigned int i) const template -void MGDoFQuadAccessor::set_mg_dof_index (const unsigned int i, +void MGDoFObjectAccessor<2, dim,BaseClass>::set_mg_dof_index (const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -197,7 +199,7 @@ void MGDoFQuadAccessor::set_mg_dof_index (const unsigned int i, template inline -int MGDoFQuadAccessor::mg_vertex_dof_index (const unsigned int vertex, +int MGDoFObjectAccessor<2, dim,BaseClass>::mg_vertex_dof_index (const unsigned int vertex, const unsigned int i) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); @@ -213,7 +215,7 @@ int MGDoFQuadAccessor::mg_vertex_dof_index (const unsigned int ve template -void MGDoFQuadAccessor::set_mg_vertex_dof_index (const unsigned int vertex, +void MGDoFObjectAccessor<2, dim,BaseClass>::set_mg_vertex_dof_index (const unsigned int vertex, const unsigned int i, const int index) const { Assert (dof_handler != 0, ExcInvalidObject()); @@ -231,7 +233,7 @@ void MGDoFQuadAccessor::set_mg_vertex_dof_index (const unsigned i template void -MGDoFQuadAccessor::get_mg_dof_indices (vector &dof_indices) const { +MGDoFObjectAccessor<2, dim,BaseClass>::get_mg_dof_indices (vector &dof_indices) const { Assert (dof_handler != 0, ExcInvalidObject()); Assert (mg_dof_handler != 0, ExcInvalidObject()); Assert (&dof_handler->get_fe() != 0, ExcInvalidObject()); @@ -257,11 +259,11 @@ MGDoFQuadAccessor::get_mg_dof_indices (vector &dof_indices) template -TriaIterator > > -MGDoFQuadAccessor::line (const unsigned int i) const { +TriaIterator > > +MGDoFObjectAccessor<2, dim,BaseClass>::line (const unsigned int i) const { Assert (i<4, ExcIndexRange (i, 0, 4)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -273,9 +275,9 @@ MGDoFQuadAccessor::line (const unsigned int i) const { template -TriaIterator > -MGDoFQuadAccessor::child (const unsigned int i) const { - TriaIterator > q (tria, +TriaIterator > +MGDoFObjectAccessor<2, dim,BaseClass>::child (const unsigned int i) const { + TriaIterator > q (tria, present_level+1, child_index (i), mg_dof_handler); @@ -291,8 +293,8 @@ MGDoFQuadAccessor::child (const unsigned int i) const { template void -MGDoFQuadAccessor::copy_from (const MGDoFQuadAccessor &a) { - DoFQuadAccessor::copy_from (a); +MGDoFObjectAccessor<2, dim,BaseClass>::copy_from (const MGDoFObjectAccessor<2, dim,BaseClass> &a) { + DoFObjectAccessor<2, dim,BaseClass>::copy_from (a); set_mg_dof_handler (a.mg_dof_handler); }; @@ -412,11 +414,11 @@ MGDoFHexAccessor::get_mg_dof_indices (vector &dof_indices) c template -TriaIterator > > +TriaIterator > > MGDoFHexAccessor::line (const unsigned int i) const { Assert (i<12, ExcIndexRange (i, 0, 12)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -428,11 +430,11 @@ MGDoFHexAccessor::line (const unsigned int i) const { template -TriaIterator > > +TriaIterator > > MGDoFHexAccessor::quad (const unsigned int i) const { Assert (i<12, ExcIndexRange (i, 0, 6)); - return TriaIterator > > + return TriaIterator > > ( tria, present_level, @@ -588,7 +590,7 @@ MGDoFCellAccessor<2>::get_mg_dof_values (const Vector &values, // explicit instantiations #if deal_II_dimension == 1 -template class MGDoFLineAccessor<1,CellAccessor<1> >; +template class MGDoFObjectAccessor<1, 1,CellAccessor<1> >; template class MGDoFCellAccessor<1>; template class TriaRawIterator<1,MGDoFCellAccessor<1> >; @@ -597,36 +599,36 @@ template class TriaActiveIterator<1,MGDoFCellAccessor<1> >; #endif #if deal_II_dimension == 2 -template class MGDoFLineAccessor<2,LineAccessor<2> >; -template class MGDoFQuadAccessor<2,QuadAccessor<2> >; -template class MGDoFQuadAccessor<2,CellAccessor<2> >; +template class MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> >; +template class MGDoFObjectAccessor<2, 2,TriaObjectAccessor<2, 2> >; +template class MGDoFObjectAccessor<2, 2,CellAccessor<2> >; template class MGDoFCellAccessor<2>; -template class TriaRawIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaRawIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaRawIterator<2,MGDoFCellAccessor<2> >; -template class TriaIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaIterator<2,MGDoFCellAccessor<2> >; -template class TriaActiveIterator<2,MGDoFLineAccessor<2,LineAccessor<2> > >; +template class TriaActiveIterator<2,MGDoFObjectAccessor<1, 2,TriaObjectAccessor<1, 2> > >; template class TriaActiveIterator<2,MGDoFCellAccessor<2> >; #endif #if deal_II_dimension == 3 -template class MGDoFLineAccessor<3,LineAccessor<3> >; -template class MGDoFQuadAccessor<3,QuadAccessor<3> >; +template class MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> >; +template class MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> >; template class MGDoFHexAccessor<3,HexAccessor<3> >; template class MGDoFHexAccessor<3,CellAccessor<3> >; template class MGDoFCellAccessor<3>; -template class TriaRawIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaRawIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaRawIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaRawIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaRawIterator<3,MGDoFHexAccessor<3,HexAccessor<3> > >; template class TriaRawIterator<3,MGDoFCellAccessor<3> >; -template class TriaIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaIterator<3,MGDoFCellAccessor<3> >; -template class TriaActiveIterator<3,MGDoFLineAccessor<3,LineAccessor<3> > >; -template class TriaActiveIterator<3,MGDoFQuadAccessor<3,QuadAccessor<3> > >; +template class TriaActiveIterator<3,MGDoFObjectAccessor<1, 3,TriaObjectAccessor<1, 3> > >; +template class TriaActiveIterator<3,MGDoFObjectAccessor<2, 3,TriaObjectAccessor<2, 3> > >; template class TriaActiveIterator<3,MGDoFCellAccessor<3> >; #endif diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000..7269963fdb --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,7 @@ +# $Id$ +# Common Makefile for all test directories + +all: + cd base ; make + cd lac ; make + cd deal.II ; make diff --git a/tests/README b/tests/README new file mode 100644 index 0000000000..accce48eea --- /dev/null +++ b/tests/README @@ -0,0 +1,24 @@ +DEAL.II TESTSUITE README +======================== + +Subdirectories in this tree contain test programs for various features +of base lac and deal.II libraries. + +All features of deal that should be available in future releases +should be tested here. + +Run make in this directory to do all tests. This is required before +any commit to the CVS repository. + +How to interpret the output? +---------------------------- + +Apart from several messages containing compiling and linking +information, the output of make will contain lines like + +=====Running======== heavy.testcase +=====OK============= + +If the second line is replaced by some diff-output, please check for +consistency. A check-in of the modified results should be considered +carefully. diff --git a/tests/base/Makefile b/tests/base/Makefile index fb1ed9f28f..bc91412488 100644 --- a/tests/base/Makefile +++ b/tests/base/Makefile @@ -128,12 +128,13 @@ target1: $(target1-o-files) $(libraries) ############################################################ %.output:%.testcase - $< + @echo =====Running======= $< + @$< @perl -pi.bak -e 's/JobId.*//;s/value.*//;' $@ @rm $@.bak %.check:%.output - @-diff $< $(patsubst %.output,%.checked, $<) + @-diff $< $(patsubst %.output,%.checked, $<) && echo '=====OK============' ############################################################ # Cleanup targets ############################################################ diff --git a/tests/deal.II/grid_test.cc b/tests/deal.II/grid_test.cc index 84ebd8cf77..2b4f44037e 100644 --- a/tests/deal.II/grid_test.cc +++ b/tests/deal.II/grid_test.cc @@ -31,7 +31,8 @@ template class Ball : - public StraightBoundary { + public StraightBoundary +{ public: virtual Point get_new_point_on_line (const typename Triangulation::line_iterator &line) const { @@ -64,7 +65,8 @@ class Ball : template class CurvedLine : - public StraightBoundary { + public StraightBoundary +{ public: virtual Point get_new_point_on_line (const typename Triangulation::line_iterator &line) const; @@ -161,7 +163,8 @@ CurvedLine::get_new_point_on_quad (const typename Triangulation::quad_ template -void test (const int test_case) { +void test (const int test_case) +{ cout << "Running testcase " << test_case << " in " << dim << " dimensions." << endl; Triangulation tria; @@ -241,7 +244,7 @@ void test (const int test_case) { tria.execute_coarsening_and_refinement(); }; - tria.set_boundary (0); + tria.set_boundary (1); break; } }; diff --git a/tests/deal.II/mg.cc b/tests/deal.II/mg.cc index d1c38f74fd..19395d9dc6 100644 --- a/tests/deal.II/mg.cc +++ b/tests/deal.II/mg.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -78,11 +79,15 @@ main() case 4: fe = &fe4; deallog.push("Q4"); break; } - for (unsigned int step=0;step < 5; ++step) + for (unsigned int step=0;step < 4; ++step) { tr.refine_global(1); dof.distribute_dofs(*fe); + ConstraintMatrix hanging_nodes; + dof.make_hanging_node_constraints(hanging_nodes); + hanging_nodes.close(); + const unsigned int size = dof.n_dofs(); deallog << "DoFs " << size << endl; deallog << "Levels: " << tr.n_levels() << endl; @@ -132,7 +137,7 @@ main() transfer.build_matrices(mgdof); - MG<2> multigrid(mgdof, mgA, transfer); + MG<2> multigrid(mgdof, hanging_nodes, mgA, transfer); PreconditionMG, Vector > mgprecondition(multigrid, smoother, smoother, coarse); diff --git a/tests/deal.II/mglocal.cc b/tests/deal.II/mglocal.cc new file mode 100644 index 0000000000..979a30412b --- /dev/null +++ b/tests/deal.II/mglocal.cc @@ -0,0 +1,198 @@ +// $Id$ +/* (c) Guido Kanschat, 1999 */ + +// deal_II_libraries.g=-ldeal_II_2d.g +// deal_II_libraries=-ldeal_II_2d + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +MGSmoother* smoother_object; +#include + +#include + +// Does anybody know why cmath does not do this? + +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 +#endif + + + +int step_counter = 0; + +#include "helmholtz.h" + +template +class RHSFunction + : + public Function +{ + public: + virtual double operator() (const Point&) const; +// virtual Tensor<1,dim> gradient (const Point &p) const; +}; + +extern void write_gnuplot (const MGDoFHandler<2>& dofs, const Vector& v, unsigned int level, + ostream &out); + +main() +{ + Helmholtz equation; + RHSFunction<2> rhs; + QGauss5<2> quadrature; + + FEQ1<2> fe1; + FEQ2<2> fe2; + FEQ3<2> fe3; + FEQ4<2> fe4; + for (unsigned int degree=1;degree<=1;degree++) + { + Triangulation<2> tr; + MGDoFHandler<2> mgdof(&tr); + DoFHandler<2>& dof(mgdof); + + GridGenerator::hyper_cube(tr,-M_PI_2,M_PI_2); + + FiniteElement<2>* fe; + switch(degree) + { + case 1: fe = &fe1; deallog.push("Q1"); break; + case 2: fe = &fe2; deallog.push("Q2"); break; + case 3: fe = &fe3; deallog.push("Q3"); break; + case 4: fe = &fe4; deallog.push("Q4"); break; + } + + tr.refine_global(1); + Triangulation<2>::active_cell_iterator cell = tr.begin_active(); + cell->set_refine_flag(); + tr.execute_coarsening_and_refinement(); + + tr.refine_global(2); + dof.distribute_dofs(*fe); + const unsigned int size = dof.n_dofs(); + deallog << "DoFs " << size << endl; + deallog << "Levels: " << tr.n_levels() << endl; + for (unsigned int step=1;step < 5; ++step) + { + deallog << "smoothing-steps" << step << endl; + SparseMatrixStruct structure(size, dof.max_couplings_between_dofs()); + dof.make_sparsity_pattern(structure); + + ConstraintMatrix hanging_nodes; + dof.make_hanging_node_constraints(hanging_nodes); + hanging_nodes.close(); + hanging_nodes.condense(structure); + + structure.compress(); + + SparseMatrix A(structure); + Vector f(size); + + equation.build_all(A,f,dof, quadrature, rhs); + + hanging_nodes.condense(A); + hanging_nodes.condense(f); + + Vector u; + u.reinit(f); + PrimitiveVectorMemory > mem; + SolverControl control(20, 1.e-12, true); + SolverRichardson, Vector >solver(control, mem); + + vector mgstruct(tr.n_levels()); + MGMatrix > mgA(0,tr.n_levels()-1); + for (unsigned int i=0;i > cgmem; + SolverCG, Vector > cgsolver(cgcontrol, cgmem); + PreconditionIdentity > cgprec; + MGCoarseGridLACIteration, Vector >, + SparseMatrix, PreconditionIdentity > > + coarse(cgsolver, mgA[tr.n_levels()-2], cgprec); + + MGSmootherRelaxation + smoother(mgdof, mgA, &SparseMatrix::template precondition_SSOR, + step, 1.); + smoother_object = &smoother; + + MGTransferPrebuilt transfer; + transfer.build_matrices(mgdof); + + + MG<2> multigrid(mgdof, hanging_nodes, mgA, transfer, tr.n_levels()-2); + PreconditionMG, Vector > + mgprecondition(multigrid, smoother, smoother, coarse); + + u = 0.; + + solver.solve(A, u, f, mgprecondition); + hanging_nodes.distribute(u); + } + deallog.pop(); + } +} + +template +double +RHSFunction::operator() (const Point&p) const +{ +// return 1.; + + return p(0)*p(0)+p(1)*p(1); + + return (2.1)*(sin(p(0))* sin(p(1))); +} + + +void write_gnuplot (const MGDoFHandler<2>& dofs, const Vector& v, unsigned int level, + ostream &out) +{ + MGDoFHandler<2>::cell_iterator cell; + MGDoFHandler<2>::cell_iterator endc = dofs.end(level); + + Vector values(dofs.get_fe().total_dofs); + + unsigned int cell_index=0; + for (cell=dofs.begin(level); cell!=endc; ++cell, ++cell_index) + { + cell->get_mg_dof_values(v, values); + + out << cell->vertex(0) << " " << values(0) << endl; + out << cell->vertex(1) << " " << values(1) << endl; + out << endl; + out << cell->vertex(3) << " " << values(3) << endl; + out << cell->vertex(2) << " " << values(2) << endl; + out << endl; + out << endl; + } + out << endl; +} diff --git a/tests/lac/Makefile b/tests/lac/Makefile index ccafc43a0e..561a86e769 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -139,12 +139,13 @@ target1: $(target1-o-files) $(libraries) ############################################################ %.output:%.testcase - $< + @echo =====Running======= $< + @$< @perl -pi.bak -e 's/JobId.*//;s/value.*//;' $@ @rm $@.bak %.check:%.output - @-diff $< $(patsubst %.output,%.checked, $<) + @-diff $< $(patsubst %.output,%.checked, $<) && echo '=====OK============' ############################################################ # Cleanup targets ############################################################