File indexing completed on 2026-04-09 07:49:16
0001 #include <cstdlib>
0002 #include <iostream>
0003
0004 #include "ssys.h"
0005 #include "salloc.h"
0006 #include "OPTICKS_LOG.hh"
0007 #include "SEventConfig.hh"
0008 #include "SComp.h"
0009
0010
0011 struct SEventConfigTest
0012 {
0013 static int Desc();
0014 static int OutPath();
0015 static int GatherCompList();
0016 static int SaveCompList();
0017 static int Initialize_Comp_Simulate_();
0018 static int SetMinimal();
0019 static int Save();
0020 static int InputGenstep();
0021
0022 static int main();
0023
0024 };
0025
0026 int SEventConfigTest::Desc()
0027 {
0028 LOG(info);
0029 std::cout << SEventConfig::Desc() << std::endl ;
0030 return 0 ;
0031 }
0032
0033 int SEventConfigTest::OutPath()
0034 {
0035 LOG(info);
0036
0037 bool unique = false ;
0038 const char* path_0 = SEventConfig::OutPath("stem", 101, ".npy", unique );
0039 const char* path_1 = SEventConfig::OutPath("local_reldir", "stem", 101, ".npy", unique );
0040 const char* path_2 = SEventConfig::OutPath("snap", -1, ".jpg", unique );
0041
0042 LOG(info) << " SEventConfig::OutPath path_0 " << path_0 ;
0043 LOG(info) << " SEventConfig::OutPath path_1 " << path_1 ;
0044 LOG(info) << " SEventConfig::OutPath path_2 " << path_2 ;
0045 return 0 ;
0046 }
0047
0048
0049 int SEventConfigTest::GatherCompList()
0050 {
0051 std::vector<unsigned> gather_comps ;
0052 SEventConfig::GatherCompList(gather_comps) ;
0053 std::cout << SComp::Desc(gather_comps) << std::endl ;
0054 return 0 ;
0055 }
0056
0057 int SEventConfigTest::SaveCompList()
0058 {
0059 std::vector<unsigned> save_comps ;
0060 SEventConfig::SaveCompList(save_comps) ;
0061 std::cout << SComp::Desc(save_comps) << std::endl ;
0062 return 0 ;
0063 }
0064
0065 int SEventConfigTest::Initialize_Comp_Simulate_()
0066 {
0067 unsigned gather_mask = 0 ;
0068 unsigned save_mask = 0 ;
0069
0070 SEventConfig::Initialize_Comp_Simulate_(gather_mask,save_mask );
0071
0072 LOG(info) << " SComp::Desc(gather_mask) " << SComp::Desc(gather_mask) ;
0073 LOG(info) << " SComp::Desc(save_mask) " << SComp::Desc(save_mask) ;
0074 return 0 ;
0075 }
0076
0077
0078
0079
0080 int SEventConfigTest::SetMinimal()
0081 {
0082 std::cout
0083 << "SEventConfigTest::SetMinimal.0"
0084 << std::endl
0085 << SEventConfig::Desc()
0086 << std::endl
0087 ;
0088
0089 SEventConfig::SetMinimal() ;
0090
0091 std::cout
0092 << "SEventConfigTest::SetMinimal.1"
0093 << std::endl
0094 << SEventConfig::Desc()
0095 << std::endl
0096 ;
0097 return 0 ;
0098 }
0099
0100 int SEventConfigTest::Save()
0101 {
0102 SEventConfig::Save("$FOLD");
0103 return 0 ;
0104 }
0105
0106 int SEventConfigTest::InputGenstep()
0107 {
0108 for(int idx=0 ; idx < 100 ; idx++)
0109 {
0110 const char* path = SEventConfig::InputGenstep(idx) ;
0111 std::cout << " idx " << std::setw(4) << idx << " path " << ( path ? path : "-" ) << std::endl ;
0112 }
0113
0114 return 0 ;
0115 }
0116
0117
0118 int SEventConfigTest::main()
0119 {
0120 SEventConfig::Initialize();
0121
0122 const char* TEST = ssys::getenvvar("TEST", "Desc");
0123 bool ALL = strcmp(TEST, "ALL") == 0 ;
0124
0125 int rc = 0 ;
0126 if(ALL||strcmp(TEST,"OutPath") == 0) rc += OutPath();
0127 if(ALL||strcmp(TEST,"GatherCompList") == 0) rc += GatherCompList();
0128 if(ALL||strcmp(TEST,"SaveCompList") == 0) rc += SaveCompList();
0129 if(ALL||strcmp(TEST,"Initialize_Comp_Simulate_") == 0) rc += Initialize_Comp_Simulate_();
0130 if(ALL||strcmp(TEST,"SetMinimal") == 0) rc += SetMinimal();
0131 if(ALL||strcmp(TEST,"Save") == 0) rc += Save();
0132 if(ALL||strcmp(TEST,"Desc") == 0) rc += Desc();
0133 if(ALL||strcmp(TEST,"InputGenstep") == 0) rc += InputGenstep();
0134
0135 return rc ;
0136 }
0137
0138
0139
0140 int main(int argc, char** argv)
0141 {
0142 OPTICKS_LOG(argc, argv);
0143 return SEventConfigTest::main() ;
0144 }