File indexing completed on 2026-04-10 07:50:28
0001
0002 #include "U4Polycone.h"
0003 #include "G4SystemOfUnits.hh"
0004 #include "U4Mesh.h"
0005
0006 #include "NPFold.h"
0007 #include "s_csg.h"
0008
0009
0010 struct U4Polycone_test
0011 {
0012 static int Flange();
0013 static int Mug();
0014 static int Main();
0015 };
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 inline int U4Polycone_test::Flange()
0030 {
0031 const char* name = "Flange" ;
0032
0033 G4double phiStart = 0.00*deg ;
0034 G4double phiTotal = 360.00*deg ;
0035
0036 G4int numRZ = 4 ;
0037 G4double ri[] = {0. , 0., 0. , 0. } ;
0038
0039 G4double ro[] = {264.050, 264.050, 264.050, 132.025 } ;
0040 G4double z[] = { -183.225, 0., 100. , 200.050 } ;
0041
0042 G4Polycone* pc = new G4Polycone(name, phiStart, phiTotal, numRZ, z, ri, ro );
0043
0044
0045 U4Mesh::Save(pc, "$FOLD", name);
0046
0047
0048 NPFold* fold = nullptr ;
0049
0050 s_csg* csg = new s_csg ;
0051 assert(csg);
0052
0053 int lvid = 0 ;
0054 int depth = 0 ;
0055 int level = 1 ;
0056 sn* root = U4Polycone::Convert( pc, lvid, depth, level );
0057 std::cout << root->render() ;
0058
0059 std::cout << csg->brief() << std::endl ;
0060 fold = csg->serialize();
0061 fold->save("$FOLD", name, "_csg");
0062
0063 return 0 ;
0064 }
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 inline int U4Polycone_test::Mug()
0099 {
0100 const char* name = "Mug" ;
0101
0102 G4double phiStart = 0.00*deg ;
0103 G4double phiTotal = 360.00*deg ;
0104 G4int numRZ = 4 ;
0105 G4double ri[] = { 0. , 0., 21650.0 , 21650.0 } ;
0106 G4double ro[] = { 21652.0 , 21652.0, 21652.0, 21652.0 } ;
0107 G4double z[] = { -21652.0 , -21650.0, -21650.0 , 22000.0 } ;
0108
0109 G4Polycone* pc = new G4Polycone(name, phiStart, phiTotal, numRZ, z, ri, ro );
0110
0111
0112 U4Mesh::Save(pc, "$FOLD", name);
0113
0114 int lvid = 0 ;
0115 int depth = 0 ;
0116 int level = 1 ;
0117 sn* root = U4Polycone::Convert( pc, lvid, depth, level );
0118 std::cout << root->render() ;
0119
0120
0121 return 0 ;
0122 }
0123
0124
0125 inline int U4Polycone_test::Main()
0126 {
0127 const char* TEST = ssys::getenvvar("TEST","Mug");
0128 bool ALL = strcmp(TEST, "ALL") == 0 ;
0129 int rc = 0 ;
0130 if(ALL||0==strcmp(TEST,"Flange")) rc += Flange();
0131 if(ALL||0==strcmp(TEST,"Mug")) rc += Mug();
0132 return rc ;
0133 }
0134
0135 int main(){ return U4Polycone_test::Main() ; }
0136