|
||||
File indexing completed on 2025-01-18 09:58:17
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 // G4Field 0027 // 0028 // Class description: 0029 // 0030 // Abstract class for any kind of Field. 0031 // It allows any kind of field (vector, scalar, tensor and any set of them) 0032 // to be defined by implementing the inquiry function interface. 0033 // 0034 // The key method is GetFieldValue( const double Point[4], 0035 // ************* double *fieldArr ) 0036 // Given an input position/time vector 'Point', 0037 // this method must return the value of the field in "fieldArr". 0038 // 0039 // A field must also specify whether it changes a track's energy: 0040 // DoesFieldChangeEnergy() 0041 // ********************* 0042 // A field must co-work with a corresponding Equation of Motion, to 0043 // enable the integration of a particle's position, momentum and, optionally, 0044 // spin. For this a field and its equation of motion must follow the 0045 // same convention for the order of field components in the array "fieldArr" 0046 0047 // Created: John Apostolakis, 10.03.1997 0048 // ------------------------------------------------------------------- 0049 #ifndef G4FIELD_HH 0050 #define G4FIELD_HH 0051 0052 #include "G4Types.hh" 0053 #include "globals.hh" 0054 0055 class G4Field 0056 { 0057 public: // with description 0058 0059 G4Field( G4bool gravityOn = false); 0060 G4Field( const G4Field& ); 0061 virtual ~G4Field(); 0062 G4Field& operator = (const G4Field& p); 0063 0064 virtual void GetFieldValue( const G4double Point[4], 0065 G4double* fieldArr ) const = 0; 0066 // Given the position time vector 'Point', 0067 // return the value of the field in the array fieldArr. 0068 // Notes: 0069 // 1) The 'Point' vector has the following structure: 0070 // Point[0] is x ( position, in Geant4 units ) 0071 // Point[1] is y 0072 // Point[2] is z 0073 // Point[3] is t ( time, in Geant4 units ) 0074 // 2) The convention for the components of the field 0075 // array 'fieldArr' are determined by the type of field. 0076 // See for example the class G4ElectroMagneticField. 0077 0078 virtual G4bool DoesFieldChangeEnergy() const = 0; 0079 // Each type/class of field should respond this accordingly 0080 // For example: 0081 // - an electric field should return "true" 0082 // - a pure magnetic field should return "false" 0083 0084 inline G4bool IsGravityActive() const; 0085 // Does this field include gravity? 0086 0087 inline void SetGravityActive( G4bool OnOffFlag ); 0088 0089 virtual G4Field* Clone() const; 0090 // Implements cloning, needed by multi-threading 0091 0092 static constexpr G4int MAX_NUMBER_OF_COMPONENTS = 24; 0093 0094 private: 0095 0096 G4bool fGravityActive = false; 0097 }; 0098 0099 // Inline methods ... 0100 0101 inline G4bool G4Field::IsGravityActive() const 0102 { 0103 return fGravityActive; 0104 } 0105 0106 inline void G4Field::SetGravityActive( G4bool OnOffFlag ) 0107 { 0108 fGravityActive = OnOffFlag; 0109 } 0110 0111 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |