44 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
45 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
50 MPI_Comm comm = PetscObjectComm((PetscObject)
f);
51 PetscSynchronizedPrintf(comm,
"SNES Verify x\n");
60 auto zero_ghost_vec = [](
Vec g) {
68 for (
int i = 0;
i != s; ++
i)
71 CHKERR VecGhostRestoreLocalForm(
g, &
l);
78 auto set = [&](
auto &fe) {
87 auto unset = [&](
auto &fe) {
102 auto cache_ptr = boost::make_shared<CacheTuple>();
110 snes_ctx->
problemName, lit.first, *lit.second,
nullptr, snes_ctx->
bH,
117 MPI_Comm comm = PetscObjectComm((PetscObject)
f);
118 PetscSynchronizedPrintf(comm,
"SNES Verify f FE < %s >\n",
139 CHKERR VecGhostUpdateBegin(
f, ADD_VALUES, SCATTER_REVERSE);
140 CHKERR VecGhostUpdateEnd(
f, ADD_VALUES, SCATTER_REVERSE);
158 auto set = [&](
auto &fe) {
168 auto unset = [&](
auto &fe) {
175 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
176 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
188 auto cache_ptr = boost::make_shared<CacheTuple>();
196 snes_ctx->
problemName, lit.first, *(lit.second),
nullptr, snes_ctx->
bH,
223 CHKERR SNESGetApplicationContext(snes, &snes_ctx);
231 CHKERR SNESGetApplicationContext(snes, &snes_ctx);
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
virtual MoFEMErrorCode loop_finite_elements(const std::string &problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode SnesMat(SNES snes, Vec x, Mat A, Mat B, void *ctx)
This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver.
PetscErrorCode SnesRhs(SNES snes, Vec x, Vec f, void *ctx)
This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.
MoFEMErrorCode SnesMoFEMSetAssemblyType(SNES snes, MatAssemblyType type)
Set assembly type at the end of SnesMat.
MoFEMErrorCode SnesMoFEMSetBehavior(SNES snes, MoFEMTypes bh)
Set behavior if finite element in sequence does not exist.
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
static constexpr Switches CtxSetA
static constexpr Switches CtxSetX
static constexpr Switches CtxSetNone
static constexpr Switches CtxSetF
static constexpr Switches CtxSetB
keeps basic data about problem
Interface for nonlinear (SNES) solver.
PetscLogEvent MOFEM_EVENT_SnesMat
Log events to assemble tangent matrix.
BasicMethodsSequence preProcess_Rhs
Sequence of methods run before residual is assembled.
BasicMethodsSequence postProcess_Mat
MoFEMTypes bH
If set to MF_EXIST check if element exist, default MF_EXIST.
BasicMethodsSequence postProcess_Rhs
Sequence of methods run after residual is assembled.
MoFEMErrorCode copyLoops(const SnesCtx &snes_ctx)
Copy sequences from other SNES contex.
MatAssemblyType typeOfAssembly
type of assembly at the end
MoFEMErrorCode clearLoops()
Clear loops.
BasicMethodsSequence preProcess_Mat
bool vErify
If true verify vector.
FEMethodsSequence loops_to_do_Mat
std::string problemName
problem name
FEMethodsSequence loops_to_do_Rhs
boost::movelib::unique_ptr< bool > matAssembleSwitch
MoFEM::Interface & mField
database Interface
boost::movelib::unique_ptr< bool > vecAssembleSwitch
PetscLogEvent MOFEM_EVENT_SnesRhs
Log events to assemble residual.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.