|
|
|||
File indexing completed on 2026-09-04 09:12:29
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4IStore 0027 // 0028 // Class description: 0029 // 0030 // An implementation of an "importance store" with the interface 0031 // G4VIStore. See description in G4VIStore. 0032 // This implementation uses G4GeometryCellImportance as the container 0033 // to store the "cells" together with the importance values. 0034 // Giving a cell the importance 0 is allowed as a flagging that no biasing 0035 // should happen between this cell and its neighbors. 0036 // If a cell is not known by the importance store no biasing should be 0037 // applied between this cell and its nighbors. 0038 0039 // Author: Michael Dressel (CERN), 2002 - Created 0040 // Alex Howard (CERN), 2013 - Changed class to a 'singleton' 0041 // ---------------------------------------------------------------------- 0042 #ifndef G4ISTORE_HH 0043 #define G4ISTORE_HH 0044 0045 #include "G4VIStore.hh" 0046 #include "G4GeometryCellImportance.hh" 0047 #include "G4TransportationManager.hh" 0048 0049 /** 0050 * @brief G4IStore is a concrete implementation of an "importance store", as 0051 * derived from G4VIStore. It is a singleton, using G4GeometryCellImportance 0052 * as the container to store the "cells" together with the importance values. 0053 * Giving a cell, the importance 0 is allowed as a flagging that no biasing 0054 * should happen between this cell and its neighbors. 0055 * If a cell is not known by the importance store no biasing should be 0056 * applied between this cell and its nighbors. 0057 */ 0058 0059 class G4IStore : public G4VIStore 0060 { 0061 public: 0062 0063 /** 0064 * Returns a pointer to the singleton instance of the class. 0065 */ 0066 static G4IStore* GetInstance(); 0067 0068 /** 0069 * Returns a pointer to the singleton instance of the class, given 0070 * the name of the parallel world of reference. 0071 */ 0072 static G4IStore* GetInstance(const G4String& ParallelWorldName); 0073 0074 /** 0075 * Returns the importance value of a "cell" from the store addressed 0076 * by 'gCell'. 0077 * @param[in] gCell The cell of reference. 0078 * @returns The associated importance weight. 0079 */ 0080 G4double GetImportance(const G4GeometryCell& gCell) const override; 0081 0082 /** 0083 * Returns true if 'gCell' is in the store, else false. 0084 * @param[in] gCell The cell of reference. 0085 * @returns true if present in the store, false otherwise. 0086 */ 0087 G4bool IsKnown(const G4GeometryCell& gCell) const override; 0088 0089 /** 0090 * Clears the cells importance store. 0091 */ 0092 void Clear(); 0093 0094 /** 0095 * Sets a reference to world volume of the "importance" geometry. 0096 */ 0097 void SetWorldVolume(); 0098 0099 /** 0100 * Sets a reference to parallel world volume of the "importance" geometry. 0101 */ 0102 void SetParallelWorldVolume(const G4String& paraName); 0103 0104 /** 0105 * Returns a reference to the world volume of the "importance" geometry. 0106 */ 0107 const G4VPhysicalVolume& GetWorldVolume() const override; 0108 0109 /** 0110 * Returns a pointer to the world volume of the "importance" geometry. 0111 */ 0112 const G4VPhysicalVolume* GetParallelWorldVolumePointer() const; 0113 0114 /** 0115 * Methods to add a "cell" together with an importance value to the store. 0116 */ 0117 void AddImportanceGeometryCell(G4double importance, 0118 const G4GeometryCell &gCell); 0119 void AddImportanceGeometryCell(G4double importance, 0120 const G4VPhysicalVolume &, 0121 G4int aRepNum = 0); 0122 0123 /** 0124 * Methods to change an importance value of a "cell". 0125 */ 0126 void ChangeImportance(G4double importance, const G4GeometryCell& gCell); 0127 void ChangeImportance(G4double importance, const G4VPhysicalVolume&, 0128 G4int aRepNum = 0); 0129 0130 /** 0131 * Returns the importance weight, given the volume and replica number. 0132 */ 0133 G4double GetImportance(const G4VPhysicalVolume& vol, G4int rpNum = 0) const; 0134 0135 private: 0136 0137 /** 0138 * Constructors. Initialising the importance store for the given geometry. 0139 */ 0140 explicit G4IStore(); 0141 explicit G4IStore(const G4String& ParallelWorldName); 0142 0143 /** 0144 * Default Destructor. 0145 */ 0146 ~G4IStore() override = default; 0147 0148 /** 0149 * Internal utilities. 0150 */ 0151 G4bool IsInWorld(const G4VPhysicalVolume&) const; 0152 void SetInternalIterator(const G4GeometryCell& gCell) const; 0153 0154 /** 0155 * Internal logger. 0156 */ 0157 void Error(const G4String& m) const; 0158 0159 private: 0160 0161 const G4VPhysicalVolume* fWorldVolume = nullptr; 0162 G4GeometryCellImportance fGeometryCelli; 0163 0164 mutable G4GeometryCellImportance::const_iterator fCurrentIterator; 0165 0166 static G4ThreadLocal G4IStore* fInstance; 0167 }; 0168 0169 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|