421 {
423
425
427 if (nb_dofs) {
428
429 auto t_grad = getFTensor1FromMat<3>(*
uGradPtr);
430
431 auto nb_base_functions = data.
getN().size2();
432 auto nb_gauss_pts = getGaussPts().size2();
433 std::array<double, MAX_DOFS_ON_ENTITY> nf;
434 std::fill(nf.begin(), &nf[nb_dofs], 0);
435
437 auto t_w = getFTensor0IntegrationWeight();
438 auto a = getMeasure();
439
440 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
441 double alpha = t_w *
a;
442
443 const auto l2 = t_grad(
i) * t_grad(
i);
445 if (l2 > std::numeric_limits<double>::epsilon())
446 t_one(
i) = t_grad(
i) / std::sqrt(l2);
447 else
449
450 size_t bb = 0;
451 for (; bb != nb_dofs; ++bb) {
452 nf[bb] -= alpha * t_diff_base(
i) * t_one(
i);
453 ++t_diff_base;
454 }
455
456 for (; bb < nb_base_functions; ++bb) {
457 ++t_diff_base;
458 }
459
460 ++t_grad;
461 }
462
463 CHKERR VecSetValues<MoFEM::EssentialBcStorage>(getKSPf(), data, &nf[0],
464 ADD_VALUES);
465 }
466
468}
#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
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.