From: David Wells Date: Sat, 9 Jul 2016 15:02:09 +0000 (-0400) Subject: Use a typedef around PetscBool or PetscTruth. X-Git-Tag: v8.5.0-rc1~872^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a44caef748f6f1902a42715f467b96ae33cec79d;p=dealii.git Use a typedef around PetscBool or PetscTruth. Before 3.2 Petsc used PetscTruth; afterwards it used PetscTruth. --- diff --git a/include/deal.II/lac/petsc_compatibility.h b/include/deal.II/lac/petsc_compatibility.h index 705ffa01a0..939b9a01c8 100644 --- a/include/deal.II/lac/petsc_compatibility.h +++ b/include/deal.II/lac/petsc_compatibility.h @@ -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 diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index 397a0d37d4..1f0850b440 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -22,8 +22,9 @@ #ifdef DEAL_II_WITH_PETSC # include -# include # include +# include +# include # include # include @@ -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); /** diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index 0d34d31a43..0d412a84ad 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -18,6 +18,7 @@ #ifdef DEAL_II_WITH_PETSC # include +# include # include # include # include @@ -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); diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index 9528b6aa85..febffa9c45 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -19,6 +19,7 @@ # include # include +# include # include # include # include @@ -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));