90 {
92
93 if (
const size_t nb_dofs = data.
getIndices().size()) {
94
95 const int nb_integration_pts = getGaussPts().size2();
96 auto t_w = getFTensor0IntegrationWeight();
98 auto t_coords = getFTensor1CoordsAtGaussPts();
99
101 nf.clear();
102
104 const double volume = getMeasure();
105
107 double error = 0;
108 for (int gg = 0; gg != nb_integration_pts; ++gg) {
109
110 const double alpha = t_w * volume;
112 t_coords(2));
113 error += alpha * pow(diff, 2);
114
115 for (
size_t r = 0;
r != nb_dofs; ++
r) {
116 nf[
r] += alpha * t_row_base * diff;
117 ++t_row_base;
118 }
119
120 ++t_w;
121 ++t_val;
122 ++t_coords;
123 }
124
125 const int index = 0;
128 }
129
131 }
#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.