31  : fpBoundingMesh(&boundingBox)
 
   32  , fResolution((2 * boundingBox.halfSideLengthInY() / pixel))
 
   39  auto iter = 
fMesh.find(key);
 
   40  if(iter == 
fMesh.end())
 
   48    return iter->second->GetMapList();
 
   60  auto xmax = (
unsigned int) (std::floor(
 
   62  auto ymax = (
unsigned int) (std::floor(
 
   64  return index.
z * ymax * xmax + index.
y * xmax + index.
x;
 
   70  auto iter = 
fMesh.begin();
 
   71  for(; iter != 
fMesh.end(); iter++)
 
   73    auto index = iter->second->GetIndex();
 
   81  auto iter    = 
fMesh.begin();
 
   82  for(; iter != 
fMesh.end(); iter++)
 
   84    auto node = 
dynamic_cast<G4Voxel*
>(iter->second);
 
   90    if(it != node->GetMapList().end())
 
  100  G4cout << 
"*********PrintVoxel::";
 
  101  G4cout << 
"key: " << 
GetKey(index) << 
" index : " << index
 
  107    G4cout << 
"_____________" << it.first->GetName() << 
" : " << it.second
 
  116  auto pVoxel = 
fMesh[key];
 
  117  if(
nullptr == pVoxel)
 
  124    assert(pVoxel->GetMapList().empty());  
 
  125    pVoxel->SetMapList(std::move(mapList));
 
  134  assert(dx >= 0 && dy >= 0 && dz >= 0);
 
  145  int dx = (int) (index.
x * pixels / xmax);
 
  146  int dy = (int) (index.
y * pixels / ymax);
 
  147  int dz = (int) (index.
z * pixels / zmax);
 
  148  assert(dx >= 0 && dy >= 0 && dz >= 0);
 
  149  return Index{ dx, dy, dz };
 
  171  G4int x_ = 
id % xmax;
 
  173  G4int y_ = 
id % ymax;
 
  181    exceptionDescription << 
"xmax != ymax";
 
  183                exceptionDescription);
 
  186  if(x_ < 0 || y_ < 0 || z_ < 0)
 
  191    exceptionDescription << 
"x_ < 0 || y_ < 0 || z_ < 0";
 
  193                exceptionDescription);
 
  195  return Index{ x_, y_, z_ };
 
  204  for(
auto iter : 
fMesh)  
 
  218  auto it = 
fMesh.find(key);
 
  219  if(it != 
fMesh.end())
 
  231std::vector<G4Voxel::Index>  
 
  234  std::vector<Index> neighbors;
 
  236  auto xMax = (int) (std::floor(
 
  238  auto yMax = (int) (std::floor(
 
  240  auto zMax = (int) (std::floor(
 
  243  auto xmin = (index.
x - 1) < 0 ? 0 : (index.
x - 1);
 
  244  auto ymin = (index.
y - 1) < 0 ? 0 : (index.
y - 1);
 
  245  auto zmin = (index.
z - 1) < 0 ? 0 : (index.
z - 1);
 
  247  auto xmax = (index.
x + 1) > xMax ? xMax : (index.
x + 1);
 
  248  auto ymax = (index.
y + 1) > yMax ? yMax : (index.
y + 1);
 
  249  auto zmax = (index.
z + 1) > zMax ? zMax : (index.
z + 1);
 
  250  for(
int ix = xmin; ix <= xmax; ix++)
 
  252    for(
int iy = ymin; iy <= ymax; iy++)
 
  254      for(
int iz = zmin; iz <= zmax; iz++)
 
  256        auto key = iz * yMax * xMax + iy * xMax + ix;
 
  264  if(neighbors.empty())
 
  267    exceptionDescription << 
"neighbors.empty()";
 
  268    G4Exception(
"G4DNAMesh::FindVoxelNeighbors", 
"G4DNAMesh001",
 
  275std::vector<G4Voxel::Index>  
 
  278  std::vector<Index> neighbors;
 
  280  auto xMax = (int) (std::floor(
 
  282  auto yMax = (int) (std::floor(
 
  284  auto zMax = (int) (std::floor(
 
  289    neighbors.emplace_back(
Index(index.
x - 1, index.
y, index.
z));
 
  293    neighbors.emplace_back(
Index(index.
x, index.
y - 1, index.
z));
 
  297    neighbors.emplace_back(
Index(index.
x, index.
y, index.
z - 1));
 
  299  if(index.
x + 1 < xMax)
 
  301    neighbors.emplace_back(
Index(index.
x + 1, index.
y, index.
z));
 
  303  if(index.
y + 1 < yMax)
 
  305    neighbors.emplace_back(
Index(index.
x, index.
y + 1, index.
z));
 
  307  if(index.
z + 1 < zMax)
 
  309    neighbors.emplace_back(
Index(index.
x, index.
y, index.
z + 1));
 
  314  for(
const auto& it : neighbors)
 
  320  if(neighbors.size() > 6)
 
  323    exceptionDescription << 
"neighbors.size() > 6";
 
  324    G4Exception(
"G4DNAMesh::FindVoxelNeighbors", 
"G4DNAMesh002",
 
  337    exceptionDescription << 
"the position: " << 
position 
  338                         << 
" is not in the box";
 
  340                exceptionDescription);
 
  350  return dz * ymax * xmax + dy * xmax + dx;
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4bool contains(const G4DNABoundingBox &other) const
void PrintVoxel(const Index &index)
void SetVoxelMapList(const Key &key, G4Voxel::MapList &&mapList)
G4double GetResolution() const
Key GetKey(const G4ThreeVector &pos) const
std::vector< Index > FindNeighboringVoxels(const Index &index) const
G4Voxel * GetVoxel(Key key)
std::vector< Index > FindVoxelNeighbors(const Index &index) const
G4Voxel::MapList & GetVoxelMapList(Key key)
const G4DNABoundingBox * fpBoundingMesh
const G4DNABoundingBox & GetBoundingBox() const
G4int GetNumberOfType(G4Voxel::MolType type) const
Index GetIndex(Key key) const
G4DNAMesh(const G4DNABoundingBox &, G4int)
std::map< MolType, size_t > MapList