File: VolumePointers.cpp

package info (click to toggle)
vecgeom 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,928 kB
  • sloc: cpp: 88,717; ansic: 6,894; python: 1,035; sh: 582; sql: 538; makefile: 29
file content (84 lines) | stat: -rw-r--r-- 1,866 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/// \file VolumePointers.cpp
/// \author Johannes de Fine Licht (johannes.definelicht@cern.ch)

#include "VecGeomBenchmark/VolumePointers.h"
#include "VecGeom/volumes/PlacedVolume.h"
#include <iostream>

#ifdef VECGEOM_ROOT
#include "TGeoShape.h"
#endif
#ifdef VECGEOM_GEANT4
#include "G4VSolid.hh"
#endif

namespace vecgeom {
inline namespace VECGEOM_IMPL_NAMESPACE {

VolumePointers::VolumePointers(VPlacedVolume const *const volume)
    : fSpecialized(volume), fUnspecialized(NULL),
#ifdef VECGEOM_ROOT
      fRoot(NULL),
#endif
#ifdef VECGEOM_GEANT4
      fGeant4(NULL),
#endif
      fInitial(kBenchmarkSpecialized)
{
  ConvertVolume();
}

VolumePointers::VolumePointers(VolumePointers const &other)
    : fSpecialized(other.fSpecialized), fUnspecialized(NULL),
#ifdef VECGEOM_ROOT
      fRoot(NULL),
#endif
#ifdef VECGEOM_GEANT4
      fGeant4(NULL),
#endif
      fInitial(other.fInitial)
{
  ConvertVolume();
}

VolumePointers::~VolumePointers()
{
  Deallocate();
}

VolumePointers &VolumePointers::operator=(VolumePointers const &other)
{
  this->Deallocate();
  this->fSpecialized = other.fSpecialized;
  this->ConvertVolume();
  return *this;
}

void VolumePointers::ConvertVolume()
{
  if (!fUnspecialized) fUnspecialized = fSpecialized->ConvertToUnspecialized();
#ifdef VECGEOM_ROOT
  if (!fRoot) fRoot = fSpecialized->ConvertToRoot();
#endif
#ifdef VECGEOM_GEANT4
  if (!fGeant4) fGeant4 = fSpecialized->ConvertToGeant4();
#endif
}

void VolumePointers::Deallocate()
{
  /*
  if (fInitial != kBenchmarkSpecialized)   delete fSpecialized;
  if (fInitial != kBenchmarkUnspecialized) delete fUnspecialized;
>>>>>>> master
#ifdef VECGEOM_ROOT
 // if (initial_ != kBenchmarkRoot)          delete root_;
#endif
#ifdef VECGEOM_GEANT4
  //  if (fInitial != kBenchmarkGeant4)        delete fGeant4;
#endif
  */
}

} // End impl namespace
} // End global namespace