File indexing completed on 2026-04-09 07:48:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <csignal>
0015 #include "ssys.h"
0016 #include "spath.h"
0017 #include "SSim.hh"
0018 #include "CSGFoundry.h"
0019 #include "CSGMaker.h"
0020 #include "OPTICKS_LOG.hh"
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 void GetNames( std::vector<std::string>& names, bool listnames )
0033 {
0034 const char* geom = ssys::getenvvar("CSGMakerTest_GEOM", nullptr );
0035
0036
0037 if( geom == nullptr )
0038 {
0039 CSGMaker::GetNames(names);
0040 }
0041 else
0042 {
0043 names.push_back(geom);
0044 }
0045 LOG(info) << " names.size " << names.size() ;
0046 if(listnames) for(unsigned i=0 ; i < names.size() ; i++) std::cout << names[i] << std::endl ;
0047 }
0048
0049 int main(int argc, char** argv)
0050 {
0051 const char* arg = argc > 1 ? argv[1] : nullptr ;
0052 bool listnames = arg && ( strcmp(arg,"N") == 0 || strcmp(arg,"n") == 0 ) ;
0053 OPTICKS_LOG(argc, argv);
0054
0055 SSim* sim = SSim::Create();
0056 assert(sim);
0057 if(!sim) std::raise(SIGINT);
0058
0059 std::vector<std::string> names ;
0060 GetNames(names, listnames);
0061 if(listnames) return 0 ;
0062
0063 for(unsigned i=0 ; i < names.size() ; i++)
0064 {
0065 const char* name = names[i].c_str() ;
0066 LOG(info) << name ;
0067
0068 CSGFoundry* fd = CSGMaker::MakeGeom( name );
0069 LOG(info) << fd->desc();
0070
0071 const char* base = spath::Join("$TMP/CSGMakerTest",name) ;
0072
0073 fd->save(base);
0074
0075 CSGFoundry* lfd = CSGFoundry::Load(base);
0076
0077
0078 LOG(info) << " lfd.loaddir " << lfd->loaddir ;
0079
0080 int rc = CSGFoundry::Compare(fd, lfd );
0081 assert( 0 == rc );
0082 if(0!=rc) std::raise(SIGINT);
0083 }
0084
0085 return 0 ;
0086 }