]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a typedef around PetscBool or PetscTruth.
authorDavid Wells <wellsd2@rpi.edu>
Sat, 9 Jul 2016 15:02:09 +0000 (11:02 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sat, 9 Jul 2016 15:02:09 +0000 (11:02 -0400)
Before 3.2 Petsc used PetscTruth; afterwards it used PetscTruth.

include/deal.II/lac/petsc_compatibility.h
include/deal.II/lac/petsc_matrix_base.h
source/lac/petsc_matrix_base.cc
source/lac/petsc_vector_base.cc

index 705ffa01a00fde4aaf4bb18a15e41e2e803c6599..939b9a01c872e2f10476c0b98f9ee218c3556faf 100644 (file)
@@ -33,6 +33,12 @@ DEAL_II_NAMESPACE_OPEN
 
 namespace PETScWrappers
 {
+#if DEAL_II_PETSC_VERSION_LT(3,2,0)
+  typedef PetscTruth PetscBooleanType;
+#else
+  typedef PetscBool PetscBooleanType;
+#endif
+
   /**
    * Set an option in the global PETSc database. This function just wraps
    * PetscOptionsSetValue with a version check (the signature of this function
index 397a0d37d4f0ceadfc08fa74427e769947f9120b..1f0850b440965363b932d65e0169dba74bf9cd1e 100644 (file)
@@ -22,8 +22,9 @@
 #ifdef DEAL_II_WITH_PETSC
 
 #  include <deal.II/base/subscriptor.h>
-#  include <deal.II/lac/full_matrix.h>
 #  include <deal.II/lac/exceptions.h>
+#  include <deal.II/lac/full_matrix.h>
+#  include <deal.II/lac/petsc_compatibility.h>
 #  include <deal.II/lac/vector.h>
 
 #  include <petscmat.h>
@@ -841,11 +842,7 @@ namespace PETScWrappers
      * Test whether a matrix is symmetric.  Default tolerance is
      * $1000\times32$-bit machine precision.
      */
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
+    PetscBooleanType
     is_symmetric (const double tolerance = 1.e-12);
 
     /**
@@ -853,11 +850,7 @@ namespace PETScWrappers
      * its transpose. Default tolerance is $1000\times32$-bit machine
      * precision.
      */
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
+    PetscBooleanType
     is_hermitian (const double tolerance = 1.e-12);
 
     /**
index 0d34d31a43057e8b43c2b17bfd93007fd076a33b..0d412a84ad551f3f042434b5b33eb119d59622fc 100644 (file)
@@ -18,6 +18,7 @@
 #ifdef DEAL_II_WITH_PETSC
 
 #  include <deal.II/lac/exceptions.h>
+#  include <deal.II/lac/petsc_compatibility.h>
 #  include <deal.II/lac/petsc_full_matrix.h>
 #  include <deal.II/lac/petsc_sparse_matrix.h>
 #  include <deal.II/lac/petsc_parallel_sparse_matrix.h>
@@ -574,19 +575,10 @@ namespace PETScWrappers
     AssertThrow (ierr == 0, ExcPETScError(ierr));
   }
 
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-  PetscTruth
-#else
-  PetscBool
-#endif
+  PetscBooleanType
   MatrixBase::is_symmetric (const double tolerance)
   {
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
-    truth;
+    PetscBooleanType truth;
     assert_is_compressed ();
     int ierr = MatIsSymmetric (matrix, tolerance, &truth);
     (void)ierr;
@@ -594,19 +586,10 @@ namespace PETScWrappers
     return truth;
   }
 
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-  PetscTruth
-#else
-  PetscBool
-#endif
+  PetscBooleanType
   MatrixBase::is_hermitian (const double tolerance)
   {
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
-    truth;
+    PetscBooleanType truth;
 
     assert_is_compressed ();
     int ierr = MatIsHermitian (matrix, tolerance, &truth);
index 9528b6aa85581a90dd4b604c85808538291dadd5..febffa9c45d8a1af6291b4f2c4df9023cb7a9a9f 100644 (file)
@@ -19,6 +19,7 @@
 
 #  include <deal.II/base/memory_consumption.h>
 #  include <deal.II/lac/exceptions.h>
+#  include <deal.II/lac/petsc_compatibility.h>
 #  include <deal.II/lac/petsc_vector.h>
 #  include <deal.II/lac/petsc_parallel_vector.h>
 #  include <cmath>
@@ -266,13 +267,7 @@ namespace PETScWrappers
     Assert (size() == v.size(),
             ExcDimensionMismatch(size(), v.size()));
 
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
-    flag;
-
+    PetscBooleanType flag;
     const int ierr = VecEqual (vector, v.vector, &flag);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 
@@ -287,13 +282,7 @@ namespace PETScWrappers
     Assert (size() == v.size(),
             ExcDimensionMismatch(size(), v.size()));
 
-#if DEAL_II_PETSC_VERSION_LT(3,2,0)
-    PetscTruth
-#else
-    PetscBool
-#endif
-    flag;
-
+    PetscBooleanType flag;
     const int ierr = VecEqual (vector, v.vector, &flag);
     AssertThrow (ierr == 0, ExcPETScError(ierr));
 

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.