363 {
365 const int nb_integration_pts = getGaussPts().size2();
366 const double area = getMeasure();
367 auto t_w = getFTensor0IntegrationWeight();
369 auto t_val_grad = getFTensor1FromMat<2>(*(
commonDataPtr->approxValsGrad));
370 auto t_coords = getFTensor1CoordsAtGaussPts();
373
374 double error_l2 = 0;
375 double error_h1 = 0;
376
377 for (int gg = 0; gg != nb_integration_pts; ++gg) {
378 const double alpha = t_w * area;
379
381 t_coords(0), t_coords(1), t_coords(2));
382 error_l2 += alpha *
sqr(diff);
383
385 t_coords(0), t_coords(1), t_coords(2));
386 auto t_fun_grad = getFTensor1FromArray<2, 2>(vec);
387 t_diff(
i) = t_val_grad(
i) - t_fun_grad(
i);
388
389 error_h1 += alpha * t_diff(
i) * t_diff(
i);
390
391 ++t_w;
392 ++t_val;
393 ++t_val_grad;
394 ++t_coords;
395 }
396
399 std::array<double, 2>
values;
403 ADD_VALUES);
405}
SmartPetscObj< Vec > values
#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.
FTensor::Index< 'i', SPACE_DIM > i
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
static double analyticalFunction(const double x, const double y, const double z)
[Analytical function]
static VectorDouble analyticalFunctionGrad(const double x, const double y, const double z)
[Analytical function]