![]() |
|
|||
File indexing completed on 2025-02-23 09:21:58
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 #ifndef MOLECULAR_UTILITY_FUNCTIONS_HH 0028 #define MOLECULAR_UTILITY_FUNCTIONS_HH 0029 0030 #include "G4ThreeVector.hh" 0031 #include "globals.hh" 0032 0033 #include <array> 0034 #include <string> 0035 #include <vector> 0036 0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0038 0039 namespace utility 0040 { 0041 std::vector<G4String>& Split(const G4String&, char, std::vector<G4String>&); 0042 0043 std::vector<G4String> Split(const G4String&, char); 0044 0045 G4String Get_seperated_element(const G4String&, char, G4int); 0046 0047 std::array<G4String, 4> Get_four_elements(const G4String&, char); 0048 0049 G4bool Path_exists(const G4String&); 0050 0051 G4String Getcwd(); 0052 0053 G4double Min(const G4ThreeVector&); 0054 0055 // sign function 0056 template<typename T> 0057 [[maybe_unused]] inline constexpr G4int Signum(T, std::false_type); 0058 0059 template<typename T> 0060 inline constexpr int Signum(T, std::true_type); 0061 0062 template<typename T> 0063 inline constexpr int Signum(T); 0064 0065 // find last (highest) significant bit 0066 // linux implementation, copied for portability 0067 // http://lxr.linux.no/#linux+v2.6.26.5/include/asm-generic/bitops/fls.h 0068 static inline int Fls(int x) 0069 { 0070 int r = 32; 0071 0072 if (!x) return 0; 0073 if (!(x & 0xffff0000u)) { 0074 x <<= 16; 0075 r -= 16; 0076 } 0077 if (!(x & 0xff000000u)) { 0078 x <<= 8; 0079 r -= 8; 0080 } 0081 if (!(x & 0xf0000000u)) { 0082 x <<= 4; 0083 r -= 4; 0084 } 0085 if (!(x & 0xc0000000u)) { 0086 x <<= 2; 0087 r -= 2; 0088 } 0089 if (!(x & 0x80000000u)) { 0090 x <<= 1; 0091 r -= 1; 0092 } 0093 return r; 0094 } 0095 0096 } // namespace utility 0097 0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0099 0100 #endif // MOLECULAR_UTILITY_FUNCTIONS_HH
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |