![]() |
|
|||
File indexing completed on 2025-02-23 09:22:10
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 /* 0027 * Based on 'G4pbc'. 0028 * Copyright (c) 2020 Amentum Pty Ltd 0029 * team@amentum.space 0030 * The original open-source version of this code 0031 * may be found at https://github.com/amentumspace/g4pbc 0032 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 0033 * associated documentation files (the "Software"), to deal in the Software without restriction, 0034 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 0035 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software 0036 * is furnished to do so, subject to the following conditions: 0037 * The above copyright notice and this permission notice shall be included in all copies 0038 * or substantial portions of the Software. 0039 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 0040 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 0041 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 0042 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0043 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0044 * 0045 * team@amentum.space 0046 */ 0047 #ifndef PeriodicBoundaryProcess_h 0048 #define PeriodicBoundaryProcess_h 1 0049 0050 #include "ParticleChangeForPeriodic.hh" 0051 0052 #include "G4Electron.hh" 0053 #include "G4VDiscreteProcess.hh" 0054 #include "globals.hh" 0055 0056 class G4Step; 0057 0058 enum ProcessStatus 0059 { 0060 Undefined, 0061 Reflection, 0062 Cycling, 0063 StepTooSmall, 0064 NotAtBoundary 0065 }; 0066 0067 class PeriodicBoundaryProcess : public G4VDiscreteProcess 0068 { 0069 public: 0070 explicit PeriodicBoundaryProcess(const G4String& processName = "PBC", 0071 G4ProcessType type = fNotDefined, bool per_x = true, 0072 bool per_y = true, bool per_z = true); 0073 0074 ~PeriodicBoundaryProcess() override = default; 0075 0076 PeriodicBoundaryProcess(const PeriodicBoundaryProcess& right) = delete; 0077 0078 PeriodicBoundaryProcess& operator=(const PeriodicBoundaryProcess& right) = delete; 0079 0080 public: 0081 G4bool IsApplicable(const G4ParticleDefinition&) override; 0082 0083 G4double GetMeanFreePath(const G4Track&, G4double, G4ForceCondition* condition) override; 0084 0085 ProcessStatus GetStatus() const; 0086 0087 G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override; 0088 0089 protected: 0090 ParticleChangeForPeriodic fParticleChange; 0091 0092 private: 0093 void BoundaryProcessVerbose(); 0094 std::map<ProcessStatus, G4String> fStatusMessages = {{Undefined, " *** Undefined *** "}, 0095 {NotAtBoundary, " *** NotAtBoundary *** "}, 0096 {Reflection, " *** Reflection *** "}, 0097 {Cycling, " *** Periodic *** "}, 0098 {StepTooSmall, " *** StepTooSmall *** "}}; 0099 0100 ProcessStatus fTheStatus = Undefined; 0101 G4ThreeVector fOldPosition; 0102 G4ThreeVector fNewPosition; 0103 G4ThreeVector fOldMomentum; 0104 G4ThreeVector fNewMomentum; 0105 G4ThreeVector fOldPolarization; 0106 G4ThreeVector fNewPolarization; 0107 G4ThreeVector fTheGlobalNormal; 0108 G4double fkCarTolerance; 0109 G4bool fPeriodicX = true; 0110 G4bool fPeriodicY = true; 0111 G4bool fPeriodicZ = true; 0112 }; 0113 0114 inline G4bool PeriodicBoundaryProcess::IsApplicable(const G4ParticleDefinition& aParticleType) 0115 { 0116 G4bool applicable = false; 0117 // applied only for electrons 0118 if (&aParticleType == G4Electron::Electron()) { 0119 applicable = true; 0120 } 0121 return applicable; 0122 } 0123 0124 inline ProcessStatus PeriodicBoundaryProcess::GetStatus() const 0125 { 0126 return fTheStatus; 0127 } 0128 0129 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |