static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
SmartPetscObj<Mat> m_ptr;
auto check = [&](const int expected) {
if (m_ptr.use_count() != expected)
"use count should be %d but is %d", expected,
m_ptr.use_count());
};
{
CHKERR MatCreate(PETSC_COMM_SELF, &
m);
m_ptr = SmartPetscObj<Mat>(
m);
}
{ PetscObject obj = static_cast<PetscObject>(m_ptr); }
{
SmartPetscObj<Mat> n_ptr(m_ptr);
}
CHKERR MatSetSizes(m_ptr, 2, 2, 2, 2);
{
SmartPetscObj<Mat> n_ptr = m_ptr;
{
SmartPetscObj<Mat> i_ptr = m_ptr;
}
}
{
SmartPetscObj<Mat> n_ptr = m_ptr;
}
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.
implementation of Data Operators for Forces and Sources
int main(int argc, char *argv[])
FTensor::Index< 'm', 3 > 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.