Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 07:50:05

0001 #pragma once
0002 
0003 #include <filesystem>
0004 #include <string>
0005 #include <vector>
0006 
0007 #include "torch.h"
0008 
0009 namespace gphox
0010 {
0011 
0012 enum class EventMode
0013 {
0014     DebugHeavy,
0015     DebugLite,
0016     Nothing,
0017     Minimal,
0018     Hit,
0019     HitPhoton,
0020     HitPhotonSeq,
0021     HitSeq
0022 };
0023 
0024 enum class ModeLite : int
0025 {
0026     /// Preserve SEventConfig's lower-level default or OPTICKS_MODE_LITE value.
0027     Unspecified = -1,
0028 
0029     /// Store standard photon/hit components. ModeMerge still controls merged hits.
0030     Standard = 0,
0031 
0032     /// Store compact photonlite/hitlite components instead of the standard forms.
0033     Lite = 1,
0034 
0035     /// Debug mode that gathers standard, lite, and local comparison components.
0036     DebugCompare = 2
0037 };
0038 
0039 enum class ModeMerge : int
0040 {
0041     /// Preserve SEventConfig's lower-level default or OPTICKS_MODE_MERGE value.
0042     Unspecified = -1,
0043 
0044     /// Keep unmerged hit or hitlite components as the canonical hit output.
0045     Separate = 0,
0046 
0047     /// Use merged hit or hitlitemerged components as the canonical hit output.
0048     Merged = 1
0049 };
0050 
0051 /**
0052  * Provides access to all configuration types and data.
0053  *
0054  * Config is the authoritative source for app-level event output policy.
0055  * Lower-level Opticks code still consumes this through SEventConfig after
0056  * Config::Apply has synchronized the selected values.
0057  */
0058 class Config
0059 {
0060   public:
0061     Config(std::string config_name = "dev");
0062 
0063     static std::string PtxPath(const std::string& ptx_name = "CSGOptiX7.ptx");
0064 
0065     /// A unique name associated with this Config
0066     std::string name{"dev"};
0067 
0068     /// Maximum photon bounce count.
0069     int max_bounce{31};
0070 
0071     /// Maximum gensteps allocated for event uploads.
0072     int max_genstep{10000000};
0073 
0074     /// Maximum event slots applied to SEventConfig.
0075     int maxslot{0};
0076 
0077     /// Event persistence mode applied to SEventConfig.
0078     EventMode event_mode{EventMode::Minimal};
0079 
0080     /// Optional compact photon/hit storage mode.
0081     ModeLite mode_lite{ModeLite::Unspecified};
0082 
0083     /// Optional hit merge mode, combined with mode_lite to choose hit output.
0084     ModeMerge mode_merge{ModeMerge::Unspecified};
0085 
0086     /// Base directory for event output folders.
0087     std::filesystem::path output_dir{std::filesystem::current_path()};
0088 
0089     /// Ray offset after boundary crossing.
0090     float propagate_epsilon{0.05f};
0091 
0092     /// Ray offset after bulk interaction.
0093     float propagate_epsilon0{0.05f};
0094 
0095     /// Flag mask selecting which bulk interactions use propagate_epsilon0.
0096     std::string propagate_epsilon0_mask{"TO,CK,SI,SC,RE"};
0097 
0098     storch torch{default_torch};
0099 
0100   private:
0101     std::string Locate(std::string filename) const;
0102     void ReadConfig(std::string filepath);
0103     void Apply() const;
0104 };
0105 
0106 } // namespace gphox