v0.16.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
MoFEM::TaoCtx Struct Reference

Interface for TAO solvers. More...

#include "src/petsc/TaoCtx.hpp"

Collaboration diagram for MoFEM::TaoCtx:
[legend]

Public Types

using PairNameFEMethodPtr = MoFEM::PairNameFEMethodPtr
 
using FEMethodsSequence = MoFEM::FEMethodsSequence
 
using BasicMethodsSequence = MoFEM::BasicMethodsSequence
 
using ObjectiveHook = boost::function< MoFEMErrorCode(Tao tao, Vec x, PetscReal *objective)>
 
using GradientHook = boost::function< MoFEMErrorCode(Tao tao, Vec x, Vec gradient)>
 
using ObjectiveAndGradientHook = boost::function< MoFEMErrorCode(Tao tao, Vec x, PetscReal *objective, Vec gradient)>
 

Public Member Functions

 TaoCtx (Interface &m_field, const std::string &problem_name)
 
virtual ~TaoCtx ()=default
 
FEMethodsSequence & getHessianLoops ()
 
BasicMethodsSequence & getPreProcHessian ()
 
BasicMethodsSequence & getPostProcHessian ()
 
FEMethodsSequence & getObjectiveLoops ()
 
BasicMethodsSequence & getPreProcObjective ()
 
BasicMethodsSequence & getPostProcObjective ()
 
FEMethodsSequence & getGradientLoops ()
 
BasicMethodsSequence & getPreProcGradient ()
 
BasicMethodsSequence & getPostProcGradient ()
 
FEMethodsSequence & getEqualityConstraintLoops ()
 
BasicMethodsSequence & getPreProcEqualityConstraint ()
 
BasicMethodsSequence & getPostProcEqualityConstraint ()
 
FEMethodsSequence & getInequalityConstraintLoops ()
 
BasicMethodsSequence & getPreProcInequalityConstraint ()
 
BasicMethodsSequence & getPostProcInequalityConstraint ()
 
FEMethodsSequence & getEqualityJacobianLoops ()
 
BasicMethodsSequence & getPreProcEqualityJacobian ()
 
BasicMethodsSequence & getPostProcEqualityJacobian ()
 
FEMethodsSequence & getInequalityJacobianLoops ()
 
BasicMethodsSequence & getPreProcInequalityJacobian ()
 
BasicMethodsSequence & getPostProcInequalityJacobian ()
 
ObjectiveHook & getObjectiveHook ()
 Get an optional objective evaluator.
 
GradientHook & getGradientHook ()
 Get an optional gradient evaluator.
 
ObjectiveAndGradientHook & getObjectiveAndGradientHook ()
 Get an optional combined objective-and-gradient evaluator.
 
MoFEMErrorCode copyLoops (const TaoCtx &tao_ctx)
 Copy sequences from another TaoCtx.
 
MoFEMErrorCode clearLoops ()
 Clear loops.
 

Public Attributes

MoFEM::Interface & mField
 database Interface
 
moab::Interface & moab
 moab Interface
 
std::string problemName
 problem name
 
bool vErify
 If true verify vector.
 
FEMethodsSequence loopsHessian
 
FEMethodsSequence loopsObjective
 
FEMethodsSequence loopsGradient
 
FEMethodsSequence loopsEqualityConstraint
 
FEMethodsSequence loopsInequalityConstraint
 
FEMethodsSequence loopsEqualityJacobian
 
FEMethodsSequence loopsInequalityJacobian
 
BasicMethodsSequence preHessian
 Sequence of methods run before Hessian is assembled.
 
BasicMethodsSequence postHessian
 Sequence of methods run after Hessian is assembled.
 
BasicMethodsSequence preObjective
 Sequence of methods run before objective is evaluated.
 
BasicMethodsSequence postObjective
 Sequence of methods run after objective is evaluated.
 
BasicMethodsSequence preGradient
 Sequence of methods run before gradient is assembled.
 
BasicMethodsSequence postGradient
 Sequence of methods run after gradient is assembled.
 
BasicMethodsSequence preEqualityConstraint
 
BasicMethodsSequence postEqualityConstraint
 
BasicMethodsSequence preInequalityConstraint
 
BasicMethodsSequence postInequalityConstraint
 
BasicMethodsSequence preEqualityJacobian
 
BasicMethodsSequence postEqualityJacobian
 
BasicMethodsSequence preInequalityJacobian
 
BasicMethodsSequence postInequalityJacobian
 

Private Member Functions

PetscErrorCode evaluateConstraint (Tao tao, Vec x, Vec c, FEMethodsSequence &loops, BasicMethodsSequence &pre_process, BasicMethodsSequence &post_process, TaoMethod::TAOContext evaluation_context, PetscLogEvent log_event)
 
PetscErrorCode evaluateConstraintJacobian (Tao tao, Vec x, Mat J, Mat Jpre, FEMethodsSequence &loops, BasicMethodsSequence &pre_process, BasicMethodsSequence &post_process, TaoMethod::TAOContext evaluation_context, PetscLogEvent log_event)
 

Private Attributes

ObjectiveHook objectiveHook
 
GradientHook gradientHook
 
ObjectiveAndGradientHook objectiveAndGradientHook
 
boost::movelib::unique_ptr< bool > vecAssembleSwitch
 
boost::movelib::unique_ptr< bool > matAssembleSwitch
 
PetscLogEvent MOFEM_EVENT_TaoHessian
 Log event for TAO Hessian.
 
PetscLogEvent MOFEM_EVENT_TaoGradient
 Log event for TAO Gradient.
 
PetscLogEvent MOFEM_EVENT_TaoObjective
 Log event for TAO Objective.
 
PetscLogEvent MOFEM_EVENT_TaoEqualityConstraint
 
PetscLogEvent MOFEM_EVENT_TaoInequalityConstraint
 
PetscLogEvent MOFEM_EVENT_TaoEqualityJacobian
 
PetscLogEvent MOFEM_EVENT_TaoInequalityJacobian
 

Friends

PetscErrorCode TaoSetObjective (Tao tao, Vec x, PetscReal *f, void *ctx)
 Sets the objective function value for a TAO optimization context.
 
PetscErrorCode TaoSetGradient (Tao tao, Vec x, Vec g, void *ctx)
 Sets the gradient vector 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 TaoSetHessian (Tao tao, Vec x, Mat H, Mat Hpre, void *ctx)
 Sets the Hessian matrix for a TAO optimization context.
 
PetscErrorCode TaoSetEqualityConstraints (Tao tao, Vec x, Vec c, void *ctx)
 Evaluate equality constraints for a TAO optimization context.
 
PetscErrorCode TaoSetInequalityConstraints (Tao tao, Vec x, Vec c, void *ctx)
 Evaluate inequality constraints for a TAO optimization context.
 
PetscErrorCode TaoSetJacobianEquality (Tao tao, Vec x, Mat J, Mat Jpre, void *ctx)
 Assemble the equality constraint Jacobian.
 
PetscErrorCode TaoSetJacobianInequality (Tao tao, Vec x, Mat J, Mat Jpre, void *ctx)
 Assemble the inequality constraint Jacobian.
 

Detailed Description

Interface for TAO solvers.

Definition at line 14 of file TaoCtx.hpp.

Member Typedef Documentation

◆ BasicMethodsSequence

Definition at line 23 of file TaoCtx.hpp.

◆ FEMethodsSequence

Definition at line 22 of file TaoCtx.hpp.

◆ GradientHook

using MoFEM::TaoCtx::GradientHook = boost::function<MoFEMErrorCode(Tao tao, Vec x, Vec gradient)>

Definition at line 26 of file TaoCtx.hpp.

◆ ObjectiveAndGradientHook

using MoFEM::TaoCtx::ObjectiveAndGradientHook = boost::function<MoFEMErrorCode( Tao tao, Vec x, PetscReal *objective, Vec gradient)>

Definition at line 28 of file TaoCtx.hpp.

◆ ObjectiveHook

using MoFEM::TaoCtx::ObjectiveHook = boost::function<MoFEMErrorCode(Tao tao, Vec x, PetscReal *objective)>

Definition at line 24 of file TaoCtx.hpp.

◆ PairNameFEMethodPtr

Definition at line 21 of file TaoCtx.hpp.

Constructor & Destructor Documentation

◆ TaoCtx()

MoFEM::TaoCtx::TaoCtx ( Interface &  m_field,
const std::string &  problem_name 
)
inline

Definition at line 93 of file TaoCtx.hpp.

94 : mField(m_field), moab(m_field.get_moab()), problemName(problem_name),
95 vErify(false) {
96 PetscLogEventRegister("LoopTAOHessian", 0, &MOFEM_EVENT_TaoHessian);
97 PetscLogEventRegister("LoopTAOObjective", 0, &MOFEM_EVENT_TaoObjective);
98 PetscLogEventRegister("LoopTAOGradient", 0, &MOFEM_EVENT_TaoGradient);
99 PetscLogEventRegister("LoopTAOEqualityConstraint", 0,
101 PetscLogEventRegister("LoopTAOInequalityConstraint", 0,
103 PetscLogEventRegister("LoopTAOEqualityJacobian", 0,
105 PetscLogEventRegister("LoopTAOInequalityJacobian", 0,
107 if (!LogManager::checkIfChannelExist("TAO_WORLD")) {
108 auto core_log = logging::core::get();
109 core_log->add_sink(
111 LogManager::setLog("TAO_WORLD");
112 MOFEM_LOG_TAG("TAO_WORLD", "TAO");
113 }
114 }
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
MoFEM::Interface & mField
database Interface
Definition TaoCtx.hpp:16
moab::Interface & moab
moab Interface
Definition TaoCtx.hpp:17
PetscLogEvent MOFEM_EVENT_TaoGradient
Log event for TAO Gradient.
Definition TaoCtx.hpp:259
std::string problemName
problem name
Definition TaoCtx.hpp:18
PetscLogEvent MOFEM_EVENT_TaoInequalityJacobian
Definition TaoCtx.hpp:264
PetscLogEvent MOFEM_EVENT_TaoHessian
Log event for TAO Hessian.
Definition TaoCtx.hpp:258
PetscLogEvent MOFEM_EVENT_TaoEqualityJacobian
Definition TaoCtx.hpp:263
PetscLogEvent MOFEM_EVENT_TaoObjective
Log event for TAO Objective.
Definition TaoCtx.hpp:260
PetscLogEvent MOFEM_EVENT_TaoInequalityConstraint
Definition TaoCtx.hpp:262
bool vErify
If true verify vector.
Definition TaoCtx.hpp:19
PetscLogEvent MOFEM_EVENT_TaoEqualityConstraint
Definition TaoCtx.hpp:261

◆ ~TaoCtx()

virtual MoFEM::TaoCtx::~TaoCtx ( )
virtualdefault

Member Function Documentation

◆ clearLoops()

MoFEMErrorCode MoFEM::TaoCtx::clearLoops ( )

Clear loops.

Evaluator hooks are unchanged.

Returns
MoFEMErrorCode

Definition at line 67 of file TaoCtx.cpp.

67 {
69 loopsHessian.clear();
70 loopsObjective.clear();
71 loopsGradient.clear();
76 preHessian.clear();
77 postHessian.clear();
78 preObjective.clear();
79 postObjective.clear();
80 preGradient.clear();
81 postGradient.clear();
86 preEqualityJacobian.clear();
91}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FEMethodsSequence loopsInequalityJacobian
Definition TaoCtx.hpp:49
BasicMethodsSequence postInequalityConstraint
Definition TaoCtx.hpp:77
BasicMethodsSequence preEqualityJacobian
Definition TaoCtx.hpp:80
BasicMethodsSequence postObjective
Sequence of methods run after objective is evaluated.
Definition TaoCtx.hpp:61
BasicMethodsSequence preEqualityConstraint
Definition TaoCtx.hpp:68
BasicMethodsSequence preInequalityConstraint
Definition TaoCtx.hpp:74
BasicMethodsSequence postEqualityConstraint
Definition TaoCtx.hpp:71
BasicMethodsSequence postGradient
Sequence of methods run after gradient is assembled.
Definition TaoCtx.hpp:66
FEMethodsSequence loopsInequalityConstraint
Definition TaoCtx.hpp:43
BasicMethodsSequence preObjective
Sequence of methods run before objective is evaluated.
Definition TaoCtx.hpp:59
FEMethodsSequence loopsObjective
Definition TaoCtx.hpp:35
BasicMethodsSequence preGradient
Sequence of methods run before gradient is assembled.
Definition TaoCtx.hpp:64
BasicMethodsSequence postEqualityJacobian
Definition TaoCtx.hpp:83
FEMethodsSequence loopsEqualityConstraint
Definition TaoCtx.hpp:40
BasicMethodsSequence preInequalityJacobian
Definition TaoCtx.hpp:86
BasicMethodsSequence postHessian
Sequence of methods run after Hessian is assembled.
Definition TaoCtx.hpp:56
BasicMethodsSequence preHessian
Sequence of methods run before Hessian is assembled.
Definition TaoCtx.hpp:54
FEMethodsSequence loopsEqualityJacobian
Definition TaoCtx.hpp:46
BasicMethodsSequence postInequalityJacobian
Definition TaoCtx.hpp:89
FEMethodsSequence loopsGradient
Definition TaoCtx.hpp:38
FEMethodsSequence loopsHessian
Definition TaoCtx.hpp:32

◆ copyLoops()

MoFEMErrorCode MoFEM::TaoCtx::copyLoops ( const TaoCtx &  tao_ctx)

Copy sequences from another TaoCtx.

Evaluator hooks are unchanged.

Parameters
tao_ctxTaoCtx from which sequences are copied
Returns
error code

Definition at line 41 of file TaoCtx.cpp.

41 {
43 loopsHessian = tao_ctx.loopsHessian;
44 loopsObjective = tao_ctx.loopsObjective;
45 loopsGradient = tao_ctx.loopsGradient;
46 loopsEqualityConstraint = tao_ctx.loopsEqualityConstraint;
47 loopsInequalityConstraint = tao_ctx.loopsInequalityConstraint;
48 loopsEqualityJacobian = tao_ctx.loopsEqualityJacobian;
49 loopsInequalityJacobian = tao_ctx.loopsInequalityJacobian;
50 preHessian = tao_ctx.preHessian;
51 postHessian = tao_ctx.postHessian;
52 preObjective = tao_ctx.preObjective;
53 postObjective = tao_ctx.postObjective;
54 preGradient = tao_ctx.preGradient;
55 postGradient = tao_ctx.postGradient;
56 preEqualityConstraint = tao_ctx.preEqualityConstraint;
57 postEqualityConstraint = tao_ctx.postEqualityConstraint;
58 preInequalityConstraint = tao_ctx.preInequalityConstraint;
59 postInequalityConstraint = tao_ctx.postInequalityConstraint;
60 preEqualityJacobian = tao_ctx.preEqualityJacobian;
61 postEqualityJacobian = tao_ctx.postEqualityJacobian;
62 preInequalityJacobian = tao_ctx.preInequalityJacobian;
63 postInequalityJacobian = tao_ctx.postInequalityJacobian;
65}

◆ evaluateConstraint()

PetscErrorCode MoFEM::TaoCtx::evaluateConstraint ( Tao  tao,
Vec  x,
Vec  c,
FEMethodsSequence &  loops,
BasicMethodsSequence &  pre_process,
BasicMethodsSequence &  post_process,
TaoMethod::TAOContext  evaluation_context,
PetscLogEvent  log_event 
)
private

Definition at line 93 of file TaoCtx.cpp.

96 {
98 PetscLogEventBegin(log_event, 0, 0, 0, 0);
99
100 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
101 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
102 CHKERR mField.getInterface<VecManager>()->setLocalGhostVector(
103 problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
104 CHKERR zeroTaoOutputVector(c);
105
106 vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
107 auto cache_ptr = boost::make_shared<CacheTuple>();
109
110 auto set = [&](auto &fe) {
111 fe.tao = tao;
112 fe.tao_x = x;
113 fe.tao_c = c;
115 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
116 fe.tao_ctx = evaluation_context;
118 fe.cacheWeakPtr = cache_ptr;
119 };
120
121 auto unset = [&](auto &fe) {
122 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
123 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
124 fe.tao_ctx = TaoMethod::CTX_TAO_NONE;
125 fe.data_ctx = PetscData::CtxSetNone;
126 };
127
128 for (auto &method : pre_process) {
129 method->vecAssembleSwitch = boost::move(vecAssembleSwitch);
130 set(*method);
132 unset(*method);
133 vecAssembleSwitch = boost::move(method->vecAssembleSwitch);
134 }
135
136 for (auto &loop : loops) {
137 loop.second->vecAssembleSwitch = boost::move(vecAssembleSwitch);
138 set(*loop.second);
139 CHKERR mField.loop_finite_elements(problemName, loop.first, *loop.second,
140 nullptr, MF_EXIST, cache_ptr);
141 unset(*loop.second);
142 vecAssembleSwitch = boost::move(loop.second->vecAssembleSwitch);
143 }
144
145 for (auto &method : post_process) {
146 method->vecAssembleSwitch = boost::move(vecAssembleSwitch);
147 set(*method);
149 unset(*method);
150 vecAssembleSwitch = boost::move(method->vecAssembleSwitch);
151 }
152
154 CHKERR assembleTaoOutputVector(c);
155
156 PetscLogEventEnd(log_event, 0, 0, 0, 0);
158}
@ COL
@ MF_EXIST
#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.
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.
const double c
speed of light (cm/ns)
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.
@ CTX_KSPNONE
No specific KSP context.
@ CTX_SETFUNCTION
Setting up the linear system function.
static constexpr Switches CtxSetX
Solution vector switch.
static constexpr Switches CtxSetNone
No data switch.
static constexpr Switches CtxSetF
Residual vector switch.
@ CTX_SNESSETFUNCTION
Setting up nonlinear function evaluation.
@ CTX_SNESNONE
No specific SNES context.
boost::movelib::unique_ptr< bool > vecAssembleSwitch
Definition TaoCtx.hpp:256
@ CTX_TAO_NONE
No specific TAO context.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ evaluateConstraintJacobian()

PetscErrorCode MoFEM::TaoCtx::evaluateConstraintJacobian ( Tao  tao,
Vec  x,
Mat  J,
Mat  Jpre,
FEMethodsSequence &  loops,
BasicMethodsSequence &  pre_process,
BasicMethodsSequence &  post_process,
TaoMethod::TAOContext  evaluation_context,
PetscLogEvent  log_event 
)
private

Definition at line 160 of file TaoCtx.cpp.

163 {
165 PetscLogEventBegin(log_event, 0, 0, 0, 0);
166
167 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
168 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
169 CHKERR mField.getInterface<VecManager>()->setLocalGhostVector(
170 problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
171
172 matAssembleSwitch = boost::movelib::make_unique<bool>(true);
173 CHKERR MatZeroEntries(Jpre);
174 if (J != Jpre)
175 CHKERR MatZeroEntries(J);
176
177 auto cache_ptr = boost::make_shared<CacheTuple>();
179
180 auto set = [&](auto &fe) {
181 fe.tao = tao;
182 fe.tao_x = x;
183 fe.tao_J = J;
184 fe.tao_Jpre = Jpre;
185 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
187 fe.tao_ctx = evaluation_context;
189 fe.cacheWeakPtr = cache_ptr;
190 };
191
192 auto unset = [&](auto &fe) {
193 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
194 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
195 fe.tao_ctx = TaoMethod::CTX_TAO_NONE;
196 fe.data_ctx = PetscData::CtxSetNone;
197 };
198
199 for (auto &method : pre_process) {
200 method->matAssembleSwitch = boost::move(matAssembleSwitch);
201 set(*method);
203 unset(*method);
204 matAssembleSwitch = boost::move(method->matAssembleSwitch);
205 }
206
207 for (auto &loop : loops) {
208 loop.second->matAssembleSwitch = boost::move(matAssembleSwitch);
209 set(*loop.second);
210 CHKERR mField.loop_finite_elements(problemName, loop.first, *loop.second,
211 nullptr, MF_EXIST, cache_ptr);
212 unset(*loop.second);
213 matAssembleSwitch = boost::move(loop.second->matAssembleSwitch);
214 }
215
216 for (auto &method : post_process) {
217 method->matAssembleSwitch = boost::move(matAssembleSwitch);
218 set(*method);
220 unset(*method);
221 matAssembleSwitch = boost::move(method->matAssembleSwitch);
222 }
223
224 if (*matAssembleSwitch) {
225 CHKERR MatAssemblyBegin(Jpre, MAT_FINAL_ASSEMBLY);
226 CHKERR MatAssemblyEnd(Jpre, MAT_FINAL_ASSEMBLY);
227 if (J != Jpre) {
228 CHKERR MatAssemblyBegin(J, MAT_FINAL_ASSEMBLY);
229 CHKERR MatAssemblyEnd(J, MAT_FINAL_ASSEMBLY);
230 }
231 }
232
233 PetscLogEventEnd(log_event, 0, 0, 0, 0);
235}
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
@ CTX_OPERATORS
Setting up linear operators.
static constexpr Switches CtxSetA
Jacobian matrix switch.
static constexpr Switches CtxSetB
Preconditioner matrix switch.
@ CTX_SNESSETJACOBIAN
Setting up Jacobian matrix computation.
boost::movelib::unique_ptr< bool > matAssembleSwitch
Definition TaoCtx.hpp:257

◆ getEqualityConstraintLoops()

FEMethodsSequence & MoFEM::TaoCtx::getEqualityConstraintLoops ( )
inline

Definition at line 134 of file TaoCtx.hpp.

134 {
136 }

◆ getEqualityJacobianLoops()

FEMethodsSequence & MoFEM::TaoCtx::getEqualityJacobianLoops ( )
inline

Definition at line 156 of file TaoCtx.hpp.

156 {
158 }

◆ getGradientHook()

GradientHook & MoFEM::TaoCtx::getGradientHook ( )
inline

Get an optional gradient evaluator.

When set, MoFEM::TaoSetGradient delegates the complete evaluation to this hook before scattering controls to the mesh or running element loops. The hook owns state synchronization and gradient assembly.

Definition at line 193 of file TaoCtx.hpp.

193{ return gradientHook; }
GradientHook gradientHook
Definition TaoCtx.hpp:254

◆ getGradientLoops()

FEMethodsSequence & MoFEM::TaoCtx::getGradientLoops ( )
inline

Definition at line 129 of file TaoCtx.hpp.

129{ return loopsGradient; }

◆ getHessianLoops()

FEMethodsSequence & MoFEM::TaoCtx::getHessianLoops ( )
inline

Definition at line 119 of file TaoCtx.hpp.

119{ return loopsHessian; }

◆ getInequalityConstraintLoops()

FEMethodsSequence & MoFEM::TaoCtx::getInequalityConstraintLoops ( )
inline

Definition at line 145 of file TaoCtx.hpp.

145 {
147 }

◆ getInequalityJacobianLoops()

FEMethodsSequence & MoFEM::TaoCtx::getInequalityJacobianLoops ( )
inline

Definition at line 167 of file TaoCtx.hpp.

167 {
169 }

◆ getObjectiveAndGradientHook()

ObjectiveAndGradientHook & MoFEM::TaoCtx::getObjectiveAndGradientHook ( )
inline

Get an optional combined objective-and-gradient evaluator.

When set, MoFEM::TaoSetObjectiveAndGradient delegates the complete evaluation to this hook. This supports reduced objectives which require an application-owned state solve before returning the value and gradient. Otherwise, the separate objective and gradient callbacks are used.

Definition at line 203 of file TaoCtx.hpp.

203 {
205 }
ObjectiveAndGradientHook objectiveAndGradientHook
Definition TaoCtx.hpp:255

◆ getObjectiveHook()

ObjectiveHook & MoFEM::TaoCtx::getObjectiveHook ( )
inline

Get an optional objective evaluator.

When set, MoFEM::TaoSetObjective delegates the complete evaluation to this hook before scattering controls to the mesh or running element loops. The hook owns state synchronization and objective evaluation.

Definition at line 184 of file TaoCtx.hpp.

184{ return objectiveHook; }
ObjectiveHook objectiveHook
Definition TaoCtx.hpp:253

◆ getObjectiveLoops()

FEMethodsSequence & MoFEM::TaoCtx::getObjectiveLoops ( )
inline

Definition at line 124 of file TaoCtx.hpp.

124{ return loopsObjective; }

◆ getPostProcEqualityConstraint()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcEqualityConstraint ( )
inline

Definition at line 140 of file TaoCtx.hpp.

140 {
142 }

◆ getPostProcEqualityJacobian()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcEqualityJacobian ( )
inline

Definition at line 162 of file TaoCtx.hpp.

162 {
164 }

◆ getPostProcGradient()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcGradient ( )
inline

Definition at line 131 of file TaoCtx.hpp.

131{ return postGradient; }

◆ getPostProcHessian()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcHessian ( )
inline

Definition at line 121 of file TaoCtx.hpp.

121{ return postHessian; }

◆ getPostProcInequalityConstraint()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcInequalityConstraint ( )
inline

Definition at line 151 of file TaoCtx.hpp.

151 {
153 }

◆ getPostProcInequalityJacobian()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcInequalityJacobian ( )
inline

Definition at line 173 of file TaoCtx.hpp.

173 {
175 }

◆ getPostProcObjective()

BasicMethodsSequence & MoFEM::TaoCtx::getPostProcObjective ( )
inline

Definition at line 126 of file TaoCtx.hpp.

126{ return postObjective; }

◆ getPreProcEqualityConstraint()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcEqualityConstraint ( )
inline

Definition at line 137 of file TaoCtx.hpp.

137 {
139 }

◆ getPreProcEqualityJacobian()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcEqualityJacobian ( )
inline

Definition at line 159 of file TaoCtx.hpp.

159 {
160 return preEqualityJacobian;
161 }

◆ getPreProcGradient()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcGradient ( )
inline

Definition at line 130 of file TaoCtx.hpp.

130{ return preGradient; }

◆ getPreProcHessian()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcHessian ( )
inline

Definition at line 120 of file TaoCtx.hpp.

120{ return preHessian; }

◆ getPreProcInequalityConstraint()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcInequalityConstraint ( )
inline

Definition at line 148 of file TaoCtx.hpp.

148 {
150 }

◆ getPreProcInequalityJacobian()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcInequalityJacobian ( )
inline

Definition at line 170 of file TaoCtx.hpp.

170 {
172 }

◆ getPreProcObjective()

BasicMethodsSequence & MoFEM::TaoCtx::getPreProcObjective ( )
inline

Definition at line 125 of file TaoCtx.hpp.

125{ return preObjective; }

Friends And Related Symbol Documentation

◆ TaoSetEqualityConstraints

PetscErrorCode TaoSetEqualityConstraints ( Tao  tao,
Vec  x,
Vec  c,
void *  ctx 
)
friend

Evaluate equality constraints for a TAO optimization context.

Register this callback with TaoSetEqualityConstraintsRoutine().

Definition at line 468 of file TaoCtx.cpp.

468 {
470 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
471 CHKERR tao_ctx->evaluateConstraint(
472 tao, x, c, tao_ctx->loopsEqualityConstraint,
473 tao_ctx->preEqualityConstraint, tao_ctx->postEqualityConstraint,
475 tao_ctx->MOFEM_EVENT_TaoEqualityConstraint);
477}
TaoCtx(Interface &m_field, const std::string &problem_name)
Definition TaoCtx.hpp:93
@ CTX_TAO_EQUALITY_CONSTRAINT
Evaluating equality constraints.

◆ TaoSetGradient

PetscErrorCode TaoSetGradient ( Tao  tao,
Vec  x,
Vec  g,
void *  ctx 
)
friend

Sets the gradient vector for a TAO optimization context.

Parameters
taoThe TAO optimization solver context.
xThe input vector at which to evaluate the gradient.
gPointer to the gradient vector.
ctxUser-defined context for the gradient function.
Returns
PetscErrorCode Error code (0 on success).

Definition at line 296 of file TaoCtx.cpp.

296 {
297 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
299 if (tao_ctx->gradientHook) {
300 CHKERR tao_ctx->gradientHook(tao, x, f);
302 }
303 PetscLogEventBegin(tao_ctx->MOFEM_EVENT_TaoGradient, 0, 0, 0, 0);
304 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
305 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
306 CHKERR tao_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
307 tao_ctx->problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
308
309 auto zero_ghost_vec = [](Vec g) {
311 Vec l;
312 CHKERR VecGhostGetLocalForm(g, &l);
313 double *a;
314 CHKERR VecGetArray(l, &a);
315 int s;
316 CHKERR VecGetLocalSize(l, &s);
317 for (int i = 0; i != s; ++i)
318 a[i] = 0;
319 CHKERR VecRestoreArray(l, &a);
320 CHKERR VecGhostRestoreLocalForm(g, &l);
322 };
323 CHKERR zero_ghost_vec(f);
324
325 tao_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
326 auto cache_ptr = boost::make_shared<CacheTuple>();
327 CHKERR tao_ctx->mField.cache_problem_entities(tao_ctx->problemName,
328 cache_ptr);
329
330 auto set = [&](auto &fe) {
331 fe.tao = tao;
332 fe.tao_x = x;
333 fe.tao_f = f;
335 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
336 fe.tao_ctx = TaoMethod::CTX_TAO_GRADIENT;
338 fe.cacheWeakPtr = cache_ptr;
339 };
340
341 auto unset = [&](auto &fe) {
342 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
343 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
344 fe.tao_ctx = TaoMethod::CTX_TAO_NONE;
345 fe.data_ctx = PetscData::CtxSetNone;
346 };
347
348 for (auto &bit : tao_ctx->preGradient) {
349 bit->vecAssembleSwitch = boost::move(tao_ctx->vecAssembleSwitch);
350 set(*bit);
351 CHKERR tao_ctx->mField.problem_basic_method_preProcess(tao_ctx->problemName,
352 *bit);
353 unset(*bit);
354 tao_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
355 }
356
357 for (auto &lit : tao_ctx->loopsGradient) {
358 lit.second->vecAssembleSwitch = boost::move(tao_ctx->vecAssembleSwitch);
359 set(*lit.second);
360 CHKERR tao_ctx->mField.loop_finite_elements(tao_ctx->problemName, lit.first,
361 *lit.second, nullptr, MF_EXIST,
362 cache_ptr);
363 unset(*lit.second);
364 tao_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
365 }
366
367 for (auto &bit : tao_ctx->postGradient) {
368 bit->vecAssembleSwitch = boost::move(tao_ctx->vecAssembleSwitch);
369 set(*bit);
370 CHKERR tao_ctx->mField.problem_basic_method_postProcess(
371 tao_ctx->problemName, *bit);
372 unset(*bit);
373 tao_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
374 }
375
376 if (*(tao_ctx->vecAssembleSwitch)) {
377 CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
378 CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
379 CHKERR VecAssemblyBegin(f);
380 CHKERR VecAssemblyEnd(f);
381 }
382 PetscLogEventEnd(tao_ctx->MOFEM_EVENT_TaoGradient, 0, 0, 0, 0);
384}
constexpr double a
auto bit
set bit
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
const FTensor::Tensor2< T, Dim, Dim > Vec
constexpr double g
@ CTX_TAO_GRADIENT
Computing gradient vector.

◆ TaoSetHessian

PetscErrorCode TaoSetHessian ( Tao  tao,
Vec  x,
Mat  H,
Mat  Hpre,
void *  ctx 
)
friend

Sets the Hessian matrix for a TAO optimization context.

Parameters
taoThe TAO optimization solver context.
xThe input vector at which to evaluate the Hessian.
HPointer to the Hessian matrix.
HprePreconditioner matrix (can be NULL).
ctxUser-defined context for the Hessian function.
Returns
PetscErrorCode Error code (0 on success).

Definition at line 399 of file TaoCtx.cpp.

399 {
400 TaoCtx *tao_ctx = (TaoCtx *)ctx;
402 PetscLogEventBegin(tao_ctx->MOFEM_EVENT_TaoHessian, 0, 0, 0, 0);
403
404 tao_ctx->matAssembleSwitch = boost::movelib::make_unique<bool>(true);
405 auto cache_ptr = boost::make_shared<CacheTuple>();
406 CHKERR tao_ctx->mField.cache_problem_entities(tao_ctx->problemName,
407 cache_ptr);
408
409 auto set = [&](auto &fe) {
410 fe.tao = tao;
411 fe.tao_A = H;
412 fe.tao_B = Hpre;
413 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
415 fe.tao_ctx = TaoMethod::CTX_TAO_HESSIAN;
417 fe.cacheWeakPtr = cache_ptr;
418 };
419
420 auto unset = [&](auto &fe) {
421 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
422 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
423 fe.tao_ctx = TaoMethod::CTX_TAO_NONE;
424 fe.data_ctx = PetscData::CtxSetNone;
425 };
426
427 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
428 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
429 CHKERR tao_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
430 tao_ctx->problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
431
432 for (auto &bit : tao_ctx->preHessian) {
433 bit->matAssembleSwitch = boost::move(tao_ctx->matAssembleSwitch);
434 set(*bit);
435 CHKERR tao_ctx->mField.problem_basic_method_preProcess(tao_ctx->problemName,
436 *bit);
437 unset(*bit);
438 tao_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
439 }
440
441 for (auto &lit : tao_ctx->loopsHessian) {
442 lit.second->matAssembleSwitch = boost::move(tao_ctx->matAssembleSwitch);
443 set(*lit.second);
444 CHKERR tao_ctx->mField.loop_finite_elements(tao_ctx->problemName, lit.first,
445 *(lit.second), nullptr,
446 MF_EXIST, cache_ptr);
447 unset(*lit.second);
448 tao_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
449 }
450
451 for (auto &bit : tao_ctx->postHessian) {
452 bit->matAssembleSwitch = boost::move(tao_ctx->matAssembleSwitch);
453 set(*bit);
454 CHKERR tao_ctx->mField.problem_basic_method_postProcess(
455 tao_ctx->problemName, *bit);
456 unset(*bit);
457 tao_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
458 }
459
460 if (*tao_ctx->matAssembleSwitch) {
461 CHKERR MatAssemblyBegin(Hpre, MAT_FINAL_ASSEMBLY);
462 CHKERR MatAssemblyEnd(Hpre, MAT_FINAL_ASSEMBLY);
463 }
464 PetscLogEventEnd(tao_ctx->MOFEM_EVENT_TaoHessian, 0, 0, 0, 0);
466}
double H
Hardening.
Definition plastic.cpp:129
@ CTX_TAO_HESSIAN
Assembling Hessian matrix.

◆ TaoSetInequalityConstraints

PetscErrorCode TaoSetInequalityConstraints ( Tao  tao,
Vec  x,
Vec  c,
void *  ctx 
)
friend

Evaluate inequality constraints for a TAO optimization context.

Register this callback with TaoSetInequalityConstraintsRoutine(). PETSc defines feasible inequality constraints by c(x) >= 0.

Definition at line 479 of file TaoCtx.cpp.

479 {
481 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
482 CHKERR tao_ctx->evaluateConstraint(
483 tao, x, c, tao_ctx->loopsInequalityConstraint,
484 tao_ctx->preInequalityConstraint, tao_ctx->postInequalityConstraint,
486 tao_ctx->MOFEM_EVENT_TaoInequalityConstraint);
488}
@ CTX_TAO_INEQUALITY_CONSTRAINT
Evaluating inequality constraints.

◆ TaoSetJacobianEquality

PetscErrorCode TaoSetJacobianEquality ( Tao  tao,
Vec  x,
Mat  J,
Mat  Jpre,
void *  ctx 
)
friend

Assemble the equality constraint Jacobian.

Register this callback with TaoSetJacobianEqualityRoutine().

Definition at line 490 of file TaoCtx.cpp.

491 {
493 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
494 CHKERR tao_ctx->evaluateConstraintJacobian(
495 tao, x, J, Jpre, tao_ctx->loopsEqualityJacobian,
496 tao_ctx->preEqualityJacobian, tao_ctx->postEqualityJacobian,
498 tao_ctx->MOFEM_EVENT_TaoEqualityJacobian);
500}
@ CTX_TAO_EQUALITY_JACOBIAN
Assembling equality Jacobian.

◆ TaoSetJacobianInequality

PetscErrorCode TaoSetJacobianInequality ( Tao  tao,
Vec  x,
Mat  J,
Mat  Jpre,
void *  ctx 
)
friend

Assemble the inequality constraint Jacobian.

Register this callback with TaoSetJacobianInequalityRoutine().

Definition at line 502 of file TaoCtx.cpp.

503 {
505 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
506 CHKERR tao_ctx->evaluateConstraintJacobian(
507 tao, x, J, Jpre, tao_ctx->loopsInequalityJacobian,
508 tao_ctx->preInequalityJacobian, tao_ctx->postInequalityJacobian,
510 tao_ctx->MOFEM_EVENT_TaoInequalityJacobian);
512}
@ CTX_TAO_INEQUALITY_JACOBIAN
Assembling inequality Jacobian.

◆ TaoSetObjective

PetscErrorCode TaoSetObjective ( Tao  tao,
Vec  x,
PetscReal *  f,
void *  ctx 
)
friend

Sets the objective function value for a TAO optimization context.

Parameters
taoThe TAO optimization solver context.
xThe input vector at which to evaluate the objective.
fPointer to store the computed objective value.
ctxUser-defined context for the objective function.
Returns
PetscErrorCode Error code (0 on success).

Definition at line 237 of file TaoCtx.cpp.

237 {
238 auto *tao_ctx = static_cast<TaoCtx *>(ctx);
240 if (tao_ctx->objectiveHook) {
241 CHKERR tao_ctx->objectiveHook(tao, x, f);
243 }
244 PetscLogEventBegin(tao_ctx->MOFEM_EVENT_TaoObjective, 0, 0, 0, 0);
245 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
246 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
247 CHKERR tao_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
248 tao_ctx->problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
249
250 auto cache_ptr = boost::make_shared<CacheTuple>();
251 CHKERR tao_ctx->mField.cache_problem_entities(tao_ctx->problemName,
252 cache_ptr);
253
254 auto set = [&](auto &fe) {
255 fe.tao = tao;
256 fe.tao_x = x;
257 fe.tao_ctx = TaoMethod::CTX_TAO_OBJECTIVE;
258 fe.data_ctx = PetscData::CtxSetX;
259 fe.cacheWeakPtr = cache_ptr;
260 };
261
262 auto unset = [&](auto &fe) {
263 fe.tao_ctx = TaoMethod::CTX_TAO_NONE;
264 fe.data_ctx = PetscData::CtxSetNone;
265 };
266
267 for (auto &bit : tao_ctx->preObjective) {
268 bit->vecAssembleSwitch = boost::move(tao_ctx->vecAssembleSwitch);
269 set(*bit);
270 CHKERR tao_ctx->mField.problem_basic_method_preProcess(tao_ctx->problemName,
271 *bit);
272 unset(*bit);
273 }
274
275 for (auto &lit : tao_ctx->loopsObjective) {
276 set(*lit.second);
277 CHKERR tao_ctx->mField.loop_finite_elements(tao_ctx->problemName, lit.first,
278 *lit.second, nullptr, MF_EXIST,
279 cache_ptr);
280 unset(*lit.second);
281 }
282
283 for (auto &bit : tao_ctx->postObjective) {
284 bit->vecAssembleSwitch = boost::move(tao_ctx->vecAssembleSwitch);
285 set(*bit);
286 CHKERR tao_ctx->mField.problem_basic_method_postProcess(
287 tao_ctx->problemName, *bit);
288 unset(*bit);
289 tao_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
290 }
291
292 PetscLogEventEnd(tao_ctx->MOFEM_EVENT_TaoObjective, 0, 0, 0, 0);
294}
@ CTX_TAO_OBJECTIVE
Evaluating objective function.

◆ TaoSetObjectiveAndGradient

PetscErrorCode TaoSetObjectiveAndGradient ( Tao  tao,
Vec  x,
PetscReal *  f,
Vec  g,
void *  ctx 
)
friend

Sets the objective function value and gradient for a TAO optimization solver.

Parameters
taoThe TAO solver context.
xInput vector at which to evaluate the objective and gradient.
fPointer to store the computed objective function value.
gVector to store the computed gradient.
ctxUser-defined context for objective and gradient evaluation.
Returns
PetscErrorCode Error code (0 on success).
Note
This function is typically called within a user-defined routine to provide both the objective value and its gradient for optimization algorithms.
See also
https://petsc.org/release/docs/manualpages/Tao/TaoSetObjectiveAndGradient.html

Definition at line 386 of file TaoCtx.cpp.

387 {
389 TaoCtx *tao_ctx = (TaoCtx *)ctx;
390 if (tao_ctx->objectiveAndGradientHook) {
391 CHKERR tao_ctx->objectiveAndGradientHook(tao, x, f, g);
393 }
394 CHKERR TaoSetObjective(tao, x, f, ctx);
395 CHKERR TaoSetGradient(tao, x, g, ctx);
397}
friend PetscErrorCode TaoSetObjective(Tao tao, Vec x, PetscReal *f, void *ctx)
Sets the objective function value for a TAO optimization context.
Definition TaoCtx.cpp:237
friend PetscErrorCode TaoSetGradient(Tao tao, Vec x, Vec g, void *ctx)
Sets the gradient vector for a TAO optimization context.
Definition TaoCtx.cpp:296

Member Data Documentation

◆ gradientHook

GradientHook MoFEM::TaoCtx::gradientHook
private

Definition at line 254 of file TaoCtx.hpp.

◆ loopsEqualityConstraint

FEMethodsSequence MoFEM::TaoCtx::loopsEqualityConstraint

Sequence of finite element methods for evaluating equality constraints

Definition at line 40 of file TaoCtx.hpp.

◆ loopsEqualityJacobian

FEMethodsSequence MoFEM::TaoCtx::loopsEqualityJacobian

Sequence of finite element methods for assembling the equality constraint Jacobian

Definition at line 46 of file TaoCtx.hpp.

◆ loopsGradient

FEMethodsSequence MoFEM::TaoCtx::loopsGradient

Sequence of finite element methods for assembling the gradient (first derivative) vector in TAO optimization

Definition at line 38 of file TaoCtx.hpp.

◆ loopsHessian

FEMethodsSequence MoFEM::TaoCtx::loopsHessian

Sequence of finite element methods for assembling the Hessian (second derivative) matrix in TAO optimization

Definition at line 32 of file TaoCtx.hpp.

◆ loopsInequalityConstraint

FEMethodsSequence MoFEM::TaoCtx::loopsInequalityConstraint

Sequence of finite element methods for evaluating inequality constraints

Definition at line 43 of file TaoCtx.hpp.

◆ loopsInequalityJacobian

FEMethodsSequence MoFEM::TaoCtx::loopsInequalityJacobian

Sequence of finite element methods for assembling the inequality constraint Jacobian

Definition at line 49 of file TaoCtx.hpp.

◆ loopsObjective

FEMethodsSequence MoFEM::TaoCtx::loopsObjective

Sequence of finite element methods for evaluating the objective function in TAO optimization

Definition at line 35 of file TaoCtx.hpp.

◆ matAssembleSwitch

boost::movelib::unique_ptr<bool> MoFEM::TaoCtx::matAssembleSwitch
private

Definition at line 257 of file TaoCtx.hpp.

◆ mField

MoFEM::Interface& MoFEM::TaoCtx::mField

database Interface

Definition at line 16 of file TaoCtx.hpp.

◆ moab

moab::Interface& MoFEM::TaoCtx::moab

moab Interface

Definition at line 17 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoEqualityConstraint

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoEqualityConstraint
private

Definition at line 261 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoEqualityJacobian

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoEqualityJacobian
private

Definition at line 263 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoGradient

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoGradient
private

Log event for TAO Gradient.

Definition at line 259 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoHessian

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoHessian
private

Log event for TAO Hessian.

Definition at line 258 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoInequalityConstraint

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoInequalityConstraint
private

Definition at line 262 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoInequalityJacobian

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoInequalityJacobian
private

Definition at line 264 of file TaoCtx.hpp.

◆ MOFEM_EVENT_TaoObjective

PetscLogEvent MoFEM::TaoCtx::MOFEM_EVENT_TaoObjective
private

Log event for TAO Objective.

Definition at line 260 of file TaoCtx.hpp.

◆ objectiveAndGradientHook

ObjectiveAndGradientHook MoFEM::TaoCtx::objectiveAndGradientHook
private

Definition at line 255 of file TaoCtx.hpp.

◆ objectiveHook

ObjectiveHook MoFEM::TaoCtx::objectiveHook
private

Definition at line 253 of file TaoCtx.hpp.

◆ postEqualityConstraint

BasicMethodsSequence MoFEM::TaoCtx::postEqualityConstraint

Sequence of methods run after equality constraints are evaluated

Definition at line 71 of file TaoCtx.hpp.

◆ postEqualityJacobian

BasicMethodsSequence MoFEM::TaoCtx::postEqualityJacobian

Sequence of methods run after the equality Jacobian is assembled

Definition at line 83 of file TaoCtx.hpp.

◆ postGradient

BasicMethodsSequence MoFEM::TaoCtx::postGradient

Sequence of methods run after gradient is assembled.

Definition at line 66 of file TaoCtx.hpp.

◆ postHessian

BasicMethodsSequence MoFEM::TaoCtx::postHessian

Sequence of methods run after Hessian is assembled.

Definition at line 56 of file TaoCtx.hpp.

◆ postInequalityConstraint

BasicMethodsSequence MoFEM::TaoCtx::postInequalityConstraint

Sequence of methods run after inequality constraints are evaluated

Definition at line 77 of file TaoCtx.hpp.

◆ postInequalityJacobian

BasicMethodsSequence MoFEM::TaoCtx::postInequalityJacobian

Sequence of methods run after the inequality Jacobian is assembled

Definition at line 89 of file TaoCtx.hpp.

◆ postObjective

BasicMethodsSequence MoFEM::TaoCtx::postObjective

Sequence of methods run after objective is evaluated.

Definition at line 61 of file TaoCtx.hpp.

◆ preEqualityConstraint

BasicMethodsSequence MoFEM::TaoCtx::preEqualityConstraint

Sequence of methods run before equality constraints are evaluated

Definition at line 68 of file TaoCtx.hpp.

◆ preEqualityJacobian

BasicMethodsSequence MoFEM::TaoCtx::preEqualityJacobian

Sequence of methods run before the equality Jacobian is assembled

Definition at line 80 of file TaoCtx.hpp.

◆ preGradient

BasicMethodsSequence MoFEM::TaoCtx::preGradient

Sequence of methods run before gradient is assembled.

Definition at line 64 of file TaoCtx.hpp.

◆ preHessian

BasicMethodsSequence MoFEM::TaoCtx::preHessian

Sequence of methods run before Hessian is assembled.

Definition at line 54 of file TaoCtx.hpp.

◆ preInequalityConstraint

BasicMethodsSequence MoFEM::TaoCtx::preInequalityConstraint

Sequence of methods run before inequality constraints are evaluated

Definition at line 74 of file TaoCtx.hpp.

◆ preInequalityJacobian

BasicMethodsSequence MoFEM::TaoCtx::preInequalityJacobian

Sequence of methods run before the inequality Jacobian is assembled

Definition at line 86 of file TaoCtx.hpp.

◆ preObjective

BasicMethodsSequence MoFEM::TaoCtx::preObjective

Sequence of methods run before objective is evaluated.

Definition at line 59 of file TaoCtx.hpp.

◆ problemName

std::string MoFEM::TaoCtx::problemName

problem name

Definition at line 18 of file TaoCtx.hpp.

◆ vecAssembleSwitch

boost::movelib::unique_ptr<bool> MoFEM::TaoCtx::vecAssembleSwitch
private

Definition at line 256 of file TaoCtx.hpp.

◆ vErify

bool MoFEM::TaoCtx::vErify

If true verify vector.

Definition at line 19 of file TaoCtx.hpp.


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