Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a98105

Browse files
committed
Don't use petscarraycmp because of really old PETSc
1 parent 7b2981b commit 3a98105

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/numerics/petsc_matrix.C

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
#include "libmesh/wrapped_petsc.h"
3535
#include "libmesh/fuzzy_equal.h"
3636

37-
#include <petscstring.h>
38-
3937
// C++ includes
4038
#ifdef LIBMESH_HAVE_UNISTD_H
4139
#include <unistd.h> // mkstemp
@@ -1598,7 +1596,7 @@ PetscMatrix<T>::fuzzy_equal(const SparseMatrix<T> & other, const Real tol) const
15981596
if ((this->local_m() != other.local_m()) || (this->local_n() != other.local_n()))
15991597
{
16001598
equiv = false;
1601-
goto endLoop;
1599+
goto globalComm;
16021600
}
16031601

16041602
for (const auto i : make_range(this->row_start(), this->row_stop()))
@@ -1644,15 +1642,16 @@ PetscMatrix<T>::fuzzy_equal(const SparseMatrix<T> & other, const Real tol) const
16441642
if (ncols != ncols_other)
16451643
{
16461644
compared_false();
1647-
goto endLoop;
1645+
goto globalComm;
16481646
}
16491647

16501648
// No need for fuzzy comparison here
1651-
PetscBool petsc_equiv;
1652-
ierr = PetscArraycmp(petsc_cols, petsc_cols_other, ncols, &petsc_equiv);
1653-
LIBMESH_CHKERR(ierr);
1654-
if (petsc_equiv == PETSC_FALSE)
1655-
compared_false();
1649+
for (const auto i : make_range(ncols))
1650+
if (petsc_cols[i] != petsc_cols_other[i])
1651+
{
1652+
compared_false();
1653+
goto globalComm;
1654+
}
16561655

16571656
for (const auto j_val : make_range(ncols))
16581657
if (relative_fuzzy_equal(petsc_row[j_val], petsc_row_other[j_val], tol) ||
@@ -1661,13 +1660,13 @@ PetscMatrix<T>::fuzzy_equal(const SparseMatrix<T> & other, const Real tol) const
16611660
else
16621661
{
16631662
compared_false();
1664-
goto endLoop;
1663+
goto globalComm;
16651664
}
16661665

16671666
restore_rows();
16681667
}
16691668

1670-
endLoop:
1669+
globalComm:
16711670
this->comm().min(equiv);
16721671

16731672
return equiv;

0 commit comments

Comments
 (0)