Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Hill <[email protected]>
  • Loading branch information
3 people authored Oct 24, 2024
1 parent 393bbe5 commit 07a1b60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/solver/impls/snes/snes.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PetscErrorCode SNESComputeJacobianScaledColor(SNES snes, Vec x1, Mat J, Mat B,
}

// Get the the SNESSolver pointer from the function call context
SNESSolver* fctx;
SNESSolver* fctx = nullptr;
err = MatFDColoringGetFunction(static_cast<MatFDColoring>(ctx), nullptr,
reinterpret_cast<void**>(&fctx));
CHKERRQ(err);
Expand Down Expand Up @@ -807,7 +807,7 @@ int SNESSolver::run() {
VecGetOwnershipRange(snes_x, &istart, &iend);

// Take ownership of snes_x and var_scaling_factors data
PetscScalar* snes_x_data;
PetscScalar* snes_x_data = nullptr;
ierr = VecGetArray(snes_x, &snes_x_data);
CHKERRQ(ierr);
PetscScalar* x1_data;
Expand Down Expand Up @@ -1061,7 +1061,6 @@ int SNESSolver::run() {
}

// Prune Jacobian, keeping diagonal elements
//ierr = MatEliminateZeros(Jfd, PETSC_TRUE); CHKERRQ(ierr);
ierr = MatFilter(Jfd, prune_abstol, PETSC_TRUE, PETSC_TRUE);

// Update the coloring from Jfd matrix
Expand Down
2 changes: 1 addition & 1 deletion src/solver/impls/snes/snes.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private:
SNES snes; ///< SNES context
Mat Jmf; ///< Matrix Free Jacobian
Mat Jfd; ///< Finite Difference Jacobian
MatFDColoring fdcoloring{NULL}; ///< Matrix coloring context
MatFDColoring fdcoloring{nullptr}; ///< Matrix coloring context
///< Jacobian evaluation

bool use_precon; ///< Use preconditioner
Expand Down

0 comments on commit 07a1b60

Please sign in to comment.