Geant4  10.02
G4UExtrudedSolid.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id:$
28 //
29 //
30 // Implementation of G4UExtrudedSolid wrapper class
31 // --------------------------------------------------------------------
32 
33 #include "G4ExtrudedSolid.hh"
34 #include "G4UExtrudedSolid.hh"
35 
36 #if defined(G4GEOM_USE_USOLIDS)
37 
38 #include "G4Polyhedron.hh"
39 
41 //
42 // Constructors
43 //
44 G4UExtrudedSolid::G4UExtrudedSolid(const G4String& name,
45  std::vector<G4TwoVector> polygon,
46  std::vector<ZSection> zsections)
47  : G4USolid(name, new UExtrudedSolid())
48 {
49  GetShape()->SetName(name);
50  std::vector<UVector2> pvec;
51  for (unsigned int i=0; i<polygon.size(); ++i)
52  {
53  pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
54  }
55  std::vector<UExtrudedSolid::ZSection> svec;
56  for (unsigned int i=0; i<zsections.size(); ++i)
57  {
58  ZSection sec = zsections[i];
59  svec.push_back(UExtrudedSolid::ZSection(sec.fZ,
60  UVector2(sec.fOffset.x(), sec.fOffset.y()), sec.fScale));
61  }
62  GetShape()->Initialise(pvec, svec);
63 }
64 
65 
66 G4UExtrudedSolid::G4UExtrudedSolid(const G4String& name,
67  std::vector<G4TwoVector> polygon,
68  G4double halfZ,
69  G4TwoVector off1, G4double scale1,
70  G4TwoVector off2, G4double scale2)
71  : G4USolid(name, new UExtrudedSolid())
72 {
73  GetShape()->SetName(name);
74  std::vector<UVector2> pvec;
75  for (unsigned int i=0; i<polygon.size(); ++i)
76  {
77  pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
78  }
79  GetShape()->Initialise(pvec, halfZ, UVector2(off1.x(), off1.y()), scale1,
80  UVector2(off2.x(), off2.y()), scale2);
81 }
82 
84 //
85 // Fake default constructor - sets only member data and allocates memory
86 // for usage restricted to object persistency.
87 //
88 G4UExtrudedSolid::G4UExtrudedSolid(__void__& a)
89  : G4USolid(a)
90 {
91 }
92 
93 
95 //
96 // Destructor
97 //
98 G4UExtrudedSolid::~G4UExtrudedSolid()
99 {
100 }
101 
102 
104 //
105 // Copy constructor
106 //
107 G4UExtrudedSolid::G4UExtrudedSolid(const G4UExtrudedSolid &source)
108  : G4USolid(source)
109 {
110 }
111 
112 
114 //
115 // Assignment operator
116 //
117 G4UExtrudedSolid&
118 G4UExtrudedSolid::operator=(const G4UExtrudedSolid &source)
119 {
120  if (this == &source) return *this;
121 
122  G4USolid::operator=( source );
123 
124  return *this;
125 }
126 
127 #endif // G4GEOM_USE_USOLIDS
G4String name
Definition: TRTMaterials.hh:40
G4double a
Definition: TRTMaterials.hh:39
const G4double x[NPOINTSGL]
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:42
double G4double
Definition: G4Types.hh:76