]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow this file to be compiled with -pedantic. this required some
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 13 Jun 2000 14:10:40 +0000 (14:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 13 Jun 2000 14:10:40 +0000 (14:10 +0000)
work-arounds, described in the comments added in this patch.

git-svn-id: https://svn.dealii.org/trunk@3009 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/precondition_block.templates.h

index 791f737f5cc21498824c6bf1d4042eb9f05c00af..ccf17906352117a377bc3f0043e6aa73492b20a0 100644 (file)
@@ -133,14 +133,36 @@ void PreconditionBlockJacobi<number,inverse_type>
 ::operator() (Vector<number2>       &dst,
              const Vector<number2> &src) const
 {
-  Assert(A!=0, ExcNoMatrixGivenToUse());
+                                  // introduce the following typedef
+                                  // since in the use of exceptions,
+                                  // strict C++ requires us to
+                                  // specify them fully as they are
+                                  // from a template dependent base
+                                  // class. thus, we'd have to write
+                                  // PreconditionBlock<number,inverse_type>::ExcNoMatrixGivenToUse,
+                                  // which is lengthy, but also poses
+                                  // some problems to the
+                                  // preprocessor due to the comma in
+                                  // the template arg list. we could
+                                  // then wrap the whole thing into
+                                  // parentheses, but that creates a
+                                  // parse error for gcc for the
+                                  // exceptions that do not take
+                                  // args...
+  typedef PreconditionBlock<number,inverse_type> BaseClass;
+  Assert(A!=0, typename BaseClass::ExcNoMatrixGivenToUse());
+  
   const SparseMatrix<number> &M=*A;
-  Assert (M.m() == M.n(), ExcMatrixNotSquare());
-  Assert (blocksize!=0, ExcBlockSizeNotSet());
-  Assert (M.m()%blocksize==0, ExcWrongBlockSize(blocksize, M.m()));
   const unsigned int n_cells=M.m()/blocksize;
+
+  Assert (M.m() == M.n(),
+         typename BaseClass::ExcMatrixNotSquare());
+  Assert (blocksize!=0,
+         typename BaseClass::ExcBlockSizeNotSet());
+  Assert (M.m()%blocksize==0,
+         typename BaseClass::ExcWrongBlockSize(blocksize, M.m()));
   Assert (inverse.size()==0 || inverse.size()==n_cells,
-         ExcWrongNumberOfInverses(inverse.size(), n_cells));
+         typename BaseClass::ExcWrongNumberOfInverses(inverse.size(), n_cells));
 
   Vector<number2> b_cell(blocksize), x_cell(blocksize);
 
@@ -216,14 +238,37 @@ template <typename number2>
 void PreconditionBlockSOR<number,inverse_type>::operator() (Vector<number2>       &dst,
                                                            const Vector<number2> &src) const
 {
-  Assert(A!=0, ExcNoMatrixGivenToUse());
+                                  // introduce the following typedef
+                                  // since in the use of exceptions,
+                                  // strict C++ requires us to
+                                  // specify them fully as they are
+                                  // from a template dependent base
+                                  // class. thus, we'd have to write
+                                  // PreconditionBlock<number,inverse_type>::ExcNoMatrixGivenToUse,
+                                  // which is lengthy, but also poses
+                                  // some problems to the
+                                  // preprocessor due to the comma in
+                                  // the template arg list. we could
+                                  // then wrap the whole thing into
+                                  // parentheses, but that creates a
+                                  // parse error for gcc for the
+                                  // exceptions that do not take
+                                  // args...
+  typedef PreconditionBlock<number,inverse_type> BaseClass;
+
+  Assert (A!=0, typename BaseClass::ExcNoMatrixGivenToUse());
+  
   const SparseMatrix<number> &M=*A;
-  Assert (M.m() == M.n(), ExcMatrixNotSquare());
-  Assert (blocksize!=0, ExcBlockSizeNotSet());
-  Assert (M.m()%blocksize==0, ExcWrongBlockSize(blocksize, M.m()));
   const unsigned int n_cells=M.m()/blocksize;
+
+  Assert (M.m() == M.n(),
+         typename BaseClass::ExcMatrixNotSquare());
+  Assert (blocksize!=0,
+         typename BaseClass::ExcBlockSizeNotSet());
+  Assert (M.m()%blocksize==0,
+         typename BaseClass::ExcWrongBlockSize(blocksize, M.m()));
   Assert (inverse.size()==0 || inverse.size()==n_cells,
-         ExcWrongNumberOfInverses(inverse.size(), n_cells));
+         typename BaseClass::ExcWrongNumberOfInverses(inverse.size(), n_cells));
 
   const SparsityPattern &spars    = M.get_sparsity_pattern();
   const unsigned int    *rowstart = spars.get_rowstart_indices();

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.