v0.14.0
Public Member Functions | Public Attributes | List of all members
ZeroFLmabda Struct Reference

Zero F_lambda. More...

#include <users_modules/basic_finite_elements/src/ArcLengthTools.hpp>

Inheritance diagram for ZeroFLmabda:
[legend]
Collaboration diagram for ZeroFLmabda:
[legend]

Public Member Functions

 ZeroFLmabda (boost::shared_ptr< ArcLengthCtx > arc_ptr)
 
MoFEMErrorCode preProcess ()
 

Public Attributes

boost::shared_ptr< ArcLengthCtxarcPtr
 

Detailed Description

Zero F_lambda.

Definition at line 283 of file ArcLengthTools.hpp.

Constructor & Destructor Documentation

◆ ZeroFLmabda()

ZeroFLmabda::ZeroFLmabda ( boost::shared_ptr< ArcLengthCtx arc_ptr)

Definition at line 359 of file ArcLengthTools.cpp.

360  : arcPtr(arc_ptr) {}

Member Function Documentation

◆ preProcess()

MoFEMErrorCode ZeroFLmabda::preProcess ( )

Definition at line 362 of file ArcLengthTools.cpp.

362  {
364  switch (snes_ctx) {
365  case CTX_SNESSETFUNCTION: {
366 
367  auto zero_vals = [&](auto v) {
369  int size = problemPtr->getNbLocalDofsRow();
370  int ghosts = problemPtr->getNbGhostDofsRow();
371  double *array;
372  CHKERR VecGetArray(v, &array);
373  for (int i = 0; i != size + ghosts; ++i)
374  array[i] = 0;
375  CHKERR VecRestoreArray(v, &array);
377  };
378 
379  Vec l_x_lambda, l_f_lambda;
380  CHKERR VecGhostGetLocalForm(arcPtr->xLambda, &l_x_lambda);
381  CHKERR VecGhostGetLocalForm(arcPtr->F_lambda, &l_f_lambda);
382  CHKERR zero_vals(l_x_lambda);
383  CHKERR zero_vals(l_f_lambda);
384  CHKERR VecGhostRestoreLocalForm(arcPtr->xLambda, &l_x_lambda);
385  CHKERR VecGhostRestoreLocalForm(arcPtr->F_lambda, &l_f_lambda);
386 
387  } break;
388  default:
389  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
390  "Lambda can be zeroed ONLY when the right hand side is evaluated.");
391  }
393 }

Member Data Documentation

◆ arcPtr

boost::shared_ptr<ArcLengthCtx> ZeroFLmabda::arcPtr

Definition at line 285 of file ArcLengthTools.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
ZeroFLmabda::arcPtr
boost::shared_ptr< ArcLengthCtx > arcPtr
Definition: ArcLengthTools.hpp:285
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359