Files
geant4/environments/g4py/source/geometry/pyG4LogicalVolume.cc
T
2016-06-09 14:44:26 +02:00

158 lines
7.0 KiB
C++

//
// ********************************************************************
// * 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: pyG4LogicalVolume.cc,v 1.4 2006/06/29 15:32:08 gunter Exp $
// $Name: geant4-08-01 $
// ====================================================================
// pyG4LogicalVolume.cc
//
// 2005 Q
// ====================================================================
#include <boost/python.hpp>
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4VSolid.hh"
#include "G4FieldManager.hh"
#include "G4VSensitiveDetector.hh"
#include "G4UserLimits.hh"
#include "G4SmartVoxelHeader.hh"
#include "G4MaterialCutsCouple.hh"
#include "G4FastSimulationManager.hh"
#include "G4VisAttributes.hh"
#include "pyG4Version.hh"
using namespace boost::python;
// ====================================================================
// thin wrappers
// ====================================================================
namespace pyG4LogicalVolume {
void(G4LogicalVolume::*f1_SetVisAttributes)(const G4VisAttributes*)
= &G4LogicalVolume::SetVisAttributes;
void(G4LogicalVolume::*f2_SetVisAttributes)(const G4VisAttributes&)
= &G4LogicalVolume::SetVisAttributes;
#if G4VERSION_NUMBER <= 701
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetMass, GetMass, 0, 2);
#elif G4VERSION_NUMBER >=710
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_GetMass, GetMass, 0, 3);
#endif
};
using namespace pyG4LogicalVolume;
// ====================================================================
// module definition
// ====================================================================
void export_G4LogicalVolume()
{
class_<G4LogicalVolume, G4LogicalVolume*, boost::noncopyable>
("G4LogicalVolume", "logical volume class", no_init)
// constructors
.def(init<G4VSolid*, G4Material*, const G4String& >())
.def(init<G4VSolid*, G4Material*, const G4String&,
G4FieldManager* >())
.def(init<G4VSolid*, G4Material*, const G4String&,
G4FieldManager*, G4VSensitiveDetector* >())
.def(init<G4VSolid*, G4Material*, const G4String&,
G4FieldManager*, G4VSensitiveDetector*,
G4UserLimits* >())
.def(init<G4VSolid*, G4Material*, const G4String&,
G4FieldManager*, G4VSensitiveDetector*,
G4UserLimits*, G4bool >())
// ---
.def("GetName", &G4LogicalVolume::GetName)
.def("SetName", &G4LogicalVolume::SetName)
// ---
.def("GetNoDaughters", &G4LogicalVolume::GetNoDaughters)
.def("GetDaughter", &G4LogicalVolume::GetDaughter,
return_internal_reference<>())
.def("AddDaughter", &G4LogicalVolume::AddDaughter)
.def("IsDaughter", &G4LogicalVolume::IsDaughter)
.def("IsAncestor", &G4LogicalVolume::IsAncestor)
.def("RemoveDaughter", &G4LogicalVolume::RemoveDaughter)
.def("ClearDaughters", &G4LogicalVolume::ClearDaughters)
.def("TotalVolumeEntities", &G4LogicalVolume::TotalVolumeEntities)
// ----
.def("GetSolid", &G4LogicalVolume::GetSolid,
return_internal_reference<>())
.def("SetSolid", &G4LogicalVolume::SetSolid)
.def("GetMaterial", &G4LogicalVolume::GetMaterial,
return_internal_reference<>())
.def("SetMaterial", &G4LogicalVolume::SetMaterial)
.def("UpdateMaterial", &G4LogicalVolume::UpdateMaterial)
// ---
.def("GetMass", &G4LogicalVolume::GetMass, f_GetMass())
.def("GetFieldManager", &G4LogicalVolume::GetFieldManager,
return_internal_reference<>())
.def("SetFieldManager", &G4LogicalVolume::SetFieldManager)
.def("GetSensitiveDetector", &G4LogicalVolume::GetSensitiveDetector,
return_internal_reference<>())
.def("GetUserLimits", &G4LogicalVolume::GetUserLimits,
return_internal_reference<>())
.def("SetUserLimits", &G4LogicalVolume::SetUserLimits)
// ---
.def("GetVoxelHeader", &G4LogicalVolume::GetVoxelHeader,
return_internal_reference<>())
.def("SetVoxelHeader", &G4LogicalVolume::SetVoxelHeader)
.def("GetSmartless", &G4LogicalVolume::GetSmartless)
.def("SetSmartless", &G4LogicalVolume::SetSmartless)
.def("IsToOptimise", &G4LogicalVolume::IsToOptimise)
.def("SetOptimisation", &G4LogicalVolume::SetOptimisation)
// ---
.def("IsRootRegion", &G4LogicalVolume::IsRootRegion)
.def("SetRegionRootFlag", &G4LogicalVolume::SetRegionRootFlag)
.def("IsRegion", &G4LogicalVolume::IsRegion)
.def("SetRegion", &G4LogicalVolume::SetRegion)
.def("GetRegion", &G4LogicalVolume::GetRegion,
return_internal_reference<>())
.def("PropagateRegion", &G4LogicalVolume::PropagateRegion)
.def("GetMaterialCutsCouple", &G4LogicalVolume::GetMaterialCutsCouple,
return_internal_reference<>())
.def("SetMaterialCutsCouple", &G4LogicalVolume::SetMaterialCutsCouple)
// ---
.def("GetVisAttributes", &G4LogicalVolume::GetVisAttributes,
return_internal_reference<>())
.def("SetVisAttributes", f1_SetVisAttributes)
.def("SetVisAttributes", f2_SetVisAttributes)
// ---
#if G4VERSION_NUMBER >= 700 && G4VERSION_NUMBER <= 711
.def("BecomeEnvelopeForFastSimulation",
&G4LogicalVolume::BecomeEnvelopeForFastSimulation)
.def("ClearEnvelopeForFastSimulation",
&G4LogicalVolume::ClearEnvelopeForFastSimulation)
#endif
.def("GetFastSimulationManager",
&G4LogicalVolume::GetFastSimulationManager,
return_internal_reference<>())
// ---
.def("SetBiasWeight", &G4LogicalVolume::SetBiasWeight)
.def("GetBiasWeight", &G4LogicalVolume::GetBiasWeight)
;
}