425 {
427
429
431 if (nb_dofs) {
432
433 auto t_grad = getFTensor1FromMat<3>(*
uGradPtr);
434
435 auto nb_base_functions = data.
getN().size2();
436 auto nb_gauss_pts = getGaussPts().size2();
437 std::array<double, MAX_DOFS_ON_ENTITY> nf;
438 std::fill(nf.begin(), &nf[nb_dofs], 0);
439
441 auto t_w = getFTensor0IntegrationWeight();
442 auto a = getMeasure();
443
444 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
445 double alpha = t_w *
a;
446
447 const auto l2 = t_grad(
i) * t_grad(
i);
449 if (l2 > std::numeric_limits<double>::epsilon())
450 t_one(
i) = t_grad(
i) / std::sqrt(l2);
451 else
453
454 size_t bb = 0;
455 for (; bb != nb_dofs; ++bb) {
456 nf[bb] -= alpha * t_diff_base(
i) * t_one(
i);
457 ++t_diff_base;
458 }
459
460 for (; bb < nb_base_functions; ++bb) {
461 ++t_diff_base;
462 }
463
464 ++t_grad;
465 }
466
467 CHKERR VecSetValues<MoFEM::EssentialBcStorage>(getKSPf(), data, &nf[0],
468 ADD_VALUES);
469 }
470
472}
#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.