34 #ifdef G4VIS_BUILD_DAWN_DRIVER
54 const int FR_DEFAULT_CONNECTION_TIME = 5 ;
55 const char FR_ENV_CONNECTION_TIME [] =
"G4DAWN_CONNECTION_TIME";
56 const char FR_ENV_DAWN_GUI_ALWAYS [] =
"G4DAWN_GUI_ALWAYS";
59 G4FukuiRenderer::G4FukuiRenderer ():
65 fIPMode( G4FukuiRenderer::IP_UNIX ),
66 flag_use_gui (false) ,
70 if( ( getenv( FR_ENV_DAWN_GUI_ALWAYS ) != NULL ) && \
71 ( strcmp( getenv( FR_ENV_DAWN_GUI_ALWAYS ),
"0" ) ) )
79 G4FukuiRenderer::~G4FukuiRenderer ()
81 if( flag_connected ) {
86 fPrimDest.DisConnect();
96 if(!flag_connected) {
delete p ; p = NULL ; }
104 if(!flag_connected)
return NULL;
106 new G4FukuiRendererViewer ((G4FukuiRendererSceneHandler&) scene, name);
111 void G4FukuiRenderer::UseInetDomainAuto()
115 #if defined DEBUG_FR_SYSTEM
117 G4cout <<
"***** Unix Inet Domain (AUTO mode)" <<
G4endl;
119 fIPMode = G4FukuiRenderer::IP_UNIX ;
121 if( ( pid = fork() ) == 0 ) {
122 if ( execlp (
"dawn",
"dawn",
"-G" , (
char *)0 ) < 0 )
129 int connection_time = FR_DEFAULT_CONNECTION_TIME ;
130 if( getenv( FR_ENV_CONNECTION_TIME ) != NULL ) {
131 int sscanf_status = \
132 sscanf( getenv( FR_ENV_CONNECTION_TIME ),
"%d", &connection_time) ;
133 if ( sscanf_status == EOF ) {
134 connection_time = FR_DEFAULT_CONNECTION_TIME ;
140 sleep(connection_time);
146 if(!flag_connected) {
152 G4cout <<
"***** GEANT4 is connected to FukuiRenderer DAWN ";
162 G4FukuiRenderer::UseInetDomain()
164 #if defined DEBUG_FR_SYSTEM
168 fIPMode = G4FukuiRenderer::IP_INET ;
172 if(!flag_connected) {
178 G4cout <<
"GEANT4 is connected to FukuiRenderer DAWN via socket" ;
186 G4FukuiRenderer::ConnectPort(
int max_port_incr )
189 int connect_trial = 0 ;
191 if ( ++connect_trial > max_port_incr ) {
192 this->flag_connected = 0 ;
195 G4cout <<
" Maybe, you have not invoked DAWN yet," <<
G4endl;
196 G4cout <<
" or too many DAWN's are already running" <<
G4endl;
199 fPrimDest.IncrementPortNumber( (- FR_MAX_PORT_INCR) );
201 }
else if ( fPrimDest.ConnectINET() ) {
203 this->flag_connected = 1 ;
205 G4cout <<
"***** GEANT4 is connected to port " ;
206 G4cout << fPrimDest.GetPortNumber() ;
212 this->flag_connected = 0 ;
213 fPrimDest.IncrementPortNumber();
215 G4cout <<
"***** GEANT4 incremented targeting port to " ;
226 void G4FukuiRenderer::UseBSDUnixDomainAuto()
230 #if defined DEBUG_FR_SYSTEM
234 fIPMode = G4FukuiRenderer::IP_UNIX ;
236 if( ( pid = fork() ) == 0 ) {
237 if ( execlp (
"dawn",
"dawn",
"-g" , (
char *)0 ) < 0 )
245 int connection_time = FR_DEFAULT_CONNECTION_TIME ;
246 if( getenv( FR_ENV_CONNECTION_TIME ) != NULL ) {
247 int sscanf_status = \
248 sscanf( getenv( FR_ENV_CONNECTION_TIME ),
"%d", &connection_time) ;
249 if ( sscanf_status == EOF ) { connection_time = FR_DEFAULT_CONNECTION_TIME ;}
251 sleep(connection_time);
254 this->flag_connected = fPrimDest.ConnectUnix();
257 if(!flag_connected) {
262 G4cout <<
"*** GEANT4 is connected to FukuiRenderer DAWN ";
272 #endif // G4VIS_BUILD_DAWN_DRIVER
const char FR_TERMINATE_DAWND[]
G4GLOB_DLL std::ostream G4cout
const char FR_DAWNFILE_FEATURES[]
static Verbosity GetVerbosity()