Compute objective function contributions at element level.
Evaluates Python objective function with current displacement and stress state, and accumulates global objective value and gradients.
809 {
811
812 auto nb_gauss_pts =
813 getGaussPts().size2();
814
815 auto objective_ptr = boost::make_shared<MatrixDouble>(
816 1, nb_gauss_pts);
817
818 auto evaluate_python = [&]() {
820 auto &coords = OP::getCoordsAtGaussPts();
823 objective_ptr);
824
826
827 auto vol = OP::getMeasure();
828 auto t_w = getFTensor0IntegrationWeight();
829 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
830
831 auto alpha = t_w * vol;
832 (*globObjectivePtr) += alpha * t_obj;
833
834 ++t_w;
835
836 ++t_obj;
837 }
839 };
840
842
844 }
#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.
auto getFTensor0FromMat(M &data)
Get tensor rank 0 (scalar) form data vector.