v0.15.0
Loading...
Searching...
No Matches
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}
constexpr double a

◆ ~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_NULLPTR);
64 }
66}
#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()
auto matCreateVecs(Mat mat)
auto createVecScatter(Vec x, IS ix, Vec y, IS iy)
Create a Vec Scatter object.
SmartPetscObj< VecScatter > sCat

Friends And Related Symbol 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}
#define CHKERR
Inline error check.

◆ 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}
constexpr double omega
Save field DOFS on vertices/tags.

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: