Geant4  10.00.p01
UTrd.icc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UTrd.icc
12 //
13 // Implementation of inline methods of UTrd
14 //
15 // 19.10.12 Marek Gayer
16 // Created from original implementation in Geant4
17 // --------------------------------------------------------------------
18 
19 inline
20 double UTrd::GetXHalfLength1() const
21 {
22  return fDx1;
23 }
24 
25 inline
26 double UTrd::GetXHalfLength2() const
27 {
28  return fDx2;
29 }
30 
31 inline
32 double UTrd::GetYHalfLength1() const
33 {
34  return fDy1;
35 }
36 
37 inline
38 double UTrd::GetYHalfLength2() const
39 {
40  return fDy2;
41 }
42 
43 inline
44 double UTrd::GetZHalfLength() const
45 {
46  return fDz;
47 }
48 
49 inline
50 void UTrd::SetXHalfLength1(double val)
51 {
52  fDx1 = val;
53  fCubicVolume = 0.;
54  fSurfaceArea = 0;
55 
56 }
57 
58 inline
59 void UTrd::SetXHalfLength2(double val)
60 {
61  fDx2 = val;
62  fCubicVolume = 0.;
63  fSurfaceArea = 0;
64 }
65 
66 inline
67 void UTrd::SetYHalfLength1(double val)
68 {
69  fDy1 = val;
70  fCubicVolume = 0.;
71  fSurfaceArea = 0;
72 }
73 
74 inline
75 void UTrd::SetYHalfLength2(double val)
76 {
77  fDy2 = val;
78  fCubicVolume = 0.;
79  fSurfaceArea = 0;
80 
81 }
82 
83 inline
84 void UTrd::SetZHalfLength(double val)
85 {
86  fDz = val;
87  fCubicVolume = 0.;
88  fSurfaceArea = 0;
89 
90 }
91 
92 inline
93 double UTrd::Capacity()
94 {
95  if (fCubicVolume != 0.)
96  {
97  ;
98  }
99  else
100  {
101  fCubicVolume = 2 * fDz * ((fDx1 + fDx2) * (fDy1 + fDy2)
102  + (fDx2 - fDx1) * (fDy2 - fDy1) / 3);
103  }
104  return fCubicVolume;
105 }
106 
107 inline
108 double UTrd::SurfaceArea()
109 {
110  if (fSurfaceArea != 0.)
111  {
112  ;
113  }
114  else
115  {
116  fSurfaceArea = 4 * (fDx1 * fDy1 + fDx2 * fDy2)
117  + 2 * ((fDy1 + fDy2) * std::sqrt(4 * fDz * fDz + (fDx2 - fDx1) * (fDx2 - fDx1))
118  + (fDx1 + fDx2) * std::sqrt(4 * fDz * fDz + (fDy2 - fDy1) * (fDy2 - fDy1)));
119  }
120  return fSurfaceArea;
121 }
122 inline double UTrd::amin(int n, const double* a) const
123 {
124  // Return value from array with the minimum element.
125  double xmin = a[0];
126  for (int i = 1; i < n; i++)
127  {
128  if (xmin > a[i]) xmin = a[i];
129  }
130  return xmin;
131 }
132 
133 inline double UTrd::amax(int n, const double* a)const
134 {
135  // Return value from array with the maximum element.
136  double xmax = a[0];
137  for (int i = 1; i < n; i++)
138  {
139  if (xmax < a[i]) xmax = a[i];
140  }
141  return xmax;
142 }