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

structure for projection matrices More...

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

Collaboration diagram for ConstrainMatrixCtx:
[legend]

Public Member Functions

 ConstrainMatrixCtx (MoFEM::Interface &m_field, string x_problem, string y_problem, bool create_ksp=true, bool own_contrain_matrix=false)
 
 ConstrainMatrixCtx (MoFEM::Interface &m_field, VecScatter scatter, bool create_ksp=true, bool own_contrain_matrix=false)
 
virtual ~ConstrainMatrixCtx ()
 
MoFEMErrorCode initializeQorP (Vec x)
 initialize vectors and matrices for Q and P shell matrices, scattering is set based on x_problem and y_problem More...
 
MoFEMErrorCode initializeQTKQ ()
 initialize vectors and matrices for CTC+QTKQ shell matrices, scattering is set based on x_problem and y_problem More...
 
MoFEMErrorCode recalculateCTandCCT ()
 re-calculate CT and CCT if C matrix has been changed since initialization More...
 
MoFEMErrorCode recalculateCTC ()
 re-calculate CTC matrix has been changed since initialization More...
 
MoFEMErrorCode destroyQorP ()
 destroy sub-matrices used for shell matrices P, Q, R, RT More...
 
MoFEMErrorCode destroyQTKQ ()
 destroy sub-matrices used for shell matrix QTKQ More...
 

Public Attributes

MoFEM::InterfacemField
 
KSP kSP
 
Mat C
 
Mat CT
 
Mat CCT
 
Mat CTC
 
Mat K
 
Vec Cx
 
Vec CCTm1_Cx
 
Vec CT_CCTm1_Cx
 
Vec CTCx
 
Vec X
 
Vec Qx
 
Vec KQx
 
bool initQorP
 
bool initQTKQ
 
bool createKSP
 
bool createScatter
 
bool cancelKSPMonitor
 
bool ownConstrainMatrix
 
VecScatter sCatter
 
string xProblem
 
string yProblem
 
PetscLogEvent MOFEM_EVENT_projInit
 
PetscLogEvent MOFEM_EVENT_projQ
 
PetscLogEvent MOFEM_EVENT_projP
 
PetscLogEvent MOFEM_EVENT_projR
 
PetscLogEvent MOFEM_EVENT_projRT
 
PetscLogEvent MOFEM_EVENT_projCTC_QTKQ
 
PetscReal rTol
 
PetscReal absTol
 
PetscReal dTol
 
PetscInt maxIts
 

Friends

MoFEMErrorCode ProjectionMatrixMultOpQ (Mat Q, Vec x, Vec f)
 Multiplication operator for Q = I-CTC(CCT)^-1C. More...
 
MoFEMErrorCode ConstrainMatrixMultOpP (Mat P, Vec x, Vec f)
 Multiplication operator for P = CT(CCT)^-1C. More...
 
MoFEMErrorCode ConstrainMatrixMultOpR (Mat R, Vec x, Vec f)
 Multiplication operator for R = CT(CCT)^-1. More...
 
MoFEMErrorCode ConstrainMatrixMultOpRT (Mat RT, Vec x, Vec f)
 Multiplication operator for RT = (CCT)^-TC. More...
 
MoFEMErrorCode ConstrainMatrixMultOpCTC_QTKQ (Mat CTC_QTKQ, Vec x, Vec f)
 Multiplication operator for RT = (CCT)^-TC. More...
 
MoFEMErrorCode ConstrainMatrixDestroyOpPorQ ()
 
MoFEMErrorCode ConstrainMatrixDestroyOpQTKQ ()
 

Detailed Description

structure for projection matrices

Definition at line 16 of file ConstrainMatrixCtx.hpp.

Constructor & Destructor Documentation

◆ ConstrainMatrixCtx() [1/2]

ConstrainMatrixCtx::ConstrainMatrixCtx ( MoFEM::Interface m_field,
string  x_problem,
string  y_problem,
bool  create_ksp = true,
bool  own_contrain_matrix = false 
)

Construct data structure to build operators for projection matrices

User need to set matrix C to make it work

Parameters
x_problemproblem on which vector is projected
y_problemproblem used to construct projection matrices
create_kspcreate ksp solver otherwise user need to set it up

Definition at line 23 of file ConstrainMatrixCtx.cpp.

27  : mField(m_field), INIT_DATA_CONSTRAINMATRIXCTX, xProblem(x_problem),
28  yProblem(y_problem) {
29  PetscLogEventRegister("ProjectionInit", 0, &MOFEM_EVENT_projInit);
30  PetscLogEventRegister("ProjectionQ", 0, &MOFEM_EVENT_projQ);
31  PetscLogEventRegister("ProjectionP", 0, &MOFEM_EVENT_projP);
32  PetscLogEventRegister("ProjectionR", 0, &MOFEM_EVENT_projR);
33  PetscLogEventRegister("ProjectionRT", 0, &MOFEM_EVENT_projRT);
34  PetscLogEventRegister("ProjectionCTC_QTKQ", 0, &MOFEM_EVENT_projCTC_QTKQ);
35 }

◆ ConstrainMatrixCtx() [2/2]

ConstrainMatrixCtx::ConstrainMatrixCtx ( MoFEM::Interface m_field,
VecScatter  scatter,
bool  create_ksp = true,
bool  own_contrain_matrix = false 
)

Definition at line 37 of file ConstrainMatrixCtx.cpp.

40  : mField(m_field), INIT_DATA_CONSTRAINMATRIXCTX, sCatter(scatter) {
41  PetscLogEventRegister("ProjectionInit", 0, &MOFEM_EVENT_projInit);
42  PetscLogEventRegister("ProjectionQ", 0, &MOFEM_EVENT_projQ);
43  PetscLogEventRegister("ProjectionP", 0, &MOFEM_EVENT_projP);
44  PetscLogEventRegister("ProjectionR", 0, &MOFEM_EVENT_projR);
45  PetscLogEventRegister("ProjectionRT", 0, &MOFEM_EVENT_projRT);
46  PetscLogEventRegister("ProjectionCTC_QTKQ", 0, &MOFEM_EVENT_projCTC_QTKQ);
47 }

◆ ~ConstrainMatrixCtx()

virtual ConstrainMatrixCtx::~ConstrainMatrixCtx ( )
inlinevirtual

Definition at line 59 of file ConstrainMatrixCtx.hpp.

59  {
60  ierr = destroyQorP();
61  CHKERRABORT(mField.get_comm(), ierr);
62  ierr = destroyQTKQ();
63  CHKERRABORT(mField.get_comm(), ierr);
64  if (ownConstrainMatrix) {
65  ierr = MatDestroy(&C);
66  CHKERRABORT(mField.get_comm(), ierr);
67  }
68  };

Member Function Documentation

◆ destroyQorP()

MoFEMErrorCode ConstrainMatrixCtx::destroyQorP ( )

destroy sub-matrices used for shell matrices P, Q, R, RT

Definition at line 98 of file ConstrainMatrixCtx.cpp.

98  {
100  if (initQorP)
102  CHKERR MatDestroy(&CT);
103  CHKERR MatDestroy(&CCT);
104  if (createKSP) {
105  CHKERR KSPDestroy(&kSP);
106  }
107  CHKERR VecDestroy(&X);
108  CHKERR VecDestroy(&Cx);
109  CHKERR VecDestroy(&CCTm1_Cx);
110  CHKERR VecDestroy(&CT_CCTm1_Cx);
111  if (createScatter) {
112  CHKERR VecScatterDestroy(&sCatter);
113  }
114  initQorP = true;
116 }

◆ destroyQTKQ()

MoFEMErrorCode ConstrainMatrixCtx::destroyQTKQ ( )

destroy sub-matrices used for shell matrix QTKQ

Definition at line 155 of file ConstrainMatrixCtx.cpp.

155  {
157  if (initQTKQ)
159  CHKERR MatDestroy(&CTC);
160  CHKERR VecDestroy(&Qx);
161  CHKERR VecDestroy(&KQx);
162  CHKERR VecDestroy(&CTCx);
163  initQTKQ = true;
165 }

◆ initializeQorP()

MoFEMErrorCode ConstrainMatrixCtx::initializeQorP ( Vec  x)

initialize vectors and matrices for Q and P shell matrices, scattering is set based on x_problem and y_problem

Parameters
xis a vector from problem x

Definition at line 49 of file ConstrainMatrixCtx.cpp.

49  {
51  if (initQorP) {
52  initQorP = false;
53 
54  PetscLogEventBegin(MOFEM_EVENT_projInit, 0, 0, 0, 0);
55  CHKERR MatTranspose(C, MAT_INITIAL_MATRIX, &CT);
56  // need to be calculated when C is changed
57  CHKERR MatTransposeMatMult(CT, CT, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CCT);
58  if (createKSP) {
59  CHKERR KSPCreate(mField.get_comm(), &kSP);
60  // need to be recalculated when C is changed
61  CHKERR KSPSetOperators(kSP, CCT, CCT);
62  CHKERR KSPSetFromOptions(kSP);
63  CHKERR KSPSetInitialGuessKnoll(kSP, PETSC_TRUE);
64  CHKERR KSPGetTolerances(kSP, &rTol, &absTol, &dTol, &maxIts);
65  CHKERR KSPSetUp(kSP);
66  if (cancelKSPMonitor) {
67  CHKERR KSPMonitorCancel(kSP);
68  }
69  }
70 #if PETSC_VERSION_GE(3, 5, 3)
71  CHKERR MatCreateVecs(C, &X, PETSC_NULL);
72  CHKERR MatCreateVecs(C, PETSC_NULL, &Cx);
73  CHKERR MatCreateVecs(CCT, PETSC_NULL, &CCTm1_Cx);
74 #else
75  CHKERR MatGetVecs(C, &X, PETSC_NULL);
76  CHKERR MatGetVecs(C, PETSC_NULL, &Cx);
77  CHKERR MatGetVecs(CCT, PETSC_NULL, &CCTm1_Cx);
78 #endif
79  CHKERR VecDuplicate(X, &CT_CCTm1_Cx);
80  if (createScatter) {
81  CHKERR mField.getInterface<VecManager>()->vecScatterCreate(
82  x, xProblem, ROW, X, yProblem, COL, &sCatter);
83  }
84  PetscLogEventEnd(MOFEM_EVENT_projInit, 0, 0, 0, 0);
85  }
87 }

◆ initializeQTKQ()

MoFEMErrorCode ConstrainMatrixCtx::initializeQTKQ ( )

initialize vectors and matrices for CTC+QTKQ shell matrices, scattering is set based on x_problem and y_problem

Definition at line 118 of file ConstrainMatrixCtx.cpp.

118  {
120  if (initQTKQ) {
121  initQTKQ = false;
122  PetscLogEventBegin(MOFEM_EVENT_projInit, 0, 0, 0, 0);
123  // need to be recalculated when C is changed
124  CHKERR MatTransposeMatMult(C, C, MAT_INITIAL_MATRIX, PETSC_DEFAULT, &CTC);
125  if (debug) {
126  // MatView(CCT,PETSC_VIEWER_DRAW_WORLD);
127  int m, n;
128  MatGetSize(CCT, &m, &n);
129  PetscPrintf(mField.get_comm(), "CCT size (%d,%d)\n", m, n);
130  // std::string wait;
131  // std::cin >> wait;
132  }
133 #if PETSC_VERSION_GE(3, 5, 3)
134  CHKERR MatCreateVecs(K, &Qx, PETSC_NULL);
135  CHKERR MatCreateVecs(K, PETSC_NULL, &KQx);
136  CHKERR MatCreateVecs(CTC, PETSC_NULL, &CTCx);
137 #else
138  CHKERR MatGetVecs(K, &Qx, PETSC_NULL);
139  CHKERR MatGetVecs(K, PETSC_NULL, &KQx);
140  CHKERR MatGetVecs(CTC, PETSC_NULL, &CTCx);
141 #endif
142  PetscLogEventEnd(MOFEM_EVENT_projInit, 0, 0, 0, 0);
143  }
145 }

◆ recalculateCTandCCT()

MoFEMErrorCode ConstrainMatrixCtx::recalculateCTandCCT ( )

re-calculate CT and CCT if C matrix has been changed since initialization

Definition at line 89 of file ConstrainMatrixCtx.cpp.

89  {
91  if (initQorP)
93  CHKERR MatTranspose(C, MAT_REUSE_MATRIX, &CT);
94  CHKERR MatTransposeMatMult(CT, CT, MAT_REUSE_MATRIX, PETSC_DEFAULT, &CCT);
96 }

◆ recalculateCTC()

MoFEMErrorCode ConstrainMatrixCtx::recalculateCTC ( )

re-calculate CTC matrix has been changed since initialization

Definition at line 147 of file ConstrainMatrixCtx.cpp.

147  {
149  if (initQTKQ)
151  CHKERR MatTransposeMatMult(C, C, MAT_REUSE_MATRIX, PETSC_DEFAULT, &CTC);
153 }

Friends And Related Function Documentation

◆ ConstrainMatrixDestroyOpPorQ

MoFEMErrorCode ConstrainMatrixDestroyOpPorQ ( )
friend

◆ ConstrainMatrixDestroyOpQTKQ

MoFEMErrorCode ConstrainMatrixDestroyOpQTKQ ( )
friend

◆ ConstrainMatrixMultOpCTC_QTKQ

MoFEMErrorCode ConstrainMatrixMultOpCTC_QTKQ ( Mat  CTC_QTKQ,
Vec  x,
Vec  f 
)
friend

Multiplication operator for RT = (CCT)^-TC.

Mat CTC_QTKQ; //for problem
projection_matrix_ctx(m_field,problem_name,contrains_problem_name);
MatCreateShell(PETSC_COMM_WORLD,m,m,M,M,&projection_matrix_ctx,&CTC_QTKQ);
MatShellSetOperation(CTC_QTKQ,MATOP_MULT,(void(*)(void))ConstrainMatrixMultOpCTC_QTKQ);
MatShellSetOperation(CTC_QTKQ,MATOP_DESTROY,(void(*)(void))ConstrainMatrixDestroyOpQTKQ);

Definition at line 265 of file ConstrainMatrixCtx.cpp.

265  {
267  void *void_ctx;
268  CHKERR MatShellGetContext(CTC_QTKQ, &void_ctx);
269  ConstrainMatrixCtx *ctx = (ConstrainMatrixCtx *)void_ctx;
270  PetscLogEventBegin(ctx->MOFEM_EVENT_projCTC_QTKQ, 0, 0, 0, 0);
271  Mat Q;
272  int M, N, m, n;
273  CHKERR MatGetSize(ctx->K, &M, &N);
274  CHKERR MatGetLocalSize(ctx->K, &m, &n);
275  CHKERR MatCreateShell(ctx->mField.get_comm(), m, n, M, N, ctx, &Q);
276  CHKERR MatShellSetOperation(Q, MATOP_MULT,
277  (void (*)(void))ProjectionMatrixMultOpQ);
278  CHKERR ctx->initializeQTKQ();
279  CHKERR MatMult(Q, x, ctx->Qx);
280  CHKERR MatMult(ctx->K, ctx->Qx, ctx->KQx);
281  CHKERR MatMult(Q, ctx->KQx, f);
282  CHKERR VecScatterBegin(ctx->sCatter, x, ctx->X, INSERT_VALUES,
283  SCATTER_FORWARD);
284  CHKERR VecScatterEnd(ctx->sCatter, x, ctx->X, INSERT_VALUES, SCATTER_FORWARD);
285  CHKERR MatMult(ctx->CTC, ctx->X, ctx->CTCx);
286  CHKERR VecScatterBegin(ctx->sCatter, ctx->CTCx, f, ADD_VALUES,
287  SCATTER_REVERSE);
288  CHKERR VecScatterEnd(ctx->sCatter, ctx->CTCx, f, ADD_VALUES, SCATTER_REVERSE);
289  CHKERR MatDestroy(&Q);
290  PetscLogEventEnd(ctx->MOFEM_EVENT_projCTC_QTKQ, 0, 0, 0, 0);
292 }

◆ ConstrainMatrixMultOpP

MoFEMErrorCode ConstrainMatrixMultOpP ( Mat  P,
Vec  x,
Vec  f 
)
friend

Multiplication operator for P = CT(CCT)^-1C.

Mat P; //for problem
projection_matrix_ctx(m_field,problem_name,contrains_problem_name);
CHKERR MatCreateShell(PETSC_COMM_WORLD,m,m,M,M,&projection_matrix_ctx,&P);
MatShellSetOperation(P,MATOP_MULT,(void(*)(void))ConstrainMatrixMultOpP);

Definition at line 201 of file ConstrainMatrixCtx.cpp.

201  {
203  void *void_ctx;
204  CHKERR MatShellGetContext(P, &void_ctx);
205  ConstrainMatrixCtx *ctx = (ConstrainMatrixCtx *)void_ctx;
206  PetscLogEventBegin(ctx->MOFEM_EVENT_projP, 0, 0, 0, 0);
207  CHKERR ctx->initializeQorP(x);
208  CHKERR VecScatterBegin(ctx->sCatter, x, ctx->X, INSERT_VALUES,
209  SCATTER_FORWARD);
210  CHKERR VecScatterEnd(ctx->sCatter, x, ctx->X, INSERT_VALUES, SCATTER_FORWARD);
211  CHKERR MatMult(ctx->C, ctx->X, ctx->Cx);
212  CHKERR KSPSolve(ctx->kSP, ctx->Cx, ctx->CCTm1_Cx);
213  CHKERR MatMult(ctx->CT, ctx->CCTm1_Cx, ctx->CT_CCTm1_Cx);
214  CHKERR VecZeroEntries(f);
215  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
216  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
217  CHKERR VecScatterBegin(ctx->sCatter, ctx->CT_CCTm1_Cx, f, INSERT_VALUES,
218  SCATTER_REVERSE);
219  CHKERR VecScatterEnd(ctx->sCatter, ctx->CT_CCTm1_Cx, f, INSERT_VALUES,
220  SCATTER_REVERSE);
221  PetscLogEventEnd(ctx->MOFEM_EVENT_projP, 0, 0, 0, 0);
223 }

◆ ConstrainMatrixMultOpR

MoFEMErrorCode ConstrainMatrixMultOpR ( Mat  R,
Vec  x,
Vec  f 
)
friend

Multiplication operator for R = CT(CCT)^-1.

Mat R; //for problem
projection_matrix_ctx(m_field,problem_name,contrains_problem_name);
CHKERR MatCreateShell(PETSC_COMM_WORLD,m,m,M,M,&projection_matrix_ctx,&R);
MatShellSetOperation(R,MATOP_MULT,(void(*)(void))ConstrainMatrixMultOpR);

Definition at line 225 of file ConstrainMatrixCtx.cpp.

225  {
227  void *void_ctx;
228  CHKERR MatShellGetContext(R, &void_ctx);
229  ConstrainMatrixCtx *ctx = (ConstrainMatrixCtx *)void_ctx;
230  PetscLogEventBegin(ctx->MOFEM_EVENT_projR, 0, 0, 0, 0);
231  if (ctx->initQorP)
232  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE,
233  "you have to call first initQorP or use Q matrix");
234  CHKERR KSPSolve(ctx->kSP, x, ctx->CCTm1_Cx);
235  CHKERR MatMult(ctx->CT, ctx->CCTm1_Cx, ctx->CT_CCTm1_Cx);
236  CHKERR VecZeroEntries(f);
237  CHKERR VecGhostUpdateBegin(f, INSERT_VALUES, SCATTER_FORWARD);
238  CHKERR VecGhostUpdateEnd(f, INSERT_VALUES, SCATTER_FORWARD);
239  CHKERR VecScatterBegin(ctx->sCatter, ctx->CT_CCTm1_Cx, f, INSERT_VALUES,
240  SCATTER_REVERSE);
241  CHKERR VecScatterEnd(ctx->sCatter, ctx->CT_CCTm1_Cx, f, INSERT_VALUES,
242  SCATTER_REVERSE);
243  PetscLogEventEnd(ctx->MOFEM_EVENT_projR, 0, 0, 0, 0);
245 }

◆ ConstrainMatrixMultOpRT

MoFEMErrorCode ConstrainMatrixMultOpRT ( Mat  RT,
Vec  x,
Vec  f 
)
friend

Multiplication operator for RT = (CCT)^-TC.

Mat RT; //for problem
projection_matrix_ctx(m_field,problem_name,contrains_problem_name);
CHKERR MatCreateShell(PETSC_COMM_WORLD,m,m,M,M,&projection_matrix_ctx,&RT);
MatShellSetOperation(RT,MATOP_MULT,(void(*)(void))ConstrainMatrixMultOpRT);

Definition at line 247 of file ConstrainMatrixCtx.cpp.

247  {
249  void *void_ctx;
250  CHKERR MatShellGetContext(RT, &void_ctx);
251  ConstrainMatrixCtx *ctx = (ConstrainMatrixCtx *)void_ctx;
252  PetscLogEventBegin(ctx->MOFEM_EVENT_projRT, 0, 0, 0, 0);
253  if (ctx->initQorP)
254  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE,
255  "you have to call first initQorP or use Q matrix");
256  CHKERR VecScatterBegin(ctx->sCatter, x, ctx->X, INSERT_VALUES,
257  SCATTER_FORWARD);
258  CHKERR VecScatterEnd(ctx->sCatter, x, ctx->X, INSERT_VALUES, SCATTER_FORWARD);
259  CHKERR MatMult(ctx->C, ctx->X, ctx->Cx);
260  CHKERR KSPSolve(ctx->kSP, ctx->Cx, f);
261  PetscLogEventEnd(ctx->MOFEM_EVENT_projRT, 0, 0, 0, 0);
263 }

◆ ProjectionMatrixMultOpQ

MoFEMErrorCode ProjectionMatrixMultOpQ ( Mat  Q,
Vec  x,
Vec  f 
)
friend

Multiplication operator for Q = I-CTC(CCT)^-1C.

Mat Q; //for problem
projection_matrix_ctx(m_field,problem_name,contrains_problem_name);
CHKERR MatCreateShell(PETSC_COMM_WORLD,m,m,M,M,&projection_matrix_ctx,&Q);
MatShellSetOperation(Q,MATOP_MULT,(void(*)(void))ProjectionMatrixMultOpQ);
MatShellSetOperation(Q,MATOP_DESTROY,(void(*)(void))ConstrainMatrixDestroyOpPorQ);

Definition at line 167 of file ConstrainMatrixCtx.cpp.

167  {
169  void *void_ctx;
170  CHKERR MatShellGetContext(Q, &void_ctx);
171  ConstrainMatrixCtx *ctx = (ConstrainMatrixCtx *)void_ctx;
172  PetscLogEventBegin(ctx->MOFEM_EVENT_projQ, 0, 0, 0, 0);
173  CHKERR ctx->initializeQorP(x);
174  CHKERR VecCopy(x, f);
175  CHKERR VecScatterBegin(ctx->sCatter, x, ctx->X, INSERT_VALUES,
176  SCATTER_FORWARD);
177  CHKERR VecScatterEnd(ctx->sCatter, x, ctx->X, INSERT_VALUES, SCATTER_FORWARD);
178  if (debug) {
179  // CHKERR VecView(ctx->X,PETSC_VIEWER_STDOUT_WORLD);
180  CHKERR VecScatterBegin(ctx->sCatter, ctx->X, f, INSERT_VALUES,
181  SCATTER_REVERSE);
182  CHKERR VecScatterEnd(ctx->sCatter, ctx->X, f, INSERT_VALUES,
183  SCATTER_REVERSE);
184  PetscBool flg;
185  CHKERR VecEqual(x, f, &flg);
186  if (flg == PETSC_FALSE)
187  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "scatter is not working");
188  }
189  CHKERR MatMult(ctx->C, ctx->X, ctx->Cx);
190  CHKERR KSPSolve(ctx->kSP, ctx->Cx, ctx->CCTm1_Cx);
191  CHKERR MatMult(ctx->CT, ctx->CCTm1_Cx, ctx->CT_CCTm1_Cx);
192  CHKERR VecScale(ctx->CT_CCTm1_Cx, -1);
193  CHKERR VecScatterBegin(ctx->sCatter, ctx->CT_CCTm1_Cx, f, ADD_VALUES,
194  SCATTER_REVERSE);
195  CHKERR VecScatterEnd(ctx->sCatter, ctx->CT_CCTm1_Cx, f, ADD_VALUES,
196  SCATTER_REVERSE);
197  PetscLogEventEnd(ctx->MOFEM_EVENT_projQ, 0, 0, 0, 0);
199 }

Member Data Documentation

◆ absTol

PetscReal ConstrainMatrixCtx::absTol

Definition at line 70 of file ConstrainMatrixCtx.hpp.

◆ C

Mat ConstrainMatrixCtx::C

Definition at line 21 of file ConstrainMatrixCtx.hpp.

◆ cancelKSPMonitor

bool ConstrainMatrixCtx::cancelKSPMonitor

Definition at line 27 of file ConstrainMatrixCtx.hpp.

◆ CCT

Mat ConstrainMatrixCtx::CCT

Definition at line 21 of file ConstrainMatrixCtx.hpp.

◆ CCTm1_Cx

Vec ConstrainMatrixCtx::CCTm1_Cx

Definition at line 22 of file ConstrainMatrixCtx.hpp.

◆ createKSP

bool ConstrainMatrixCtx::createKSP

Definition at line 25 of file ConstrainMatrixCtx.hpp.

◆ createScatter

bool ConstrainMatrixCtx::createScatter

Definition at line 26 of file ConstrainMatrixCtx.hpp.

◆ CT

Mat ConstrainMatrixCtx::CT

Definition at line 21 of file ConstrainMatrixCtx.hpp.

◆ CT_CCTm1_Cx

Vec ConstrainMatrixCtx::CT_CCTm1_Cx

Definition at line 22 of file ConstrainMatrixCtx.hpp.

◆ CTC

Mat ConstrainMatrixCtx::CTC

Definition at line 21 of file ConstrainMatrixCtx.hpp.

◆ CTCx

Vec ConstrainMatrixCtx::CTCx

Definition at line 22 of file ConstrainMatrixCtx.hpp.

◆ Cx

Vec ConstrainMatrixCtx::Cx

Definition at line 22 of file ConstrainMatrixCtx.hpp.

◆ dTol

PetscReal ConstrainMatrixCtx::dTol

Definition at line 70 of file ConstrainMatrixCtx.hpp.

◆ initQorP

bool ConstrainMatrixCtx::initQorP

Definition at line 24 of file ConstrainMatrixCtx.hpp.

◆ initQTKQ

bool ConstrainMatrixCtx::initQTKQ

Definition at line 24 of file ConstrainMatrixCtx.hpp.

◆ K

Mat ConstrainMatrixCtx::K

Definition at line 21 of file ConstrainMatrixCtx.hpp.

◆ KQx

Vec ConstrainMatrixCtx::KQx

Definition at line 23 of file ConstrainMatrixCtx.hpp.

◆ kSP

KSP ConstrainMatrixCtx::kSP

Definition at line 20 of file ConstrainMatrixCtx.hpp.

◆ maxIts

PetscInt ConstrainMatrixCtx::maxIts

Definition at line 71 of file ConstrainMatrixCtx.hpp.

◆ mField

MoFEM::Interface& ConstrainMatrixCtx::mField

Definition at line 18 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projCTC_QTKQ

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projCTC_QTKQ

Definition at line 41 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projInit

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projInit

Definition at line 36 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projP

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projP

Definition at line 38 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projQ

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projQ

Definition at line 37 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projR

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projR

Definition at line 39 of file ConstrainMatrixCtx.hpp.

◆ MOFEM_EVENT_projRT

PetscLogEvent ConstrainMatrixCtx::MOFEM_EVENT_projRT

Definition at line 40 of file ConstrainMatrixCtx.hpp.

◆ ownConstrainMatrix

bool ConstrainMatrixCtx::ownConstrainMatrix

Definition at line 28 of file ConstrainMatrixCtx.hpp.

◆ Qx

Vec ConstrainMatrixCtx::Qx

Definition at line 23 of file ConstrainMatrixCtx.hpp.

◆ rTol

PetscReal ConstrainMatrixCtx::rTol

Definition at line 68 of file ConstrainMatrixCtx.hpp.

◆ sCatter

VecScatter ConstrainMatrixCtx::sCatter

Definition at line 33 of file ConstrainMatrixCtx.hpp.

◆ X

Vec ConstrainMatrixCtx::X

Definition at line 23 of file ConstrainMatrixCtx.hpp.

◆ xProblem

string ConstrainMatrixCtx::xProblem

Definition at line 34 of file ConstrainMatrixCtx.hpp.

◆ yProblem

string ConstrainMatrixCtx::yProblem

Definition at line 34 of file ConstrainMatrixCtx.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:447
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition: UnknownInterface.hpp:93
ConstrainMatrixCtx::initializeQorP
MoFEMErrorCode initializeQorP(Vec x)
initialize vectors and matrices for Q and P shell matrices, scattering is set based on x_problem and ...
Definition: ConstrainMatrixCtx.cpp:49
INIT_DATA_CONSTRAINMATRIXCTX
#define INIT_DATA_CONSTRAINMATRIXCTX
Definition: ConstrainMatrixCtx.cpp:15
ConstrainMatrixCtx::dTol
PetscReal dTol
Definition: ConstrainMatrixCtx.hpp:70
ConstrainMatrixCtx::KQx
Vec KQx
Definition: ConstrainMatrixCtx.hpp:23
ConstrainMatrixCtx::destroyQorP
MoFEMErrorCode destroyQorP()
destroy sub-matrices used for shell matrices P, Q, R, RT
Definition: ConstrainMatrixCtx.cpp:98
ConstrainMatrixCtx::initQTKQ
bool initQTKQ
Definition: ConstrainMatrixCtx.hpp:24
ConstrainMatrixCtx::absTol
PetscReal absTol
Definition: ConstrainMatrixCtx.hpp:70
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
ConstrainMatrixCtx::MOFEM_EVENT_projCTC_QTKQ
PetscLogEvent MOFEM_EVENT_projCTC_QTKQ
Definition: ConstrainMatrixCtx.hpp:41
ConstrainMatrixCtx::rTol
PetscReal rTol
Definition: ConstrainMatrixCtx.hpp:68
ConstrainMatrixCtx::ConstrainMatrixMultOpCTC_QTKQ
friend MoFEMErrorCode ConstrainMatrixMultOpCTC_QTKQ(Mat CTC_QTKQ, Vec x, Vec f)
Multiplication operator for RT = (CCT)^-TC.
Definition: ConstrainMatrixCtx.cpp:265
ConstrainMatrixCtx::ConstrainMatrixMultOpRT
friend MoFEMErrorCode ConstrainMatrixMultOpRT(Mat RT, Vec x, Vec f)
Multiplication operator for RT = (CCT)^-TC.
Definition: ConstrainMatrixCtx.cpp:247
ConstrainMatrixCtx::X
Vec X
Definition: ConstrainMatrixCtx.hpp:23
ConstrainMatrixCtx::C
Mat C
Definition: ConstrainMatrixCtx.hpp:21
ConstrainMatrixCtx::K
Mat K
Definition: ConstrainMatrixCtx.hpp:21
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
ConstrainMatrixCtx::kSP
KSP kSP
Definition: ConstrainMatrixCtx.hpp:20
ConstrainMatrixCtx::initQorP
bool initQorP
Definition: ConstrainMatrixCtx.hpp:24
ConstrainMatrixCtx::ConstrainMatrixDestroyOpPorQ
friend MoFEMErrorCode ConstrainMatrixDestroyOpPorQ()
ConstrainMatrixCtx::destroyQTKQ
MoFEMErrorCode destroyQTKQ()
destroy sub-matrices used for shell matrix QTKQ
Definition: ConstrainMatrixCtx.cpp:155
ROW
@ ROW
Definition: definitions.h:123
PlasticOps::M
FTensor::Index< 'M', 3 > M
Definition: PlasticOps.hpp:117
ConstrainMatrixCtx::ConstrainMatrixMultOpR
friend MoFEMErrorCode ConstrainMatrixMultOpR(Mat R, Vec x, Vec f)
Multiplication operator for R = CT(CCT)^-1.
Definition: ConstrainMatrixCtx.cpp:225
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
ConstrainMatrixCtx::Cx
Vec Cx
Definition: ConstrainMatrixCtx.hpp:22
ConstrainMatrixCtx::MOFEM_EVENT_projR
PetscLogEvent MOFEM_EVENT_projR
Definition: ConstrainMatrixCtx.hpp:39
ConstrainMatrixCtx::yProblem
string yProblem
Definition: ConstrainMatrixCtx.hpp:34
ConstrainMatrixCtx::Qx
Vec Qx
Definition: ConstrainMatrixCtx.hpp:23
R
@ R
Definition: free_surface.cpp:394
ConstrainMatrixCtx::ConstrainMatrixMultOpP
friend MoFEMErrorCode ConstrainMatrixMultOpP(Mat P, Vec x, Vec f)
Multiplication operator for P = CT(CCT)^-1C.
Definition: ConstrainMatrixCtx.cpp:201
ConstrainMatrixCtx::MOFEM_EVENT_projInit
PetscLogEvent MOFEM_EVENT_projInit
Definition: ConstrainMatrixCtx.hpp:36
ConstrainMatrixCtx::xProblem
string xProblem
Definition: ConstrainMatrixCtx.hpp:34
ConstrainMatrixCtx::ProjectionMatrixMultOpQ
friend MoFEMErrorCode ProjectionMatrixMultOpQ(Mat Q, Vec x, Vec f)
Multiplication operator for Q = I-CTC(CCT)^-1C.
Definition: ConstrainMatrixCtx.cpp:167
EshelbianPlasticity::P
@ P
Definition: EshelbianContact.cpp:193
COL
@ COL
Definition: definitions.h:123
ConstrainMatrixCtx::CT_CCTm1_Cx
Vec CT_CCTm1_Cx
Definition: ConstrainMatrixCtx.hpp:22
ConstrainMatrixCtx::sCatter
VecScatter sCatter
Definition: ConstrainMatrixCtx.hpp:33
ConstrainMatrixCtx::createKSP
bool createKSP
Definition: ConstrainMatrixCtx.hpp:25
ConstrainMatrixCtx::ownConstrainMatrix
bool ownConstrainMatrix
Definition: ConstrainMatrixCtx.hpp:28
ConstrainMatrixCtx::MOFEM_EVENT_projRT
PetscLogEvent MOFEM_EVENT_projRT
Definition: ConstrainMatrixCtx.hpp:40
ConstrainMatrixCtx::CTC
Mat CTC
Definition: ConstrainMatrixCtx.hpp:21
ConstrainMatrixCtx::CCTm1_Cx
Vec CCTm1_Cx
Definition: ConstrainMatrixCtx.hpp:22
ConstrainMatrixCtx::ConstrainMatrixDestroyOpQTKQ
friend MoFEMErrorCode ConstrainMatrixDestroyOpQTKQ()
MoFEM::VecManager
Vector manager is used to create vectors \mofem_vectors.
Definition: VecManager.hpp:23
convert.n
n
Definition: convert.py:82
ConstrainMatrixCtx::MOFEM_EVENT_projP
PetscLogEvent MOFEM_EVENT_projP
Definition: ConstrainMatrixCtx.hpp:38
N
const int N
Definition: speed_test.cpp:3
ConstrainMatrixCtx::CTCx
Vec CTCx
Definition: ConstrainMatrixCtx.hpp:22
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
ConstrainMatrixCtx::mField
MoFEM::Interface & mField
Definition: ConstrainMatrixCtx.hpp:18
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
ConstrainMatrixCtx::MOFEM_EVENT_projQ
PetscLogEvent MOFEM_EVENT_projQ
Definition: ConstrainMatrixCtx.hpp:37
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
ConstrainMatrixCtx::cancelKSPMonitor
bool cancelKSPMonitor
Definition: ConstrainMatrixCtx.hpp:27
ConstrainMatrixCtx::CT
Mat CT
Definition: ConstrainMatrixCtx.hpp:21
debug
const static bool debug
Definition: ConstrainMatrixCtx.cpp:13
ConstrainMatrixCtx
structure for projection matrices
Definition: ConstrainMatrixCtx.hpp:16
ConstrainMatrixCtx::initializeQTKQ
MoFEMErrorCode initializeQTKQ()
initialize vectors and matrices for CTC+QTKQ shell matrices, scattering is set based on x_problem and...
Definition: ConstrainMatrixCtx.cpp:118
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
ConstrainMatrixCtx::maxIts
PetscInt maxIts
Definition: ConstrainMatrixCtx.hpp:71
ConstrainMatrixCtx::createScatter
bool createScatter
Definition: ConstrainMatrixCtx.hpp:26
ConstrainMatrixCtx::CCT
Mat CCT
Definition: ConstrainMatrixCtx.hpp:21