v0.13.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
PCMGSubMatrixCtx_private Struct Reference
Inheritance diagram for PCMGSubMatrixCtx_private:
[legend]
Collaboration diagram for PCMGSubMatrixCtx_private:
[legend]

Public Member Functions

 PCMGSubMatrixCtx_private (Mat a, IS is)
 
 ~PCMGSubMatrixCtx_private ()
 
MoFEMErrorCode initData (Vec x)
 
- Public Member Functions inherited from PCMGSubMatrixCtx
 PCMGSubMatrixCtx (Mat a, IS is)
 
virtual ~PCMGSubMatrixCtx ()
 

Public Attributes

PetscLogEvent MOFEM_EVENT_mult
 
PetscLogEvent MOFEM_EVENT_sor
 
bool isInitisalised
 
- Public Attributes inherited from PCMGSubMatrixCtx
Mat A
 
Vec X
 
Vec F
 
IS iS
 
VecScatter sCat
 

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 48 of file PCMGSetUpViaApproxOrders.cpp.

Constructor & Destructor Documentation

◆ PCMGSubMatrixCtx_private()

PCMGSubMatrixCtx_private::PCMGSubMatrixCtx_private ( Mat  a,
IS  is 
)
inline

Definition at line 49 of file PCMGSetUpViaApproxOrders.cpp.

50 : PCMGSubMatrixCtx(a, is), isInitisalised(false) {
51 PetscLogEventRegister("PCMGSubMatrixCtx_mult", 0, &MOFEM_EVENT_mult);
52 PetscLogEventRegister("PCMGSubMatrixCtx_sor", 0, &MOFEM_EVENT_sor);
53 }
constexpr double a

◆ ~PCMGSubMatrixCtx_private()

PCMGSubMatrixCtx_private::~PCMGSubMatrixCtx_private ( )
inline

Definition at line 54 of file PCMGSetUpViaApproxOrders.cpp.

54 {
55 if (isInitisalised) {
56 ierr = VecScatterDestroy(&sCat);
57 CHKERRABORT(PETSC_COMM_WORLD, ierr);
58 ierr = VecDestroy(&X);
59 CHKERRABORT(PETSC_COMM_WORLD, ierr);
60 ierr = VecDestroy(&F);
61 CHKERRABORT(PETSC_COMM_WORLD, ierr);
62 }
63 }
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76

Member Function Documentation

◆ initData()

MoFEMErrorCode PCMGSubMatrixCtx_private::initData ( Vec  x)
inline

Definition at line 71 of file PCMGSetUpViaApproxOrders.cpp.

71 {
73 if (!isInitisalised) {
74 CHKERR MatCreateVecs(A, &X, &F);
75 CHKERR VecScatterCreate(X, iS, x, PETSC_NULL, &sCat);
76 CHKERR VecZeroEntries(X);
77 CHKERR VecZeroEntries(F);
78 isInitisalised = true;
79 }
81 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535

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 88 of file PCMGSetUpViaApproxOrders.cpp.

88 {
89 void *void_ctx;
91 CHKERR MatShellGetContext(a, &void_ctx);
93 if (!ctx->isInitisalised) {
94 CHKERR ctx->initData(x);
95 }
96 PetscLogEventBegin(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
97 CHKERR VecScatterBegin(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
98 CHKERR VecScatterEnd(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
99 CHKERR MatMult(ctx->A, ctx->X, ctx->F);
100 CHKERR VecScatterBegin(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
101 CHKERR VecScatterEnd(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
102 PetscLogEventEnd(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
104}

◆ 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 114 of file PCMGSetUpViaApproxOrders.cpp.

116 {
117 void *void_ctx;
119 CHKERR MatShellGetContext(mat, &void_ctx);
121 if (!ctx->isInitisalised) {
122 CHKERR ctx->initData(x);
123 }
124 PetscLogEventBegin(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
125 CHKERR VecScatterBegin(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
126 CHKERR VecScatterEnd(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
127 CHKERR MatSOR(ctx->A, ctx->X, omega, flag, shift, its, lits, ctx->F);
128 CHKERR VecScatterBegin(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
129 CHKERR VecScatterEnd(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
130 PetscLogEventEnd(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
132}
constexpr double omega

Member Data Documentation

◆ isInitisalised

bool PCMGSubMatrixCtx_private::isInitisalised

Definition at line 84 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_mult

PetscLogEvent PCMGSubMatrixCtx_private::MOFEM_EVENT_mult

Definition at line 82 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_sor

PetscLogEvent PCMGSubMatrixCtx_private::MOFEM_EVENT_sor

Definition at line 83 of file PCMGSetUpViaApproxOrders.cpp.


The documentation for this struct was generated from the following file: