Belle II Software development
PolyhedronBelleLathe Class Reference

Belle lathe polyhedron. More...

#include <BelleLathe.h>

Inheritance diagram for PolyhedronBelleLathe:

Public Member Functions

 PolyhedronBelleLathe (const std::vector< zr_t > &, const std::vector< triangle_t > &, double, double)
 constructor
 
virtual ~PolyhedronBelleLathe ()
 destructor
 

Detailed Description

Belle lathe polyhedron.

Definition at line 201 of file BelleLathe.h.

Constructor & Destructor Documentation

◆ PolyhedronBelleLathe()

PolyhedronBelleLathe ( const std::vector< zr_t > &  v,
const std::vector< triangle_t > &  t,
double  phi,
double  dphi 
)

constructor

Definition at line 1950 of file BelleLathe.cc.

1951{
1952 int nphi = GetNumberOfRotationSteps();
1953 bool twopi = abs(dphi - 2 * M_PI) < 1e-6;
1954 int n = v.size();
1955 if (twopi) {
1956 int nv = n * nphi;
1957 int nf = nv;
1958 AllocateMemory(nv, nf);
1959
1960 auto vnum = [nphi, n](int iphi, int ip) {
1961 return (iphi % nphi) * n + (ip % n) + 1;
1962 };
1963
1964 int fcount = 1;
1965 double dfi = dphi / nphi;
1966 for (int i = 0; i < nphi; i++) {
1967 double fi = phi + i * dfi;
1968 double cf = cos(fi), sf = sin(fi);
1969 for (int j = 0; j < n; j++) pV[vnum(i, j)].set(v[j].r * cf, v[j].r * sf, v[j].z);
1970 for (int j = 0; j < n; j++) pF[fcount++ ] = G4Facet(vnum(i, j), 0, vnum(i, j + 1), 0, vnum(i + 1, j + 1), 0, vnum(i + 1, j), 0);
1971 }
1972 } else {
1973 // cout<<"NPHI = "<<nphi<<" "<<phi<<" "<<dphi<<endl;
1974 nphi = int(nphi * (dphi / (2 * M_PI)) + 0.5);
1975 nphi = nphi > 3 ? nphi : 3;
1976
1977 // cout<<"NPHI = "<<nphi<<endl;
1978
1979 int nv = n * nphi;
1980 int nf = n * (nphi - 1) + 2 * t.size();
1981 AllocateMemory(nv, nf);
1982
1983 auto vnum = [n](int iphi, int ip) {
1984 return iphi * n + (ip % n) + 1;
1985 };
1986
1987 int fcount = 1;
1988 double dfi = dphi / (nphi - 1);
1989 for (int i = 0; i < nphi; i++) {
1990 double fi = phi + i * dfi;
1991 double cf = cos(fi), sf = sin(fi);
1992 for (int j = 0; j < n; j++) pV[vnum(i, j)].set(v[j].r * cf, v[j].r * sf, v[j].z);
1993 if (i == nphi - 1) break;
1994 for (int j = 0; j < n; j++) pF[fcount++] = G4Facet(vnum(i, j), 0, vnum(i, j + 1), 0, vnum(i + 1, j + 1), 0, vnum(i + 1, j), 0);
1995 }
1996
1997 for (const triangle_t& k : t) pF[fcount++] = G4Facet(vnum(0, k.i0), 0, vnum(0, k.i2), 0, vnum(0, k.i1), 0, 0, 0);
1998 int i = nphi - 1;
1999 for (const triangle_t& k : t) pF[fcount++] = G4Facet(vnum(i, k.i0), 0, vnum(i, k.i1), 0, vnum(i, k.i2), 0, 0, 0);
2000
2001 }
2002 SetReferences();
2003 // takePolyhedron(*this);
2004}
struct for a triangle
Definition: BelleLathe.h:55

◆ ~PolyhedronBelleLathe()

~PolyhedronBelleLathe ( )
virtual

destructor

Definition at line 2006 of file BelleLathe.cc.

2006{}

The documentation for this class was generated from the following files: