Compute objective function contributions at element level.
Evaluates Python objective function with current displacement and stress state, and accumulates global objective value and gradients.
849 {
851
852 auto nb_gauss_pts =
853 getGaussPts().size2();
854
855 auto objective_ptr = boost::make_shared<MatrixDouble>(
856 1, nb_gauss_pts);
857
858 auto evaluate_python = [&]() {
860 auto &coords = OP::getCoordsAtGaussPts();
863 objective_ptr);
864
866
867 auto vol = OP::getMeasure();
868 auto t_w = getFTensor0IntegrationWeight();
869 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
870
871 auto alpha = t_w * vol;
872 (*globObjectivePtr) += alpha * t_obj;
873
874 ++t_w;
875
876 ++t_obj;
877 }
879 };
880
882
884 }
#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.