41 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
42 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
46 auto cache_ptr = boost::make_shared<CacheTuple>();
50 auto set = [&](
auto &fe) {
55 fe.cacheWeakPtr = cache_ptr;
58 auto unset = [&](
auto &fe) {
96 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
97 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
101 auto zero_ghost_vec = [](Vec
g) {
109 for (
int i = 0;
i != s; ++
i)
112 CHKERR VecGhostRestoreLocalForm(
g, &
l);
118 auto cache_ptr = boost::make_shared<CacheTuple>();
122 auto set = [&](
auto &fe) {
130 fe.cacheWeakPtr = cache_ptr;
133 auto unset = [&](
auto &fe) {
153 *lit.second,
nullptr,
169 CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
170 CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
171 CHKERR VecAssemblyBegin(f);
192 auto cache_ptr = boost::make_shared<CacheTuple>();
196 auto set = [&](
auto &fe) {
204 fe.cacheWeakPtr = cache_ptr;
207 auto unset = [&](
auto &fe) {
215 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
216 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
249 CHKERR MatAssemblyBegin(Hpre, MAT_FINAL_ASSEMBLY);
250 CHKERR MatAssemblyEnd(Hpre, MAT_FINAL_ASSEMBLY);
#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 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
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode TaoSetObjective(Tao tao, Vec x, PetscReal *f, void *ctx)
Sets the objective function value for a TAO optimization context.
PetscErrorCode TaoSetObjectiveAndGradient(Tao tao, Vec x, PetscReal *f, Vec g, void *ctx)
Sets the objective function value and gradient for a TAO optimization solver.
PetscErrorCode TaoSetGradient(Tao tao, Vec x, Vec f, void *ctx)
Sets the gradient vector for a TAO optimization context.
PetscErrorCode TaoSetHessian(Tao tao, Vec x, Mat H, Mat Hpre, void *ctx)
Sets the Hessian matrix for a TAO optimization context.
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
Interface for TAO solvers.
MoFEMErrorCode copyLoops(const TaoCtx &tao_ctx)
Copy sequences from another TaoCtx.
boost::movelib::unique_ptr< bool > vecAssembleSwitch
MoFEM::Interface & mField
database Interface
BasicMethodsSequence postObjective
Sequence of methods run after objective is evaluated.
PetscLogEvent MOFEM_EVENT_TaoGradient
Log event for TAO Gradient.
std::string problemName
problem name
BasicMethodsSequence postGradient
Sequence of methods run after gradient is assembled.
PetscLogEvent MOFEM_EVENT_TaoHessian
Log event for TAO Hessian.
boost::movelib::unique_ptr< bool > matAssembleSwitch
BasicMethodsSequence preObjective
Sequence of methods run before objective is evaluated.
FEMethodsSequence loopsObjective
BasicMethodsSequence preGradient
Sequence of methods run before gradient is assembled.
PetscLogEvent MOFEM_EVENT_TaoObjective
Log event for TAO Objective.
MoFEMErrorCode clearLoops()
Clear loops.
BasicMethodsSequence postHessian
Sequence of methods run after Hessian is assembled.
BasicMethodsSequence preHessian
Sequence of methods run before Hessian is assembled.
FEMethodsSequence loopsGradient
FEMethodsSequence loopsHessian
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Vector manager is used to create vectors \mofem_vectors.