EXTERN_C_FOR_PETSC_END Namespace Reference
Functions | |
| std::streambuf * | out_buf (NULL) |
| std::streambuf * | err_buf (NULL) |
| void | libmesh_handleFPE (int, siginfo_t *info, void *) |
| void | enableFPE (bool on) |
Variables | |
| AutoPtr< GetPot > | command_line (NULL) |
| AutoPtr< std::ofstream > | _ofstream (NULL) |
| AutoPtr < libMesh::Threads::task_scheduler_init > | task_scheduler (NULL) |
| bool | libmesh_initialized_mpi = false |
| bool | libmesh_initialized_petsc = false |
| bool | libmesh_initialized_slepc = false |
Function Documentation
| void EXTERN_C_FOR_PETSC_END::enableFPE | ( | bool | on | ) |
Toggle floating point exceptions -- courtesy of Cody Permann & MOOSE team
Definition at line 133 of file libmesh.C.
References libmesh_handleFPE().
00134 { 00135 #if !defined(LIBMESH_HAVE_FEENABLEEXCEPT) && defined(LIBMESH_HAVE_XMMINTRIN_H) 00136 static int flags = 0; 00137 #endif 00138 00139 if (on) 00140 { 00141 struct sigaction new_action, old_action; 00142 00143 #ifdef LIBMESH_HAVE_FEENABLEEXCEPT 00144 feenableexcept(FE_DIVBYZERO | FE_INVALID); 00145 #elif LIBMESH_HAVE_XMMINTRIN_H 00146 # ifndef __SUNPRO_CC 00147 flags = _MM_GET_EXCEPTION_MASK(); // store the flags 00148 _MM_SET_EXCEPTION_MASK(flags & ~_MM_MASK_INVALID); 00149 # endif 00150 #endif 00151 00152 00153 // Set up the structure to specify the new action. 00154 new_action.sa_sigaction = libmesh_handleFPE; 00155 sigemptyset (&new_action.sa_mask); 00156 new_action.sa_flags = SA_SIGINFO; 00157 00158 sigaction (SIGFPE, NULL, &old_action); 00159 if (old_action.sa_handler != SIG_IGN) 00160 sigaction (SIGFPE, &new_action, NULL); 00161 } 00162 else 00163 { 00164 #ifdef LIBMESH_HAVE_FEDISABLEEXCEPT 00165 fedisableexcept(FE_DIVBYZERO | FE_INVALID); 00166 #elif LIBMESH_HAVE_XMMINTRIN_H 00167 # ifndef __SUNPRO_CC 00168 _MM_SET_EXCEPTION_MASK(flags); 00169 # endif 00170 #endif 00171 signal(SIGFPE, 0); 00172 } 00173 }
| std::streambuf* EXTERN_C_FOR_PETSC_END::err_buf | ( | NULL | ) |
| void EXTERN_C_FOR_PETSC_END::libmesh_handleFPE | ( | int | , | |
| siginfo_t * | info, | |||
| void * | ||||
| ) |
Floating point exception handler -- courtesy of Cody Permann & MOOSE team
Definition at line 100 of file libmesh.C.
Referenced by enableFPE().
00101 { 00102 std::cout << std::endl; 00103 std::cout << "Floating point exception signaled ("; 00104 switch (info->si_code) 00105 { 00106 case FPE_INTDIV: std::cerr << "integer divide by zero"; break; 00107 case FPE_INTOVF: std::cerr << "integer overflow"; break; 00108 case FPE_FLTDIV: std::cerr << "floating point divide by zero"; break; 00109 case FPE_FLTOVF: std::cerr << "floating point overflow"; break; 00110 case FPE_FLTUND: std::cerr << "floating point underflow"; break; 00111 case FPE_FLTRES: std::cerr << "floating point inexact result"; break; 00112 case FPE_FLTINV: std::cerr << "invalid floating point operation"; break; 00113 case FPE_FLTSUB: std::cerr << "subscript out of range"; break; 00114 default: std::cerr << "unrecognized"; break; 00115 } 00116 std::cout << ")!" << std::endl; 00117 00118 std::cout << std::endl; 00119 std::cout << "To track this down, compile debug version, start debugger, set breakpoint for 'libmesh_handleFPE' and run" << std::endl; 00120 std::cout << "In gdb do:" << std::endl; 00121 std::cout << " break libmesh_handleFPE" << std::endl; 00122 std::cout << " run ..." << std::endl; 00123 std::cout << " bt" << std::endl; 00124 00125 libmesh_error(); 00126 }
| std::streambuf* EXTERN_C_FOR_PETSC_END::out_buf | ( | NULL | ) |
Variable Documentation
| AutoPtr<std::ofstream> EXTERN_C_FOR_PETSC_END::_ofstream(NULL) |
| AutoPtr<GetPot> EXTERN_C_FOR_PETSC_END::command_line(NULL) |
| bool EXTERN_C_FOR_PETSC_END::libmesh_initialized_mpi = false |
| bool EXTERN_C_FOR_PETSC_END::libmesh_initialized_petsc = false |
| bool EXTERN_C_FOR_PETSC_END::libmesh_initialized_slepc = false |
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:05 UTC
Hosted By: