Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -52,18 +52,18 @@ G4PyCoutDestination::~G4PyCoutDestination()
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cout(G4String coutString)
|
||||
/////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cout(const G4String& coutString)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
PySys_WriteStdout("%s", coutString.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cerr(G4String cerrString)
|
||||
/////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
G4int G4PyCoutDestination::ReceiveG4cerr(const G4String& cerrString)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
PySys_WriteStderr("%s", cerrString.c_str());
|
||||
return 0;
|
||||
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
G4PyCoutDestination();
|
||||
~G4PyCoutDestination();
|
||||
|
||||
virtual G4int ReceiveG4cout(G4String coutString);
|
||||
virtual G4int ReceiveG4cerr(G4String cerrString);
|
||||
virtual G4int ReceiveG4cout(const G4String& coutString);
|
||||
virtual G4int ReceiveG4cerr(const G4String& cerrString);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <boost/python.hpp>
|
||||
#include "G4VExceptionHandler.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
@@ -52,43 +53,47 @@ public:
|
||||
G4ExceptionSeverity severity,
|
||||
const char* description) {
|
||||
|
||||
G4cerr << "*** G4Exception : " << exceptionCode << G4endl;
|
||||
G4cerr << " issued by : " << originOfException << G4endl;
|
||||
G4cerr << description << G4endl;
|
||||
G4cerr << G4endl << "Severity : ";
|
||||
|
||||
std::ostringstream message;
|
||||
message << "*** G4Exception : " << exceptionCode << G4endl
|
||||
<< " issued by : " << originOfException << G4endl
|
||||
<< description << G4endl;
|
||||
|
||||
switch(severity) {
|
||||
case FatalException:
|
||||
PyErr_SetString(PyExc_AssertionError,
|
||||
"*** Fatal Exception ***");
|
||||
PyErr_Print();
|
||||
G4cerr << message.str() << G4endl;
|
||||
break;
|
||||
|
||||
case FatalErrorInArgument:
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"*** Fatal Error In Argument ***");
|
||||
PyErr_Print();
|
||||
G4cerr << message.str() << G4endl;
|
||||
break;
|
||||
|
||||
case RunMustBeAborted:
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"*** Run Must Be Aborted ***");
|
||||
PyErr_Print();
|
||||
G4cerr << message.str() << G4endl;
|
||||
break;
|
||||
|
||||
case EventMustBeAborted:
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"*** Event Must Be Aborted ***");
|
||||
PyErr_Print();
|
||||
G4cerr << message.str() << G4endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
PyErr_Warn(PyExc_RuntimeWarning,
|
||||
"*** This is just a warning message. ***");
|
||||
G4cerr << message.str() << G4endl;
|
||||
break;
|
||||
}
|
||||
|
||||
G4cerr << G4endl;
|
||||
|
||||
// anyway, no abort.
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user