74 message <<
"TwistedTrapBoxSide is not used as a the side of a box: "
77 G4Exception(
"G4TwistBoxSide::G4TwistBoxSide()",
"GeomSolids0002",
125 :
G4VTwistSurface(a), fTheta(0.), fPhi(0.), fDy1(0.), fDx1(0.), fDx2(0.),
126 fDy2(0.), fDx3(0.), fDx4(0.), fDz(0.), fAlph(0.), fTAlph(0.), fPhiTwist(0.),
127 fAngleSide(0.), fdeltaX(0.), fdeltaY(0.), fDx4plus2(0.), fDx4minus2(0.),
128 fDx3plus1(0.), fDx3minus1(0.), fDy2plus1(0.), fDy2minus1(0.), fa1md1(0.),
256 std::vector<Intersection> xbuf ;
275 + (
fTAlph*v.
x() + v.
y())*std::sin(phi)));
282 * (v.
y()*std::cos(phi) - v.
x()*std::sin(phi))) / q;
290 xbuf.push_back(xbuftmp) ;
299 areacode[0], isvalid[0],
300 0, validate, &gp, &gv);
319 G4cout <<
"coef = " << c[0] <<
" "
337 G4cout <<
"Solution " << i <<
" : " << srd[i] <<
G4endl ;
339 phi = std::fmod(srd[i], pihalf) ;
353 xbuf.push_back(xbuftmp) ;
356 G4cout <<
"solution " << i <<
" = " << phi <<
" , " <<
u <<
G4endl ;
374 for (
size_t k = 0 ;
k<xbuf.size() ; ++
k )
377 G4cout <<
"Solution " <<
k <<
" : "
378 <<
"reconstructed phiR = " << xbuf[
k].phi
379 <<
", uR = " << xbuf[
k].u <<
G4endl ;
385 IsConverged =
false ;
387 for (
G4int i = 1 ; i<maxint ; ++i )
392 deltaX = ( tmpxx - xxonsurface ).mag() ;
393 theta = std::fabs(std::acos(v*surfacenormal) - pihalf) ;
405 G4cout <<
"Step i = " << i <<
", distance = " << tmpdist <<
", " << deltaX <<
G4endl ;
412 G4cout <<
"approximated phi = " << phi <<
", u = " <<
u <<
G4endl ;
415 if ( deltaX <= factor*ctol ) { IsConverged =
true ; break ; }
419 if ( std::fabs(tmpdist)<ctol ) tmpdist = 0. ;
422 G4cout <<
"refined solution " << phi <<
" , " <<
u <<
G4endl ;
436 if (tmpdist >= 0) tmpisvalid =
true;
444 if (tmpdist >= 0) tmpisvalid =
true;
451 "Feature NOT implemented !");
462 xbuf[
k].distance = tmpdist ;
463 xbuf[
k].areacode = tmpareacode ;
464 xbuf[
k].isvalid = tmpisvalid ;
471 G4cout << G4endl <<
"list xbuf after sorting : " <<
G4endl ;
480 G4int nxxtmp = xbuf.size() ;
482 if ( nxxtmp<2 || IsParallel )
497 xbuf.push_back(xbuftmp) ;
512 xbuf.push_back(xbuftmp) ;
514 for (
size_t k = nxxtmp ;
k<xbuf.size() ; ++
k )
517 G4cout <<
"Solution " <<
k <<
" : "
518 <<
"reconstructed phiR = " << xbuf[
k].phi
519 <<
", uR = " << xbuf[
k].u <<
G4endl ;
525 IsConverged =
false ;
527 for (
G4int i = 1 ; i<maxint ; ++i )
532 deltaX = ( tmpxx - xxonsurface ).mag() ;
533 theta = std::fabs(std::acos(v*surfacenormal) - pihalf) ;
544 G4cout <<
"Step i = " << i <<
", distance = "
545 << tmpdist <<
", " << deltaX <<
G4endl ;
553 G4cout <<
"approximated phi = " << phi <<
", u = " <<
u <<
G4endl ;
556 if ( deltaX <= factor*ctol ) { IsConverged =
true ; break ; }
560 if ( std::fabs(tmpdist)<ctol ) tmpdist = 0. ;
563 G4cout <<
"refined solution " << phi <<
" , " <<
u <<
G4endl ;
577 if (tmpdist >= 0) tmpisvalid =
true;
585 if (tmpdist >= 0) tmpisvalid =
true;
590 G4Exception(
"G4TwistedBoxSide::DistanceToSurface()",
592 "Feature NOT implemented !");
603 xbuf[
k].distance = tmpdist ;
604 xbuf[
k].areacode = tmpareacode ;
605 xbuf[
k].isvalid = tmpisvalid ;
616 G4cout << G4endl <<
"list xbuf after sorting : " <<
G4endl ;
622 for (
size_t i = 0 ; i<xbuf.size() ; ++i )
624 distance[i] = xbuf[i].distance;
626 areacode[i] = xbuf[i].areacode ;
627 isvalid[i] = xbuf[i].isvalid ;
630 isvalid[i], nxx, validate, &gp, &gv);
633 G4cout <<
"element Nr. " << i
634 <<
", local Intersection = " << xbuf[i].xx
635 <<
", distance = " << xbuf[i].distance
636 <<
", u = " << xbuf[i].u
637 <<
", phi = " << xbuf[i].phi
638 <<
", isvalid = " << xbuf[i].isvalid
646 G4cout << nxx <<
" possible physical solutions found" <<
G4endl ;
649 G4cout <<
"global intersection Point found: " << gxx[
k] <<
G4endl ;
703 for (
G4int i = 1 ; i<maxint ; ++i )
706 surfacenormal =
NormAng(phiR,uR) ;
708 deltaX = ( xx - xxonsurface ).mag() ;
711 G4cout <<
"i = " << i <<
", distance = " << distance[0]
712 <<
", " << deltaX <<
G4endl ;
719 if ( deltaX <= ctol ) { break ; }
727 if ( phiR > halfphi ) phiR = halfphi ;
728 if ( phiR < -halfphi ) phiR = -halfphi ;
729 if ( uR > uMax ) uR = uMax ;
730 if ( uR < -uMax ) uR = -uMax ;
733 distance[0] = ( p -
xx ).mag() ;
734 if ( distance[0] <= ctol ) { distance[0] = 0 ; }
739 G4cout <<
"refined solution " << phiR <<
" , " << uR <<
" , " <<
G4endl ;
748 G4cout <<
"intersection Point found: " << gxx[0] <<
G4endl ;
777 G4cout <<
"GetAreaCode: yprime = " << yprime <<
G4endl ;
778 G4cout <<
"Intervall is " << fYAxisMin <<
" to " << fYAxisMax <<
G4endl ;
793 if (yprime < fYAxisMin + ctol)
796 if (yprime <= fYAxisMin - ctol) isoutside =
true;
799 else if (yprime > fYAxisMax - ctol)
802 if (yprime >= fYAxisMax + ctol) isoutside =
true;
813 if (xx.
z() <=
fAxisMin[zaxis] - ctol) isoutside =
true;
816 else if (xx.
z() >
fAxisMax[zaxis] - ctol)
822 if (xx.
z() >=
fAxisMax[zaxis] + ctol) isoutside =
true;
831 areacode = tmpareacode;
843 if (yprime < fYAxisMin )
847 else if (yprime > fYAxisMax)
879 "Feature NOT implemented !");
933 "Method NOT implemented !");
950 direction = direction.
unit();
956 direction = direction.
unit();
962 direction = direction.
unit();
968 direction = direction.
unit();
977 "Feature NOT implemented !");
1050 for ( i = 0 ; i<
n ; ++i )
1052 z = -
fDz+i*(2.*
fDz)/(n-1) ;
1056 for ( j = 0 ; j<
k ; ++j )
1058 nnode =
GetNode(i,j,k,n,iside) ;
1059 u = -b/2 +j*b/(k-1) ;
1063 xyz[nnode][0] = p.
x() ;
1064 xyz[nnode][1] = p.
y() ;
1065 xyz[nnode][2] = p.
z() ;
1067 if ( i<n-1 && j<k-1 )
1069 nface =
GetFace(i,j,k,n,iside) ;