From: Wolfgang Bangerth Date: Wed, 14 Jun 2000 11:16:48 +0000 (+0000) Subject: Enforce -pedantic -ansi when using the gcc compiler in order to get closer to the... X-Git-Tag: v8.0.0~20401 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca08978419029470b12665fe150f06eb1b34c209;p=dealii.git Enforce -pedantic -ansi when using the gcc compiler in order to get closer to the C++ standard. Doing so required a whole lot of changes, which mostly fall into the following to categories: 1/ Adding `typename' when accessing template dependent names, such as vector::iterator. 2/ When accessing member classes of templatized parent classes, full qualification is required. Thus, when in Derived::f we want to access the type Base::ExcSomething, we have to use typename Base::ExcSomething now. Overall, these changes should lead to more portable code. git-svn-id: https://svn.dealii.org/trunk@3011 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/source/function_lib.cc b/deal.II/base/source/function_lib.cc index 14f8f594ee..b33804a119 100644 --- a/deal.II/base/source/function_lib.cc +++ b/deal.II/base/source/function_lib.cc @@ -17,6 +17,21 @@ #include + +// in strict ANSI C mode, the following constants are not defined by +// default, so we do it ourselves +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +#ifndef M_PI_2 +# define M_PI_2 1.57079632679489661923 +#endif + + + + + template double PillowFunction::value (const Point &p, diff --git a/deal.II/configure b/deal.II/configure index a39af221eb..48a44a580d 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1156,7 +1156,7 @@ fi if test $GXX = yes ; then CXXFLAGSO="-O2 -Wuninitialized -felide-constructors -fnonnull-objects -ftemplate-depth-32" - CXXFLAGSG="-DDEBUG -ggdb -Wall -W -Wtraditional -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Woverloaded-virtual -Wstrict-prototypes -Wsynth -Wsign-compare -Wconversion -ftemplate-depth-32" + CXXFLAGSG="-DDEBUG -ggdb -ansi -pedantic -Wall -W -Wtraditional -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Woverloaded-virtual -Wstrict-prototypes -Wsynth -Wsign-compare -Wconversion -ftemplate-depth-32" case "$GXXVERSION" in diff --git a/deal.II/configure.in b/deal.II/configure.in index 0974d8ba53..e8ac7576bb 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -89,7 +89,7 @@ dnl ------------------------------------------------------------- if test $GXX = yes ; then CXXFLAGSO="-O2 -Wuninitialized -felide-constructors -fnonnull-objects -ftemplate-depth-32" - CXXFLAGSG="-DDEBUG -ggdb -Wall -W -Wtraditional -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Woverloaded-virtual -Wstrict-prototypes -Wsynth -Wsign-compare -Wconversion -ftemplate-depth-32" + CXXFLAGSG="-DDEBUG -ggdb -ansi -pedantic -Wall -W -Wtraditional -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Woverloaded-virtual -Wstrict-prototypes -Wsynth -Wsign-compare -Wconversion -ftemplate-depth-32" dnl set some flags that are specific to some versions of the dnl compiler: 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 9731e92513..43c2f7576f 100644 --- a/deal.II/deal.II/include/dofs/dof_accessor.templates.h +++ b/deal.II/deal.II/include/dofs/dof_accessor.templates.h @@ -82,10 +82,21 @@ inline unsigned int DoFObjectAccessor<1,dim>::dof_index (const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, typename BaseClass::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, typename BaseClass::ExcInvalidObject()); Assert (iselected_fe->dofs_per_line, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_line)); @@ -100,8 +111,19 @@ unsigned int DoFObjectAccessor<1,dim>::vertex_dof_index (const unsigned int vertex, const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, typename BaseClass::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, typename BaseClass::ExcInvalidObject()); Assert (vertex<2, ExcIndexRange (i,0,2)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -118,11 +140,22 @@ inline void DoFObjectAccessor<1,dim>::get_dof_indices (vector &dof_indices) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, typename BaseClass::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, typename BaseClass::ExcInvalidObject()); Assert (dof_indices.size() == (2*dof_handler->get_fe().dofs_per_vertex + dof_handler->get_fe().dofs_per_line), - ExcVectorDoesNotMatch()); + typename BaseClass::ExcVectorDoesNotMatch()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line; @@ -169,10 +202,12 @@ template inline unsigned int DoFObjectAccessor<2,dim>::dof_index (const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (iselected_fe->dofs_per_quad, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_quad)); @@ -187,8 +222,10 @@ unsigned int DoFObjectAccessor<2,dim>::vertex_dof_index (const unsigned int vertex, const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (vertex<4, ExcIndexRange (i,0,4)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -205,12 +242,14 @@ inline void DoFObjectAccessor<2,dim>::get_dof_indices (vector &dof_indices) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (dof_indices.size() == (4*dof_handler->get_fe().dofs_per_vertex + 4*dof_handler->get_fe().dofs_per_line + dof_handler->get_fe().dofs_per_quad), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, @@ -280,10 +319,12 @@ inline unsigned int DoFObjectAccessor<3,dim>::dof_index (const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (iselected_fe->dofs_per_hex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_hex)); @@ -298,8 +339,10 @@ unsigned int DoFObjectAccessor<3,dim>::vertex_dof_index (const unsigned int vertex, const unsigned int i) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (vertex<8, ExcIndexRange (i,0,8)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -316,13 +359,15 @@ inline void DoFObjectAccessor<3,dim>::get_dof_indices (vector &dof_indices) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (dof_indices.size() == (8*dof_handler->get_fe().dofs_per_vertex + 12*dof_handler->get_fe().dofs_per_line + 6*dof_handler->get_fe().dofs_per_quad + dof_handler->get_fe().dofs_per_hex), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 633f795720..1d5dea2b95 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -1259,6 +1259,8 @@ class FESubfaceValues : public FEFaceValuesBase }; + + /*------------------------ Inline functions: FEValuesBase ------------------------*/ @@ -1273,6 +1275,7 @@ const FullMatrix & FEValuesBase::get_shape_values () const }; + template inline const vector > > & @@ -1283,6 +1286,7 @@ FEValuesBase::get_shape_grads () const }; + template inline const vector > > & @@ -1293,45 +1297,55 @@ FEValuesBase::get_shape_2nd_derivatives () const }; + template inline const vector > & -FEValuesBase::get_quadrature_points () const { +FEValuesBase::get_quadrature_points () const +{ Assert (update_flags & update_q_points, ExcAccessToUninitializedField()); return quadrature_points; }; + template inline const vector > & -FEValuesBase::get_support_points () const { +FEValuesBase::get_support_points () const +{ Assert (update_flags & update_support_points, ExcAccessToUninitializedField()); return support_points; }; + template inline const vector & -FEValuesBase::get_JxW_values () const { +FEValuesBase::get_JxW_values () const +{ Assert (update_flags & update_JxW_values, ExcAccessToUninitializedField()); return JxW_values; }; + template inline const FiniteElement & -FEValuesBase::get_fe () const { +FEValuesBase::get_fe () const +{ return *fe; }; + template inline const DoFHandler::cell_iterator & -FEValuesBase::get_cell() const { +FEValuesBase::get_cell() const +{ return present_cell; }; @@ -1341,8 +1355,10 @@ FEValuesBase::get_cell() const { template inline const vector > & -FEFaceValuesBase::get_normal_vectors () const { - Assert (update_flags & update_normal_vectors, ExcAccessToUninitializedField()); +FEFaceValuesBase::get_normal_vectors () const +{ + Assert (update_flags & update_normal_vectors, + typename FEValuesBase::ExcAccessToUninitializedField()); return normal_vectors; }; 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 8be1815786..51e5e35e36 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.templates.h +++ b/deal.II/deal.II/include/grid/tria_accessor.templates.h @@ -103,7 +103,8 @@ template inline bool TriaObjectAccessor<1,dim>::used () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->lines.used[present_index]; }; @@ -112,7 +113,7 @@ template inline bool TriaObjectAccessor<1,dim>::user_flag_set () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->lines.user_flags[present_index]; }; @@ -121,7 +122,7 @@ template inline void TriaObjectAccessor<1,dim>::set_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = true; }; @@ -130,7 +131,7 @@ template inline void TriaObjectAccessor<1,dim>::clear_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_flags[present_index] = false; }; @@ -145,7 +146,7 @@ TriaObjectAccessor<1,dim>::child (const unsigned int i) const { #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsChild()); + Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); #endif return q; }; @@ -164,7 +165,7 @@ template inline bool TriaObjectAccessor<1,dim>::has_children () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->lines.children[present_index] != -1); } @@ -240,7 +241,8 @@ template inline bool TriaObjectAccessor<2,dim>::used () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->quads.used[present_index]; }; @@ -249,7 +251,7 @@ template inline bool TriaObjectAccessor<2,dim>::user_flag_set () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->quads.user_flags[present_index]; }; @@ -258,7 +260,7 @@ template inline void TriaObjectAccessor<2,dim>::set_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = true; }; @@ -267,7 +269,7 @@ template inline void TriaObjectAccessor<2,dim>::clear_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_flags[present_index] = false; }; @@ -306,7 +308,7 @@ TriaObjectAccessor<2,dim>::child (const unsigned int i) const { #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsChild()); + Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); #endif return q; }; @@ -324,7 +326,7 @@ template inline bool TriaObjectAccessor<2,dim>::has_children () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->quads.children[present_index] != -1); }; @@ -402,7 +404,8 @@ template inline bool TriaObjectAccessor<3,dim>::used () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); return tria->levels[present_level]->hexes.used[present_index]; }; @@ -411,7 +414,7 @@ template inline bool TriaObjectAccessor<3,dim>::user_flag_set () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->hexes.user_flags[present_index]; }; @@ -420,7 +423,7 @@ template inline void TriaObjectAccessor<3,dim>::set_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_flags[present_index] = true; }; @@ -428,7 +431,7 @@ TriaObjectAccessor<3,dim>::set_user_flag () const { template inline void TriaObjectAccessor<3,dim>::clear_user_flag () const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_flags[present_index] = false; }; @@ -437,7 +440,7 @@ template inline TriaIterator > TriaObjectAccessor<3,dim>::line (const unsigned int i) const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); Assert (i<12, ExcIndexRange (i,0,12)); // egcs 1.1.2 gets into trouble if we @@ -474,7 +477,7 @@ template inline TriaIterator > TriaObjectAccessor<3,dim>::quad (const unsigned int i) const { - Assert (used(), ExcCellNotUsed()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return TriaIterator > ( @@ -535,7 +538,7 @@ TriaObjectAccessor<3,dim>::child (const unsigned int i) const #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsChild()); + Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); #endif return q; }; @@ -551,7 +554,7 @@ int TriaObjectAccessor<3,dim>::child_index (unsigned int i) const { template bool TriaObjectAccessor<3,dim>::has_children () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); return (tria->levels[present_level]->hexes.children[present_index] != -1); }; @@ -927,7 +930,7 @@ inline int CellAccessor::neighbor_index (const unsigned int i) const { Assert (i::faces_per_cell, - ExcInvalidNeighbor(i)); + typename TriaAccessor::ExcInvalidNeighbor(i)); return tria->levels[present_level]-> neighbors[present_index*GeometryInfo::faces_per_cell+i].second; }; @@ -936,19 +939,22 @@ CellAccessor::neighbor_index (const unsigned int i) const { template inline int -CellAccessor::neighbor_level (const unsigned int i) const { +CellAccessor::neighbor_level (const unsigned int i) const +{ Assert (i::faces_per_cell, - ExcInvalidNeighbor(i)); + typename TriaAccessor::ExcInvalidNeighbor(i)); return tria->levels[present_level]-> neighbors[present_index*GeometryInfo::faces_per_cell+i].first; }; + template inline bool -CellAccessor::refine_flag_set () const { - Assert (used(), ExcCellNotUsed()); +CellAccessor::refine_flag_set () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); // cells flagged for refinement must be active // (the #set_refine_flag# function checks this, // but activity may change when refinement is @@ -960,31 +966,38 @@ CellAccessor::refine_flag_set () const { }; + template inline void -CellAccessor::set_refine_flag () const { +CellAccessor::set_refine_flag () const +{ Assert (used() && active(), ExcRefineCellNotActive()); - Assert (!coarsen_flag_set(), ExcCellFlaggedForCoarsening()); + Assert (!coarsen_flag_set(), + ExcCellFlaggedForCoarsening()); tria->levels[present_level]->refine_flags[present_index] = true; }; + template inline void -CellAccessor::clear_refine_flag () const { +CellAccessor::clear_refine_flag () const +{ Assert (used() && active(), ExcRefineCellNotActive()); tria->levels[present_level]->refine_flags[present_index] = false; }; + template inline bool -CellAccessor::coarsen_flag_set () const { - Assert (used(), ExcCellNotUsed()); +CellAccessor::coarsen_flag_set () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); // cells flagged for coarsening must be active // (the #set_refine_flag# function checks this, // but activity may change when refinement is @@ -996,10 +1009,12 @@ CellAccessor::coarsen_flag_set () const { }; + template inline void -CellAccessor::set_coarsen_flag () const { +CellAccessor::set_coarsen_flag () const +{ Assert (used() && active(), ExcRefineCellNotActive()); Assert (!refine_flag_set(), ExcCellFlaggedForRefinement()); @@ -1007,47 +1022,55 @@ CellAccessor::set_coarsen_flag () const { }; + template inline void -CellAccessor::clear_coarsen_flag () const { +CellAccessor::clear_coarsen_flag () const +{ Assert (used() && active(), ExcRefineCellNotActive()); tria->levels[present_level]->coarsen_flags[present_index] = false; }; + template inline TriaIterator > -CellAccessor::neighbor (const unsigned int i) const { +CellAccessor::neighbor (const unsigned int i) const +{ TriaIterator > q (tria, neighbor_level (i), neighbor_index (i)); #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsNeighbor()); + Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsNeighbor()); #endif return q; }; + template inline TriaIterator > -CellAccessor::child (const unsigned int i) const { +CellAccessor::child (const unsigned int i) const +{ TriaIterator > q (tria, present_level+1, child_index (i)); #ifdef DEBUG if (q.state() != past_the_end) - Assert (q->used(), ExcUnusedCellAsChild()); + Assert (q->used(), typename TriaAccessor::ExcUnusedCellAsChild()); #endif return q; }; + template inline bool -CellAccessor::active () const { +CellAccessor::active () const +{ return !has_children(); }; diff --git a/deal.II/deal.II/include/numerics/data_out.h b/deal.II/deal.II/include/numerics/data_out.h index 490584367f..3442db7b7e 100644 --- a/deal.II/deal.II/include/numerics/data_out.h +++ b/deal.II/deal.II/include/numerics/data_out.h @@ -486,7 +486,7 @@ class DataOut : public DataOut_DoFData * used, the function is called * once and generates all patches. */ - void DataOut::build_some_patches (Data data); + void build_some_patches (Data data); }; diff --git a/deal.II/deal.II/source/dofs/dof_accessor.cc b/deal.II/deal.II/source/dofs/dof_accessor.cc index 191e4c861f..a31776eaf4 100644 --- a/deal.II/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/deal.II/source/dofs/dof_accessor.cc @@ -51,9 +51,23 @@ template void DoFObjectAccessor<1, dim>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, const unsigned int index) const + { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, + typename BaseClass::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename BaseClass::ExcInvalidObject()); Assert (vertex<2, ExcIndexRange (i,0,2)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -69,14 +83,28 @@ void DoFObjectAccessor<1, dim>::set_vertex_dof_index (const unsigned int vertex, template void DoFObjectAccessor<1, dim>:: distribute_local_to_global (const Vector &local_source, - Vector &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Vector &global_destination) const +{ + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, + typename BaseClass::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename BaseClass::ExcInvalidObject()); Assert (local_source.size() == (2*dof_handler->get_fe().dofs_per_vertex + dof_handler->get_fe().dofs_per_line), - ExcVectorDoesNotMatch()); + typename BaseClass::ExcVectorDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.size(), - ExcVectorDoesNotMatch()); + typename BaseClass::ExcVectorDoesNotMatch()); const unsigned int n_dofs = local_source.size(); @@ -94,18 +122,32 @@ distribute_local_to_global (const Vector &local_source, template void DoFObjectAccessor<1, dim>:: distribute_local_to_global (const FullMatrix &local_source, - SparseMatrix &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + SparseMatrix &global_destination) const +{ + // since the exception classes are + // from a template dependent base + // class, we have to fully qualify + // them. to work around more + // trouble, typedef the template + // dependent base class to a + // non-template dependent name and + // use that to specify the + // qualified exception names + typedef DoFAccessor BaseClass; + + Assert (dof_handler != 0, + typename BaseClass::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename BaseClass::ExcInvalidObject()); Assert (local_source.m() == (2*dof_handler->get_fe().dofs_per_vertex + dof_handler->get_fe().dofs_per_line), - ExcVectorDoesNotMatch()); + typename BaseClass::ExcVectorDoesNotMatch()); Assert (local_source.m() == local_source.n(), - ExcMatrixDoesNotMatch()); + typename BaseClass::ExcMatrixDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.m(), - ExcMatrixDoesNotMatch()); + typename BaseClass::ExcMatrixDoesNotMatch()); Assert (global_destination.m() == global_destination.n(), - ExcMatrixDoesNotMatch()); + typename BaseClass::ExcMatrixDoesNotMatch()); const unsigned int n_dofs = local_source.m(); @@ -135,7 +177,7 @@ DoFObjectAccessor<1,dim>::get_dof_values (const InputVector &values, DoFAccessor<1>::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), DoFAccessor<1>::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + Assert (has_children() == false, DoFAccessor<1>::ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line; @@ -166,7 +208,7 @@ DoFObjectAccessor<1,dim>::set_dof_values (const Vector &local_values, DoFAccessor<1>::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), DoFAccessor<1>::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + Assert (has_children() == false, DoFAccessor<1>::ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line; @@ -189,10 +231,12 @@ template void DoFObjectAccessor<2, dim>::set_dof_index (const unsigned int i, const unsigned int index) const { - Assert (dof_handler != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (iselected_fe->dofs_per_quad, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_quad)); @@ -208,8 +252,10 @@ DoFObjectAccessor<2, dim>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, const unsigned int index) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (vertex<4, ExcIndexRange (i,0,4)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -226,14 +272,16 @@ template void DoFObjectAccessor<2, dim>:: distribute_local_to_global (const Vector &local_source, Vector &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_source.size() == (4*dof_handler->get_fe().dofs_per_vertex + 4*dof_handler->get_fe().dofs_per_line + dof_handler->get_fe().dofs_per_quad), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.size(), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); const unsigned int n_dofs = local_source.size(); @@ -252,18 +300,20 @@ template void DoFObjectAccessor<2, dim>:: distribute_local_to_global (const FullMatrix &local_source, SparseMatrix &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_source.m() == (4*dof_handler->get_fe().dofs_per_vertex + 4*dof_handler->get_fe().dofs_per_line + dof_handler->get_fe().dofs_per_quad), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (local_source.m() == local_source.n(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.m(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (global_destination.m() == global_destination.n(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); const unsigned int n_dofs = local_source.m(); @@ -287,13 +337,16 @@ DoFObjectAccessor<2,dim>::get_dof_values (const InputVector &values, { Assert (dim==2, ExcInternalError()); - Assert (dof_handler != 0, DoFAccessor::ExcInvalidObject()); - Assert (&dof_handler->get_fe() != 0, DoFAccessor::ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (&dof_handler->get_fe() != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell, - DoFAccessor::ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), - DoFAccessor::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + typename DoFAccessor::ExcVectorDoesNotMatch()); + Assert (has_children() == false, typename DoFAccessor:: + ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, @@ -322,13 +375,16 @@ DoFObjectAccessor<2,dim>::set_dof_values (const Vector &local_values, { Assert (dim==2, ExcInternalError()); - Assert (dof_handler != 0, DoFAccessor::ExcInvalidObject()); - Assert (&dof_handler->get_fe() != 0, DoFAccessor::ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (&dof_handler->get_fe() != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell, - DoFAccessor::ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), - DoFAccessor::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + typename DoFAccessor::ExcVectorDoesNotMatch()); + Assert (has_children() == false, + typename DoFAccessor::ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, @@ -355,10 +411,12 @@ template void DoFObjectAccessor<3, dim>::set_dof_index (const unsigned int i, const unsigned int index) const { - Assert (dof_handler != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); // make sure a FE has been selected // and enough room was reserved - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (iselected_fe->dofs_per_hex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_hex)); @@ -373,9 +431,12 @@ void DoFObjectAccessor<3, dim>::set_vertex_dof_index (const unsigned int vertex, const unsigned int i, const unsigned int index) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); - Assert (vertex<8, ExcIndexRange (i,0,8)); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (vertex<8, + ExcIndexRange (i,0,8)); Assert (iselected_fe->dofs_per_vertex, ExcIndexRange (i, 0, dof_handler->selected_fe->dofs_per_vertex)); @@ -391,15 +452,17 @@ template void DoFObjectAccessor<3, dim>:: distribute_local_to_global (const Vector &local_source, Vector &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_source.size() == (8*dof_handler->get_fe().dofs_per_vertex + 12*dof_handler->get_fe().dofs_per_line + 6*dof_handler->get_fe().dofs_per_quad + dof_handler->get_fe().dofs_per_hex), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.size(), - ExcVectorDoesNotMatch()); + typename DoFAccessor::ExcVectorDoesNotMatch()); const unsigned int n_dofs = local_source.size(); @@ -419,19 +482,21 @@ void DoFObjectAccessor<3, dim>:: distribute_local_to_global (const FullMatrix &local_source, SparseMatrix &global_destination) const { - Assert (dof_handler != 0, ExcInvalidObject()); - Assert (dof_handler->selected_fe != 0, ExcInvalidObject()); + Assert (dof_handler != 0, + typename DoFAccessor::ExcInvalidObject()); + Assert (dof_handler->selected_fe != 0, + typename DoFAccessor::ExcInvalidObject()); Assert (local_source.m() == (8*dof_handler->get_fe().dofs_per_vertex + 12*dof_handler->get_fe().dofs_per_line + 6*dof_handler->get_fe().dofs_per_quad + dof_handler->get_fe().dofs_per_hex), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (local_source.m() == local_source.n(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (dof_handler->n_dofs() == global_destination.m(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); Assert (global_destination.m() == global_destination.n(), - ExcMatrixDoesNotMatch()); + typename DoFAccessor::ExcMatrixDoesNotMatch()); const unsigned int n_dofs = local_source.m(); @@ -461,7 +526,8 @@ DoFObjectAccessor<3,dim>::get_dof_values (const InputVector &values, DoFAccessor<3>::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), DoFAccessor<3>::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + Assert (has_children() == false, + DoFAccessor<3>::ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, @@ -494,13 +560,16 @@ DoFObjectAccessor<3,dim>::set_dof_values (const Vector &local_values, { Assert (dim==3, ExcInternalError()); - Assert (dof_handler != 0, DoFAccessor<3>::ExcInvalidObject()); - Assert (&dof_handler->get_fe() != 0, DoFAccessor<3>::ExcInvalidObject()); + Assert (dof_handler != 0, + DoFAccessor<3>::ExcInvalidObject()); + Assert (&dof_handler->get_fe() != 0, + DoFAccessor<3>::ExcInvalidObject()); Assert (local_values.size() == dof_handler->get_fe().dofs_per_cell, DoFAccessor<3>::ExcVectorDoesNotMatch()); Assert (values.size() == dof_handler->n_dofs(), DoFAccessor<3>::ExcVectorDoesNotMatch()); - Assert (has_children() == false, ExcNotActive()); + Assert (has_children() == false, + DoFAccessor<3>::ExcNotActive()); const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, diff --git a/deal.II/deal.II/source/fe/fe.cc b/deal.II/deal.II/source/fe/fe.cc index bc0a1c0168..d9234f41d7 100644 --- a/deal.II/deal.II/source/fe/fe.cc +++ b/deal.II/deal.II/source/fe/fe.cc @@ -441,15 +441,20 @@ void FiniteElement::fill_fe_face_values (const DoFHandler::cell_iterat vector > &normal_vectors, const bool compute_normal_vectors, const FullMatrix &shape_values_transform, - const vector > > &shape_gradients_transform) const { + const vector > > &shape_gradients_transform) const +{ Assert (jacobians.size() == unit_points.size(), - ExcWrongFieldDimension(jacobians.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(jacobians.size(), + unit_points.size())); Assert (q_points.size() == unit_points.size(), - ExcWrongFieldDimension(q_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(q_points.size(), + unit_points.size())); Assert (global_unit_points.size() == unit_points.size(), - ExcWrongFieldDimension(global_unit_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(global_unit_points.size(), + unit_points.size())); Assert (support_points.size() == dofs_per_face, - ExcWrongFieldDimension(support_points.size(), dofs_per_face)); + typename FiniteElementBase::ExcWrongFieldDimension(support_points.size(), + dofs_per_face)); // size not checked since not used static vector > dummy(0); @@ -490,13 +495,17 @@ void FiniteElement::fill_fe_subface_values (const DoFHandler::cell_ite vector > &normal_vectors, const bool compute_normal_vectors, const FullMatrix &shape_values_transform, - const vector > > &shape_gradients_transform) const { + const vector > > &shape_gradients_transform) const +{ Assert (jacobians.size() == unit_points.size(), - ExcWrongFieldDimension(jacobians.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(jacobians.size(), + unit_points.size())); Assert (q_points.size() == unit_points.size(), - ExcWrongFieldDimension(q_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(q_points.size(), + unit_points.size())); Assert (global_unit_points.size() == unit_points.size(), - ExcWrongFieldDimension(global_unit_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(global_unit_points.size(), + unit_points.size())); static vector > dummy(0); // size not checked since not used fill_fe_values (cell, global_unit_points, 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 2819712774..a1a8cc5a63 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 @@ -910,11 +910,14 @@ void FECrissCross::fill_fe_values (const DoFHandler::cell_iterator &ce const FullMatrix &shape_values_transform, const vector > > &/*shape_grad_transform*/) const { Assert (jacobians.size() == unit_points.size(), - ExcWrongFieldDimension(jacobians.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(jacobians.size(), + unit_points.size())); Assert (q_points.size() == unit_points.size(), - ExcWrongFieldDimension(q_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(q_points.size(), + unit_points.size())); Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension(support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension(support_points.size(), + dofs_per_cell)); unsigned int n_points=unit_points.size(); diff --git a/deal.II/deal.II/source/fe/fe_lib.dg.cc b/deal.II/deal.II/source/fe/fe_lib.dg.cc index 0a3386f340..1b23d5c99c 100644 --- a/deal.II/deal.II/source/fe/fe_lib.dg.cc +++ b/deal.II/deal.II/source/fe/fe_lib.dg.cc @@ -4412,6 +4412,7 @@ FEDG_Q3<3>::FEDG_Q3(): }; + template<> FEDG_Q4<3>::FEDG_Q4(): FEQ4<3>(1) @@ -4427,36 +4428,43 @@ FEDG_Q4<3>::FEDG_Q4(): template void FEDG_Q1::get_face_support_points (const typename DoFHandler::face_iterator &, - vector > &support_points) const { + vector > &support_points) const +{ Assert ((support_points.size() == 0), - ExcWrongFieldDimension (support_points.size(),0)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(),0)); }; + template void FEDG_Q2::get_face_support_points (const typename DoFHandler::face_iterator &, - vector > &support_points) const { + vector > &support_points) const +{ Assert ((support_points.size() == 0), - ExcWrongFieldDimension (support_points.size(),0)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(),0)); }; + template void FEDG_Q3::get_face_support_points (const typename DoFHandler::face_iterator &, - vector > &support_points) const { + vector > &support_points) const +{ Assert ((support_points.size() == 0), - ExcWrongFieldDimension (support_points.size(),0)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(),0)); }; + template void FEDG_Q4::get_face_support_points (const typename DoFHandler::face_iterator &, - vector > &support_points) const { + vector > &support_points) const +{ Assert ((support_points.size() == 0), - ExcWrongFieldDimension (support_points.size(),0)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(),0)); }; diff --git a/deal.II/deal.II/source/fe/fe_lib.dg.constant.cc b/deal.II/deal.II/source/fe/fe_lib.dg.constant.cc index 75ae788336..a6d457bc5c 100644 --- a/deal.II/deal.II/source/fe/fe_lib.dg.constant.cc +++ b/deal.II/deal.II/source/fe/fe_lib.dg.constant.cc @@ -42,13 +42,15 @@ FEDG_Q0::FEDG_Q0 () : template <> void FEDG_Q0<1>::get_face_support_points (const DoFHandler<1>::face_iterator &, - vector > &) const { + vector > &) const +{ Assert (false, ExcInternalError()); }; #endif + template inline double @@ -60,22 +62,24 @@ FEDG_Q0::shape_value (const unsigned int i, }; + template inline Tensor<1,dim> FEDG_Q0::shape_grad (const unsigned int i, - const Point&) const + const Point&) const { Assert((i (); }; + template inline Tensor<2,dim> FEDG_Q0::shape_grad_grad (const unsigned int i, - const Point &) const + const Point &) const { Assert((i::shape_grad_grad (const unsigned int i, }; + template void FEDG_Q0::get_local_mass_matrix (const DoFHandler::cell_iterator &cell, - FullMatrix &local_mass_matrix) const { + FullMatrix &local_mass_matrix) const +{ Assert (local_mass_matrix.n() == dofs_per_cell, - ExcWrongFieldDimension(local_mass_matrix.n(),dofs_per_cell)); + FiniteElementBase::ExcWrongFieldDimension(local_mass_matrix.n(), + dofs_per_cell)); Assert (local_mass_matrix.m() == dofs_per_cell, - ExcWrongFieldDimension(local_mass_matrix.m(),dofs_per_cell)); + FiniteElementBase::ExcWrongFieldDimension(local_mass_matrix.m(), + dofs_per_cell)); local_mass_matrix(0,0) = cell->measure(); }; + template void -FEDG_Q0::get_unit_support_points (vector > &unit_points) const { +FEDG_Q0::get_unit_support_points (vector > &unit_points) const +{ Assert (unit_points.size() == dofs_per_cell, - ExcWrongFieldDimension (unit_points.size(), dofs_per_cell)); + FiniteElementBase::ExcWrongFieldDimension (unit_points.size(), dofs_per_cell)); for (unsigned int d=0; d void FEDG_Q0::get_support_points (const typename DoFHandler::cell_iterator &cell, - vector > &support_points) const { + vector > &support_points) const +{ Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); support_points[0] = cell->center(); }; + template void FEDG_Q0::get_face_support_points (const typename DoFHandler::face_iterator &, - vector > &support_points) const { + vector > &support_points) const +{ Assert ((support_points.size() == 0), - ExcWrongFieldDimension (support_points.size(),0)); + FiniteElementBase::ExcWrongFieldDimension (support_points.size(),0)); }; diff --git a/deal.II/deal.II/source/fe/fe_lib.dgp1.cc b/deal.II/deal.II/source/fe/fe_lib.dgp1.cc index a5b45f2187..fb40f756fa 100644 --- a/deal.II/deal.II/source/fe/fe_lib.dgp1.cc +++ b/deal.II/deal.II/source/fe/fe_lib.dgp1.cc @@ -355,7 +355,8 @@ FEDG_P1::get_support_points (const typename DoFHandler::cell_iterator vector > &support_points) const { Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + dofs_per_cell)); for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) support_points[vertex] = cell->vertex(vertex); @@ -369,8 +370,8 @@ FEDG_P1::get_face_support_points (const typename DoFHandler::face_iter { Assert ((support_points.size() == dofs_per_face) && (support_points.size() == GeometryInfo::vertices_per_face), - ExcWrongFieldDimension (support_points.size(), - GeometryInfo::vertices_per_face)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + GeometryInfo::vertices_per_face)); for (unsigned int vertex=0; vertexvertex(vertex); diff --git a/deal.II/deal.II/source/fe/fe_lib.dgp2.cc b/deal.II/deal.II/source/fe/fe_lib.dgp2.cc index 4c148ed223..223ddaa531 100644 --- a/deal.II/deal.II/source/fe/fe_lib.dgp2.cc +++ b/deal.II/deal.II/source/fe/fe_lib.dgp2.cc @@ -337,7 +337,8 @@ FEDG_P2::get_support_points (const typename DoFHandler::cell_iterator vector > &support_points) const { Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + dofs_per_cell)); for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) support_points[vertex] = cell->vertex(vertex); @@ -351,8 +352,8 @@ FEDG_P2::get_face_support_points (const typename DoFHandler::face_iter { Assert ((support_points.size() == dofs_per_face) && (support_points.size() == GeometryInfo::vertices_per_face), - ExcWrongFieldDimension (support_points.size(), - GeometryInfo::vertices_per_face)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + GeometryInfo::vertices_per_face)); for (unsigned int vertex=0; vertexvertex(vertex); diff --git a/deal.II/deal.II/source/fe/fe_lib.dgp3.cc b/deal.II/deal.II/source/fe/fe_lib.dgp3.cc index 0dc598fdde..807855abfb 100644 --- a/deal.II/deal.II/source/fe/fe_lib.dgp3.cc +++ b/deal.II/deal.II/source/fe/fe_lib.dgp3.cc @@ -348,7 +348,8 @@ FEDG_P3::get_support_points (const typename DoFHandler::cell_iterator vector > &support_points) const { Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + dofs_per_cell)); for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) support_points[vertex] = cell->vertex(vertex); @@ -362,8 +363,8 @@ FEDG_P3::get_face_support_points (const typename DoFHandler::face_iter { Assert ((support_points.size() == dofs_per_face) && (support_points.size() == GeometryInfo::vertices_per_face), - ExcWrongFieldDimension (support_points.size(), - GeometryInfo::vertices_per_face)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + GeometryInfo::vertices_per_face)); for (unsigned int vertex=0; vertexvertex(vertex); diff --git a/deal.II/deal.II/source/fe/fe_lib.linear.cc b/deal.II/deal.II/source/fe/fe_lib.linear.cc index 913bf63499..37906ffe41 100644 --- a/deal.II/deal.II/source/fe/fe_lib.linear.cc +++ b/deal.II/deal.II/source/fe/fe_lib.linear.cc @@ -867,7 +867,8 @@ void FEQ1::get_support_points (const typename DoFHandler::cell_iterator &cell, vector > &support_points) const { Assert (support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension (support_points.size(), + dofs_per_cell)); for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) support_points[vertex] = cell->vertex(vertex); @@ -880,6 +881,7 @@ FEQ1::get_face_support_points (const typename DoFHandler::face_iterato vector > &support_points) const { Assert ((support_points.size() == dofs_per_face) && (support_points.size() == GeometryInfo::vertices_per_face), + typename FiniteElementBase:: ExcWrongFieldDimension (support_points.size(), GeometryInfo::vertices_per_face)); diff --git a/deal.II/deal.II/source/fe/fe_system.cc b/deal.II/deal.II/source/fe/fe_system.cc index e20955631c..3a58b3a0b2 100644 --- a/deal.II/deal.II/source/fe/fe_system.cc +++ b/deal.II/deal.II/source/fe/fe_system.cc @@ -767,7 +767,9 @@ void FESystem::get_unit_support_points ( vector > &unit_support_points) const { Assert(unit_support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (unit_support_points.size(), dofs_per_cell)); + typename FiniteElementBase:: + ExcWrongFieldDimension (unit_support_points.size(), + dofs_per_cell)); vector > base_unit_support_points (base_element(0).dofs_per_cell); unsigned int component = 0; @@ -818,7 +820,9 @@ void FESystem::get_support_points (const DoFHandler::cell_iterator &ce vector > &support_points) const { Assert(support_points.size() == dofs_per_cell, - ExcWrongFieldDimension (support_points.size(), dofs_per_cell)); + typename FiniteElementBase:: + ExcWrongFieldDimension (support_points.size(), + dofs_per_cell)); vector > base_support_points (base_element(0).dofs_per_cell); unsigned int component = 0; @@ -847,7 +851,9 @@ void FESystem::get_face_support_points (const DoFHandler::face_iterato vector > & support_points) const { Assert (support_points.size() == dofs_per_face, - ExcWrongFieldDimension (support_points.size(), dofs_per_face)); + typename FiniteElementBase:: + ExcWrongFieldDimension (support_points.size(), + dofs_per_face)); vector > base_support_points (base_element(0).dofs_per_face); unsigned int comp = 0; @@ -874,9 +880,13 @@ void FESystem::get_local_mass_matrix (const DoFHandler::cell_iterator FullMatrix &local_mass_matrix) const { Assert (local_mass_matrix.n() == dofs_per_cell, - ExcWrongFieldDimension(local_mass_matrix.n(),dofs_per_cell)); + typename FiniteElementBase:: + ExcWrongFieldDimension(local_mass_matrix.n(), + dofs_per_cell)); Assert (local_mass_matrix.m() == dofs_per_cell, - ExcWrongFieldDimension(local_mass_matrix.m(),dofs_per_cell)); + typename FiniteElementBase:: + ExcWrongFieldDimension(local_mass_matrix.m(), + dofs_per_cell)); // track which component we are // presently working with, since we diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index d1cf51ff7c..0aef5bdfbe 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -338,7 +338,7 @@ FEValues::FEValues (const FiniteElement &fe, unit_quadrature_points(quadrature.get_points()) { Assert ((update_flags & update_normal_vectors) == false, - ExcInvalidUpdateFlag()); + typename FEValuesBase::ExcInvalidUpdateFlag()); for (unsigned int i=0; i::reinit (const typename DoFHandler::cell_iterator &cell) Assert (static_cast&>(*fe) == static_cast&>(cell->get_dof_handler().get_fe()), - ExcFEDontMatch()); + typename FEValuesBase::ExcFEDontMatch()); // fill jacobi matrices and real // quadrature points @@ -497,7 +497,7 @@ FEFaceValuesBase::normal_vector (const unsigned int i) const { Assert (i::ExcAccessToUninitializedField()); return normal_vectors[i]; }; @@ -568,7 +568,7 @@ void FEFaceValues::reinit (const typename DoFHandler::cell_iterator &c Assert (static_cast&>(*fe) == static_cast&>(cell->get_dof_handler().get_fe()), - ExcFEDontMatch()); + typename FEValuesBase::ExcFEDontMatch()); Assert (face_no < GeometryInfo::faces_per_cell, ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); @@ -678,7 +678,7 @@ FESubfaceValues::FESubfaceValues (const FiniteElement &fe, fe) { Assert ((update_flags & update_support_points) == false, - ExcInvalidUpdateFlag()); + typename FEValuesBase::ExcInvalidUpdateFlag()); unit_face_quadrature_points = quadrature.get_points(); weights = quadrature.get_weights (); @@ -752,7 +752,7 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator Assert (static_cast&>(*fe) == static_cast&>(cell->get_dof_handler().get_fe()), - ExcFEDontMatch()); + typename FEValuesBase::ExcFEDontMatch()); Assert (face_no < GeometryInfo::faces_per_cell, ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); Assert (subface_no < GeometryInfo::subfaces_per_face, diff --git a/deal.II/deal.II/source/fe/q1_mapping.cc b/deal.II/deal.II/source/fe/q1_mapping.cc index 4545fbf7fc..7ce933a7a9 100644 --- a/deal.II/deal.II/source/fe/q1_mapping.cc +++ b/deal.II/deal.II/source/fe/q1_mapping.cc @@ -546,13 +546,17 @@ void FEQ1Mapping::fill_fe_values (const DoFHandler::cell_iterator &cel const vector > > &shape_grad_transform) const { Assert ((!compute_jacobians) || (jacobians.size() == unit_points.size()), - ExcWrongFieldDimension(jacobians.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(jacobians.size(), + unit_points.size())); Assert ((!compute_jacobians_grad) || (jacobians_grad.size() == unit_points.size()), - ExcWrongFieldDimension(jacobians_grad.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(jacobians_grad.size(), + unit_points.size())); Assert ((!compute_q_points) || (q_points.size() == unit_points.size()), - ExcWrongFieldDimension(q_points.size(), unit_points.size())); + typename FiniteElementBase::ExcWrongFieldDimension(q_points.size(), + unit_points.size())); Assert ((!compute_support_points) || (support_points.size() == dofs_per_cell), - ExcWrongFieldDimension(support_points.size(), dofs_per_cell)); + typename FiniteElementBase::ExcWrongFieldDimension(support_points.size(), + dofs_per_cell)); unsigned int n_points=unit_points.size(); diff --git a/deal.II/deal.II/source/grid/persistent_tria.cc b/deal.II/deal.II/source/grid/persistent_tria.cc index c13536a0b3..0b16f09e73 100644 --- a/deal.II/deal.II/source/grid/persistent_tria.cc +++ b/deal.II/deal.II/source/grid/persistent_tria.cc @@ -108,7 +108,7 @@ PersistentTriangulation::write_flags(ostream &out) const { const unsigned int n_flag_levels=refine_flags.size(); - AssertThrow (out, ExcIO()); + AssertThrow (out, typename Triangulation::ExcIO()); out << mn_persistent_tria_flags_begin << ' ' << n_flag_levels << endl; @@ -122,7 +122,7 @@ PersistentTriangulation::write_flags(ostream &out) const out << mn_persistent_tria_flags_end << endl; - AssertThrow (out, ExcIO()); + AssertThrow (out, typename Triangulation::ExcIO()); } @@ -130,13 +130,15 @@ template void PersistentTriangulation::read_flags(istream &in) { - Assert(refine_flags.size()==0 && coarsen_flags.size()==0, ExcTriaNotEmpty()); + Assert(refine_flags.size()==0 && coarsen_flags.size()==0, + ExcTriaNotEmpty()); - AssertThrow (in, ExcIO()); + AssertThrow (in, typename Triangulation::ExcIO()); unsigned int magic_number; in >> magic_number; - AssertThrow(magic_number==mn_persistent_tria_flags_begin, ExcGridReadError()); + AssertThrow(magic_number==mn_persistent_tria_flags_begin, + typename Triangulation::ExcGridReadError()); unsigned int n_flag_levels; in >> n_flag_levels; @@ -151,9 +153,10 @@ PersistentTriangulation::read_flags(istream &in) } in >> magic_number; - AssertThrow(magic_number==mn_persistent_tria_flags_end, ExcGridReadError()); + AssertThrow(magic_number==mn_persistent_tria_flags_end, + typename Triangulation::ExcGridReadError()); - AssertThrow (in, ExcIO()); + AssertThrow (in, typename Triangulation::ExcIO()); } diff --git a/deal.II/deal.II/source/grid/tria_accessor.cc b/deal.II/deal.II/source/grid/tria_accessor.cc index 5e013d0113..a6f9354fc3 100644 --- a/deal.II/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/deal.II/source/grid/tria_accessor.cc @@ -26,41 +26,54 @@ /*------------------------ Functions: LineAccessor ---------------------------*/ template -void TriaObjectAccessor<1, dim>::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 TriaObjectAccessor<1, dim>::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); }; + template Point & -TriaObjectAccessor<1, dim>::vertex (const unsigned int i) const { +TriaObjectAccessor<1, dim>::vertex (const unsigned int i) const +{ return tria->vertices[vertex_index(i)]; }; + template -void TriaObjectAccessor<1, dim>::set_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +void TriaObjectAccessor<1, dim>::set_used_flag () const +{ + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->lines.used[present_index] = true; }; + template -void TriaObjectAccessor<1, dim>::clear_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +void TriaObjectAccessor<1, dim>::clear_used_flag () const +{ + Assert (state() == valid, + typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->lines.used[present_index] = false; }; + template -void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const { +void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const +{ set_user_flag (); if (has_children()) @@ -69,8 +82,10 @@ void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const { }; + template -void TriaObjectAccessor<1, dim>::recursively_clear_user_flag () const { +void TriaObjectAccessor<1, dim>::recursively_clear_user_flag () const +{ clear_user_flag (); if (has_children()) @@ -79,95 +94,122 @@ void TriaObjectAccessor<1, dim>::recursively_clear_user_flag () const { }; + template -void TriaObjectAccessor<1, dim>::set_user_pointer (void *p) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<1, dim>::set_user_pointer (void *p) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_pointers[present_index] = p; }; + template -void TriaObjectAccessor<1, dim>::clear_user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<1, dim>::clear_user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.user_pointers[present_index] = 0; }; + template -void * TriaObjectAccessor<1, dim>::user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void * TriaObjectAccessor<1, dim>::user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->lines.user_pointers[present_index]; }; + template -void TriaObjectAccessor<1, dim>::set_children (const int index) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<1, dim>::set_children (const int index) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); Assert ((index==-1) || - (!has_children() && (index>=0)), ExcCantSetChildren(index)); + (!has_children() && (index>=0)), + typename TriaAccessor::ExcCantSetChildren(index)); tria->levels[present_level]->lines.children[present_index] = index; }; + template -void TriaObjectAccessor<1, dim>::clear_children () const { +void TriaObjectAccessor<1, dim>::clear_children () const +{ set_children (-1); }; + template -unsigned char TriaObjectAccessor<1, dim>::boundary_indicator () const { - Assert (dim>=2, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +unsigned char TriaObjectAccessor<1, dim>::boundary_indicator () const +{ + Assert (dim>=2, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->lines.material_id[present_index]; }; + template -void TriaObjectAccessor<1, dim>::set_boundary_indicator (unsigned char boundary_ind) const { - Assert (dim>=2, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<1, dim>::set_boundary_indicator (unsigned char boundary_ind) const +{ + Assert (dim>=2, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->lines.material_id[present_index] = boundary_ind; }; + template -bool TriaObjectAccessor<1, dim>::at_boundary () const { +bool TriaObjectAccessor<1, dim>::at_boundary () const +{ // error checking is done // in boundary_indicator() return (boundary_indicator() != 255); }; + template -double TriaObjectAccessor<1, dim>::diameter () const { +double TriaObjectAccessor<1, dim>::diameter () const +{ return sqrt((vertex(1)-vertex(0)).square()); }; + template -Point TriaObjectAccessor<1, dim>::center () const { +Point TriaObjectAccessor<1, dim>::center () const +{ return (vertex(1)+vertex(0))/2.; }; + template -Point TriaObjectAccessor<1, dim>::barycenter () const { +Point TriaObjectAccessor<1, dim>::barycenter () const +{ return (vertex(1)+vertex(0))/2.; }; + template -double TriaObjectAccessor<1, dim>::measure () const { +double TriaObjectAccessor<1, dim>::measure () const +{ return sqrt((vertex(1)-vertex(0)).square()); }; + template -unsigned int TriaObjectAccessor<1, dim>::number_of_children () const { +unsigned int TriaObjectAccessor<1, dim>::number_of_children () const +{ if (!has_children()) return 1; else @@ -183,13 +225,16 @@ unsigned int TriaObjectAccessor<1, dim>::number_of_children () const { /*------------------------ Functions: QuadAccessor ---------------------------*/ template -void TriaObjectAccessor<2, dim>::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 TriaObjectAccessor<2, dim>::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 }; @@ -197,30 +242,38 @@ int TriaObjectAccessor<2, dim>::vertex_index (const unsigned int corner) const { }; + template Point & -TriaObjectAccessor<2, dim>::vertex (const unsigned int i) const { +TriaObjectAccessor<2, dim>::vertex (const unsigned int i) const +{ return tria->vertices[vertex_index(i)]; }; + template void -TriaObjectAccessor<2, dim>::set_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +TriaObjectAccessor<2, dim>::set_used_flag () const +{ + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->quads.used[present_index] = true; }; + template -void TriaObjectAccessor<2, dim>::clear_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +void TriaObjectAccessor<2, dim>::clear_used_flag () const +{ + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->quads.used[present_index] = false; }; + template -void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const { +void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const +{ set_user_flag (); if (has_children()) @@ -229,8 +282,10 @@ void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const { }; + template -void TriaObjectAccessor<2, dim>::recursively_clear_user_flag () const { +void TriaObjectAccessor<2, dim>::recursively_clear_user_flag () const +{ clear_user_flag (); if (has_children()) @@ -239,78 +294,100 @@ void TriaObjectAccessor<2, dim>::recursively_clear_user_flag () const { }; + template -void TriaObjectAccessor<2, dim>::set_user_pointer (void *p) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<2, dim>::set_user_pointer (void *p) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_pointers[present_index] = p; }; + template -void TriaObjectAccessor<2, dim>::clear_user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<2, dim>::clear_user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.user_pointers[present_index] = 0; }; + template -void * TriaObjectAccessor<2, dim>::user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void * TriaObjectAccessor<2, dim>::user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->quads.user_pointers[present_index]; }; + template -void TriaObjectAccessor<2, dim>::set_children (const int index) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<2, dim>::set_children (const int index) const +{ + Assert (used(), + typename TriaAccessor::ExcCellNotUsed()); Assert ((index==-1) || - (!has_children() && (index>=0)), ExcCantSetChildren(index)); + (!has_children() && (index>=0)), + typename TriaAccessor::ExcCantSetChildren(index)); tria->levels[present_level]->quads.children[present_index] = index; }; + template -void TriaObjectAccessor<2, dim>::clear_children () const { +void TriaObjectAccessor<2, dim>::clear_children () const +{ set_children (-1); }; + template -unsigned char TriaObjectAccessor<2, dim>::boundary_indicator () const { - Assert (dim>=3, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +unsigned char TriaObjectAccessor<2, dim>::boundary_indicator () const +{ + Assert (dim>=3, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->quads.material_id[present_index]; }; + template -void TriaObjectAccessor<2, dim>::set_boundary_indicator (unsigned char boundary_ind) const { - Assert (dim>=3, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<2, dim>::set_boundary_indicator (unsigned char boundary_ind) const +{ + Assert (dim>=3, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->quads.material_id[present_index] = boundary_ind; }; + template -bool TriaObjectAccessor<2, dim>::at_boundary () const { +bool TriaObjectAccessor<2, dim>::at_boundary () const +{ // error checking is done // in boundary_indicator() return (boundary_indicator() != 255); }; + template -double TriaObjectAccessor<2, dim>::diameter () const { +double TriaObjectAccessor<2, dim>::diameter () const +{ return sqrt(max((vertex(2)-vertex(0)).square(), (vertex(3)-vertex(1)).square())); }; + template -Point TriaObjectAccessor<2, dim>::center () const { +Point TriaObjectAccessor<2, dim>::center () const +{ return (vertex(0)+vertex(1)+vertex(2)+vertex(3))/4.; }; @@ -318,7 +395,8 @@ Point TriaObjectAccessor<2, dim>::center () const { #if deal_II_dimension == 2 template <> -Point<2> TriaObjectAccessor<2, 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 @@ -392,8 +470,10 @@ Point<2> TriaObjectAccessor<2, 2>::barycenter () const { }; + template <> -double TriaObjectAccessor<2, 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 @@ -444,7 +524,8 @@ double TriaObjectAccessor<2, 2>::measure () const { #if deal_II_dimension == 3 template <> -Point<3> TriaObjectAccessor<2, 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 @@ -497,8 +578,10 @@ Point<3> TriaObjectAccessor<2, 3>::barycenter () const { }; + template <> -double TriaObjectAccessor<2, 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 @@ -514,7 +597,8 @@ double TriaObjectAccessor<2, 3>::measure () const { template -unsigned int TriaObjectAccessor<2, dim>::number_of_children () const { +unsigned int TriaObjectAccessor<2, dim>::number_of_children () const +{ if (!has_children()) return 1; else @@ -530,13 +614,16 @@ unsigned int TriaObjectAccessor<2, dim>::number_of_children () const { /*------------------------ Functions: TriaObjectAccessor ---------------------------*/ template -void TriaObjectAccessor<3, dim>::set (const Hexahedron &hex) const { +void TriaObjectAccessor<3, dim>::set (const Hexahedron &hex) const +{ tria->levels[present_level]->hexes.hexes[present_index] = hex; }; + template -int TriaObjectAccessor<3, dim>::vertex_index (const unsigned int corner) const { +int TriaObjectAccessor<3, dim>::vertex_index (const unsigned int corner) const +{ Assert (corner<8, ExcIndexRange(corner,0,8)); // get the corner indices by asking @@ -549,29 +636,37 @@ int TriaObjectAccessor<3, dim>::vertex_index (const unsigned int corner) const { }; + template Point & -TriaObjectAccessor<3, dim>::vertex (const unsigned int i) const { +TriaObjectAccessor<3, dim>::vertex (const unsigned int i) const +{ return tria->vertices[vertex_index(i)]; }; + template -void TriaObjectAccessor<3, dim>::set_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +void TriaObjectAccessor<3, dim>::set_used_flag () const +{ + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->hexes.used[present_index] = true; }; + template -void TriaObjectAccessor<3, dim>::clear_used_flag () const { - Assert (state() == valid, ExcDereferenceInvalidObject()); +void TriaObjectAccessor<3, dim>::clear_used_flag () const +{ + Assert (state() == valid, typename TriaAccessor::ExcDereferenceInvalidObject()); tria->levels[present_level]->hexes.used[present_index] = false; }; + template -void TriaObjectAccessor<3, dim>::recursively_set_user_flag () const { +void TriaObjectAccessor<3, dim>::recursively_set_user_flag () const +{ set_user_flag (); if (has_children()) @@ -580,8 +675,10 @@ void TriaObjectAccessor<3, dim>::recursively_set_user_flag () const { }; + template -void TriaObjectAccessor<3, dim>::recursively_clear_user_flag () const { +void TriaObjectAccessor<3, dim>::recursively_clear_user_flag () const +{ clear_user_flag (); if (has_children()) @@ -590,71 +687,90 @@ void TriaObjectAccessor<3, dim>::recursively_clear_user_flag () const { }; + template -void TriaObjectAccessor<3, dim>::set_user_pointer (void *p) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<3, dim>::set_user_pointer (void *p) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_pointers[present_index] = p; }; + template -void TriaObjectAccessor<3, dim>::clear_user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<3, dim>::clear_user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.user_pointers[present_index] = 0; }; + template -void * TriaObjectAccessor<3, dim>::user_pointer () const { - Assert (used(), ExcCellNotUsed()); +void * TriaObjectAccessor<3, dim>::user_pointer () const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->hexes.user_pointers[present_index]; }; + template -void TriaObjectAccessor<3, dim>::set_children (const int index) const { - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<3, dim>::set_children (const int index) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); Assert ((index==-1) || - (!has_children() && (index>=0)), ExcCantSetChildren(index)); + (!has_children() && (index>=0)), + typename TriaAccessor::ExcCantSetChildren(index)); tria->levels[present_level]->hexes.children[present_index] = index; }; + template -void TriaObjectAccessor<3, dim>::clear_children () const { +void TriaObjectAccessor<3, dim>::clear_children () const +{ set_children (-1); }; + template -unsigned char TriaObjectAccessor<3, dim>::boundary_indicator () const { - Assert (dim<4, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +unsigned char TriaObjectAccessor<3, dim>::boundary_indicator () const +{ + Assert (dim<4, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); return tria->levels[present_level]->hexes.material_id[present_index]; }; + template -void TriaObjectAccessor<3, dim>::set_boundary_indicator (unsigned char boundary_ind) const { - Assert (dim<4, ExcNotUsefulForThisDimension()); - Assert (used(), ExcCellNotUsed()); +void TriaObjectAccessor<3, dim>::set_boundary_indicator (unsigned char boundary_ind) const +{ + Assert (dim<4, typename TriaAccessor::ExcNotUsefulForThisDimension()); + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); tria->levels[present_level]->hexes.material_id[present_index] = boundary_ind; }; + template -bool TriaObjectAccessor<3, dim>::at_boundary () const { +bool TriaObjectAccessor<3, dim>::at_boundary () const +{ // error checking is done // in boundary_indicator() return (boundary_indicator() != 255); }; + template -double TriaObjectAccessor<3, dim>::diameter () const { +double TriaObjectAccessor<3, dim>::diameter () const +{ return sqrt(max( max((vertex(6)-vertex(0)).square(), (vertex(7)-vertex(1)).square()), max((vertex(4)-vertex(2)).square(), @@ -662,8 +778,10 @@ double TriaObjectAccessor<3, dim>::diameter () const { }; + template -Point TriaObjectAccessor<3, dim>::center () const { +Point TriaObjectAccessor<3, dim>::center () const +{ return (vertex(0)+vertex(1)+vertex(2)+vertex(3)+ vertex(4)+vertex(5)+vertex(6)+vertex(7))/8.; }; @@ -672,7 +790,8 @@ Point TriaObjectAccessor<3, dim>::center () const { #if deal_II_dimension == 3 template <> -Point<3> TriaObjectAccessor<3, 3>::barycenter () const { +Point<3> TriaObjectAccessor<3, 3>::barycenter () const +{ /* Get the computation of the barycenter by this little Maple script. We use the trilinear mapping of the unit hex to the real hex. @@ -1319,8 +1438,10 @@ x[7]*y[3]-z[5]*x[6]*y[4]-z[5]*x[4]*y[1]+z[5]*x[4]*y[6]+x[1]*y[6]*z[2]+x[2]*y[6] }; + template <> -double TriaObjectAccessor<3, 3>::measure () const { +double TriaObjectAccessor<3, 3>::measure () const +{ /* Get the computation of the measure by the same little Maple script as above. */ @@ -1398,8 +1519,10 @@ y[2]*x[3]*z[6]/12.0+s2+s1+x[2]*y[0]*z[3]/12.0; #endif + template -unsigned int TriaObjectAccessor<3, dim>::number_of_children () const { +unsigned int TriaObjectAccessor<3, dim>::number_of_children () const +{ if (!has_children()) return 1; else @@ -1418,20 +1541,25 @@ unsigned int TriaObjectAccessor<3, dim>::number_of_children () const { #if deal_II_dimension == 1 template <> -bool CellAccessor<1>::at_boundary () const { +bool CellAccessor<1>::at_boundary () const +{ return at_boundary(0) || at_boundary(1); }; + template <> -unsigned char CellAccessor<1>::material_id () const { +unsigned char CellAccessor<1>::material_id () const +{ Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->lines.material_id[present_index]; }; + template <> -void CellAccessor<1>::set_material_id (const unsigned char mat_id) const { +void CellAccessor<1>::set_material_id (const unsigned char mat_id) const +{ Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->lines.material_id[present_index] = mat_id; @@ -1447,20 +1575,25 @@ void CellAccessor<1>::set_material_id (const unsigned char mat_id) const { #if deal_II_dimension == 2 template <> -bool CellAccessor<2>::at_boundary () const { +bool CellAccessor<2>::at_boundary () const +{ return at_boundary(0) || at_boundary(1) || at_boundary(2) || at_boundary(3); }; + template <> -unsigned char CellAccessor<2>::material_id () const { +unsigned char CellAccessor<2>::material_id () const +{ Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->quads.material_id[present_index]; }; + template <> -void CellAccessor<2>::set_material_id (const unsigned char mat_id) const { +void CellAccessor<2>::set_material_id (const unsigned char mat_id) const +{ Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->quads.material_id[present_index] = mat_id; @@ -1475,22 +1608,27 @@ void CellAccessor<2>::set_material_id (const unsigned char mat_id) const { #if deal_II_dimension == 3 template <> -bool CellAccessor<3>::at_boundary () const { +bool CellAccessor<3>::at_boundary () const +{ return (at_boundary(0) || at_boundary(1) || at_boundary(2) || at_boundary(3) || at_boundary(4) || at_boundary(5)); }; + template <> -unsigned char CellAccessor<3>::material_id () const { +unsigned char CellAccessor<3>::material_id () const +{ Assert (used(), ExcCellNotUsed()); return tria->levels[present_level]->hexes.material_id[present_index]; }; + template <> -void CellAccessor<3>::set_material_id (const unsigned char mat_id) const { +void CellAccessor<3>::set_material_id (const unsigned char mat_id) const +{ Assert (used(), ExcCellNotUsed()); tria->levels[present_level]->hexes.material_id[present_index] = mat_id; @@ -1504,8 +1642,10 @@ void CellAccessor<3>::set_material_id (const unsigned char mat_id) const { template void CellAccessor::set_neighbor (const unsigned int i, - const TriaIterator > &pointer) const { - Assert (i::faces_per_cell, ExcInvalidNeighbor(i)); + const TriaIterator > &pointer) const +{ + Assert (i::faces_per_cell, + typename TriaAccessor::ExcInvalidNeighbor(i)); if (pointer.state() == valid) { @@ -1528,15 +1668,16 @@ void CellAccessor::set_neighbor (const unsigned int i, }; + template unsigned int CellAccessor::neighbor_of_neighbor (const unsigned int neighbor) const { // make sure that the neighbor is // not on a coarser level Assert (neighbor_level(neighbor) == present_level, - ExcNeighborIsCoarser()); + typename TriaAccessor::ExcNeighborIsCoarser()); Assert (neighbor < GeometryInfo::faces_per_cell, - ExcInvalidNeighbor(neighbor)); + typename TriaAccessor::ExcInvalidNeighbor(neighbor)); const TriaIterator > neighbor_cell = this->neighbor(neighbor); @@ -1579,9 +1720,11 @@ unsigned int CellAccessor::neighbor_of_neighbor (const unsigned int neighbo }; + template -bool CellAccessor::at_boundary (const unsigned int i) const { - Assert (used(), ExcCellNotUsed()); +bool CellAccessor::at_boundary (const unsigned int i) const +{ + Assert (used(), typename TriaAccessor::ExcCellNotUsed()); Assert (i::faces_per_cell, ExcIndexRange (i,0,GeometryInfo::faces_per_cell)); @@ -1589,6 +1732,7 @@ bool CellAccessor::at_boundary (const unsigned int i) const { }; + // explicit instantiations template class TriaAccessor; template class TriaObjectAccessor<1, deal_II_dimension>; diff --git a/deal.II/deal.II/source/grid/tria_boundary.cc b/deal.II/deal.II/source/grid/tria_boundary.cc index 23e3a7142a..8fa2eff1cf 100644 --- a/deal.II/deal.II/source/grid/tria_boundary.cc +++ b/deal.II/deal.II/source/grid/tria_boundary.cc @@ -47,7 +47,7 @@ template Point StraightBoundary::get_new_point_on_quad (const typename Triangulation::quad_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Boundary::ExcPureVirtualFunctionCalled()); return Point(); }; 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 c81fcd9fef..c2a31faeb0 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_accessor.cc @@ -143,7 +143,7 @@ MGDoFObjectAccessor<1,dim>::get_mg_dof_values (const Vector &values, const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line; - vector::iterator next_dof_value=dof_values.begin(); + typename vector::iterator next_dof_value=dof_values.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) for (unsigned int d=0; d::get_mg_dof_values (const Vector &values, const unsigned int dofs_per_vertex = dof_handler->get_fe().dofs_per_vertex, dofs_per_line = dof_handler->get_fe().dofs_per_line, dofs_per_quad = dof_handler->get_fe().dofs_per_quad; - vector::iterator next_dof_value=dof_values.begin(); + typename vector::iterator next_dof_value=dof_values.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) for (unsigned int d=0; d::get_mg_dof_values (const Vector &values, dofs_per_line = dof_handler->get_fe().dofs_per_line, dofs_per_quad = dof_handler->get_fe().dofs_per_quad, dofs_per_hex = dof_handler->get_fe().dofs_per_hex; - vector::iterator next_dof_value=dof_values.begin(); + typename vector::iterator next_dof_value=dof_values.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) for (unsigned int d=0; d::assemble (const Equation &equation, // in the docs map boundary_value_list; - for (FunctionMap::const_iterator dirichlet = dirichlet_bc.begin() ; + for (typename FunctionMap::const_iterator dirichlet = dirichlet_bc.begin() ; dirichlet != dirichlet_bc.end() ; ++dirichlet) VectorTools::interpolate_boundary_values (*dof_handler, dirichlet->first, diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index baeb073f28..d9940c5076 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -178,10 +178,12 @@ vector DataOut_DoFData::get_dataset_names () const vector names; // collect the names of dof // and cell data - for (vector::const_iterator d=dof_data.begin(); d!=dof_data.end(); ++d) + for (typename vector::const_iterator d=dof_data.begin(); + d!=dof_data.end(); ++d) for (unsigned int i=0; inames.size(); ++i) names.push_back (d->names[i]); - for (vector::const_iterator d=cell_data.begin(); d!=cell_data.end(); ++d) + for (typename vector::const_iterator d=cell_data.begin(); + d!=cell_data.end(); ++d) { Assert (d->names.size() == 1, ExcInternalError()); names.push_back (d->names[0]); @@ -214,7 +216,7 @@ void DataOut::build_some_patches (Data data) const unsigned int n_q_points = patch_points.n_quadrature_points; unsigned int cell_number = 0; - vector >::iterator patch = patches.begin(); + typename vector >::iterator patch = patches.begin(); DoFHandler::cell_iterator cell=first_cell(); // get first cell in this thread @@ -286,7 +288,7 @@ template void DataOut::build_patches (const unsigned int n_subdivisions, const unsigned int n_threads_) { - Assert (dofs != 0, ExcNoDoFHandlerSelected()); + Assert (dofs != 0, typename DataOut_DoFData::ExcNoDoFHandlerSelected()); #ifdef DEAL_II_USE_MT const unsigned int n_threads = n_threads_; diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index 747d359aab..38e470d4ac 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -39,10 +39,12 @@ void DataOutStack::new_parameter_value (const double p, // // this is to prevent serious waste of // memory - for (vector::const_iterator i=dof_data.begin(); i!=dof_data.end(); ++i) + for (typename vector::const_iterator i=dof_data.begin(); + i!=dof_data.end(); ++i) Assert (i->data.size() == 0, ExcDataNotCleared ()); - for (vector::const_iterator i=cell_data.begin(); i!=cell_data.end(); ++i) + for (typename vector::const_iterator i=cell_data.begin(); + i!=cell_data.end(); ++i) Assert (i->data.size() == 0, ExcDataNotCleared ()); @@ -80,12 +82,12 @@ void DataOutStack::declare_data_vector (const vector &names, // used twice for (vector::const_iterator name=names.begin(); name!=names.end(); ++name) { - for (vector::const_iterator data_set=dof_data.begin(); + for (typename vector::const_iterator data_set=dof_data.begin(); data_set!=dof_data.end(); ++data_set) for (unsigned int i=0; inames.size(); ++i) Assert (*name != data_set->names[i], ExcNameAlreadyUsed(*name)); - for (vector::const_iterator data_set=cell_data.begin(); + for (typename vector::const_iterator data_set=cell_data.begin(); data_set!=cell_data.end(); ++data_set) for (unsigned int i=0; inames.size(); ++i) Assert (*name != data_set->names[i], ExcNameAlreadyUsed(*name)); @@ -139,7 +141,7 @@ void DataOutStack::add_data_vector (const Vector &vec, if (vec.size() == dof_handler->n_dofs()) { - vector::iterator data_vector=dof_data.begin(); + typename vector::iterator data_vector=dof_data.begin(); for (; data_vector!=dof_data.end(); ++data_vector) if (data_vector->names == names) { @@ -153,7 +155,7 @@ void DataOutStack::add_data_vector (const Vector &vec, } else { - vector::iterator data_vector=cell_data.begin(); + typename vector::iterator data_vector=cell_data.begin(); for (; data_vector!=cell_data.end(); ++data_vector) if (data_vector->names == names) { @@ -213,9 +215,9 @@ void DataOutStack::build_patches (const unsigned int n_subdivisions) // now loop over all cells and // actually create the patches - vector >::iterator patch = &patches[patches.size()-n_patches]; - unsigned int cell_number = 0; - for (DoFHandler::active_cell_iterator cell=dof_handler->begin_active(); + typename vector >::iterator patch = &patches[patches.size()-n_patches]; + unsigned int cell_number = 0; + for (typename DoFHandler::active_cell_iterator cell=dof_handler->begin_active(); cell != dof_handler->end(); ++cell, ++patch, ++cell_number) { Assert (patch != patches.end(), ExcInternalError()); @@ -293,10 +295,12 @@ void DataOutStack::finish_parameter_value () { // release lock on dof handler dof_handler = 0; - for (vector::iterator i=dof_data.begin(); i!=dof_data.end(); ++i) + for (typename vector::iterator i=dof_data.begin(); + i!=dof_data.end(); ++i) i->data.reinit (0); - for (vector::iterator i=cell_data.begin(); i!=cell_data.end(); ++i) + for (typename vector::iterator i=cell_data.begin(); + i!=cell_data.end(); ++i) i->data.reinit (0); }; @@ -313,10 +317,10 @@ template vector DataOutStack::get_dataset_names () const { vector names; - for (vector::const_iterator dataset=dof_data.begin(); + for (typename vector::const_iterator dataset=dof_data.begin(); dataset!=dof_data.end(); ++dataset) names.insert (names.end(), dataset->names.begin(), dataset->names.end()); - for (vector::const_iterator dataset=cell_data.begin(); + for (typename vector::const_iterator dataset=cell_data.begin(); dataset!=cell_data.end(); ++dataset) names.insert (names.end(), dataset->names.begin(), dataset->names.end()); diff --git a/deal.II/deal.II/source/numerics/derivative_approximation.cc b/deal.II/deal.II/source/numerics/derivative_approximation.cc index 18f2ba2fef..0c90b9e97e 100644 --- a/deal.II/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/deal.II/source/numerics/derivative_approximation.cc @@ -181,7 +181,7 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // now loop over all active // neighbors and collect the // data we need - vector::active_cell_iterator>::const_iterator + typename vector::active_cell_iterator>::const_iterator neighbor_ptr = active_neighbors.begin(); for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr) { diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index 4786c2567d..d0dc99d44c 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -92,7 +92,7 @@ KellyErrorEstimator::Data::Data(const DoFHandler &dof, Assert (neumann_bc.find(255) == neumann_bc.end(), ExcInvalidBoundaryIndicator()); - for (FunctionMap::const_iterator i=neumann_bc.begin(); i!=neumann_bc.end(); ++i) + for (typename FunctionMap::const_iterator i=neumann_bc.begin(); i!=neumann_bc.end(); ++i) Assert (i->second->n_components == n_components, ExcInvalidBoundaryFunction()); // the last cell, often needed diff --git a/deal.II/deal.II/source/numerics/gradient_estimator.cc b/deal.II/deal.II/source/numerics/gradient_estimator.cc index 18f2ba2fef..0c90b9e97e 100644 --- a/deal.II/deal.II/source/numerics/gradient_estimator.cc +++ b/deal.II/deal.II/source/numerics/gradient_estimator.cc @@ -181,7 +181,7 @@ GradientEstimator::estimate_threaded (const DoFHandler &dof_handler, // now loop over all active // neighbors and collect the // data we need - vector::active_cell_iterator>::const_iterator + typename vector::active_cell_iterator>::const_iterator neighbor_ptr = active_neighbors.begin(); for (; neighbor_ptr!=active_neighbors.end(); ++neighbor_ptr) { diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index a2ec11793b..b4b3b8635a 100644 --- a/deal.II/examples/step-6/step-6.cc +++ b/deal.II/examples/step-6/step-6.cc @@ -893,7 +893,7 @@ void LaplaceProblem::run () // obtain a reasonable view on the // solution, we rescale the z-axis // by a factor of four. - DataOut::EpsFlags eps_flags; + typename DataOut::EpsFlags eps_flags; eps_flags.z_scaling = 4; DataOut data_out; diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index 996be16f80..12b95372cd 100644 --- a/deal.II/examples/step-9/step-9.cc +++ b/deal.II/examples/step-9/step-9.cc @@ -37,6 +37,15 @@ #include + +// in strict ANSI C mode, the following constants are not defined by +// default, so we do it ourselves +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + + + template class AdvectionProblem { @@ -525,7 +534,7 @@ void AdvectionProblem::run () output_results (cycle); }; - DataOut::EpsFlags eps_flags; + typename DataOut::EpsFlags eps_flags; eps_flags.z_scaling = 4; DataOut data_out; diff --git a/deal.II/lac/include/lac/solver_bicgstab.h b/deal.II/lac/include/lac/solver_bicgstab.h index c1838ed788..182b07c136 100644 --- a/deal.II/lac/include/lac/solver_bicgstab.h +++ b/deal.II/lac/include/lac/solver_bicgstab.h @@ -265,7 +265,8 @@ SolverBicgstab::iterate(const MATRIX& A, //TODO: Find better breakdown criterion (G) - if (fabs(alpha) > 1.e10) return ReturnState(breakdown); + if (fabs(alpha) > 1.e10) + return typename Solver::ReturnState(breakdown); s.equ(1., r, -alpha, v); precondition(z,s); @@ -307,7 +308,7 @@ SolverBicgstab::solve(const MATRIX &A, step = 0; - ReturnState state = breakdown; + typename Solver::ReturnState state = breakdown; do { diff --git a/deal.II/lac/include/lac/solver_qmrs.h b/deal.II/lac/include/lac/solver_qmrs.h index c6f181d570..20ce79596f 100644 --- a/deal.II/lac/include/lac/solver_qmrs.h +++ b/deal.II/lac/include/lac/solver_qmrs.h @@ -238,7 +238,7 @@ SolverQMRS::solve (const MATRIX &A, step = 0; - ReturnState state = breakdown; + typename Solver::ReturnState state = breakdown; do { @@ -263,6 +263,8 @@ SolverQMRS::solve (const MATRIX &A, return state; }; + + template template typename Solver::ReturnState @@ -299,7 +301,7 @@ SolverQMRS::iterate(const MATRIX& A, res = A.residual(v, q, b); if (control().check(step, res) == SolverControl::success) - return ReturnState(success); + return success; p = v; @@ -322,7 +324,7 @@ while (state == SolverControl::iterate) //TODO: Find a really good breakdown criterion // The absolute one detects breakdown instead of convergence if (fabs(sigma) < additional_data.breakdown) - return ReturnState(breakdown); + return breakdown; // Step 3 alpha = rho/sigma; //deallog << "alpha:" << alpha << endl; @@ -349,12 +351,12 @@ while (state == SolverControl::iterate) res = sqrt((it+1)*tau); state = control().check(step,res); if (state == SolverControl::success) - return ReturnState(success); + return success; else if (state == SolverControl::failure) - return ReturnState(exceeded); + return exceeded; // Step 6 if (fabs(rho) < additional_data.breakdown) - return ReturnState(breakdown); + return breakdown; // Step 7 rho_old = rho; precondition(q,v); @@ -364,7 +366,7 @@ while (state == SolverControl::iterate) p.sadd(beta,v); precondition(q,p); } - return ReturnState(exceeded); + return exceeded; } diff --git a/deal.II/lac/include/lac/vector_memory.h b/deal.II/lac/include/lac/vector_memory.h index c0960b7ca2..f9084da451 100644 --- a/deal.II/lac/include/lac/vector_memory.h +++ b/deal.II/lac/include/lac/vector_memory.h @@ -172,8 +172,9 @@ template GrowingVectorMemory::GrowingVectorMemory(const unsigned int initial_size) : pool(initial_size) { - for (vector::iterator i=pool.begin();i != pool.end() - ;++i) + for (typename vector::iterator i=pool.begin(); + i != pool.end(); + ++i) { i->first = false; i->second = new Vector; @@ -182,11 +183,14 @@ GrowingVectorMemory::GrowingVectorMemory(const unsigned int initial_size } + template GrowingVectorMemory::~GrowingVectorMemory() { unsigned int n = 0; - for (vector::iterator i=pool.begin();i != pool.end() ;++i) + for (typename vector::iterator i=pool.begin(); + i != pool.end(); + ++i) { if (i->first == true) ++n; @@ -202,12 +206,15 @@ GrowingVectorMemory::~GrowingVectorMemory() } + template Vector* GrowingVectorMemory::alloc() { ++n_alloc; - for (vector::iterator i=pool.begin();i != pool.end() ;++i) + for (typename vector::iterator i=pool.begin(); + i != pool.end(); + ++i) { if (i->first == false) { @@ -223,11 +230,12 @@ GrowingVectorMemory::alloc() } + template void GrowingVectorMemory::free(const Vector* const v) { - for (vector::iterator i=pool.begin();i != pool.end() ;++i) + for (typename vector::iterator i=pool.begin();i != pool.end() ;++i) { if (v == (i->second)) { @@ -235,7 +243,7 @@ GrowingVectorMemory::free(const Vector* const v) return; } } - Assert(false, ExcNotAllocatedHere()); + Assert(false, typename VectorMemory::ExcNotAllocatedHere()); } diff --git a/tests/big-tests/convergence/convergence.cc b/tests/big-tests/convergence/convergence.cc index 38bffd824e..423492109f 100644 --- a/tests/big-tests/convergence/convergence.cc +++ b/tests/big-tests/convergence/convergence.cc @@ -182,7 +182,7 @@ template void PoissonEquation::assemble (FullMatrix &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; @@ -191,7 +191,7 @@ template void PoissonEquation::assemble (Vector &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; diff --git a/tests/big-tests/error-estimation/error-estimation.cc b/tests/big-tests/error-estimation/error-estimation.cc index cd11fc8630..6d181e222e 100644 --- a/tests/big-tests/error-estimation/error-estimation.cc +++ b/tests/big-tests/error-estimation/error-estimation.cc @@ -310,7 +310,7 @@ template void PoissonEquation::assemble (FullMatrix &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; @@ -319,7 +319,7 @@ template void PoissonEquation::assemble (Vector &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; diff --git a/tests/big-tests/multigrid/multigrid.cc b/tests/big-tests/multigrid/multigrid.cc index 2782a285c8..891b8cbe58 100644 --- a/tests/big-tests/multigrid/multigrid.cc +++ b/tests/big-tests/multigrid/multigrid.cc @@ -461,7 +461,7 @@ void LaplaceProblem::run () solve (); output_results (cycle); - DataOut::EpsFlags eps_flags; + typename DataOut::EpsFlags eps_flags; eps_flags.z_scaling = 4; DataOut data_out; diff --git a/tests/big-tests/nonlinear/fixed-point-iteration/nonlinear.cc b/tests/big-tests/nonlinear/fixed-point-iteration/nonlinear.cc index 5c305727dc..1ab5f1b2a9 100644 --- a/tests/big-tests/nonlinear/fixed-point-iteration/nonlinear.cc +++ b/tests/big-tests/nonlinear/fixed-point-iteration/nonlinear.cc @@ -132,7 +132,7 @@ template void PoissonEquation::assemble (FullMatrix &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; @@ -141,7 +141,7 @@ template void PoissonEquation::assemble (Vector &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; diff --git a/tests/big-tests/poisson/equation.cc b/tests/big-tests/poisson/equation.cc index 9610c7e888..08eda93399 100644 --- a/tests/big-tests/poisson/equation.cc +++ b/tests/big-tests/poisson/equation.cc @@ -66,7 +66,7 @@ template void PoissonEquation::assemble (FullMatrix &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; @@ -75,7 +75,7 @@ template void PoissonEquation::assemble (Vector &, const FEValues &, const DoFHandler::cell_iterator &) const { - Assert (false, ExcPureVirtualFunctionCalled()); + Assert (false, typename Equation::ExcPureVirtualFunctionCalled()); }; diff --git a/tests/deal.II/wave-test-3.cc b/tests/deal.II/wave-test-3.cc index 40a9ac44a6..f596a461ef 100644 --- a/tests/deal.II/wave-test-3.cc +++ b/tests/deal.II/wave-test-3.cc @@ -138,6 +138,15 @@ class TimeStep_Primal : public TimeStep_Wave virtual void solve_primal_problem (); virtual string branch_signature () const; virtual void wake_up (const unsigned int wakeup_level); + virtual void end_sweep () + { + TimeStep_Wave::end_sweep(); + }; + virtual void sleep (const unsigned int sleep_level) + { + TimeStep_Wave::sleep (sleep_level); + }; + private: void assemble_vectors (Vector &right_hand_side1, @@ -175,6 +184,16 @@ class TimeStep_Dual : public TimeStep_Wave virtual string branch_signature () const; virtual void wake_up (const unsigned int wakeup_level); + virtual void end_sweep () + { + TimeStep_Wave::end_sweep(); + }; + virtual void sleep (const unsigned int sleep_level) + { + TimeStep_Wave::sleep (sleep_level); + }; + + private: void assemble_vectors (Vector &right_hand_side1, Vector &right_hand_side2); @@ -2804,7 +2823,7 @@ double EvaluateSeismicSignal::evaluate () { const unsigned int n_q_points = quadrature_face->n_quadrature_points; ofstream out((base_file_name + ".seismic").c_str()); - AssertThrow (out, ExcIO()); + AssertThrow (out, typename EvaluationBase::ExcIO()); DoFHandler::active_cell_iterator cell = dof->begin_active(), endc = dof->end(); @@ -2847,7 +2866,7 @@ double EvaluateSeismicSignal::evaluate () { << endl << endl; }; - AssertThrow (out, ExcIO()); + AssertThrow (out, typename EvaluationBase::ExcIO()); out.close (); if (time!=0) @@ -5596,16 +5615,16 @@ void TimeStep_Dual::do_initial_step () { solver_steps1 = solve (system_matrix, u, tmp_u_bar), solver_steps2 = solve (system_matrix, v, tmp_v_bar); - statistic_data = StatisticData (tria->n_active_cells(), - dof_handler->n_dofs(), - solver_steps1, solver_steps2, - compute_energy ()); + statistic_data = typename TimeStep_Wave::StatisticData (tria->n_active_cells(), + dof_handler->n_dofs(), + solver_steps1, solver_steps2, + compute_energy ()); } else - statistic_data = StatisticData (tria->n_active_cells(), - dof_handler->n_dofs(), - 0, 0, - make_pair (0.0, 0.0)); + statistic_data = typename TimeStep_Wave::StatisticData (tria->n_active_cells(), + dof_handler->n_dofs(), + 0, 0, + make_pair (0.0, 0.0)); deallog << "." << endl; }; @@ -5732,11 +5751,11 @@ void TimeStep_Dual::do_timestep () const unsigned int solver_steps2 = solve (system_matrix, u, right_hand_side2); - statistic_data = StatisticData (tria->n_active_cells(), - dof_handler->n_dofs(), - solver_steps1, - solver_steps2, - compute_energy ()); + statistic_data = typename TimeStep_Wave::StatisticData (tria->n_active_cells(), + dof_handler->n_dofs(), + solver_steps1, + solver_steps2, + compute_energy ()); deallog << "." << endl; }; @@ -5813,7 +5832,7 @@ void TimeStep_Dual::build_rhs (Vector &right_hand_side1, = static_cast*>(next_timestep)->get_timestep_dual(); Assert (previous_time_level.tria->n_cells(0) == tria->n_cells(0), - ExcCoarsestGridsDiffer()); + typename TimeStep_Wave::ExcCoarsestGridsDiffer()); // convenience typedef typedef DoFHandler::cell_iterator cell_iterator; @@ -7507,10 +7526,12 @@ void TimeStep::write_statistics_descriptions (ostream &ou const WaveParameters ¶meters) { out << "# Primal problem:" << endl; - TimeStep_Primal::StatisticData::write_descriptions (out); + typename TimeStep_Primal::StatisticData xp; + xp.write_descriptions (out); out << "# Dual problem:" << endl; - TimeStep_Dual::StatisticData::write_descriptions (out); + typename TimeStep_Dual::StatisticData xd; + xd.write_descriptions (out); out << "# Error estimation:" << endl; TimeStep_ErrorEstimation::StatisticData::write_descriptions (out); @@ -7593,7 +7614,7 @@ void TimeStep_Postprocess::postprocess_timestep () deallog << "[o]"; DataOut out; - DataOut::OutputFormat output_format + typename DataOut::OutputFormat output_format = DataOut::parse_output_format (parameters.output_format); string data_filename = (parameters.output_directory + @@ -7865,11 +7886,11 @@ void TimeStep_Primal::do_initial_step () // set energy to zero since we // don't want to assemble the matrices // needed for this - statistic_data = StatisticData (tria->n_active_cells(), - dof_handler->n_dofs(), - 0, - 0, - make_pair (0.0, 0.0)); + statistic_data = typename TimeStep_Wave::StatisticData (tria->n_active_cells(), + dof_handler->n_dofs(), + 0, + 0, + make_pair (0.0, 0.0)); deallog << "." << endl; }; @@ -7991,11 +8012,11 @@ if (parameters.extrapolate_old_solutions) const unsigned int solver_steps2 = solve (system_matrix, v, right_hand_side2); - statistic_data = StatisticData (tria->n_active_cells(), - dof_handler->n_dofs(), - solver_steps1, - solver_steps2, - compute_energy ()); + statistic_data = typename TimeStep_Wave::StatisticData (tria->n_active_cells(), + dof_handler->n_dofs(), + solver_steps1, + solver_steps2, + compute_energy ()); deallog << "." << endl; }; @@ -8059,7 +8080,7 @@ void TimeStep_Primal::build_rhs (Vector &right_hand_side1, = static_cast*>(previous_timestep)->get_timestep_primal(); Assert (previous_time_level.tria->n_cells(0) == tria->n_cells(0), - ExcCoarsestGridsDiffer()); + typename TimeStep_Wave::ExcCoarsestGridsDiffer()); // convenience typedef typedef DoFHandler::cell_iterator cell_iterator;