36 #include "PetscSetupUtils.hpp"
46 #include "Citations.hpp"
47 #include "CommandLineArguments.hpp"
49 #include "GetCurrentWorkingDirectory.hpp"
50 #include "PetscException.hpp"
57 void FpeSignalToAbort(
int sig_num, siginfo_t* info,
void* context )
59 if ( info->si_code == FPE_FLTDIV)
61 std::cerr <<
"SIGFPE: floating point exception was divide by zero.\n";
63 else if ( info->si_code == FPE_FLTINV)
65 std::cerr <<
"SIGFPE: floating point exception was an invalid operation (like 0.0/0.0).\n";
69 std::cerr <<
"SIGFPE: unexpected error code.\n";
74 #if ( PETSC_VERSION_MAJOR<3 || PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<5 )
79 static PetscBool PetscCite1 = PETSC_FALSE;
80 const char PetscCitation1[] =
"@TechReport{petsc-user-ref,\n"
81 " Author = {Satish Balay and Shrirang Abhyankar and Mark F. Adams and Jed Brown and Peter Brune\n"
82 " and Kris Buschelman and Victor Eijkhout and William D. Gropp\n"
83 " and Dinesh Kaushik and Matthew G. Knepley\n"
84 " and Lois Curfman McInnes and Karl Rupp and Barry F. Smith\n"
86 " Title = {{PETS}c Users Manual},\n"
87 " Number = {ANL-95/11 - Revision 3.5},\n"
88 " Institution = {Argonne National Laboratory},\n"
91 static PetscBool PetscCite2 = PETSC_FALSE;
92 const char PetscCitation2[] =
"@InProceedings{petsc-efficient,\n"
93 " Author = {Satish Balay and William D. Gropp and Lois Curfman McInnes and Barry F. Smith},\n"
94 " Title = {Efficient Management of Parallelism in Object Oriented Numerical Software Libraries},\n"
95 " Booktitle = {Modern Software Tools in Scientific Computing},\n"
96 " Editor = {E. Arge and A. M. Bruaset and H. P. Langtangen},\n"
97 " Pages = {163--202},\n"
98 " Publisher = {Birkh{\\\"{a}}user Press},\n"
104 static PetscBool ChasteCite = PETSC_FALSE;
105 const char ChasteCitation[] =
"@article{mirams2013chaste,\n"
106 " author = {Mirams, G.R. and Arthurs, C.J. and Bernabeu, M.O. and Bordas, R. and Cooper, "
107 "J. and Corrias, A. and Davit, Y. and Dunn, S-J. and Fletcher, A.G. and Harvey, D.G. and "
108 "Marsh, M.E. and Osborne, J.M. and Pathmanathan, P. and Pitt-Francis, J. and Southern, J. "
109 "and Zemzemi, N. and Gavaghan, D.J.},\n"
110 " title = {Chaste: an open source C++ library for computational physiology and biology},\n"
111 " journal = {PLoS computational biology},\n"
114 " pages = {e1002970},\n"
116 " publisher = {Public Library of Science}\n"
123 PETSCEXCEPT(PetscInitialize(p_args->
p_argc, p_args->
p_argv, PETSC_NULL, PETSC_NULL));
131 #if ( PETSC_VERSION_MAJOR<3 || PETSC_VERSION_MAJOR==3 && PETSC_VERSION_MINOR<5 )
140 std::string cwd = GetCurrentWorkingDirectory() +
"/";
143 #define COVERAGE_IGNORE
145 std::cout << std::endl <<
"Changing directory from '" << cwd <<
"' to '" <<
ChasteSourceRootDir() <<
"'." << std::endl;
147 std::cout <<
"CWD now: " << GetCurrentWorkingDirectory() << std::endl;
148 #undef COVERAGE_IGNORE
153 feenableexcept(FE_DIVBYZERO | FE_INVALID );
156 sa.sa_sigaction = FpeSignalToAbort;
157 sa.sa_flags = SA_RESETHAND|SA_SIGINFO;
159 sigaction(SIGFPE, &sa, NULL);
166 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()