Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BREPSolidTorus.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 // GEANT 4 class source file
31 //
32 // G4BREPSolidTorus.cc
33 //
34 // ----------------------------------------------------------------------
35 
36 #include "G4BREPSolidTorus.hh"
37 #include "G4ToroidalSurface.hh"
38 
40  const G4ThreeVector& origin,
41  const G4ThreeVector& axis,
42  const G4ThreeVector& direction,
43  G4double MinRadius,
44  G4double MaxRadius)
45  : G4BREPSolid(name)
46 {
47  // Save constructor parameters
48  constructorParams.origin = origin;
49  constructorParams.axis = axis;
50  constructorParams.direction = direction;
51  constructorParams.MinRadius = MinRadius;
52  constructorParams.MaxRadius = MaxRadius;
53 
54  active = 1;
55  InitializeTorus();
56 }
57 
59  : G4BREPSolid(a)
60 {
61 }
62 
64 {
65 }
66 
68  : G4BREPSolid(rhs)
69 {
70  constructorParams.origin = rhs.constructorParams.origin;
71  constructorParams.axis = rhs.constructorParams.axis;
72  constructorParams.direction = rhs.constructorParams.direction;
73  constructorParams.MinRadius = rhs.constructorParams.MinRadius;
74  constructorParams.MaxRadius = rhs.constructorParams.MaxRadius;
75 
76  InitializeTorus();
77 }
78 
81 {
82  // Check assignment to self
83  //
84  if (this == &rhs) { return *this; }
85 
86  // Copy base class data
87  //
89 
90  // Copy data
91  //
92  constructorParams.origin = rhs.constructorParams.origin;
93  constructorParams.axis = rhs.constructorParams.axis;
94  constructorParams.direction = rhs.constructorParams.direction;
95  constructorParams.MinRadius = rhs.constructorParams.MinRadius;
96  constructorParams.MaxRadius = rhs.constructorParams.MaxRadius;
97 
98  InitializeTorus();
99 
100  return *this;
101 }
102 
103 void G4BREPSolidTorus::InitializeTorus()
104 {
105  SurfaceVec = new G4Surface*[1];
106  SurfaceVec[0] = new G4ToroidalSurface( constructorParams.origin,
107  constructorParams.axis,
108  constructorParams.direction,
109  constructorParams.MinRadius,
110  constructorParams.MaxRadius );
111  nb_of_surfaces = 1;
112 
113  Initialize();
114 }
115 
117 {
118  return new G4BREPSolidTorus(*this);
119 }
120 
121 std::ostream& G4BREPSolidTorus::StreamInfo(std::ostream& os) const
122 {
123  // Streams solid contents to output stream.
124 
126  << "\n origin: " << constructorParams.origin
127  << "\n axis: " << constructorParams.axis
128  << "\n direction: " << constructorParams.direction
129  << "\n MinRadius: " << constructorParams.MinRadius
130  << "\n MaxRadius: " << constructorParams.MaxRadius
131  << "\n-----------------------------------------------------------\n";
132 
133  return os;
134 }
135