Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:08

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   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