From 8b1cf3820e5ce02412fc8bcc4242fd371dbd8381 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 15 Jul 1999 09:00:53 +0000 Subject: [PATCH] Cleanup git-svn-id: https://svn.dealii.org/trunk@1577 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/data_out_base.h | 7 +++- deal.II/base/include/base/exceptions.h | 2 +- deal.II/base/include/base/tensor_base.h | 4 +-- deal.II/base/include/base/tensorindex.h | 34 +++++++++---------- deal.II/deal.II/include/dofs/dof_tools.h | 9 +++++ .../deal.II/include/multigrid/mg_smoother.h | 6 +++- deal.II/deal.II/include/multigrid/multigrid.h | 4 +-- .../deal.II/include/numerics/mg_smoother.h | 6 +++- deal.II/deal.II/include/numerics/multigrid.h | 4 +-- deal.II/deal.II/source/dofs/dof_tools.cc | 34 +++++++++++++++++++ deal.II/deal.II/source/multigrid/multigrid.cc | 1 - deal.II/deal.II/source/numerics/multigrid.cc | 1 - deal.II/doc/parser/dealparse.l | 7 ++-- deal.II/doc/parser/dealparse.y | 21 ++---------- 14 files changed, 88 insertions(+), 52 deletions(-) diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index b7f87264e6..7f4e37a3df 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -528,7 +528,12 @@ class DataOutBase * Structure keeping the three color * values in the RGB system. */ - struct RgbValues { float red, green, blue; }; + struct RgbValues + { + float red; + float green; + float blue; + }; /** * Definition of a function pointer diff --git a/deal.II/base/include/base/exceptions.h b/deal.II/base/include/base/exceptions.h index 487a7eb171..8f3d6b76a6 100644 --- a/deal.II/base/include/base/exceptions.h +++ b/deal.II/base/include/base/exceptions.h @@ -572,7 +572,7 @@ namespace StandardExceptions << "Dimension " << arg1 << " not equal to " << arg2); DeclException3 (ExcIndexRange, int, int, int, << "Index " << arg1 << " is not in [" - << arg2 << "," << arg3 << ")"); + << arg2 << "," << arg3 << "["); }; diff --git a/deal.II/base/include/base/tensor_base.h b/deal.II/base/include/base/tensor_base.h index 4280d93ed0..be7087d420 100644 --- a/deal.II/base/include/base/tensor_base.h +++ b/deal.II/base/include/base/tensor_base.h @@ -66,7 +66,7 @@ class Tensor<1,dim> { * but egcs1.1.2 chokes on that so * we need it presently. */ - static const unsigned int array_size = (dim>0 ? dim : 1); + static const unsigned int array_size = ((dim!=0) ? (dim) : 1); /** * Declare an array type which can @@ -195,7 +195,7 @@ class Tensor<1,dim> { * to disallow the creation of such * an object. */ - double values[dim>0 ? dim : 1]; + double values[(dim!=0) ? (dim) : 1]; /** * Help function for unroll. diff --git a/deal.II/base/include/base/tensorindex.h b/deal.II/base/include/base/tensorindex.h index beb570adaa..bf4e0b598a 100644 --- a/deal.II/base/include/base/tensorindex.h +++ b/deal.II/base/include/base/tensorindex.h @@ -53,12 +53,12 @@ private: /** * Field of indices. */ - unsigned index[4]; + unsigned int index[4]; public: /** * Constructor taking #rank# indices. */ - TensorIndex(unsigned i0, unsigned i1, unsigned i2, unsigned i3) + TensorIndex(unsigned int i0, unsigned int i1, unsigned int i2, unsigned int i3) { index[0] = i0; index[1] = i1; @@ -77,7 +77,7 @@ public: return index[n]; } - DeclException1(ExcRank, unsigned, + DeclException1(ExcRank, unsigned int, << "Index " << arg1 << " higher than maximum 3"); }; @@ -88,12 +88,12 @@ private: /** * Field of indices. */ - unsigned index[3]; + unsigned int index[3]; public: /** * Constructor taking #rank# indices. */ - TensorIndex(unsigned i0, unsigned i1, unsigned i2) + TensorIndex(unsigned int i0, unsigned int i1, unsigned int i2) { index[0] = i0; index[1] = i1; @@ -106,14 +106,14 @@ private: * in #n#th component * */ - unsigned operator () (unsigned n) const + unsigned int operator () (unsigned int n) const { Assert(n<3, ExcRank(n)); return index[n]; } - DeclException1(ExcRank, unsigned, + DeclException1(ExcRank, unsigned int, << "Index " << arg1 << " higher than maximum 2"); }; @@ -124,12 +124,12 @@ class TensorIndex<2> /** * Field of indices. */ - unsigned index[4]; + unsigned int index[4]; public: /** * Constructor taking #rank# indices. */ - TensorIndex(unsigned i0, unsigned i1) + TensorIndex(unsigned int i0, unsigned int i1) { index[0] = i0; index[1] = i1; @@ -140,13 +140,13 @@ class TensorIndex<2> * Access operator returning index * in #n#th component */ - unsigned operator () (unsigned n) const + unsigned int operator () (unsigned int n) const { Assert(n<2, ExcRank(n)); return index[n]; } - DeclException1(ExcRank, unsigned, + DeclException1(ExcRank, unsigned int, << "Index " << arg1 << " higher than maximum 1"); }; @@ -157,12 +157,12 @@ class TensorIndex<1> /** * Field of indices. */ - unsigned index[1]; + unsigned int index[1]; public: /** * Constructor taking #rank# indices. */ - TensorIndex(unsigned i0) + TensorIndex(unsigned int i0) { index[0] = i0; } @@ -172,22 +172,22 @@ class TensorIndex<1> * Access operator returning index * in #n#th component */ - unsigned operator () (unsigned n) const + unsigned int operator () (unsigned int n) const { Assert(n<1, ExcRank(n)); return index[n]; } - DeclException1(ExcRank, unsigned, + DeclException1(ExcRank, unsigned int, << "Index " << arg1 << " higher than maximum 0"); }; template -inline unsigned +inline unsigned int TensorIndex:: -operator() (unsigned n) const +operator() (unsigned int n) const { Assert(n& dof, const bit_vector& select, bit_vector& selected_dofs); + + /** + * Same as #extract_dofs# for multi-level. + */ + template + static void extract_level_dofs(unsigned int level, + const MGDoFHandler& dof, + const bit_vector& select, + bit_vector& selected_dofs); }; diff --git a/deal.II/deal.II/include/multigrid/mg_smoother.h b/deal.II/deal.II/include/multigrid/mg_smoother.h index 110cca5eb1..6b76df8894 100644 --- a/deal.II/deal.II/include/multigrid/mg_smoother.h +++ b/deal.II/deal.II/include/multigrid/mg_smoother.h @@ -176,7 +176,11 @@ class MGSmootherRelaxation : public MGSmoother /** * Auxiliary vector. */ - mutable Vector h1, h2; + mutable Vector h1; + /** + * Auxiliary vector. + */ + mutable Vector h2; }; inline diff --git a/deal.II/deal.II/include/multigrid/multigrid.h b/deal.II/deal.II/include/multigrid/multigrid.h index 74a92453c0..6086ecbdb4 100644 --- a/deal.II/deal.II/include/multigrid/multigrid.h +++ b/deal.II/deal.II/include/multigrid/multigrid.h @@ -101,13 +101,11 @@ class MG */ class MGTransferPrebuilt : public MGTransferBase { - const MGSmoother& smoother; public: /** * Preliminary constructor */ - MGTransferPrebuilt(const MGSmoother& smoother) : - smoother(smoother) + MGTransferPrebuilt() {} diff --git a/deal.II/deal.II/include/numerics/mg_smoother.h b/deal.II/deal.II/include/numerics/mg_smoother.h index 110cca5eb1..6b76df8894 100644 --- a/deal.II/deal.II/include/numerics/mg_smoother.h +++ b/deal.II/deal.II/include/numerics/mg_smoother.h @@ -176,7 +176,11 @@ class MGSmootherRelaxation : public MGSmoother /** * Auxiliary vector. */ - mutable Vector h1, h2; + mutable Vector h1; + /** + * Auxiliary vector. + */ + mutable Vector h2; }; inline diff --git a/deal.II/deal.II/include/numerics/multigrid.h b/deal.II/deal.II/include/numerics/multigrid.h index 74a92453c0..6086ecbdb4 100644 --- a/deal.II/deal.II/include/numerics/multigrid.h +++ b/deal.II/deal.II/include/numerics/multigrid.h @@ -101,13 +101,11 @@ class MG */ class MGTransferPrebuilt : public MGTransferBase { - const MGSmoother& smoother; public: /** * Preliminary constructor */ - MGTransferPrebuilt(const MGSmoother& smoother) : - smoother(smoother) + MGTransferPrebuilt() {} diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index c8e7dc8217..391003e19a 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -2,7 +2,9 @@ // Copyright Guido Kanschat, 1999 #include +#include #include +#include #include #include #include @@ -35,7 +37,39 @@ DoFTools::extract_dofs(const DoFHandler& dof, } } +template +void +DoFTools::extract_level_dofs(unsigned int level, + const MGDoFHandler& dof, + const bit_vector& local_select, + bit_vector& selected_dofs) +{ + const FiniteElement& fe = dof.get_fe(); + Assert(local_select.size() == fe.n_components, + ExcDimensionMismatch(local_select.size(), fe.n_components)); + Assert(selected_dofs.size() == dof.n_dofs(level), + ExcDimensionMismatch(selected_dofs.size(), dof.n_dofs(level))); + + vector indices(fe.total_dofs); + + MGDoFHandler::cell_iterator c; + for (c = dof.begin(level) ; c != dof.end(level) ; ++ c) + { + c->get_mg_dof_indices(indices); + for (unsigned int i=0;i comp + = fe.system_to_component_index(i); + selected_dofs[indices[i]] = local_select[comp.first]; + } + } +} + template void DoFTools::extract_dofs(const DoFHandler& dof, const bit_vector& local_select, bit_vector& selected_dofs); +template void DoFTools::extract_level_dofs(unsigned int level, + const MGDoFHandler& dof, + const bit_vector& local_select, + bit_vector& selected_dofs); //template DoFTools; diff --git a/deal.II/deal.II/source/multigrid/multigrid.cc b/deal.II/deal.II/source/multigrid/multigrid.cc index 2785d302c6..4b5c8b7946 100644 --- a/deal.II/deal.II/source/multigrid/multigrid.cc +++ b/deal.II/deal.II/source/multigrid/multigrid.cc @@ -154,7 +154,6 @@ void MGTransferPrebuilt::restrict (const unsigned int from_level, { Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()), ExcIndexRange (from_level, 1, prolongation_matrices.size()+1)); -// smoother.set_zero_interior_boundary(from_level, src); prolongation_matrices[from_level-1].Tvmult_add (dst, src); }; diff --git a/deal.II/deal.II/source/numerics/multigrid.cc b/deal.II/deal.II/source/numerics/multigrid.cc index 2785d302c6..4b5c8b7946 100644 --- a/deal.II/deal.II/source/numerics/multigrid.cc +++ b/deal.II/deal.II/source/numerics/multigrid.cc @@ -154,7 +154,6 @@ void MGTransferPrebuilt::restrict (const unsigned int from_level, { Assert ((from_level >= 1) && (from_level<=prolongation_matrices.size()), ExcIndexRange (from_level, 1, prolongation_matrices.size()+1)); -// smoother.set_zero_interior_boundary(from_level, src); prolongation_matrices[from_level-1].Tvmult_add (dst, src); }; diff --git a/deal.II/doc/parser/dealparse.l b/deal.II/doc/parser/dealparse.l index 87e8908c7c..a3b2a7881f 100644 --- a/deal.II/doc/parser/dealparse.l +++ b/deal.II/doc/parser/dealparse.l @@ -25,6 +25,7 @@ extern string cvs_id; NAME [_a-zA-Z][_a-zA-Z0-9]* INT [+-]?[0-9]+ WHITE [ \t\n\f\v] +ID "$"Id[^\$]* CLASS (class)|(struct)|(union) ACCESS (public)|(protected)|(private) OP \+|\-|\/|\||\^|(==)|(!=)|(<<)|(>>)|(->)|(\+\+)|(\-\-) @@ -56,9 +57,9 @@ DeclException[0-9] { yylval = string("@") + string(yytext); return(DECLEXCEPTIO /* scan CVS id in file preamble */ -"$Id$]*"$" { cvs_id = string(yytext); } -"$Id$]*"$" { cvs_id = string(yytext); } -"$Id$]*"$" { cvs_id = string(yytext); } +{ID} { cvs_id = string(yytext); } +{ID} { cvs_id = string(yytext); } +{ID} { cvs_id = string(yytext); } /* Ignore function bodies */ diff --git a/deal.II/doc/parser/dealparse.y b/deal.II/doc/parser/dealparse.y index 9b8a3920ee..b79a9cda22 100644 --- a/deal.II/doc/parser/dealparse.y +++ b/deal.II/doc/parser/dealparse.y @@ -38,7 +38,6 @@ void yyerror(const char* s) %token TYPEDEF %token ACCESS %token IDENTIFIER -%token FARG %token CONST %token STATIC %token EXTERN @@ -156,7 +155,7 @@ typedef_declaration: array_dimensions: '[' ']' { $$ = string("[]"); } - | '[' identifier ']' { $$ = string("[") + $2 + string("]"); } + | '[' expression ']' { $$ = string("[") + $2 + string("]"); } | '[' INT ']' { $$ = string("[") + $2 + string("]"); } | array_dimensions array_dimensions { $$ = $1 + $2; } ; @@ -342,8 +341,10 @@ identifier: expression: literal | identifier + | '&' expression { $$ = string("&") + $2; } | OP expression { $$ = $1 + $2; } | expression OP expression { $$ = $1 + $2 + $3; } + | expression '?' expression ':' expression { $$ = string("Conditional"); } | expression '*' expression { $$ = $1 + $2 + $3; } | expression INT { $$ = $1 + $2; } | identifier argument_declaration { $$ = $1 + $2; } @@ -393,22 +394,6 @@ deal_exception_declaration: } ; -deal_exception_arglist: /* empty */ - | deal_exception_arglist ',' deal_exception_arg -; - -deal_exception_arg: - vartype - | deal_exception_output_declaration - | literal -; - -deal_exception_output_declaration: OP - | expression -/* | deal_exception_output_declaration vartype - | deal_exception_output_declaration literal - | deal_exception_output_declaration OP */ -; %% -- 2.39.5