2 // ********************************************************************
 
    3 // * License and Disclaimer                                           *
 
    5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
 
    6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
 
    7 // * conditions of the Geant4 Software License,  included in the file *
 
    8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
 
    9 // * include a list of copyright holders.                             *
 
   11 // * Neither the authors of this software system, nor their employing *
 
   12 // * institutes,nor the agencies providing financial support for this *
 
   13 // * work  make  any representation or  warranty, express or implied, *
 
   14 // * regarding  this  software system or assume any liability for its *
 
   15 // * use.  Please see the license in the file  LICENSE  and URL above *
 
   16 // * for the full disclaimer and the limitation of liability.         *
 
   18 // * This  code  implementation is the result of  the  scientific and *
 
   19 // * technical work of the GEANT4 collaboration.                      *
 
   20 // * By using,  copying,  modifying or  distributing the software (or *
 
   21 // * any work based  on the software)  you  agree  to acknowledge its *
 
   22 // * use  in  resulting  scientific  publications,  and indicate your *
 
   23 // * acceptance of all terms of the Geant4 Software license.          *
 
   24 // ********************************************************************
 
   27 // $Id: G4Region.icc 67975 2013-03-13 10:19:44Z gcosmo $
 
   30 // class G4Region Inline Implementation file
 
   32 // 19.09.02 - G.Cosmo: Created
 
   33 // --------------------------------------------------------------------
 
   35 // ********************************************************************
 
   36 // Equality operator, defined by address only
 
   37 // ********************************************************************
 
   40 G4bool G4Region::operator==(const G4Region& rg) const
 
   42   return (this==&rg) ? true : false;
 
   45 // ********************************************************************
 
   47 // ********************************************************************
 
   50 G4int G4Region::GetInstanceID() const
 
   55 // ********************************************************************
 
   57 // ********************************************************************
 
   60 const G4String& G4Region::GetName() const
 
   65 // ********************************************************************
 
   67 // ********************************************************************
 
   70 void G4Region::SetName(const G4String& pName)
 
   75 // ********************************************************************
 
   77 // ********************************************************************
 
   80 void G4Region::RegionModified(G4bool flag)
 
   85 // ********************************************************************
 
   87 // ********************************************************************
 
   90 G4bool G4Region::IsModified() const
 
   95 // ********************************************************************
 
   97 // ********************************************************************
 
  100 void G4Region::SetProductionCuts(G4ProductionCuts* cut)
 
  106 // ********************************************************************
 
  108 // ********************************************************************
 
  111 G4ProductionCuts* G4Region::GetProductionCuts() const
 
  116 // ********************************************************************
 
  117 // GetLogicalVolumeIterator
 
  118 // ********************************************************************
 
  121 std::vector<G4LogicalVolume*>::iterator
 
  122 G4Region::GetRootLogicalVolumeIterator()
 
  124   G4RootLVList::iterator iterator =
 
  125     G4RootLVList::iterator(fRootVolumes.begin());
 
  129 // ********************************************************************
 
  130 // GetMaterialIterator
 
  131 // ********************************************************************
 
  134 std::vector<G4Material*>::const_iterator
 
  135 G4Region::GetMaterialIterator() const
 
  137   G4MaterialList::const_iterator iterator = fMaterials.begin();
 
  141 // ********************************************************************
 
  142 // GetNumberOfMaterials
 
  143 // ********************************************************************
 
  146 size_t G4Region::GetNumberOfMaterials() const
 
  148   return fMaterials.size();
 
  151 // ********************************************************************
 
  152 // GetNumberOfRootVolumes
 
  153 // ********************************************************************
 
  156 size_t G4Region::GetNumberOfRootVolumes() const
 
  158   return fRootVolumes.size();
 
  161 // ********************************************************************
 
  162 // SetUserInformation
 
  163 // ********************************************************************
 
  166 void G4Region::SetUserInformation(G4VUserRegionInformation* ui)
 
  171 // ********************************************************************
 
  172 // GetUserInformation
 
  173 // ********************************************************************
 
  176 G4VUserRegionInformation* G4Region::GetUserInformation() const
 
  181 // ********************************************************************
 
  183 // ********************************************************************
 
  186 void G4Region::SetUserLimits(G4UserLimits* ul)
 
  191 // ********************************************************************
 
  193 // ********************************************************************
 
  196 G4UserLimits* G4Region::GetUserLimits() const
 
  201 // ********************************************************************
 
  203 // ********************************************************************
 
  206 void G4Region::ClearMap()
 
  208   if(!(fMaterialCoupleMap.empty()))
 
  210     G4MaterialCoupleMap::iterator b = fMaterialCoupleMap.begin();
 
  211     G4MaterialCoupleMap::iterator e = fMaterialCoupleMap.end();
 
  212     fMaterialCoupleMap.erase(b,e);
 
  216 // ********************************************************************
 
  217 // RegisterMateralCouplePair
 
  218 // ********************************************************************
 
  221 void G4Region::RegisterMaterialCouplePair(G4Material* mat,
 
  222                                           G4MaterialCutsCouple* couple)
 
  224   fMaterialCoupleMap.insert(G4MaterialCouplePair(mat,couple));
 
  227 // ********************************************************************
 
  229 // ********************************************************************
 
  232 G4MaterialCutsCouple* G4Region::FindCouple(G4Material* mat)
 
  234   G4MaterialCoupleMap::iterator c = fMaterialCoupleMap.find(mat);
 
  235   G4MaterialCutsCouple* couple = 0;
 
  236   if(c!=fMaterialCoupleMap.end()) couple = (*c).second;
 
  240 // ********************************************************************
 
  241 // SetFastSimulationManager
 
  242 // ********************************************************************
 
  245 void G4Region::SetFastSimulationManager(G4FastSimulationManager* fsm)
 
  247   G4MT_fsmanager = fsm;
 
  250 // ********************************************************************
 
  251 // GetFastSimulationManager
 
  252 // ********************************************************************
 
  255 G4FastSimulationManager* G4Region::GetFastSimulationManager() const
 
  257   return G4MT_fsmanager;
 
  260 // ********************************************************************
 
  262 // ********************************************************************
 
  265 G4FieldManager* G4Region::GetFieldManager() const
 
  267   return fFieldManager;
 
  270 // ********************************************************************
 
  272 // ********************************************************************
 
  275 void G4Region::SetFieldManager(G4FieldManager* fm)
 
  280 // ********************************************************************
 
  282 // ********************************************************************
 
  285 G4VPhysicalVolume* G4Region::GetWorldPhysical() const
 
  290 // ********************************************************************
 
  292 // ********************************************************************
 
  295 void G4Region::AddMaterial(G4Material* aMaterial)
 
  297   G4MaterialList::iterator pos =
 
  298     std::find(fMaterials.begin(),fMaterials.end(),aMaterial);
 
  299   if (pos == fMaterials.end())
 
  301     fMaterials.push_back(aMaterial);
 
  306 // ********************************************************************
 
  307 // SetRegionalSteppingAction
 
  308 // ********************************************************************
 
  311 void G4Region::SetRegionalSteppingAction(G4UserSteppingAction* rusa)
 
  313   G4MT_rsaction = rusa;
 
  316 // ********************************************************************
 
  317 // GetRegionalSteppingAction
 
  318 // ********************************************************************
 
  321 G4UserSteppingAction* G4Region::GetRegionalSteppingAction() const
 
  323   return G4MT_rsaction;
 
  326 // ********************************************************************
 
  327 // UsedInMassGeometry
 
  328 // ********************************************************************
 
  331 void G4Region::UsedInMassGeometry(G4bool val)
 
  333   fInMassGeometry = val;
 
  336 // ********************************************************************
 
  337 // UsedInParallelGeometry
 
  338 // ********************************************************************
 
  341 void G4Region::UsedInParallelGeometry(G4bool val)
 
  343   fInParallelGeometry = val;
 
  346 // ********************************************************************
 
  348 // ********************************************************************
 
  351 G4bool G4Region::IsInMassGeometry() const
 
  353   return fInMassGeometry;
 
  356 // ********************************************************************
 
  357 // IsInParallelGeometry
 
  358 // ********************************************************************
 
  361 G4bool G4Region::IsInParallelGeometry() const
 
  363   return fInParallelGeometry;