Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-18 08:32:37

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 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);  // GetorCreateVoxel
0054   size_t size() { return fVoxelVector.size(); };
0055   Index ConvertIndex(const Index& index, const G4int&) const;
0056   Index GetRandomIndex(const Index&, const G4double& resolution) const;
0057   std::vector<Index> FindNeighboringVoxels(const Index& index) const;
0058   void Reset();
0059   Data& GetVoxelMapList(const Index& index);
0060   auto end() { return fVoxelVector.end(); }
0061   auto begin() { return fVoxelVector.begin(); }
0062   VoxelVector::const_iterator const_end() const { return fVoxelVector.end(); }
0063   VoxelVector::const_iterator const_begin() const
0064   {
0065     return fVoxelVector.begin();
0066   }
0067   void PrintMesh();
0068   void PrintVoxel(const Index& index);
0069   const G4DNABoundingBox& GetBoundingBox() const;
0070   G4DNABoundingBox GetBoundingBox(const Index& index);
0071   G4int GetNumberOfType(MolType type) const;
0072   void InitializeVoxel(const Index& key, Data&& mapList);
0073   G4double GetResolution() const;
0074 
0075  private:
0076   IndexMap fIndexMap;
0077   VoxelVector fVoxelVector;
0078   const G4DNABoundingBox* fpBoundingMesh;
0079   G4double fResolution;
0080 };
0081 #endif