Create and destroy PETSc objects with smart pointer.
Create and destroy PETSc objects with smart pointer
static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
auto check = [&](const int expected) {
"use count should be %d but is %d", expected,
};
{
CHKERR MatCreate(PETSC_COMM_SELF, &
m);
}
{ std::ignore = static_cast<PetscObject>(m_ptr); }
{
}
CHKERR MatSetSizes(m_ptr, 2, 2, 2, 2);
{
{
}
}
{
}
m_ptr.reset();
{
}
}
return 0;
}
#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
implementation of Data Operators for Forces and Sources
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