Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
@@ -0,0 +1,30 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 07:54:28 kmura Exp $
# ===========================================================
# Makefile for building Python module with Boost.Python
#
# ===========================================================
include ../../config/config.gmk
# python module name
MODULE := test05#
# location of exposured library
G4PY_EXLIB_ROOT := ./mylib
G4PY_EXLIB_INCDIR := $(G4PY_EXLIB_ROOT)
G4PY_EXLIB_LIBDIR := $(G4PY_EXLIB_ROOT)
G4PY_EXLIB_LIBNAME := XXX
COMPILE_WITH_BOOST := true
include $(G4PY_INSTALL)/config/module.gmk
.PHONY: all mylib cleanall
all : cleanall mylib module
mylib :
@cd $(G4PY_EXLIB_ROOT) && $(MAKE)
cleanall: clean
@cd $(G4PY_EXLIB_ROOT) && $(MAKE) clean
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * 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: AClass.cc,v 1.4 2006/06/29 15:38:44 gunter Exp $
// ====================================================================
// AClass.cc
//
// 2005 Q
// ====================================================================
#include "AClass.hh"
#include <iostream>
// ====================================================================
//
// class description
//
// ====================================================================
////////////////
AClass::AClass()
: ival(0)
////////////////
{
}
///////////////////////////////
AClass::AClass(int i, double d)
: ival(i)
///////////////////////////////
{
std::cout << "*** AClass constructor, d= "<< d << std::endl;
}
/////////////////
AClass::~AClass()
/////////////////
{
}
/////////////////////
int AClass::AMethod()
/////////////////////
{
return 0;
}
//////////////////////////
int AClass::AMethod(int i)
//////////////////////////
{
return 1;
}
////////////////////////////////////
int AClass::AMethod(int i, double d)
////////////////////////////////////
{
return 2;
}
//////////////////////
int AClass::BMethod()
//////////////////////
{
return 0;
}
////////////////////////////////
double AClass::BMethod(double d)
////////////////////////////////
{
return 1.;
}
///////////////////////////////////////////////////
double AClass::CMethod(int i, double d1, double d2)
///////////////////////////////////////////////////
{
return i*d1*d2;
}
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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: AClass.hh,v 1.4 2006/06/29 15:38:47 gunter Exp $
// ====================================================================
// AClass.hh
//
// 2005 Q
// ====================================================================
#ifndef ACLASS_H
#define ACLASS_H
// ====================================================================
//
// class definition
//
// ====================================================================
class AClass {
private:
int ival;
public:
AClass();
AClass(int i, double d=0.);
~AClass();
void SetIVal(int i);
int GetIVal() const;
int AMethod();
int AMethod(int i);
int AMethod(int i, double d);
int BMethod();
double BMethod(double d);
double CMethod(int i, double d1=1., double d2=2.);
};
// ====================================================================
// inline functions
// ====================================================================
inline void AClass::SetIVal(int i) { ival= i; }
inline int AClass::GetIVal() const { return ival; }
#endif
@@ -0,0 +1,11 @@
# $Id: GNUmakefile,v 1.2 2006/04/25 07:54:29 kmura Exp $
# ===========================================================
# Makefile for building local library
#
# ===========================================================
include ../../../config/config.gmk
MODULE := libXXX
include $(G4PY_INSTALL)/config/mylib.gmk
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * 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: XFunc.cc,v 1.4 2006/06/29 15:38:50 gunter Exp $
// ====================================================================
// XFunc.cc
//
// 2005 Q
// ====================================================================
#include "XFunc.hh"
// ====================================================================
//
// class description
//
// ====================================================================
int func1(int i)
{
return i;
}
double func1(int i, double d)
{
return i*d;
}
int func2(int i)
{
return i;
}
int func2(int i0, int i1)
{
return i0*i1;
}
int func3(int i)
{
return 0;
}
int func3(double d)
{
return 1;
}
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * 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: XFunc.hh,v 1.4 2006/06/29 15:38:53 gunter Exp $
// ====================================================================
// XFunc.hh
//
// 2005 Q
// ====================================================================
#ifndef XFUNC_H
#define XFUNC_H
int func1(int i);
double func1(int i, double d);
int func2(int i);
int func2(int i0, int i1);
int func3(int i);
int func3(double d);
#endif
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/python
# ==================================================================
# python script for Geant4Py test
#
#
# ==================================================================
import test05
print "AClass(2,3.)"
a= test05.AClass(2,3.)
print "a.i=", a.i
print ""
print "func2(10)=", test05.func2(10)
print "func2(10,100)=", test05.func2(10, 100)
print ""
print "func3(1)=", test05.func3(1)
print "func3(1.)=", test05.func3(1.)
print ""
print "AMethod()=", a.AMethod()
print "AMethod(1)=", a.AMethod(1)
print "AMethod(1,2.)=", a.AMethod(1,2.)
print ""
print "BMethod()=", a.BMethod()
print "BMethod(1.)=", a.BMethod(1.)
print ""
print "CMethod(1)=", a.CMethod(1)
print "CMethod(1,10.)=", a.CMethod(1,10.)
print "CMethod(1,10.,100.)=", a.CMethod(1,10.,100.)
print ""
print "*** ERRORS!! ***"
a.AMethod(1,2,3) # error
+82
View File
@@ -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: test05.cc,v 1.4 2006/06/29 15:38:41 gunter Exp $
// ====================================================================
// test05.cc
//
// test of function overloading
// - constructor
// - default arguments
// - auto-overloading
// - docstrings
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "XFunc.hh"
#include "AClass.hh"
using namespace boost::python;
BOOST_PYTHON_FUNCTION_OVERLOADS(f_func2, func2, 1, 2);
//int(*func2_1)(int) = func2;
//int(*func2_2)(int,int) = func2;
int(*func3_1)(int)= func3;
int(*func3_2)(double)= func3;
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_AMethod, AMethod, 0, 2);
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_CMethod, CMethod, 1, 3);
int(AClass::*f1_BMethod)() = &AClass::BMethod;
double(AClass::*f2_BMethod)(double) = &AClass::BMethod;
BOOST_PYTHON_MODULE(test05) {
// this is a temporal solution
def("func2", (int(*)(int,int))0, f_func2());
//def("func2", func2_1);
//def("func2", func2_2);
def("func3", func3_2);
def("func3", func3_1);
class_<AClass>( "AClass", "a class")
.def(init<>())
.def(init<int, optional<double> >())
.add_property("i", &AClass::GetIVal, &AClass::SetIVal)
.def("AMethod", (int(AClass::*)(int,double))0,
f_AMethod(args("i","d"), "amethod"))
.def("BMethod", f1_BMethod)
.def("BMethod", f2_BMethod, args("i","d"), "bmethod2")
.def("CMethod", &AClass::CMethod,
f_CMethod((arg("i"), arg("d1")=1., arg("d2")=2.),
"cmethod: return i*d1*d2")
)
;
}