Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 101892 2016-12-07 08:07:30Z gcosmo $
|
||||
$Id: History 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -18,6 +18,10 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
envs-V10-03-01 / Nov. 24 K.Murakami
|
||||
- g4py, updated for 10.4 release
|
||||
- zmq, new ZeroMQ interface (experimental)
|
||||
|
||||
envs-V10-02-02 / 7 Dec. 2016 K.Murakami
|
||||
- remove G4VisAttributes::Invisible as deprecated
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ Geant4Py is a Geant4-Python bridge.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
24 Nov. 2017 K. Murakami
|
||||
- update for 10.4 release
|
||||
|
||||
7 Dec. 2016 K. Murakami
|
||||
- remove G4VisAttributes::Invisible as deprecated
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@ ROOT for histogramming/analysis
|
||||
### Tested Platforms
|
||||
|
||||
* CentOS7 (RH7 clones)
|
||||
* OSX (Sierra)
|
||||
* OSX (High Siera)
|
||||
|
||||
|
||||
How to Install
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: pyG4ChordFinder.cc 76884 2013-11-18 12:54:03Z gcosmo $
|
||||
// $Id: pyG4ChordFinder.cc 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
// ====================================================================
|
||||
// pyG4ChordFinder.cc
|
||||
//
|
||||
@@ -54,7 +54,6 @@ void export_G4ChordFinder()
|
||||
class_<G4ChordFinder, G4ChordFinder*, boost::noncopyable>
|
||||
("G4ChordFinder", "chord finder class", no_init)
|
||||
// constructor
|
||||
.def(init<G4MagInt_Driver*>())
|
||||
.def(init<G4MagneticField*>())
|
||||
.def(init<G4MagneticField*, G4double>())
|
||||
.def(init<G4MagneticField*, G4double, G4MagIntegratorStepper*>())
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: pyG4FieldManager.cc 76884 2013-11-18 12:54:03Z gcosmo $
|
||||
// $Id: pyG4FieldManager.cc 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
// ====================================================================
|
||||
// pyG4FieldManager.cc
|
||||
//
|
||||
@@ -39,17 +39,6 @@
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// miscs
|
||||
// ====================================================================
|
||||
#if G4VERSION_NUMBER <= 801
|
||||
// What a hell!
|
||||
inline const G4ChordFinder* G4FieldManager::GetChordFinder() const
|
||||
{
|
||||
return fChordFinder;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
@@ -57,9 +46,13 @@ namespace pyG4FieldManager {
|
||||
|
||||
G4ChordFinder*(G4FieldManager::*f1_GetChordFinder)()
|
||||
= &G4FieldManager::GetChordFinder;
|
||||
|
||||
const G4ChordFinder*(G4FieldManager::*f2_GetChordFinder)() const
|
||||
= &G4FieldManager::GetChordFinder;
|
||||
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_SetDetectorField,
|
||||
SetDetectorField, 1, 2);
|
||||
|
||||
}
|
||||
|
||||
using namespace pyG4FieldManager;
|
||||
@@ -78,7 +71,8 @@ void export_G4FieldManager()
|
||||
.def(init<G4Field*, G4ChordFinder*, G4bool>())
|
||||
.def(init<G4MagneticField*>())
|
||||
// ---
|
||||
.def("SetDetectorField", &G4FieldManager::SetDetectorField)
|
||||
.def("SetDetectorField", &G4FieldManager::SetDetectorField,
|
||||
f_SetDetectorField())
|
||||
.def("GetDetectorField", &G4FieldManager::GetDetectorField,
|
||||
return_internal_reference<>())
|
||||
.def("DoesFieldExist", &G4FieldManager::DoesFieldExist)
|
||||
@@ -103,4 +97,3 @@ void export_G4FieldManager()
|
||||
.def("SetFieldChangesEnergy", &G4FieldManager::SetFieldChangesEnergy)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: pyG4RandomDirection.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
// $Id: pyG4RandomDirection.cc 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
// ====================================================================
|
||||
// pyG4RandomDirection.cc
|
||||
//
|
||||
@@ -34,11 +34,23 @@
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4RandomDirection {
|
||||
|
||||
G4ThreeVector(*G4RandomDirection_1)() = G4RandomDirection;
|
||||
G4ThreeVector(*G4RandomDirection_2)(double) = G4RandomDirection;
|
||||
|
||||
}
|
||||
|
||||
using namespace pyG4RandomDirection;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4RandomDirection()
|
||||
{
|
||||
def("G4RandomDirection", G4RandomDirection);
|
||||
def("G4RandomDirection", G4RandomDirection_1);
|
||||
def("G4RandomDirection", G4RandomDirection_2);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: pyG4TwoVector.cc 76884 2013-11-18 12:54:03Z gcosmo $
|
||||
// $Id: pyG4TwoVector.cc 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
// ====================================================================
|
||||
// pyG4TwoVector.cc
|
||||
//
|
||||
@@ -31,8 +31,6 @@
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4Version.hh"
|
||||
|
||||
#if G4VERSION_NUMBER >= 830
|
||||
#include "G4TwoVector.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
@@ -53,15 +51,11 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_isOrthogonal, isOrthogonal, 1, 2)
|
||||
|
||||
using namespace pyG4TwoVector;
|
||||
|
||||
#endif
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4TwoVector()
|
||||
{
|
||||
#if G4VERSION_NUMBER >= 830
|
||||
|
||||
class_<G4TwoVector>("G4TwoVector", "general 2-vector")
|
||||
// constructors
|
||||
.def(init<G4double>())
|
||||
@@ -112,8 +106,4 @@ void export_G4TwoVector()
|
||||
.def(self >= self)
|
||||
.def(self <= self)
|
||||
;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: pyglobals.cc 76884 2013-11-18 12:54:03Z gcosmo $
|
||||
// $Id: pyglobals.cc 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
// ====================================================================
|
||||
// pyglobals.cc
|
||||
//
|
||||
@@ -65,9 +65,8 @@ typedef std::vector<G4int> G4intVector;
|
||||
typedef std::vector<G4double> G4doubleVector;
|
||||
typedef std::vector<G4String> G4StringVector;
|
||||
typedef std::vector<G4ThreeVector> G4ThreeVectorVector;
|
||||
#if G4VERSION_NUMBER >= 830
|
||||
typedef std::vector<G4TwoVector> G4TwoVectorVector;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
using namespace pyglobals;
|
||||
@@ -96,11 +95,8 @@ void export_globals()
|
||||
.def(vector_indexing_suite<G4ThreeVectorVector>())
|
||||
;
|
||||
|
||||
#if G4VERSION_NUMBER >= 830
|
||||
class_<G4TwoVectorVector> ("G4StringVector", "2-vector vector")
|
||||
.def(vector_indexing_suite<G4TwoVectorVector>())
|
||||
;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
# This package contains a set of Python interface with Geant4.
|
||||
# ==================================================================
|
||||
"""
|
||||
# $Id: __init__.py 101648 2016-11-21 08:42:14Z gcosmo $
|
||||
__version__ ='10.3'
|
||||
__date__ = 'November/2016'
|
||||
# $Id: __init__.py 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
__version__ ='10.4'
|
||||
__date__ = 'December/2017'
|
||||
__author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
|
||||
|
||||
# import submodules
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
# This package contains a set of Python interface with Geant4.
|
||||
# ==================================================================
|
||||
"""
|
||||
# $Id: __init__.py 101648 2016-11-21 08:42:14Z gcosmo $
|
||||
__version__ ='10.3'
|
||||
__date__ = 'November/2016'
|
||||
# $Id: __init__.py 107590 2017-11-24 11:59:22Z gcosmo $
|
||||
__version__ ='10.4'
|
||||
__date__ = 'December/2017'
|
||||
__author__ = 'K.Murakami (Koichi.Murakami@kek.jp)'
|
||||
|
||||
# import submodules
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,99 @@
|
||||
#
|
||||
# CMakeLists.txt for buidlig zmq-geant4
|
||||
#
|
||||
# Copyright 2017 Koichi Murakami
|
||||
#
|
||||
# ***************************
|
||||
# !! DONOT EDIT THIS FILE !!
|
||||
# ***************************
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
include(config.cmake)
|
||||
#==============================================================================
|
||||
project(ZMQ-GEANT4)
|
||||
#==============================================================================
|
||||
|
||||
# version.h generation (true for release)
|
||||
if(DEVMODE)
|
||||
set(SKIP_VERSION FALSE)
|
||||
else()
|
||||
set(SKIP_VERSION TRUE)
|
||||
endif()
|
||||
|
||||
# static / shared library
|
||||
#set (LIBRARY_TYPE "STATIC")
|
||||
|
||||
# cmake modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${PROJECT_SOURCE_DIR}/cmake/Modules
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# library path (lib or lib64)
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(_LIBDIR_DEFAULT "lib")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||
AND NOT EXISTS "/etc/debian_version")
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(_LIBDIR_DEFAULT "lib64")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}")
|
||||
endif()
|
||||
|
||||
# find packages
|
||||
find_package(Geant4 REQUIRED)
|
||||
find_package(ZMQ REQUIRED)
|
||||
|
||||
# c++11
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# build options
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
if(DEBUG)
|
||||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
|
||||
elseif(OPTIMIZE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# parameters for building
|
||||
message(STATUS "--------------------------------------------------------")
|
||||
message(STATUS "Parameters for building")
|
||||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
|
||||
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
|
||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||
message(STATUS "GEANT4_LIBRARY_DIR: ${GEANT4_LIBRARY_DIR}")
|
||||
|
||||
message(STATUS "--------------------------------------------------------")
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# version.h (#.##d# + rev# / dev flag d/a/b/rc)
|
||||
#if(NOT SKIP_VERSION)
|
||||
#set(G4ZMQ_VERSION_MAJOR 1)
|
||||
#set(G4ZMQ_VERSION_MINOR 0.1)
|
||||
#execute_process (COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE
|
||||
# G4ZMQ_VERSION_BUILD OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
#configure_file(
|
||||
# "${PROJECT_SOURCE_DIR}/cmake/version.h.in"
|
||||
# "${PROJECT_SOURCE_DIR}/zmq/version.h"
|
||||
#)
|
||||
#endif()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# adding sub directories to the project
|
||||
add_subdirectory(zmq)
|
||||
|
||||
# unit tests
|
||||
if(DEVMODE)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
#add_subdirectory(tests/ut)
|
||||
endif()
|
||||
|
||||
# integration tests
|
||||
#add_subdirectory(tests/it EXCLUDE_FROM_ALL)
|
||||
@@ -0,0 +1,15 @@
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
G4ZMQ History file
|
||||
---------------------
|
||||
|
||||
ZeroMQ Interface for Geant4
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
24 Nov. 2017 K. Murakami
|
||||
- First release for ZeroMQ interface (experimental)
|
||||
@@ -0,0 +1,14 @@
|
||||
# ZeroMQ Interface for Geant4
|
||||
|
||||
Copyright (c) 2017, Koichi Murakami
|
||||
|
||||
zmq-geant4 is a [ZeroMQ](http://zeromq.org/) interface with Geant4,
|
||||
that is an alternative implementation of Geant4 UI session.
|
||||
The interface is designed for the purpose of Geant4 kernel
|
||||
for [Jupyter](http://jupyter.org/).
|
||||
A Jupyter kernel is provided in
|
||||
[igeant4](https://github.com/koichi-murakami/igeant4) repository.
|
||||
|
||||
* [Releases](https://github.com/koichi-murakami/zmq-geant4/releases)
|
||||
* [Install Instructions](https://github.com/koichi-murakami/zmq-geant4/wiki/Installation)
|
||||
* [Issues](https://github.com/koichi-murakami/zmq-geant4/issues)
|
||||
@@ -0,0 +1,54 @@
|
||||
# - Find Geant4 library
|
||||
# This module sets up Geant4 information
|
||||
# It defines:
|
||||
# GEANT4_FOUND If the Geant4 is found
|
||||
# GEANT4_INCLUDE_DIR PATH to the include directory
|
||||
# GEANT4_LIBRARY_DIR PATH to the library directory
|
||||
# GEANT4_LIBRARIES Most common libraries
|
||||
# GEANT4_LIBRARIES_WITH_VIS Most common libraries with visualization
|
||||
|
||||
find_program(GEANT4_CONFIG NAMES geant4-config
|
||||
PATHS $ENV{GEANT4_INSTALL}/bin
|
||||
${GEANT4_INSTALL}/bin
|
||||
/usr/local/bin /opt/local/bin)
|
||||
|
||||
if(GEANT4_CONFIG)
|
||||
set(GEANT4_FOUND TRUE)
|
||||
|
||||
execute_process(COMMAND ${GEANT4_CONFIG} --prefix
|
||||
OUTPUT_VARIABLE GEANT4_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${GEANT4_CONFIG} --version
|
||||
OUTPUT_VARIABLE GEANT4_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
message(STATUS "Found Geant4: ${GEANT4_PREFIX} (${GEANT4_VERSION})")
|
||||
|
||||
else()
|
||||
set(GEANT4_FOUND FALSE)
|
||||
if (Geant4_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "NOT Found Geant4: set GEANT4_INSTALL.")
|
||||
else()
|
||||
message(WARNING "NOT Found Geant4: set GEANT4_INSTALL.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
set(GEANT4_INCLUDE_DIR ${GEANT4_PREFIX}/include/Geant4)
|
||||
set(GEANT4_LIBRARY_DIR ${GEANT4_PREFIX}/${_LIBDIR_DEFAULT})
|
||||
set(GEANT4_LIBRARIES G4interfaces G4persistency G4analysis
|
||||
G4error_propagation G4readout G4physicslists
|
||||
G4run G4event G4tracking G4parmodels G4processes
|
||||
G4digits_hits G4track G4particles G4geometry
|
||||
G4materials G4graphics_reps G4intercoms
|
||||
G4global G4clhep G4zlib)
|
||||
|
||||
set(GEANT4_LIBRARIES_WITH_VIS
|
||||
G4OpenGL G4gl2ps G4Tree G4FR G4GMocren G4visHepRep
|
||||
G4RayTracer G4VRML G4vis_management G4modeling
|
||||
G4interfaces G4persistency G4analysis
|
||||
G4error_propagation G4readout G4physicslists
|
||||
G4run G4event G4tracking G4parmodels G4processes
|
||||
G4digits_hits G4track G4particles G4geometry
|
||||
G4materials G4graphics_reps G4intercoms
|
||||
G4global G4clhep G4zlib)
|
||||
@@ -0,0 +1,45 @@
|
||||
# - Find ZMQ library
|
||||
#
|
||||
# It defines:
|
||||
# ZMQ_FOUND If the ZeroMQ is found
|
||||
# ZMQ_INCLUDE_DIRS PATH to the include directory
|
||||
# ZMQ_LIBRARIES libraries
|
||||
#
|
||||
# ZMQ_DIR is used for guessing the installed path.
|
||||
#
|
||||
|
||||
message("-- Detecting ZeroMQ package")
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(ZMQ QUIET zmq)
|
||||
|
||||
if(PC_ZMQ_FOUND)
|
||||
set(ZMQ_FOUND 1)
|
||||
else()
|
||||
set(ZMQ_FOUND 0)
|
||||
endif()
|
||||
|
||||
# find include path
|
||||
find_path(ZMQ_INCLUDE_DIRS zmq.hpp
|
||||
HINTS /usr/include ${ZMQ_DIR}/include ${PC_ZMQ_INCLUDE_DIRS})
|
||||
if(ZMQ_INCLUDE_DIRS MATCHES "^.*-NOTFOUND")
|
||||
set(ZMQ_FOUND 0)
|
||||
endif()
|
||||
|
||||
# find library
|
||||
find_library(ZMQ_LIBRARIES NAMES zmq
|
||||
PATHS /usr/lib64 /usr/lib
|
||||
${ZMQ_DIR}/lib64 ${ZMQ_DIR}/lib ${PC_ZMQ_LIBRARY_DIRS})
|
||||
|
||||
if(ZMQ_LIBRARIES MATCHES "^.*-NOTFOUND")
|
||||
set(ZMQ_FOUND 0)
|
||||
endif()
|
||||
#
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(ZMQ DEFAULT_MSG
|
||||
ZMQ_INCLUDE_DIRS ZMQ_LIBRARIES)
|
||||
|
||||
mark_as_advanced(ZMQ_INCLUDE_DIRS ZMQ_LIBRARY_DIRS ZMQ_LIBRARIES)
|
||||
|
||||
message("-- Detecting ZMQ package - done")
|
||||
@@ -0,0 +1,28 @@
|
||||
#==============================================================================
|
||||
# CMake configuration
|
||||
#
|
||||
# NOTE:
|
||||
# CACHE variables can be changed in CMake CLI with -D option.
|
||||
#==============================================================================
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX /zzz
|
||||
CACHE STRING "Install prefix")
|
||||
|
||||
# Geant4 installation path
|
||||
set(GEANT4_INSTALL /zzz
|
||||
CACHE STRING "Geant4 installation path")
|
||||
|
||||
# visualization flag
|
||||
set(ENABLE_VIS FALSE CACHE BOOL "Enable visualization flag")
|
||||
|
||||
# Optimizaton / Debug flags
|
||||
set(OPTIMIZE TRUE CACHE BOOL "Optimizaton flag (O3)")
|
||||
set(DEBUG FALSE CACHE BOOL "Debug mode")
|
||||
|
||||
# Development flag (set false for release)
|
||||
set(DEVMODE FALSE CACHE BOOL "Development mode")
|
||||
|
||||
# Optional configurations
|
||||
# Compiler
|
||||
#set(CMAKE_C_COMPILER /opt/gcc-4.8.5/bin/gcc)
|
||||
#set(CMAKE_CXX_COMPILER /opt/gcc-4.8.5/bin/g++)
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
#!/bin/sh -
|
||||
# ======================================================================
|
||||
# Configure script for G4Bench
|
||||
#
|
||||
# Note:
|
||||
# This script is an alternative cmake wrapper.
|
||||
# The script generates a cmake build directory in "build" directory.
|
||||
# You can do the same things with cmake command using -DXXX=VVV options.
|
||||
# ======================================================================
|
||||
export LANG=C
|
||||
|
||||
# ======================================================================
|
||||
# help message
|
||||
# ======================================================================
|
||||
show_help() {
|
||||
cat <<EOF
|
||||
|
||||
\`configure' cmake configure script for G4Bench apps.
|
||||
|
||||
Usage: configure [OPTION]... [VAR=VALUE]...
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
|
||||
Installation directories:
|
||||
--prefix=PREFIX installation prefix [config.cmake]
|
||||
|
||||
Fine tuning of the library build:
|
||||
--with-geant4-dir=DIR Geant4 installed dir [config.cmake]
|
||||
|
||||
Enable/disable options: prefix with either --enable- or --disable-
|
||||
vis OpenGL support [disable]
|
||||
opt optimization (O3) [enable]
|
||||
debug debug mode [disable]
|
||||
dev development mode [config.cmake/disable]
|
||||
|
||||
After configuration is done,
|
||||
cd build
|
||||
make
|
||||
make install
|
||||
EOF
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# functions
|
||||
# ======================================================================
|
||||
check_error() {
|
||||
if [ $? -ne 0 ]; then
|
||||
exit -1
|
||||
fi
|
||||
}
|
||||
|
||||
show_line() {
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# main
|
||||
# ======================================================================
|
||||
# default values
|
||||
prefix=_cmake
|
||||
g4_install=_cmake
|
||||
enable_vis=0
|
||||
enable_opt=1
|
||||
enable_debug=0
|
||||
enable_dev=_cmake
|
||||
|
||||
# parsing options
|
||||
while test $# -gt 0
|
||||
do
|
||||
case $1 in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
--help|-h) show_help; exit 0 ;;
|
||||
# ---------------------------------------------------------------
|
||||
--prefix=*) prefix=$optarg ;;
|
||||
--with-geant4-dir=*) g4_install=$optarg ;;
|
||||
# ---------------------------------------------------------------
|
||||
--enable-vis ) enable_vis=1 ;;
|
||||
--disable-vis ) enable_vis=0 ;;
|
||||
--enable-opt ) enable_opt=1 ;;
|
||||
--disable-opt ) enable_opt=0 ;;
|
||||
--enable-debug ) enable_debug=1 ;;
|
||||
--disable-debug ) enable_debug=0 ;;
|
||||
--enable-dev ) enable_dev=1 ;;
|
||||
--disable-dev ) enable_dev=0 ;;
|
||||
# ---------------------------------------------------------------
|
||||
-*)
|
||||
echo "Unrecognized option: $1"
|
||||
exit -1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument: $1"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# ======================================================================
|
||||
cmake_option=""
|
||||
|
||||
echo "Build configuration:"
|
||||
echo -n "G4Bench prefix ... "
|
||||
if [ $prefix = _cmake ]; then
|
||||
echo "[config.cmake]"
|
||||
else
|
||||
echo $prefix
|
||||
cmake_option="-DCMAKE_INSTALL_PREFIX=${prefix}"
|
||||
fi
|
||||
|
||||
echo -n "Geant4 dir ... "
|
||||
if [ $g4_install = _cmake ]; then
|
||||
echo "[config.cmake]"
|
||||
else
|
||||
echo $g4_install
|
||||
cmake_option="${cmake_option} -DGEANT4_INSTALL=${g4_install}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -n "Enabled support for [ "
|
||||
if [ $enable_vis = 1 ]; then
|
||||
echo -n "vis "
|
||||
cmake_option="${cmake_option} -DENABLE_VIS=TRUE"
|
||||
else
|
||||
cmake_option="${cmake_option} -DENABLE_VIS=FALSE"
|
||||
fi
|
||||
|
||||
if [ $enable_debug = 1 ]; then
|
||||
echo -n "debug "
|
||||
cmake_option="${cmake_option} -DDEBUG=TRUE"
|
||||
enable_opt=0
|
||||
else
|
||||
cmake_option="${cmake_option} -DDEBUG=FALSE"
|
||||
fi
|
||||
|
||||
if [ $enable_opt = 1 ]; then
|
||||
echo -n "opt "
|
||||
cmake_option="${cmake_option} -DOPTIMIZE=TRUE"
|
||||
else
|
||||
cmake_option="${cmake_option} -DOPTIMIZE=FALSE"
|
||||
fi
|
||||
|
||||
if [ $enable_dev != _cmake ]; then
|
||||
if [ $enable_dev = 1 ]; then
|
||||
echo -n "dev "
|
||||
cmake_option="${cmake_option} -DDEVMODE=TRUE"
|
||||
else
|
||||
cmake_option="${cmake_option} -DDEVMODE=FALSE"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "]"
|
||||
echo " "
|
||||
echo "cmake flags:${cmake_option}"
|
||||
# ======================================================================
|
||||
show_line
|
||||
echo "@@ execute cmake..."
|
||||
if [ -d build ]; then
|
||||
rm -r -f build
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
cmake $cmake_option ..
|
||||
check_error
|
||||
exit 0
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#/usr/bin/env python
|
||||
# ==================================================================
|
||||
# python client for zmq-geant4
|
||||
#
|
||||
# *** Python3 ***
|
||||
# ==================================================================
|
||||
import zmq
|
||||
|
||||
# global vars
|
||||
charset = 'utf-8'
|
||||
context = zmq.Context(1)
|
||||
socket = context.socket(zmq.REQ)
|
||||
|
||||
# ===============================================================
|
||||
def connect(endpoint="tcp://127.0.0.1:5555") :
|
||||
socket.setsockopt(zmq.LINGER, 0)
|
||||
socket.connect(endpoint)
|
||||
ping()
|
||||
|
||||
def ping() :
|
||||
socket.send(b"@@ping")
|
||||
poller = zmq.Poller()
|
||||
poller.register(socket, zmq.POLLIN)
|
||||
if poller.poll(1*1000) :
|
||||
output = socket.recv()
|
||||
print ("@@ G4ZMQ server connected.")
|
||||
else :
|
||||
raise ConnectionError("*** connection timeout")
|
||||
|
||||
def debug(dflag) :
|
||||
if dflag :
|
||||
socket.send(b"@@debug")
|
||||
else :
|
||||
socket.send(b"@@nodebug")
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def apply(command) :
|
||||
cmd_str= command.encode(charset)
|
||||
socket.send(cmd_str)
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def execute(command) :
|
||||
apply(command)
|
||||
|
||||
def pwd() :
|
||||
socket.send(b"pwd")
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def cwd() :
|
||||
socket.send(b"cwd")
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def cd(dir="") :
|
||||
cmd = "cd " + dir
|
||||
socket.send(cmd.encode(charset))
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def lc(target="") :
|
||||
cmd = "lc " + target
|
||||
socket.send(cmd.encode(charset))
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def ls(target="") :
|
||||
cmd = "ls " + target
|
||||
socket.send(cmd.encode(charset))
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def help(target="") :
|
||||
if ( target == "" ) :
|
||||
raise SyntaxWarning("*** no command specified.")
|
||||
else :
|
||||
cmd = "help " + target
|
||||
socket.send(cmd.encode(charset))
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def history() :
|
||||
socket.send(b"history")
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def beamOn(nevent) :
|
||||
cmd = "/run/beamOn " + str(nevent)
|
||||
apply(cmd)
|
||||
|
||||
def getvalue(target="") :
|
||||
cmd = "?" + target
|
||||
socket.send(cmd.encode(charset))
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
def exit() :
|
||||
socket.send(b"exit")
|
||||
output = socket.recv()
|
||||
print(output.decode(charset))
|
||||
|
||||
# ===============================================================
|
||||
if __name__ == '__main__' :
|
||||
pass
|
||||
@@ -0,0 +1,18 @@
|
||||
# - build G4zeromq library
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR} ${GEANT4_INCLUDE_DIR}
|
||||
${ZMQ_INCLUDE_DIRS})
|
||||
|
||||
# library
|
||||
add_library(
|
||||
G4zeromq SHARED
|
||||
G4ZMQServer.cc
|
||||
)
|
||||
# headers
|
||||
set(HEADERS
|
||||
G4ZMQServer.hh
|
||||
)
|
||||
|
||||
# install
|
||||
install(TARGETS G4zeromq LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
|
||||
@@ -0,0 +1,314 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.hh 95232 2016-02-01 14:31:22Z gcosmo $
|
||||
//
|
||||
//
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include <zmq.hpp>
|
||||
#include "G4UItcsh.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcommandTree.hh"
|
||||
#include "G4ZMQServer.hh"
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
namespace {
|
||||
|
||||
G4UImanager* ui_manager = nullptr;
|
||||
G4bool qexit = false;
|
||||
std::stringstream cout_stream;
|
||||
std::string black_str = "\033[30m";
|
||||
std::string command_list = "";
|
||||
|
||||
void ThrowException(const std::string& message)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "[ERROR] " << message << std::endl;
|
||||
throw std::runtime_error(ss.str());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void GetCommandTree(G4UIcommandTree* ctree)
|
||||
{
|
||||
command_list += (ctree-> GetPathName() + " ");
|
||||
|
||||
auto n_cmd = ctree-> GetCommandEntry();
|
||||
for ( auto icmd = 1; icmd <= n_cmd; icmd++ ) {
|
||||
auto cmd_path = ctree-> GetCommand(icmd)-> GetCommandPath();
|
||||
command_list += (cmd_path + " ");
|
||||
}
|
||||
|
||||
auto n_tree = ctree-> GetTreeEntry();
|
||||
for ( auto itr = 1; itr <= n_tree ; itr++ ) {
|
||||
G4UIcommandTree* atree = ctree-> GetTree(itr);
|
||||
::GetCommandTree(atree);
|
||||
}
|
||||
}
|
||||
|
||||
} // end of namespace
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4ZMQServer::G4ZMQServer()
|
||||
{
|
||||
endpoint_ = "tcp://127.0.0.1:5555";
|
||||
qdebug_ = false;
|
||||
shell_= new G4UItcsh();
|
||||
shell_-> SetLsColor(BLUE, RED);
|
||||
|
||||
::ui_manager = G4UImanager::GetUIpointer();
|
||||
::ui_manager-> SetSession(this);
|
||||
::ui_manager-> SetCoutDestination(this);
|
||||
|
||||
::qexit = false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4ZMQServer::~G4ZMQServer()
|
||||
{
|
||||
delete shell_;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4UIsession* G4ZMQServer::SessionStart()
|
||||
{
|
||||
zmq::context_t context(1);
|
||||
zmq::socket_t socket( context, ZMQ_REP );
|
||||
socket.bind(endpoint_);
|
||||
|
||||
enum { kBufferSize = 4096 };
|
||||
char buffer[kBufferSize];
|
||||
|
||||
while ( ! ::qexit ) {
|
||||
if ( qdebug_ ) {
|
||||
std::cout << "@@ Waiting..." << std::endl;
|
||||
}
|
||||
|
||||
// waiting command
|
||||
zmq::message_t request;
|
||||
G4bool qok = socket.recv(&request);
|
||||
if ( qok == false ) ::ThrowException("G4ZMQSever: socket recv error");
|
||||
auto end_pos = request.size();
|
||||
if ( end_pos >= kBufferSize ) end_pos = kBufferSize - 1;
|
||||
std::memcpy(buffer, request.data(), end_pos);
|
||||
buffer[end_pos] = '\0';
|
||||
std::string cmd_str = buffer;
|
||||
|
||||
if ( qdebug_ ) {
|
||||
std::cout << "@@ Recv=" << cmd_str << "<<" << std::endl;
|
||||
}
|
||||
|
||||
// store output & send back response
|
||||
::cout_stream.str("");
|
||||
|
||||
if ( cmd_str == "@@ping" ) {
|
||||
G4cout << "pong" << G4endl;
|
||||
|
||||
} else if ( cmd_str == "@@debug") {
|
||||
qdebug_ = true;
|
||||
G4cout << "G4ZMQ debug activated" << G4endl;
|
||||
|
||||
} else if ( cmd_str == "@@nodebug") {
|
||||
qdebug_ = false;
|
||||
G4cout << "G4ZMQ debug deactivated" << G4endl;
|
||||
|
||||
} else if ( cmd_str == "@@get_command_tree" ) {
|
||||
auto cwd_name = GetCurrentWorkingDirectory();
|
||||
auto cwd_tree = FindDirectory(cwd_name.c_str());
|
||||
::command_list = "";
|
||||
::GetCommandTree(cwd_tree);
|
||||
G4cout << ::command_list << std::flush;
|
||||
|
||||
} else if ( cmd_str == "@@get_fullcommand_tree" ) {
|
||||
auto root = ::ui_manager-> GetTree();
|
||||
::command_list = "";
|
||||
::GetCommandTree(root);
|
||||
G4cout << ::command_list << std::flush;
|
||||
|
||||
} else if ( cmd_str == "help" ) {
|
||||
G4cout << "help <command>" << G4endl;
|
||||
|
||||
} else {
|
||||
G4String new_command = GetCommand(cmd_str);
|
||||
if ( qdebug_ ) {
|
||||
std::cout << ::black_str << "@@ Cmd="
|
||||
<< new_command << "<<" << std::endl;
|
||||
}
|
||||
ExecuteCommand(new_command);
|
||||
}
|
||||
|
||||
std::string reply = ::cout_stream.str();
|
||||
size_t cout_size = reply.size();
|
||||
zmq::message_t message(cout_size);
|
||||
std::strncpy((char*)message.data(), reply.c_str(), cout_size);
|
||||
qok = socket.send(message);
|
||||
if ( qok == false ) ::ThrowException("G4ZMQServer: socket send error");
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void G4ZMQServer::PauseSessionStart(const G4String& msg)
|
||||
{
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4int G4ZMQServer::ReceiveG4cout(const G4String& coutString)
|
||||
{
|
||||
if ( qdebug_ ) {
|
||||
std::cout << coutString << std::flush;
|
||||
}
|
||||
|
||||
::cout_stream << coutString << std::flush;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4int G4ZMQServer::ReceiveG4cerr(const G4String& cerrString)
|
||||
{
|
||||
if ( qdebug_ ) {
|
||||
std::cerr << cerrString << std::flush;
|
||||
}
|
||||
|
||||
::cout_stream << cerrString << std::flush;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4String G4ZMQServer::GetCommand(const G4String& input)
|
||||
{
|
||||
const std::string nullstr = "";
|
||||
G4String cmdstr = input;
|
||||
|
||||
G4String cstr = cmdstr.strip(G4String::leading);
|
||||
if ( cstr.length() == 0 ) {
|
||||
cmdstr = nullstr;
|
||||
|
||||
// define built-in shell commands...
|
||||
} else if ( cstr(0) == '#' ) {
|
||||
G4cout << cstr << G4endl;
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "ls" || cstr.substr(0,3) == "ls " ) {
|
||||
ListDirectory(cstr);
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "lc" || cstr.substr(0,3) == "lc " ) {
|
||||
shell_-> ListCommand(cstr.remove(0,2));
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if (cstr == "pwd" ) {
|
||||
G4cout << "Current Command Directory : "
|
||||
<< GetCurrentWorkingDirectory() << G4endl;
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "cwd" ) {
|
||||
shell_-> ShowCurrentDirectory();
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if (cstr == "cd" || cstr.substr(0,3) == "cd " ) {
|
||||
ChangeDirectoryCommand(cstr);
|
||||
shell_-> SetCurrentDirectory(GetCurrentWorkingDirectory());
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "help" || cstr.substr(0,5) == "help " ) {
|
||||
TerminalHelp(cstr);
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr(0) == '?' ) {
|
||||
ShowCurrent(cstr);
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "history" ) {
|
||||
auto nh= ::ui_manager-> GetNumberOfHistory();
|
||||
for (auto i = 0; i < nh; i++) {
|
||||
G4cout << i << ": " << ::ui_manager->GetPreviousCommand(i) << G4endl;
|
||||
}
|
||||
cmdstr = nullstr;
|
||||
|
||||
} else if ( cstr == "exit" ) {
|
||||
::qexit = true;
|
||||
cmdstr = nullstr;
|
||||
}
|
||||
|
||||
return ModifyToFullPathCommand(cmdstr);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void G4ZMQServer::ExecuteCommand(const G4String& command)
|
||||
{
|
||||
auto rc = ::ui_manager-> ApplyCommand(command);
|
||||
auto pcode = rc % 100;
|
||||
auto status = rc - pcode;
|
||||
|
||||
G4UIcommand* cmd = nullptr;
|
||||
if( status != fCommandSucceeded ) cmd = FindCommand(command);
|
||||
|
||||
switch ( status ) {
|
||||
case fCommandSucceeded:
|
||||
break;
|
||||
case fCommandNotFound:
|
||||
G4cerr << "command <" << ::ui_manager-> SolveAlias(command)
|
||||
<< "> not found" << G4endl;
|
||||
break;
|
||||
case fIllegalApplicationState:
|
||||
G4cerr << "illegal application state -- command refused" << G4endl;
|
||||
break;
|
||||
case fParameterOutOfRange:
|
||||
G4cerr << "Parameter is out of range" << G4endl;
|
||||
break;
|
||||
case fParameterOutOfCandidates:
|
||||
G4cerr << "Parameter is out of candidate list (index "
|
||||
<< pcode << ")" << G4endl;
|
||||
G4cerr << "Candidates : "
|
||||
<< cmd-> GetParameter(pcode)-> GetParameterCandidates()
|
||||
<< G4endl;
|
||||
break;
|
||||
case fParameterUnreadable:
|
||||
G4cerr << "Parameter is wrong type and/or is not omittable (index "
|
||||
<< pcode << ")" << G4endl;
|
||||
break;
|
||||
case fAliasNotFound:
|
||||
break;
|
||||
default:
|
||||
G4cerr << "command refused (" << status << ")" << G4endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
G4bool G4ZMQServer::GetHelpChoice(G4int&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
void G4ZMQServer::ExitHelp() const
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.hh 95232 2016-02-01 14:31:22Z gcosmo $
|
||||
//
|
||||
//
|
||||
#ifndef G4ZMQ_SERVER_H_
|
||||
#define G4ZMQ_SERVER_H_
|
||||
|
||||
#include "G4VBasicShell.hh"
|
||||
|
||||
class G4UItcsh;
|
||||
|
||||
class G4ZMQServer : public G4VBasicShell {
|
||||
public:
|
||||
G4ZMQServer();
|
||||
~G4ZMQServer();
|
||||
|
||||
void SetEndpoint(const G4String& endpoint);
|
||||
G4String GetEndpoint() const;
|
||||
|
||||
void SetDebug(G4bool flag);
|
||||
|
||||
virtual G4UIsession* SessionStart();
|
||||
virtual void PauseSessionStart(const G4String& message);
|
||||
|
||||
virtual G4int ReceiveG4cout(const G4String& coutString);
|
||||
virtual G4int ReceiveG4cerr(const G4String& cerrString);
|
||||
|
||||
private:
|
||||
G4bool qdebug_;
|
||||
G4String endpoint_;
|
||||
G4UItcsh* shell_;
|
||||
|
||||
G4String GetCommand(const G4String& input);
|
||||
|
||||
virtual void ExecuteCommand(const G4String& command);
|
||||
virtual G4bool GetHelpChoice(G4int& );
|
||||
virtual void ExitHelp() const;
|
||||
|
||||
};
|
||||
|
||||
// ==========================================================================
|
||||
inline void G4ZMQServer::SetEndpoint(const G4String& endpoint)
|
||||
{
|
||||
endpoint_ = endpoint;
|
||||
}
|
||||
|
||||
inline G4String G4ZMQServer::GetEndpoint() const
|
||||
{
|
||||
return endpoint_;
|
||||
}
|
||||
|
||||
inline void G4ZMQServer::SetDebug(G4bool flag)
|
||||
{
|
||||
qdebug_ = flag;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user