v0.14.0
Public Member Functions | Public Attributes | Friends | List of all members
MoFEM::PCMGSubMatrixCtx Struct Reference
Collaboration diagram for MoFEM::PCMGSubMatrixCtx:
[legend]

Public Member Functions

 PCMGSubMatrixCtx (Mat a, IS is)
 
virtual ~PCMGSubMatrixCtx ()=default
 
MoFEMErrorCode initData (Vec x)
 

Public Attributes

SmartPetscObj< Mat > A
 
SmartPetscObj< IS > iS
 
SmartPetscObj< VecScatter > sCat
 
SmartPetscObj< Vec > X
 
SmartPetscObj< Vec > F
 
PetscLogEvent MOFEM_EVENT_mult
 
PetscLogEvent MOFEM_EVENT_sor
 

Friends

template<InsertMode MODE>
MoFEMErrorCode sub_mat_mult_generic (Mat a, Vec x, Vec f)
 
MoFEMErrorCode sub_mat_sor (Mat mat, Vec b, PetscReal omega, MatSORType flag, PetscReal shift, PetscInt its, PetscInt lits, Vec x)
 

Detailed Description

Definition at line 29 of file PCMGSetUpViaApproxOrders.cpp.

Constructor & Destructor Documentation

◆ PCMGSubMatrixCtx()

MoFEM::PCMGSubMatrixCtx::PCMGSubMatrixCtx ( Mat  a,
IS  is 
)

Definition at line 52 of file PCMGSetUpViaApproxOrders.cpp.

52  : A(a, true), iS(is, true) {
53  PetscLogEventRegister("PCMGSubMatrixCtx_mult", 0, &MOFEM_EVENT_mult);
54  PetscLogEventRegister("PCMGSubMatrixCtx_sor", 0, &MOFEM_EVENT_sor);
55 }

◆ ~PCMGSubMatrixCtx()

virtual MoFEM::PCMGSubMatrixCtx::~PCMGSubMatrixCtx ( )
virtualdefault

Member Function Documentation

◆ initData()

MoFEMErrorCode MoFEM::PCMGSubMatrixCtx::initData ( Vec  x)

Definition at line 57 of file PCMGSetUpViaApproxOrders.cpp.

57  {
59  if (sCat.use_count() == 0) {
60  auto [x_tmp, f_tmp] = matCreateVecs(A);
61  X = x_tmp;
62  F = f_tmp;
63  sCat = createVecScatter(X, iS, x, PETSC_NULL);
64  }
66 }

Friends And Related Function Documentation

◆ sub_mat_mult_generic

template<InsertMode MODE>
MoFEMErrorCode sub_mat_mult_generic ( Mat  a,
Vec  x,
Vec  f 
)
friend

Definition at line 144 of file PCMGSetUpViaApproxOrders.cpp.

144  {
145  void *void_ctx;
147  CHKERR MatShellGetContext(a, &void_ctx);
148  PCMGSubMatrixCtx *ctx = (PCMGSubMatrixCtx *)void_ctx;
149  PetscLogEventBegin(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
150  CHKERR ctx->initData(x);
151  CHKERR VecScatterBegin(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
152  CHKERR VecScatterEnd(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
153  CHKERR MatMult(ctx->A, ctx->X, ctx->F);
154  CHKERR VecScatterBegin(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
155  CHKERR VecScatterEnd(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
156  PetscLogEventEnd(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
158 }

◆ sub_mat_sor

MoFEMErrorCode sub_mat_sor ( Mat  mat,
Vec  b,
PetscReal  omega,
MatSORType  flag,
PetscReal  shift,
PetscInt  its,
PetscInt  lits,
Vec  x 
)
friend

Definition at line 168 of file PCMGSetUpViaApproxOrders.cpp.

170  {
171 
172  //FIXME: that is crap implementation of SOR
173 
174  void *void_ctx;
176  CHKERR MatShellGetContext(mat, &void_ctx);
177  PCMGSubMatrixCtx *ctx = (PCMGSubMatrixCtx *)void_ctx;
178  PetscLogEventBegin(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
179  CHKERR ctx->initData(x);
180  CHKERR VecScatterBegin(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
181  CHKERR VecScatterEnd(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
182  CHKERR MatSOR(ctx->A, ctx->X, omega, flag, shift, its, lits, ctx->F);
183  CHKERR VecScatterBegin(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
184  CHKERR VecScatterEnd(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
185  PetscLogEventEnd(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
187 }

Member Data Documentation

◆ A

SmartPetscObj<Mat> MoFEM::PCMGSubMatrixCtx::A

Definition at line 42 of file PCMGSetUpViaApproxOrders.cpp.

◆ F

SmartPetscObj<Vec> MoFEM::PCMGSubMatrixCtx::F

Definition at line 46 of file PCMGSetUpViaApproxOrders.cpp.

◆ iS

SmartPetscObj<IS> MoFEM::PCMGSubMatrixCtx::iS

Definition at line 43 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_mult

PetscLogEvent MoFEM::PCMGSubMatrixCtx::MOFEM_EVENT_mult

Definition at line 48 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_sor

PetscLogEvent MoFEM::PCMGSubMatrixCtx::MOFEM_EVENT_sor

Definition at line 49 of file PCMGSetUpViaApproxOrders.cpp.

◆ sCat

SmartPetscObj<VecScatter> MoFEM::PCMGSubMatrixCtx::sCat

Definition at line 44 of file PCMGSetUpViaApproxOrders.cpp.

◆ X

SmartPetscObj<Vec> MoFEM::PCMGSubMatrixCtx::X

Definition at line 45 of file PCMGSetUpViaApproxOrders.cpp.


The documentation for this struct was generated from the following file:
omega
constexpr double omega
Save field DOFS on vertices/tags.
Definition: dynamic_first_order_con_law.cpp:93
MoFEM::PCMGSubMatrixCtx::iS
SmartPetscObj< IS > iS
Definition: PCMGSetUpViaApproxOrders.cpp:43
MoFEM::PCMGSubMatrixCtx::MOFEM_EVENT_mult
PetscLogEvent MOFEM_EVENT_mult
Definition: PCMGSetUpViaApproxOrders.cpp:48
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::matCreateVecs
auto matCreateVecs(Mat mat)
Definition: PetscSmartObj.hpp:390
MoFEM::SmartPetscObj::use_count
int use_count() const
Definition: PetscSmartObj.hpp:109
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::PCMGSubMatrixCtx::X
SmartPetscObj< Vec > X
Definition: PCMGSetUpViaApproxOrders.cpp:45
MoFEM::PCMGSubMatrixCtx::A
SmartPetscObj< Mat > A
Definition: PCMGSetUpViaApproxOrders.cpp:42
MoFEM::PCMGSubMatrixCtx::sCat
SmartPetscObj< VecScatter > sCat
Definition: PCMGSetUpViaApproxOrders.cpp:44
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
MoFEM::createVecScatter
auto createVecScatter(Vec x, IS ix, Vec y, IS iy)
Create a Vec Scatter object.
Definition: PetscSmartObj.hpp:361
MoFEM::PCMGSubMatrixCtx::F
SmartPetscObj< Vec > F
Definition: PCMGSetUpViaApproxOrders.cpp:46
MoFEM::PCMGSubMatrixCtx::MOFEM_EVENT_sor
PetscLogEvent MOFEM_EVENT_sor
Definition: PCMGSetUpViaApproxOrders.cpp:49
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEM::PCMGSubMatrixCtx::PCMGSubMatrixCtx
PCMGSubMatrixCtx(Mat a, IS is)
Definition: PCMGSetUpViaApproxOrders.cpp:52
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359