https://mooseframework.inl.gov
Public Member Functions | Private Attributes | List of all members
Moose::PetscSupport::PetscOptionsScope Class Reference

Activates a problem's PETSc options database for the lifetime of this scope. More...

#include <PetscSupport.h>

Public Member Functions

 PetscOptionsScope (FEProblemBase &problem)
 
 ~PetscOptionsScope ()
 
 PetscOptionsScope (const PetscOptionsScope &)=delete
 
PetscOptionsScopeoperator= (const PetscOptionsScope &)=delete
 

Private Attributes

FEProblemBase_problem
 Problem whose PETSc options database is activated. More...
 
bool _pushed
 Whether a database was pushed and therefore needs to be popped. More...
 

Detailed Description

Activates a problem's PETSc options database for the lifetime of this scope.

Definition at line 71 of file PetscSupport.h.

Constructor & Destructor Documentation

◆ PetscOptionsScope() [1/2]

Moose::PetscSupport::PetscOptionsScope::PetscOptionsScope ( FEProblemBase problem)
explicit

Definition at line 102 of file PetscSupport.C.

102  : _problem(problem), _pushed(false)
103 {
104 #if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
106  {
107  LibmeshPetscCallA(_problem.comm().get(), PetscOptionsPush(_problem.petscOptionsDatabase()));
108  _pushed = true;
109  }
110 #endif
111 }
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:866
const Parallel::Communicator & comm() const
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:87
PetscOptions & petscOptionsDatabase()
FEProblemBase & _problem
Problem whose PETSc options database is activated.
Definition: PetscSupport.h:82
bool _pushed
Whether a database was pushed and therefore needs to be popped.
Definition: PetscSupport.h:85

◆ ~PetscOptionsScope()

Moose::PetscSupport::PetscOptionsScope::~PetscOptionsScope ( )

Definition at line 113 of file PetscSupport.C.

114 {
115 #if !PETSC_RELEASE_LESS_THAN(3, 12, 0)
116  if (_pushed)
117  PetscCallAbort(_problem.comm().get(), PetscOptionsPop());
118 #endif
119 }
const Parallel::Communicator & comm() const
FEProblemBase & _problem
Problem whose PETSc options database is activated.
Definition: PetscSupport.h:82
bool _pushed
Whether a database was pushed and therefore needs to be popped.
Definition: PetscSupport.h:85

◆ PetscOptionsScope() [2/2]

Moose::PetscSupport::PetscOptionsScope::PetscOptionsScope ( const PetscOptionsScope )
delete

Member Function Documentation

◆ operator=()

PetscOptionsScope& Moose::PetscSupport::PetscOptionsScope::operator= ( const PetscOptionsScope )
delete

Member Data Documentation

◆ _problem

FEProblemBase& Moose::PetscSupport::PetscOptionsScope::_problem
private

Problem whose PETSc options database is activated.

Definition at line 82 of file PetscSupport.h.

Referenced by PetscOptionsScope(), and ~PetscOptionsScope().

◆ _pushed

bool Moose::PetscSupport::PetscOptionsScope::_pushed
private

Whether a database was pushed and therefore needs to be popped.

Definition at line 85 of file PetscSupport.h.

Referenced by PetscOptionsScope(), and ~PetscOptionsScope().


The documentation for this class was generated from the following files: