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