Import Geant4 8.1.0 source tree
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# $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 := test01#
|
||||
|
||||
# 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,73 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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:37:52 gunter Exp $
|
||||
// ====================================================================
|
||||
// AClass.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "AClass.hh"
|
||||
#include <iostream>
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////
|
||||
AClass::AClass()
|
||||
: ival(-1),
|
||||
dval(-1.)
|
||||
////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
AClass::AClass(int i, double d)
|
||||
: ival(i), dval(d)
|
||||
///////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////
|
||||
AClass::~AClass()
|
||||
/////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////
|
||||
void AClass::AMethod()
|
||||
//////////////////////
|
||||
{
|
||||
std::cout << "%%% AClass::AMethod is called."
|
||||
<< " (ival, dval)= (" << ival << "," << dval << ")"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
@@ -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:37:55 gunter Exp $
|
||||
// ====================================================================
|
||||
// AClass.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef ACLASS_H
|
||||
#define ACLASS_H
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class AClass {
|
||||
private:
|
||||
int ival;
|
||||
double dval;
|
||||
|
||||
public:
|
||||
AClass();
|
||||
AClass(int i, double d=0.);
|
||||
|
||||
~AClass();
|
||||
|
||||
inline void SetIVal(int i);
|
||||
inline int GetIVal() const;
|
||||
|
||||
inline void SetDVal(double d);
|
||||
inline double GetDVal() const;
|
||||
|
||||
void AMethod();
|
||||
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
|
||||
inline void AClass::SetIVal(int i) { ival= i; }
|
||||
inline int AClass::GetIVal() const { return ival; }
|
||||
|
||||
inline void AClass::SetDVal(double d) { dval= d; }
|
||||
inline double AClass::GetDVal() const { return dval; }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
# $Id: GNUmakefile,v 1.2 2006/04/25 07:54:28 kmura Exp $
|
||||
# ===========================================================
|
||||
# Makefile for building local library
|
||||
#
|
||||
# ===========================================================
|
||||
include ../../../config/config.gmk
|
||||
|
||||
MODULE := libXXX#
|
||||
|
||||
include $(G4PY_INSTALL)/config/mylib.gmk
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
# ==================================================================
|
||||
# python script for Geant4Py test
|
||||
#
|
||||
#
|
||||
# ==================================================================
|
||||
import test01
|
||||
|
||||
print "importing created module...\n"
|
||||
|
||||
a= test01.AClass()
|
||||
b= test01.AClass(0)
|
||||
c= test01.AClass(1, 1.)
|
||||
|
||||
print " >>a<<",
|
||||
a.AMethod()
|
||||
|
||||
print ">>b<<",
|
||||
b.AMethod()
|
||||
|
||||
print ">>c<<",
|
||||
c.AMethod()
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: test01.cc,v 1.4 2006/06/29 15:37:49 gunter Exp $
|
||||
// ====================================================================
|
||||
// test01.cc
|
||||
//
|
||||
// exposure of a simple class
|
||||
// - constructor
|
||||
// - multiple constructors
|
||||
// - default value in function arguments
|
||||
// - setter/getter
|
||||
// - method
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include "AClass.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
BOOST_PYTHON_MODULE(test01) {
|
||||
class_<AClass>( "AClass", "a simple class")
|
||||
.def(init<>())
|
||||
.def(init<int>())
|
||||
.def(init<int, double>())
|
||||
.add_property("ival", &AClass::GetIVal, &AClass::SetIVal)
|
||||
.add_property("dval", &AClass::GetDVal, &AClass::SetDVal)
|
||||
.def("AMethod", &AClass::AMethod)
|
||||
;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user