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