92 {
94
95 if (
const size_t nb_dofs = data.
getIndices().size()) {
96
97 const int nb_integration_pts = getGaussPts().size2();
98 auto t_w = getFTensor0IntegrationWeight();
100 auto t_coords = getFTensor1CoordsAtGaussPts();
101
103 nf.clear();
104
106 const double volume = getMeasure();
107
109 double error = 0;
110 for (int gg = 0; gg != nb_integration_pts; ++gg) {
111
112 const double alpha = t_w * volume;
114 t_coords(2));
115 error += alpha * pow(diff, 2);
116
117 for (
size_t r = 0;
r != nb_dofs; ++
r) {
118 nf[
r] += alpha * t_row_base * diff;
119 ++t_row_base;
120 }
121
122 ++t_w;
123 ++t_val;
124 ++t_coords;
125 }
126
127 const int index = 0;
130 }
131
133 }
#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(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.
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 dofs on entity.