14 {
15
17
18 try {
19
21
22
23 auto check = [&](const int expected) {
27 "use count should be %d but is %d", expected,
30 };
31
32
33 {
35 CHKERR MatCreate(PETSC_COMM_SELF, &
m);
37 }
38
39
40 { PetscObject obj = static_cast<PetscObject>(m_ptr); }
41
42 {
45 }
46
48
49
50 CHKERR MatSetSizes(m_ptr, 2, 2, 2, 2);
51
52 {
53
56 {
57
60 }
62 }
63
64
65 {
66
69 }
70
71
73
74
75 m_ptr.reset();
76
77
79
80 {
82 }
83
84 }
86
88 return 0;
89}
#define CATCH_ERRORS
Catch errors.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'm', SPACE_DIM > m
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
intrusive_ptr for managing petsc objects