v0.9.1
Public Types | Public Member Functions | Public Attributes | List of all members
MoFEM::SnesMethod Struct Reference

data structure for snes (nonlinear solver) contextStructure stores context data which are set in functions run by PETSc SNES functions. More...

#include <src/interfaces/LoopMethods.hpp>

Inheritance diagram for MoFEM::SnesMethod:
[legend]
Collaboration diagram for MoFEM::SnesMethod:
[legend]

Public Types

enum  SNESContext { CTX_SNESSETFUNCTION, CTX_SNESSETJACOBIAN, CTX_SNESNONE }
 

Public Member Functions

MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 SnesMethod ()
 
virtual ~SnesMethod ()=default
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
DEPRECATED MoFEMErrorCode setSnesCtx (SNESContext ctx)
 

Public Attributes

SNESContext snes_ctx
 
SNES snes
 snes solver More...
 
Vec & snes_x
 state vector More...
 
Vec & snes_f
 residual More...
 
Mat & snes_A
 jacobian matrix More...
 
Mat & snes_B
 preconditioner of jacobian matrix More...
 

Additional Inherited Members

- Protected Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0, CTX_SET_F = 1 << 0, CTX_SET_A = 1 << 1, CTX_SET_B = 1 << 2,
  CTX_SET_X = 1 << 3, CTX_SET_X_T = 1 << 4, CTX_SET_X_TT = 1 << 6, CTX_SET_TIME = 1 << 7
}
 
using Switches = std::bitset< 8 >
 
- Protected Member Functions inherited from MoFEM::PetscData
 PetscData ()
 
virtual ~PetscData ()=default
 
- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()=default
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 
- Protected Attributes inherited from MoFEM::PetscData
Switches data_ctx
 
Vec f
 
Mat A
 
Mat B
 
Vec x
 
Vec x_t
 
Vec x_tt
 
- Static Protected Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 

Detailed Description

data structure for snes (nonlinear solver) context

Structure stores context data which are set in functions run by PETSc SNES functions.

Definition at line 125 of file LoopMethods.hpp.

Member Enumeration Documentation

◆ SNESContext

Constructor & Destructor Documentation

◆ SnesMethod()

MoFEM::SnesMethod::SnesMethod ( )

◆ ~SnesMethod()

virtual MoFEM::SnesMethod::~SnesMethod ( )
virtualdefault

Member Function Documentation

◆ copySnes()

MoFEMErrorCode MoFEM::SnesMethod::copySnes ( const SnesMethod snes)

Copy snes data.

Definition at line 84 of file LoopMethods.cpp.

84  {
86  this->snes_ctx = snes.snes_ctx;
87  this->snes = snes.snes;
88  this->snes_x = snes.snes_x;
89  this->snes_f = snes.snes_f;
90  this->snes_A = snes.snes_A;
91  this->snes_B = snes.snes_B;
93 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:507
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
Vec & snes_f
residual
Mat & snes_B
preconditioner of jacobian matrix
Vec & snes_x
state vector
SNES snes
snes solver
SNESContext snes_ctx
Mat & snes_A
jacobian matrix

◆ query_interface()

MoFEMErrorCode MoFEM::SnesMethod::query_interface ( const MOFEMuuid uuid,
UnknownInterface **  iface 
) const
virtual

Reimplemented from MoFEM::PetscData.

Reimplemented in MoFEM::DofMethod, MoFEM::EntityMethod, MoFEM::FEMethod, and MoFEM::BasicMethod.

Definition at line 71 of file LoopMethods.cpp.

72  {
73  if (uuid == IDD_MOFEMSnesMethod) {
74  *iface = const_cast<SnesMethod *>(this);
76  }
77  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
78  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
static const MOFEMuuid IDD_MOFEMSnesMethod
Definition: LoopMethods.hpp:28

◆ setSnesCtx()

MoFEMErrorCode MoFEM::SnesMethod::setSnesCtx ( SNESContext  ctx)
Deprecated:
Avoid using values by hand.

Definition at line 155 of file LoopMethods.hpp.

155  {
156  snes_ctx = ctx;
157  return 0;
158 }
SNESContext snes_ctx

Member Data Documentation

◆ snes

SNES MoFEM::SnesMethod::snes

snes solver

Definition at line 148 of file LoopMethods.hpp.

◆ snes_A

Mat& MoFEM::SnesMethod::snes_A

jacobian matrix

Definition at line 151 of file LoopMethods.hpp.

◆ snes_B

Mat& MoFEM::SnesMethod::snes_B

preconditioner of jacobian matrix

Definition at line 152 of file LoopMethods.hpp.

◆ snes_ctx

SNESContext MoFEM::SnesMethod::snes_ctx
Examples
simple_contact.cpp.

Definition at line 141 of file LoopMethods.hpp.

◆ snes_f

Vec& MoFEM::SnesMethod::snes_f

residual

Definition at line 150 of file LoopMethods.hpp.

◆ snes_x

Vec& MoFEM::SnesMethod::snes_x

state vector

Definition at line 149 of file LoopMethods.hpp.


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