]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove further instances of the ExcInvalidConstructorCall exception. 3016/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 25 Aug 2016 19:23:58 +0000 (13:23 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 26 Aug 2016 04:01:46 +0000 (22:01 -0600)
include/deal.II/lac/block_sparsity_pattern.h
include/deal.II/lac/chunk_sparsity_pattern.h
include/deal.II/lac/sparsity_pattern.h
source/lac/block_sparsity_pattern.cc
source/lac/chunk_sparsity_pattern.cc
source/lac/sparsity_pattern.cc

index ffb2ecccc891a8fc30923ab6eaedbaa9c9aa2592..565b7a2c697ca13aeff6acdf6d3dc5997d185ff4 100644 (file)
@@ -308,10 +308,6 @@ public:
                   int, int, int, int,
                   << "The blocks [" << arg1 << ',' << arg2 << "] and ["
                   << arg3 << ',' << arg4 << "] have differing column numbers.");
-  /**
-   * Exception
-   */
-  DeclException0 (ExcInvalidConstructorCall);
   //@}
 
 protected:
index 5f8b4d99ab021523a1364f5651d827ae7458127e..2f754e23457a6b72ac2cc54ad8160e91533d2f77 100644 (file)
@@ -751,10 +751,6 @@ public:
    * Exception
    */
   DeclException0 (ExcEmptyObject);
-  /**
-   * Exception
-   */
-  DeclException0 (ExcInvalidConstructorCall);
   /**
    * Exception
    */
index 104d40cb56b97064bd4536da47b68e4a1c010911..ce07d9e127f708d6cbd469da55a2aeb510815414 100644 (file)
@@ -989,10 +989,6 @@ public:
   DeclExceptionMsg (ExcMatrixIsCompressed,
                     "The operation you attempted changes the structure of the SparsityPattern "
                     "and is not possible after compress() has been called.");
-  /**
-   * Exception
-   */
-  DeclException0 (ExcInvalidConstructorCall);
   /**
    * Exception
    */
index 62bb2323e8f66458088c4ee30f22a765a52458be..3b2e5555700899ae24e82a64714671ed4a252ecd 100644 (file)
@@ -47,14 +47,15 @@ template <class SparsityPatternBase>
 BlockSparsityPatternBase<SparsityPatternBase>::
 BlockSparsityPatternBase (const BlockSparsityPatternBase &s)
   :
-  Subscriptor ()
+  Subscriptor (),
+  rows (0),
+  columns (0)
 {
   (void)s;
-  Assert(s.rows==0, ExcInvalidConstructorCall());
-  Assert(s.columns==0, ExcInvalidConstructorCall());
-
-  rows = 0;
-  columns=0;
+  Assert (s.rows==0 && s.columns==0,
+          ExcMessage("This constructor can only be called if the provided argument "
+                     "is the sparsity pattern for an empty matrix. This constructor can "
+                     "not be used to copy-construct a non-empty sparsity pattern."));
 }
 
 
index 1f31479a6130b481c5b587c0b9143ec8437080fb..5c080ca5685f61f31fff07e66b4cad0671b063fd 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2008 - 2015 by the deal.II authors
+// Copyright (C) 2008 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -35,8 +35,10 @@ ChunkSparsityPattern::ChunkSparsityPattern (const ChunkSparsityPattern &s)
   chunk_size (s.chunk_size),
   sparsity_pattern(s.sparsity_pattern)
 {
-  Assert (s.rows == 0, ExcInvalidConstructorCall());
-  Assert (s.cols == 0, ExcInvalidConstructorCall());
+  Assert (s.rows==0 && s.cols==0,
+          ExcMessage("This constructor can only be called if the provided argument "
+                     "is the sparsity pattern for an empty matrix. This constructor can "
+                     "not be used to copy-construct a non-empty sparsity pattern."));
 
   reinit (0,0,0,0);
 }
@@ -97,8 +99,14 @@ ChunkSparsityPattern::~ChunkSparsityPattern ()
 ChunkSparsityPattern &
 ChunkSparsityPattern::operator = (const ChunkSparsityPattern &s)
 {
-  Assert (s.rows == 0, ExcInvalidConstructorCall());
-  Assert (s.cols == 0, ExcInvalidConstructorCall());
+  Assert (s.rows==0 && s.cols==0,
+          ExcMessage("This operator can only be called if the provided argument "
+                     "is the sparsity pattern for an empty matrix. This operator can "
+                     "not be used to copy a non-empty sparsity pattern."));
+
+  Assert (rows==0 && cols==0,
+          ExcMessage("This operator can only be called if the current object is "
+                     "empty."));
 
   // perform the checks in the underlying object as well
   sparsity_pattern = s.sparsity_pattern;
index b7d60c7cce84061d5b377524e4e6e5cab563f306..501b4878ed507151427a204966ae60f920db498f 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2000 - 2015 by the deal.II authors
+// Copyright (C) 2000 - 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -62,10 +62,10 @@ SparsityPattern::SparsityPattern (const SparsityPattern &s)
   store_diagonal_first_in_row(false)
 {
   (void)s;
-  Assert (s.rowstart == 0, ExcInvalidConstructorCall());
-  Assert (s.colnums == 0, ExcInvalidConstructorCall());
-  Assert (s.rows == 0, ExcInvalidConstructorCall());
-  Assert (s.cols == 0, ExcInvalidConstructorCall());
+  Assert (s.rows==0 && s.cols==0 && s.rowstart==0 && s.colnums==0,
+          ExcMessage("This constructor can only be called if the provided argument "
+                     "is the sparsity pattern for an empty matrix. This constructor can "
+                     "not be used to copy-construct a non-empty sparsity pattern."));
 
   reinit (0,0,0);
 }
@@ -226,15 +226,14 @@ SparsityPattern &
 SparsityPattern::operator = (const SparsityPattern &s)
 {
   (void)s;
-  Assert (s.rowstart == 0, ExcInvalidConstructorCall());
-  Assert (s.colnums == 0, ExcInvalidConstructorCall());
-  Assert (s.rows == 0, ExcInvalidConstructorCall());
-  Assert (s.cols == 0, ExcInvalidConstructorCall());
-
-  Assert (rowstart == 0, ExcInvalidConstructorCall());
-  Assert (colnums == 0, ExcInvalidConstructorCall());
-  Assert (rows == 0, ExcInvalidConstructorCall());
-  Assert (cols == 0, ExcInvalidConstructorCall());
+  Assert (s.rows==0 && s.cols==0 && s.rowstart==0 && s.colnums==0,
+          ExcMessage("This operator can only be called if the provided argument "
+                     "is the sparsity pattern for an empty matrix. This operator can "
+                     "not be used to copy a non-empty sparsity pattern."));
+
+  Assert (rows==0 && cols==0 && rowstart==0 && cols==0,
+          ExcMessage("This operator can only be called if the current object is "
+                     "empty."));
 
   return *this;
 }

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.