![]() |
|
|||
File indexing completed on 2025-03-13 09:19:59
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2024 UT-Battelle, LLC, and other Celeritas developers. 0003 // See the top-level COPYRIGHT file for details. 0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0005 //---------------------------------------------------------------------------// 0006 //! \file orange/g4org/ProtoConstructor.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <memory> 0011 #include <unordered_map> 0012 0013 #include "orange/orangeinp/ObjectInterface.hh" 0014 #include "orange/orangeinp/UnitProto.hh" 0015 0016 #include "Volume.hh" 0017 0018 namespace celeritas 0019 { 0020 namespace g4org 0021 { 0022 //---------------------------------------------------------------------------// 0023 /*! 0024 * Recursively build ORANGE proto-universes from a \c LogicalVolume . 0025 * 0026 * The input to this function is the output of \c LogicalVolumeConverter . This 0027 * class is responsible for "placing" the converted \c PhysicalVolume by 0028 * transforming its children. Depending on heuristics, the children are 0029 * directly inserted into a \c UnitProto as volumes (specifically, the logical 0030 * volume becomes a \c UnitProto::MaterialInput), or a \c LogicalVolume is 0031 * turned into a \em new \c UnitProto that can be used in multiple locations. 0032 */ 0033 class ProtoConstructor 0034 { 0035 public: 0036 //!@{ 0037 //! \name Type aliases 0038 using SPConstObject = std::shared_ptr<orangeinp::ObjectInterface const>; 0039 using ObjLv = std::pair<SPConstObject, LogicalVolume const*>; 0040 using SPUnitProto = std::shared_ptr<orangeinp::UnitProto>; 0041 using ProtoInput = orangeinp::UnitProto::Input; 0042 //!@} 0043 0044 public: 0045 //! Construct with verbosity setting 0046 explicit ProtoConstructor(bool verbose) : verbose_{verbose} {} 0047 0048 // Construct a proto from a logical volume 0049 SPUnitProto operator()(LogicalVolume const& pv); 0050 0051 private: 0052 std::unordered_map<LogicalVolume const*, SPUnitProto> protos_; 0053 int depth_{0}; 0054 bool verbose_{false}; 0055 0056 // Place a physical volume into the given unconstructed proto 0057 void place_pv(VariantTransform const& parent_transform, 0058 PhysicalVolume const& pv, 0059 ProtoInput* proto); 0060 0061 // (TODO: make this configurable) 0062 //! Number of daughters above which we use a "fill" material 0063 static constexpr int fill_daughter_threshold() { return 2; } 0064 }; 0065 0066 //---------------------------------------------------------------------------// 0067 } // namespace g4org 0068 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |