Files
2025-12-05 08:54:02 +01:00

307 lines
8.8 KiB
Plaintext

//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// G4Region inline implementation
//
// Author: Gabriele Cosmo (CERN), 18.09.2002
// --------------------------------------------------------------------
// ********************************************************************
// Equality operator, defined by address only
// ********************************************************************
//
inline
G4bool G4Region::operator==(const G4Region& rg) const
{
return this==&rg;
}
// ********************************************************************
// GetInstanceID
// ********************************************************************
//
inline
G4int G4Region::GetInstanceID() const
{
return instanceID;
}
// ********************************************************************
// GetName
// ********************************************************************
//
inline
const G4String& G4Region::GetName() const
{
return fName;
}
// ********************************************************************
// RegionModified
// ********************************************************************
//
inline
void G4Region::RegionModified(G4bool flag)
{
fRegionMod = flag;
}
// ********************************************************************
// IsModified
// ********************************************************************
//
inline
G4bool G4Region::IsModified() const
{
return fRegionMod;
}
// ********************************************************************
// SetProductionCuts
// ********************************************************************
//
inline
void G4Region::SetProductionCuts(G4ProductionCuts* cut)
{
fCut = cut;
fRegionMod = true;
}
// ********************************************************************
// GetProductionCuts
// ********************************************************************
//
inline
G4ProductionCuts* G4Region::GetProductionCuts() const
{
return fCut;
}
// ********************************************************************
// GetLogicalVolumeIterator
// ********************************************************************
//
inline
std::vector<G4LogicalVolume*>::iterator
G4Region::GetRootLogicalVolumeIterator()
{
return G4RootLVList::iterator(fRootVolumes.begin());
}
// ********************************************************************
// GetMaterialIterator
// ********************************************************************
//
inline
std::vector<G4Material*>::const_iterator
G4Region::GetMaterialIterator() const
{
return fMaterials.cbegin();
}
// ********************************************************************
// GetNumberOfMaterials
// ********************************************************************
//
inline
std::size_t G4Region::GetNumberOfMaterials() const
{
return fMaterials.size();
}
// ********************************************************************
// GetNumberOfRootVolumes
// ********************************************************************
//
inline
std::size_t G4Region::GetNumberOfRootVolumes() const
{
return fRootVolumes.size();
}
// ********************************************************************
// SetUserInformation
// ********************************************************************
//
inline
void G4Region::SetUserInformation(G4VUserRegionInformation* ui)
{
fUserInfo = ui;
}
// ********************************************************************
// GetUserInformation
// ********************************************************************
//
inline
G4VUserRegionInformation* G4Region::GetUserInformation() const
{
return fUserInfo;
}
// ********************************************************************
// SetUserLimits
// ********************************************************************
//
inline
void G4Region::SetUserLimits(G4UserLimits* ul)
{
fUserLimits = ul;
}
// ********************************************************************
// GetUserLimits
// ********************************************************************
//
inline
G4UserLimits* G4Region::GetUserLimits() const
{
return fUserLimits;
}
// ********************************************************************
// ClearMap
// ********************************************************************
//
inline
void G4Region::ClearMap()
{
if(!(fMaterialCoupleMap.empty()))
{
auto b = fMaterialCoupleMap.cbegin();
auto e = fMaterialCoupleMap.cend();
fMaterialCoupleMap.erase(b,e);
}
}
// ********************************************************************
// RegisterMateralCouplePair
// ********************************************************************
//
inline
void G4Region::RegisterMaterialCouplePair(G4Material* mat,
G4MaterialCutsCouple* couple)
{
fMaterialCoupleMap.insert(G4MaterialCouplePair(mat,couple));
}
// ********************************************************************
// FindCouple
// ********************************************************************
//
inline
G4MaterialCutsCouple* G4Region::FindCouple(G4Material* mat)
{
auto c = fMaterialCoupleMap.find(mat);
G4MaterialCutsCouple* couple = nullptr;
if(c!=fMaterialCoupleMap.cend()) { couple = (*c).second; }
return couple;
}
// ********************************************************************
// GetFieldManager
// ********************************************************************
//
inline
G4FieldManager* G4Region::GetFieldManager() const
{
return fFieldManager;
}
// ********************************************************************
// SetFieldManager
// ********************************************************************
//
inline
void G4Region::SetFieldManager(G4FieldManager* fm)
{
fFieldManager = fm;
}
// ********************************************************************
// GetWorldPhysical
// ********************************************************************
//
inline
G4VPhysicalVolume* G4Region::GetWorldPhysical() const
{
return fWorldPhys;
}
// ********************************************************************
// AddMaterial
// ********************************************************************
//
inline
void G4Region::AddMaterial(G4Material* aMaterial)
{
auto pos = std::find(fMaterials.cbegin(),fMaterials.cend(),aMaterial);
if (pos == fMaterials.cend())
{
fMaterials.push_back(aMaterial);
fRegionMod = true;
}
}
// ********************************************************************
// UsedInMassGeometry
// ********************************************************************
//
inline
void G4Region::UsedInMassGeometry(G4bool val)
{
fInMassGeometry = val;
}
// ********************************************************************
// UsedInParallelGeometry
// ********************************************************************
//
inline
void G4Region::UsedInParallelGeometry(G4bool val)
{
fInParallelGeometry = val;
}
// ********************************************************************
// IsInMassGeometry
// ********************************************************************
//
inline
G4bool G4Region::IsInMassGeometry() const
{
return fInMassGeometry;
}
// ********************************************************************
// IsInParallelGeometry
// ********************************************************************
//
inline
G4bool G4Region::IsInParallelGeometry() const
{
return fInParallelGeometry;
}