Import Geant4 8.2.0 source tree
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# $Id: GNUmakefile,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
# $Name: geant4-08-02 $
|
||||
# ===========================================================
|
||||
# Makefile for building Geant4Py modules
|
||||
# ===========================================================
|
||||
include ../../config/config.gmk
|
||||
|
||||
# python module name
|
||||
MODULE := G4intercoms#
|
||||
|
||||
include $(G4PY_INSTALL)/config/g4py.gmk
|
||||
include $(G4PY_INSTALL)/config/module.gmk
|
||||
include $(G4PY_INSTALL)/config/install.gmk
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UIcommand.cc,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
// $Name: geant4-08-02 $
|
||||
// ====================================================================
|
||||
// pyG4UIcommand.cc
|
||||
//
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// thin wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4UIcommand {
|
||||
|
||||
// GetStateList (returning python list)
|
||||
list f_GetStateList(G4UIcommand* acommand)
|
||||
{
|
||||
list pyStateList;
|
||||
std::vector<G4ApplicationState>* stateList= acommand->GetStateList();
|
||||
|
||||
for(G4int i=0; i< stateList->size(); i++) {
|
||||
pyStateList.append(&(*stateList)[i]);
|
||||
}
|
||||
|
||||
return pyStateList;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
using namespace pyG4UIcommand;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UIcommand()
|
||||
{
|
||||
class_<G4UIcommand, G4UIcommand*>
|
||||
("G4UIcommand", "UI command")
|
||||
.def(init<const char*, G4UImessenger*>())
|
||||
// ---
|
||||
.def("GetCurrentValue", &G4UIcommand::GetCurrentValue)
|
||||
.def("IsAvailable", &G4UIcommand::IsAvailable)
|
||||
.def("List", &G4UIcommand::List)
|
||||
.def("GetRange", &G4UIcommand::GetRange,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetGuidanceEntries", &G4UIcommand::GetGuidanceEntries)
|
||||
.def("GetGuidanceLine", &G4UIcommand::GetGuidanceLine,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetCommandPath", &G4UIcommand::GetCommandPath,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetCommandName", &G4UIcommand::GetCommandName,
|
||||
return_value_policy<return_by_value>())
|
||||
.def("GetParameterEntries", &G4UIcommand::GetParameterEntries)
|
||||
.def("GetParameter", &G4UIcommand::GetParameter,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("GetStateList", f_GetStateList)
|
||||
.def("GetTitle", &G4UIcommand::GetTitle)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UIcommandTree.cc,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
// $Name: geant4-08-02 $
|
||||
// ====================================================================
|
||||
// pyG4UIcommandTree.cc
|
||||
//
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UIcommandTree.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4UIcommandTree {
|
||||
|
||||
// GetTree
|
||||
G4UIcommandTree*(G4UIcommandTree::*f1_GetTree)(G4int)=
|
||||
&G4UIcommandTree::GetTree;
|
||||
G4UIcommandTree*(G4UIcommandTree::*f2_GetTree)(const char*)=
|
||||
&G4UIcommandTree::GetTree;
|
||||
|
||||
};
|
||||
|
||||
using namespace pyG4UIcommandTree;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UIcommandTree()
|
||||
{
|
||||
class_<G4UIcommandTree, G4UIcommandTree*>
|
||||
("G4UIcommandTree", "UI command tree")
|
||||
// constructors
|
||||
.def(init<const char*>())
|
||||
// ---
|
||||
.def("FindPath", &G4UIcommandTree::FindPath,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("List", &G4UIcommandTree::List)
|
||||
.def("ListCurrent", &G4UIcommandTree::ListCurrent)
|
||||
.def("ListCurrentWithNum", &G4UIcommandTree::ListCurrentWithNum)
|
||||
.def("CreateHTML", &G4UIcommandTree::CreateHTML)
|
||||
.def("GetGuidance", &G4UIcommandTree::GetGuidance,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("GetPathName", &G4UIcommandTree::GetPathName)
|
||||
// ---
|
||||
.def("GetTreeEntry", &G4UIcommandTree::GetTreeEntry)
|
||||
.def("GetCommandEntry", &G4UIcommandTree::GetCommandEntry)
|
||||
.def("GetTree", f1_GetTree,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("GetTree", f2_GetTree,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.def("GetCommand", &G4UIcommandTree::GetCommand,
|
||||
return_value_policy<reference_existing_object>())
|
||||
// ---
|
||||
.def("GetTitle", &G4UIcommandTree::GetTitle)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UImanager.cc,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
// $Name: geant4-08-02 $
|
||||
// ====================================================================
|
||||
// pyG4UImanager.cc
|
||||
//
|
||||
// G4UImanager class is pure singleton, so it cannnot be exposed
|
||||
// from BPL. Functionality of G4UImanager is exposed in global
|
||||
// name space via wrappers.
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcommandTree.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// wrappers
|
||||
// ====================================================================
|
||||
namespace pyG4UImanager {
|
||||
|
||||
// ApplyCommand
|
||||
G4int(G4UImanager::*f1_ApplyCommand)(const char*)= &G4UImanager::ApplyCommand;
|
||||
G4int(G4UImanager::*f2_ApplyCommand)(G4String)= &G4UImanager::ApplyCommand;
|
||||
|
||||
// CreateHTML
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CreateHTML, CreateHTML, 0, 1);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
G4int ApplyUICommand_1(const G4String& cmdstr)
|
||||
//////////////////////////////////////////////
|
||||
{
|
||||
G4UImanager* UImgr= G4UImanager::GetUIpointer();
|
||||
G4int returnVal= UImgr-> ApplyCommand(cmdstr);
|
||||
if( returnVal == fCommandSucceeded ) return returnVal;
|
||||
|
||||
G4int paramIndex= returnVal % 100;
|
||||
G4int commandStatus= returnVal - paramIndex;
|
||||
|
||||
switch(commandStatus) {
|
||||
case fCommandSucceeded:
|
||||
break;
|
||||
|
||||
case fCommandNotFound:
|
||||
G4cout << "command <" << UImgr-> SolveAlias(cmdstr)
|
||||
<< "> not found" << G4endl;
|
||||
break;
|
||||
|
||||
case fIllegalApplicationState:
|
||||
G4cout << "illegal application state -- command refused"
|
||||
<< G4endl;
|
||||
break;
|
||||
|
||||
case fParameterOutOfRange:
|
||||
break;
|
||||
|
||||
case fParameterOutOfCandidates:
|
||||
G4cout << "Parameter is out of candidate list (index "
|
||||
<< paramIndex << ")"
|
||||
<< G4endl;
|
||||
break;
|
||||
|
||||
case fParameterUnreadable:
|
||||
G4cout << "Parameter is wrong type and/or is not omittable (index "
|
||||
<< paramIndex << ")" << G4endl;
|
||||
break;
|
||||
|
||||
case fAliasNotFound:
|
||||
break;
|
||||
|
||||
default:
|
||||
G4cout << "command refused (" << commandStatus << ")" << G4endl;
|
||||
break;
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
G4int ApplyUICommand_2(const std::string& cmdstr)
|
||||
/////////////////////////////////////////////////
|
||||
{
|
||||
return ApplyUICommand_1(cmdstr);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
using namespace pyG4UImanager;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UImanager()
|
||||
{
|
||||
class_<G4UImanager, boost::noncopyable>
|
||||
("G4UImanager", "UI manager class", no_init)
|
||||
.def("GetUIpointer", &G4UImanager::GetUIpointer,
|
||||
return_value_policy<reference_existing_object>())
|
||||
.staticmethod("GetUIpointer")
|
||||
// ---
|
||||
.def("GetCurrentValues", &G4UImanager::GetCurrentValues)
|
||||
.def("ExecuteMacroFile", &G4UImanager::ExecuteMacroFile)
|
||||
.def("ApplyCommand", f1_ApplyCommand)
|
||||
.def("ApplyCommand", f2_ApplyCommand)
|
||||
.def("CreateHTML", &G4UImanager::CreateHTML, f_CreateHTML())
|
||||
// ---
|
||||
.def("SetPauseAtBeginOfEvent", &G4UImanager::SetPauseAtBeginOfEvent)
|
||||
.def("GetPauseAtBeginOfEvent", &G4UImanager::GetPauseAtBeginOfEvent)
|
||||
.def("SetPauseAtEndOfEvent", &G4UImanager::SetPauseAtEndOfEvent)
|
||||
.def("GetPauseAtEndOfEvent", &G4UImanager::GetPauseAtEndOfEvent)
|
||||
.def("SetVerboseLevel", &G4UImanager::SetVerboseLevel)
|
||||
.def("GetVerboseLevel", &G4UImanager::GetVerboseLevel)
|
||||
// ---
|
||||
.def("GetTree", &G4UImanager::GetTree,
|
||||
return_value_policy<reference_existing_object>())
|
||||
;
|
||||
|
||||
// ---
|
||||
def("ApplyUICommand", ApplyUICommand_1);
|
||||
def("ApplyUICommand", ApplyUICommand_2);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pyG4UIparameter.cc,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
// $Name: geant4-08-02 $
|
||||
// ====================================================================
|
||||
// pyG4UIparameter.cc
|
||||
//
|
||||
// 2006 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "G4UIparameter.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
void export_G4UIparameter()
|
||||
{
|
||||
class_<G4UIparameter, G4UIparameter*>
|
||||
("G4UIparameter", "UI parameter")
|
||||
// constructors
|
||||
.def(init<char>())
|
||||
.def(init<const char*, char, G4bool>())
|
||||
// ---
|
||||
.def("List", &G4UIparameter::List)
|
||||
.def("GetDefaultValue", &G4UIparameter::GetDefaultValue)
|
||||
.def("GetParameterType", &G4UIparameter::GetParameterType)
|
||||
.def("GetParameterRange", &G4UIparameter::GetParameterRange)
|
||||
.def("GetParameterName", &G4UIparameter::GetParameterName)
|
||||
.def("GetParameterCandidates", &G4UIparameter::GetParameterCandidates)
|
||||
.def("IsOmittable", &G4UIparameter::IsOmittable)
|
||||
.def("GetCurrentAsDefault", &G4UIparameter::GetCurrentAsDefault)
|
||||
.def("GetParameterGuidance", &G4UIparameter::GetParameterGuidance)
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: pymodG4intercoms.cc,v 1.1 2006/08/08 05:20:57 kmura Exp $
|
||||
// $Name: geant4-08-02 $
|
||||
// ====================================================================
|
||||
// pymodG4intercoms.cc [Geant4Py module]
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// module definition
|
||||
// ====================================================================
|
||||
|
||||
void export_G4UImanager();
|
||||
void export_G4UIcommandTree();
|
||||
void export_G4UIcommand();
|
||||
void export_G4UIparameter();
|
||||
|
||||
BOOST_PYTHON_MODULE(G4intercoms)
|
||||
{
|
||||
export_G4UImanager();
|
||||
export_G4UIcommandTree();
|
||||
export_G4UIcommand();
|
||||
export_G4UIparameter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user