36 #include "PetscSetupUtils.hpp"
46 #include "Citations.hpp"
47 #include "CommandLineArguments.hpp"
49 #include "GetCurrentWorkingDirectory.hpp"
50 #include "PetscException.hpp"
53 #include "PetscAndChasteCitations.hpp"
59 void FpeSignalToAbort(
int sig_num, siginfo_t* info,
void* context)
61 if (info->si_code == FPE_FLTDIV)
63 std::cerr <<
"SIGFPE: floating point exception was divide by zero.\n";
65 else if (info->si_code == FPE_FLTINV)
67 std::cerr <<
"SIGFPE: floating point exception was an invalid operation (like 0.0/0.0).\n";
71 std::cerr <<
"SIGFPE: unexpected error code.\n";
80 PETSCEXCEPT(PetscInitialize(p_args->
p_argc, p_args->
p_argv, PETSC_NULL, PETSC_NULL));
90 if ((PETSC_VERSION_MAJOR < 3) || (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 5))
100 std::string cwd = GetCurrentWorkingDirectory() +
"/";
104 std::cout << std::endl
105 <<
"Changing directory from '" << cwd <<
"' to '" <<
ChasteSourceRootDir() <<
"'." << std::endl;
107 std::cout <<
"CWD now: " << GetCurrentWorkingDirectory() << std::endl;
112 feenableexcept(FE_DIVBYZERO | FE_INVALID);
115 sa.sa_sigaction = FpeSignalToAbort;
116 sa.sa_flags = SA_RESETHAND | SA_SIGINFO;
118 sigaction(SIGFPE, &sa, NULL);
127 PETSCEXCEPT(PetscFinalize());
const char * ChasteSourceRootDir()
static void CommonSetup()
static void InitialisePetsc()
#define EXPECT0(cmd, arg)
static void CommonFinalize()
static void ResetStatusCache()
static void Register(const char *pCitation, PetscBool *pSet)
static CommandLineArguments * Instance()