117 {
119
120 if (
const size_t nb_dofs = data.
getIndices().size()) {
121
122 const int nb_integration_pts = getGaussPts().size2();
123 auto t_w = getFTensor0IntegrationWeight();
125 auto t_coords = getFTensor1CoordsAtGaussPts();
126
128 nf.clear();
129
131 const double volume = getMeasure();
132
134 double error = 0;
135 for (int gg = 0; gg != nb_integration_pts; ++gg) {
136
137 const double alpha = t_w * volume;
139 t_coords(0), t_coords(1), t_coords(2));
140
141 error += alpha * pow(diff, 2);
142
143 for (
size_t r = 0;
r != nb_dofs; ++
r) {
144 nf[
r] += alpha * t_row_base * diff;
145 ++t_row_base;
146 }
147
148 ++t_w;
149 ++t_val;
150 ++t_coords;
151 }
152
153 const int index = 0;
156 }
157
159 }
#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.
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.
static double sourceFunction(const double x, const double y, const double z)