89 {
91
92 if (
const size_t nb_dofs = data.
getIndices().size()) {
93
94 const int nb_integration_pts = getGaussPts().size2();
95 auto t_w = getFTensor0IntegrationWeight();
97 auto t_coords = getFTensor1CoordsAtGaussPts();
98
100 nf.clear();
101
103 const double volume = getMeasure();
104
106 double error = 0;
107 for (int gg = 0; gg != nb_integration_pts; ++gg) {
108
109 const double alpha = t_w * volume;
111 t_coords(2));
112 error += alpha * pow(diff, 2);
113
114 for (
size_t r = 0;
r != nb_dofs; ++
r) {
115 nf[
r] += alpha * t_row_base * diff;
116 ++t_row_base;
117 }
118
119 ++t_w;
120 ++t_val;
121 ++t_coords;
122 }
123
124 const int index = 0;
127 }
128
130 }
#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 ApproxFieldFunction< FIELD_DIM > approxFunction
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.