Compute objective function contributions at element level.
Evaluates Python objective function with current displacement and stress state, and accumulates global objective value and gradients.
813 {
815
816 auto nb_gauss_pts =
817 getGaussPts().size2();
818
819 auto objective_ptr = boost::make_shared<MatrixDouble>(
820 1, nb_gauss_pts);
821
822 auto evaluate_python = [&]() {
824 auto &coords = OP::getCoordsAtGaussPts();
827 objective_ptr);
828
830
831 auto vol = OP::getMeasure();
832 auto t_w = getFTensor0IntegrationWeight();
833 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
834
835 auto alpha = t_w * vol;
836 (*globObjectivePtr) += alpha * t_obj;
837
838 ++t_w;
839
840 ++t_obj;
841 }
843 };
844
846
848 }
#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.