IBAMR  IBAMR version 0.19.
Public Member Functions | List of all members
IBTK::PETScSNESJacobianJOWrapper Class Reference

Class PETScSNESJacobianJOWrapper provides a JacobianOperator interface for a PETSc SNES Jacobian.

#include <ibtk/PETScSNESJacobianJOWrapper.h>

Inheritance diagram for IBTK::PETScSNESJacobianJOWrapper:
Inheritance graph
[legend]

Public Member Functions

 PETScSNESJacobianJOWrapper (std::string object_name, SNES petsc_snes, PetscErrorCode(*petsc_snes_form_jac)(SNES, Vec, Mat, Mat, void *), void *petsc_snes_jac_ctx)
 Constructor. More...
 
 ~PETScSNESJacobianJOWrapper ()
 Destructor. More...
 
General Jacobian functionality.
void formJacobian (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &x) override
 Compute hierarchy dependent data required for evaluating F'[x]. More...
 
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > getBaseVector () const override
 Return the vector where the Jacobian is evaluated. More...
 

Logging functions.

virtual void setLoggingEnabled (bool enable_logging=true)
 Enable or disable logging. More...
 
virtual bool getLoggingEnabled () const
 Determine whether logging is enabled or disabled. More...
 
virtual void printClassData (std::ostream &stream)
 Print class data to stream. More...
 
const std::string d_object_name
 
bool d_is_initialized = false
 
bool d_homogeneous_bc
 
double d_solution_time = std::numeric_limits<double>::quiet_NaN()
 
double d_current_time = std::numeric_limits<double>::quiet_NaN()
 
double d_new_time = std::numeric_limits<double>::quiet_NaN()
 
SAMRAI::tbox::Pointer< HierarchyMathOpsd_hier_math_ops
 
bool d_hier_math_ops_external = false
 
bool d_enable_logging = false
 

Functions to access the underlying PETSc function.

PetscErrorCode(*)(SNES, Vec, Mat, Mat, void *) getPETScSNESFormJacobian ()
 Get the function pointer to the PETSc SNES Jacobian "wrapped" by this object. More...
 
const SNES & getPETScSNES () const
 Get the PETSc SNES object "wrapped" by this object. More...
 
void * getPETScSNESJacobianContext () const
 Get the PETSc SNES Jacobian context object "wrapped" by this object. More...
 

Linear operator functionality.

const SNES d_petsc_snes
 
Mat d_petsc_snes_jac = nullptr
 
PetscErrorCode(*const d_petsc_snes_form_jac )(SNES, Vec, Mat, Mat, void *)
 
void *const d_petsc_snes_jac_ctx
 
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > d_x
 
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > d_y
 
SAMRAI::tbox::Pointer< SAMRAI::solv::SAMRAIVectorReal< NDIM, double > > d_z
 
Vec d_petsc_x = nullptr
 
Vec d_petsc_y = nullptr
 
Vec d_petsc_z = nullptr
 
void apply (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &x, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &y) override
 Compute y=Ax. More...
 
void applyAdd (SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &x, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &y, SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &z) override
 Compute z=Ax+y. More...
 
void initializeOperatorState (const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &in, const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &out) override
 Compute hierarchy dependent data required for computing y=Ax and z=Ax+y. More...
 
void deallocateOperatorState () override
 Remove all hierarchy dependent data allocated by initializeOperatorState(). More...
 
 PETScSNESJacobianJOWrapper ()=delete
 Default constructor. More...
 
 PETScSNESJacobianJOWrapper (const PETScSNESJacobianJOWrapper &from)=delete
 Copy constructor. More...
 
PETScSNESJacobianJOWrapperoperator= (const PETScSNESJacobianJOWrapper &that)=delete
 Assignment operator. More...
 

Constructor & Destructor Documentation

◆ PETScSNESJacobianJOWrapper() [1/3]

IBTK::PETScSNESJacobianJOWrapper::PETScSNESJacobianJOWrapper ( std::string  object_name,
SNES  petsc_snes,
PetscErrorCode(*)(SNES, Vec, Mat, Mat, void *)  petsc_snes_form_jac,
void *  petsc_snes_jac_ctx 
)

Construct a Jacobian operator wrapper corresponding to the provided PETSc SNES Jacobian object.

◆ ~PETScSNESJacobianJOWrapper()

IBTK::PETScSNESJacobianJOWrapper::~PETScSNESJacobianJOWrapper ( )

◆ PETScSNESJacobianJOWrapper() [2/3]

IBTK::PETScSNESJacobianJOWrapper::PETScSNESJacobianJOWrapper ( )
privatedelete
Note
This constructor is not implemented and should not be used.

◆ PETScSNESJacobianJOWrapper() [3/3]

IBTK::PETScSNESJacobianJOWrapper::PETScSNESJacobianJOWrapper ( const PETScSNESJacobianJOWrapper from)
privatedelete
Note
This constructor is not implemented and should not be used.
Parameters
fromThe value to copy to this object.

Member Function Documentation

◆ getPETScSNES()

const SNES& IBTK::PETScSNESJacobianJOWrapper::getPETScSNES ( ) const

◆ getPETScSNESJacobianContext()

void* IBTK::PETScSNESJacobianJOWrapper::getPETScSNESJacobianContext ( ) const

◆ formJacobian()

void IBTK::PETScSNESJacobianJOWrapper::formJacobian ( SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  x)
overridevirtual
Parameters
xvalue where the Jacobian is to be evaluated

Implements IBTK::JacobianOperator.

◆ getBaseVector()

SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > IBTK::PETScSNESJacobianJOWrapper::getBaseVector ( ) const
overridevirtual

◆ apply()

void IBTK::PETScSNESJacobianJOWrapper::apply ( SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  x,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  y 
)
overridevirtual

Before calling this function, the form of the vectors x and y should be set properly by the user on all patch interiors on the range of levels covered by the operator. All data in these vectors should be allocated. The user is responsible for managing the storage for the vectors.

Conditions on arguments:

  • vectors must have same hierarchy
  • vectors must have same variables (except that x must have enough ghost cells for computation of Ax).

In general, the vectors x and y cannot be the same.

Note
The operator NEED NOT be initialized prior to calling apply.
See also
initializeOperatorState
Parameters
xinput
youtput: y=Ax

Implements IBTK::GeneralOperator.

◆ applyAdd()

void IBTK::PETScSNESJacobianJOWrapper::applyAdd ( SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  x,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  y,
SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  z 
)
overridevirtual

Before calling this function, the form of the vectors x, y, and z should be set properly by the user on all patch interiors on the range of levels covered by the operator. All data in these vectors should be allocated. The user is responsible for managing the storage for the vectors.

Conditions on arguments:

  • vectors must have same hierarchy
  • vectors must have same variables (except that x must have enough ghost cells for computation of Ax).

In general, the vectors x and z cannot be the same.

Note
The operator NEED NOT be initialized prior to calling apply.
See also
initializeOperatorState
Parameters
xinput
yinput
zoutput: z=Ax+y

Reimplemented from IBTK::GeneralOperator.

◆ initializeOperatorState()

void IBTK::PETScSNESJacobianJOWrapper::initializeOperatorState ( const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  in,
const SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  out 
)
overridevirtual

The vector arguments for apply(), applyAdd(), etc, need not match those for initializeOperatorState(). However, there must be a certain degree of similarity, including

  • hierarchy configuration (hierarchy pointer and level range)
  • number, type and alignment of vector component data
  • ghost cell widths of data in the input and output vectors
Note
It is generally necessary to reinitialize the operator state when the hierarchy configuration changes.

It is safe to call initializeOperatorState() when the state is already initialized. In this case, the operator state is first deallocated and then reinitialized.

Conditions on arguments:

  • input and output vectors must have same hierarchy
  • input and output vectors must have same structure, depth, etc.

Call deallocateOperatorState() to remove any data allocated by this method.

See also
deallocateOperatorState
Parameters
ininput vector
outoutput vector

Reimplemented from IBTK::GeneralOperator.

◆ deallocateOperatorState()

void IBTK::PETScSNESJacobianJOWrapper::deallocateOperatorState ( )
overridevirtual

Remove all hierarchy dependent data set by initializeOperatorState(). It is safe to call deallocateOperatorState() when the operator state is already deallocated.

See also
initializeOperatorState

Reimplemented from IBTK::GeneralOperator.

◆ operator=()

PETScSNESJacobianJOWrapper& IBTK::PETScSNESJacobianJOWrapper::operator= ( const PETScSNESJacobianJOWrapper that)
privatedelete
Note
This operator is not implemented and should not be used.
Parameters
thatThe value to assign to this object.
Returns
A reference to this object.

◆ modifyRhsForBcs()

void IBTK::LinearOperator::modifyRhsForBcs ( SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  y)
overridevirtualinherited

Before calling this function, the form of the vector y should be set properly by the user on all patch interiors on the range of levels covered by the operator. All data in this vector should be allocated. The user is responsible for managing the storage for the vectors.

Note
The operator MUST be initialized prior to calling modifyRhsForBcs.
See also
initializeOperatorState
Note
A default implementation evaluates y := y - A*0.

Reimplemented from IBTK::GeneralOperator.

◆ getName()

const std::string& IBTK::GeneralOperator::getName ( ) const
inherited

◆ getIsInitialized()

virtual bool IBTK::GeneralOperator::getIsInitialized ( ) const
virtualinherited

◆ setHomogeneousBc()

virtual void IBTK::GeneralOperator::setHomogeneousBc ( bool  homogeneous_bc)
virtualinherited

◆ getHomogeneousBc()

virtual bool IBTK::GeneralOperator::getHomogeneousBc ( ) const
virtualinherited

◆ setSolutionTime()

virtual void IBTK::GeneralOperator::setSolutionTime ( double  solution_time)
virtualinherited

◆ getSolutionTime()

virtual double IBTK::GeneralOperator::getSolutionTime ( ) const
virtualinherited

◆ setTimeInterval()

virtual void IBTK::GeneralOperator::setTimeInterval ( double  current_time,
double  new_time 
)
virtualinherited

◆ getTimeInterval()

virtual std::pair<double, double> IBTK::GeneralOperator::getTimeInterval ( ) const
virtualinherited

◆ getDt()

virtual double IBTK::GeneralOperator::getDt ( ) const
virtualinherited

◆ setHierarchyMathOps()

virtual void IBTK::GeneralOperator::setHierarchyMathOps ( SAMRAI::tbox::Pointer< HierarchyMathOps hier_math_ops)
virtualinherited

◆ getHierarchyMathOps()

virtual SAMRAI::tbox::Pointer<HierarchyMathOps> IBTK::GeneralOperator::getHierarchyMathOps ( ) const
virtualinherited

◆ imposeSolBcs()

virtual void IBTK::GeneralOperator::imposeSolBcs ( SAMRAI::solv::SAMRAIVectorReal< NDIM, double > &  u)
virtualinherited

Before calling this function, the form of the vector y should be set properly by the user on all patch interiors on the range of levels covered by the operator. All data in this vector should be allocated. The user is responsible for managing the storage for the vectors.

Note
The operator MUST be initialized prior to calling imposeSolBcs.
See also
initializeOperatorState
Note
A default implementation does not modify the sol vector u.

◆ setLoggingEnabled()

virtual void IBTK::GeneralOperator::setLoggingEnabled ( bool  enable_logging = true)
virtualinherited

◆ getLoggingEnabled()

virtual bool IBTK::GeneralOperator::getLoggingEnabled ( ) const
virtualinherited

◆ printClassData()

virtual void IBTK::GeneralOperator::printClassData ( std::ostream &  stream)
virtualinherited

Member Data Documentation

◆ getPETScSNESFormJacobian

PetscErrorCode(*)(SNES, Vec, Mat, Mat, void*) IBTK::PETScSNESJacobianJOWrapper::getPETScSNESFormJacobian()

◆ d_petsc_snes

const SNES IBTK::PETScSNESJacobianJOWrapper::d_petsc_snes
private

◆ d_petsc_snes_jac

Mat IBTK::PETScSNESJacobianJOWrapper::d_petsc_snes_jac = nullptr
private

◆ d_petsc_snes_form_jac

PetscErrorCode(*const IBTK::PETScSNESJacobianJOWrapper::d_petsc_snes_form_jac) (SNES, Vec, Mat, Mat, void *)
private

◆ d_petsc_snes_jac_ctx

void* const IBTK::PETScSNESJacobianJOWrapper::d_petsc_snes_jac_ctx
private

◆ d_x

SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > IBTK::PETScSNESJacobianJOWrapper::d_x
private

◆ d_y

SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > IBTK::PETScSNESJacobianJOWrapper::d_y
private

◆ d_z

SAMRAI::tbox::Pointer<SAMRAI::solv::SAMRAIVectorReal<NDIM, double> > IBTK::PETScSNESJacobianJOWrapper::d_z
private

◆ d_petsc_x

Vec IBTK::PETScSNESJacobianJOWrapper::d_petsc_x = nullptr
private

◆ d_petsc_y

Vec IBTK::PETScSNESJacobianJOWrapper::d_petsc_y = nullptr
private

◆ d_petsc_z

Vec IBTK::PETScSNESJacobianJOWrapper::d_petsc_z = nullptr
private

◆ d_object_name

const std::string IBTK::GeneralOperator::d_object_name
protectedinherited

◆ d_is_initialized

bool IBTK::GeneralOperator::d_is_initialized = false
protectedinherited

◆ d_homogeneous_bc

bool IBTK::GeneralOperator::d_homogeneous_bc
protectedinherited

◆ d_solution_time

double IBTK::GeneralOperator::d_solution_time = std::numeric_limits<double>::quiet_NaN()
protectedinherited

◆ d_current_time

double IBTK::GeneralOperator::d_current_time = std::numeric_limits<double>::quiet_NaN()
protectedinherited

◆ d_new_time

double IBTK::GeneralOperator::d_new_time = std::numeric_limits<double>::quiet_NaN()
protectedinherited

◆ d_hier_math_ops

SAMRAI::tbox::Pointer<HierarchyMathOps> IBTK::GeneralOperator::d_hier_math_ops
protectedinherited

◆ d_hier_math_ops_external

bool IBTK::GeneralOperator::d_hier_math_ops_external = false
protectedinherited

◆ d_enable_logging

bool IBTK::GeneralOperator::d_enable_logging = false
protectedinherited

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