v0.8.16
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 59 of file PCMGSetUpViaApproxOrders.cpp.

Constructor & Destructor Documentation

◆ PCMGSubMatrixCtx_private()

PCMGSubMatrixCtx_private::PCMGSubMatrixCtx_private ( Mat  a,
IS  is 
)

Definition at line 60 of file PCMGSetUpViaApproxOrders.cpp.

61  : PCMGSubMatrixCtx(a, is), isInitisalised(false) {
62  PetscLogEventRegister("PCMGSubMatrixCtx_mult", 0, &MOFEM_EVENT_mult);
63  PetscLogEventRegister("PCMGSubMatrixCtx_sor", 0, &MOFEM_EVENT_sor);
64  }

◆ ~PCMGSubMatrixCtx_private()

PCMGSubMatrixCtx_private::~PCMGSubMatrixCtx_private ( )

Definition at line 65 of file PCMGSetUpViaApproxOrders.cpp.

65  {
66  if (isInitisalised) {
67  ierr = VecScatterDestroy(&sCat);
68  CHKERRABORT(PETSC_COMM_WORLD, ierr);
69  ierr = VecDestroy(&X);
70  CHKERRABORT(PETSC_COMM_WORLD, ierr);
71  ierr = VecDestroy(&F);
72  CHKERRABORT(PETSC_COMM_WORLD, ierr);
73  }
74  }

Member Function Documentation

◆ initData()

MoFEMErrorCode PCMGSubMatrixCtx_private::initData ( Vec  x)

Definition at line 82 of file PCMGSetUpViaApproxOrders.cpp.

82  {
84  if (!isInitisalised) {
85  CHKERR MatCreateVecs(A, &X, &F);
86  CHKERR VecScatterCreate(X, iS, x, PETSC_NULL, &sCat);
87  CHKERR VecZeroEntries(X);
88  CHKERR VecZeroEntries(F);
89  isInitisalised = true;
90  }
92  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

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

99  {
100  void *void_ctx;
102  CHKERR MatShellGetContext(a, &void_ctx);
104  if (!ctx->isInitisalised) {
105  CHKERR ctx->initData(x);
106  }
107  PetscLogEventBegin(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
108  CHKERR VecScatterBegin(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
109  CHKERR VecScatterEnd(ctx->sCat, x, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
110  CHKERR MatMult(ctx->A, ctx->X, ctx->F);
111  CHKERR VecScatterBegin(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
112  CHKERR VecScatterEnd(ctx->sCat, ctx->F, f, MODE, SCATTER_FORWARD);
113  PetscLogEventEnd(ctx->MOFEM_EVENT_mult, 0, 0, 0, 0);
115 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

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

127  {
128  void *void_ctx;
130  CHKERR MatShellGetContext(mat, &void_ctx);
132  if (!ctx->isInitisalised) {
133  CHKERR ctx->initData(x);
134  }
135  PetscLogEventBegin(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
136  CHKERR VecScatterBegin(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
137  CHKERR VecScatterEnd(ctx->sCat, b, ctx->X, INSERT_VALUES, SCATTER_REVERSE);
138  CHKERR MatSOR(ctx->A, ctx->X, omega, flag, shift, its, lits, ctx->F);
139  CHKERR VecScatterBegin(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
140  CHKERR VecScatterEnd(ctx->sCat, ctx->F, x, INSERT_VALUES, SCATTER_FORWARD);
141  PetscLogEventEnd(ctx->MOFEM_EVENT_sor, 0, 0, 0, 0);
143 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

Member Data Documentation

◆ isInitisalised

bool PCMGSubMatrixCtx_private::isInitisalised

Definition at line 95 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_mult

PetscLogEvent PCMGSubMatrixCtx_private::MOFEM_EVENT_mult

Definition at line 93 of file PCMGSetUpViaApproxOrders.cpp.

◆ MOFEM_EVENT_sor

PetscLogEvent PCMGSubMatrixCtx_private::MOFEM_EVENT_sor

Definition at line 94 of file PCMGSetUpViaApproxOrders.cpp.


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