File indexing completed on 2025-01-18 09:58:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef G4DNAMesh_hh
0028 #define G4DNAMesh_hh 1
0029
0030 #include "globals.hh"
0031 #include "G4DNABoundingBox.hh"
0032 #include <vector>
0033 #include <array>
0034 #include <cmath>
0035 #include <unordered_map>
0036 #include <memory>
0037 #include <sstream>
0038 #include "G4MolecularConfiguration.hh"
0039 #include "G4VDNAMesh.hh"
0040
0041 class G4DNAMesh : public G4VDNAMesh
0042 {
0043 public:
0044 using Box = G4DNABoundingBox;
0045 using MolType = const G4MolecularConfiguration*;
0046 using Data = std::map<MolType, size_t>;
0047 using Voxel = std::tuple<Index, Box, Data>;
0048 using IndexMap = std::unordered_map<Index, G4int, G4VDNAMesh::hashFunc>;
0049 using VoxelVector = std::vector<Voxel>;
0050 G4DNAMesh(const G4DNABoundingBox&, G4int);
0051 ~G4DNAMesh() override;
0052 Index GetIndex(const G4ThreeVector& position) const;
0053 Voxel& GetVoxel(const Index& index);
0054 size_t size() { return fVoxelVector.size(); };
0055 Index ConvertIndex(const Index& index, const G4int&) const;
0056 std::vector<Index> FindNeighboringVoxels(const Index& index) const;
0057 void Reset();
0058 Data& GetVoxelMapList(const Index& index);
0059 auto end() { return fVoxelVector.end(); }
0060 auto begin() { return fVoxelVector.begin(); }
0061 VoxelVector::const_iterator const_end() const { return fVoxelVector.end(); }
0062 VoxelVector::const_iterator const_begin() const
0063 {
0064 return fVoxelVector.begin();
0065 }
0066 void PrintMesh();
0067 void PrintVoxel(const Index& index);
0068 const G4DNABoundingBox& GetBoundingBox() const;
0069 G4DNABoundingBox GetBoundingBox(const Index& index);
0070 G4int GetNumberOfType(MolType type) const;
0071 void InitializeVoxel(const Index& key, Data&& mapList);
0072 G4double GetResolution() const;
0073
0074 private:
0075 IndexMap fIndexMap;
0076 VoxelVector fVoxelVector;
0077 const G4DNABoundingBox* fpBoundingMesh;
0078 G4double fResolution;
0079 };
0080 #endif