367 {
369 const int nb_integration_pts = getGaussPts().size2();
370 const double area = getMeasure();
371 auto t_w = getFTensor0IntegrationWeight();
374 auto t_coords = getFTensor1CoordsAtGaussPts();
377
378 double error_l2 = 0;
379 double error_h1 = 0;
380
381 for (int gg = 0; gg != nb_integration_pts; ++gg) {
382 const double alpha = t_w * area;
383
385 t_coords(0), t_coords(1), t_coords(2));
386 error_l2 += alpha *
sqr(diff);
387
389 t_coords(0), t_coords(1), t_coords(2));
391 t_diff(
i) = t_val_grad(
i) - t_fun_grad(
i);
392
393 error_h1 += alpha * t_diff(
i) * t_diff(
i);
394
395 ++t_w;
396 ++t_val;
397 ++t_val_grad;
398 ++t_coords;
399 }
400
404 std::array<double, 2> values;
405 values[0] = error_l2;
406 values[1] = error_h1;
408 ADD_VALUES);
410}
#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
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
static auto getFTensor0FromVec(ublas::vector< T, A > &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.
auto getFTensor1FromArray(VectorDouble &data)
Get FTensor1 from array.
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]