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