|
|
|||
File indexing completed on 2025-11-05 08:53:43
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Geometry/Volume.hpp" 0012 #include "Acts/Geometry/VolumeResizeStrategy.hpp" 0013 #include "Acts/Utilities/AxisDefinitions.hpp" 0014 0015 #include <span> 0016 #include <vector> 0017 0018 namespace Acts { 0019 0020 /// @class VolumeStack 0021 /// @brief A stack of volumes 0022 /// @note This is a base class for the different types of volume stacks 0023 class VolumeStack : public Volume { 0024 public: 0025 /// Access the gap volume that were created during attachment or resizing. 0026 /// @return the vector of gap volumes 0027 const std::vector<std::shared_ptr<Volume>>& gaps() const; 0028 0029 /// Check if a volume is a gap volume 0030 /// @param volume is the volume to check 0031 /// @return true if the volume is a gap volume, false otherwise 0032 bool isGapVolume(const Volume& volume) const; 0033 0034 private: 0035 /// Helper to get the first volume in the input, and throw an exception if 0036 /// there is not one. 0037 /// @param volumes is the vector of volumes 0038 /// @return the first volume 0039 static Volume& initialVolume(std::span<Volume*> volumes); 0040 0041 protected: 0042 struct ResizeStrategies { 0043 VolumeResizeStrategy first; 0044 VolumeResizeStrategy second; 0045 0046 friend std::ostream& operator<<(std::ostream& os, 0047 const ResizeStrategies& rs) { 0048 if (rs.first == rs.second) { 0049 os << "<-" << rs.first << "->"; 0050 } else { 0051 os << "<-" << rs.first << "|" << rs.second << "->"; 0052 } 0053 return os; 0054 } 0055 }; 0056 0057 /// @param volumes is the vector of volumes 0058 /// @param direction is the direction of the stack 0059 /// @param resizeStrategies is the pair of resize strategies 0060 VolumeStack( 0061 std::vector<Volume*>& volumes, AxisDirection direction, 0062 std::pair<VolumeResizeStrategy, VolumeResizeStrategy> resizeStrategies); 0063 0064 /// @param transform is the transform of the gap volume 0065 /// @param bounds is the bounds of the gap volume 0066 /// @return the shared pointer to the gap volume 0067 std::shared_ptr<Volume> addGapVolume( 0068 const Transform3& transform, const std::shared_ptr<VolumeBounds>& bounds); 0069 0070 /// Direction axis along which volumes are stacked 0071 AxisDirection m_direction{}; 0072 0073 /// Resize strategies for volume attachment and modification 0074 ResizeStrategies m_resizeStrategies; 0075 0076 /// Container of gap volumes created during volume attachment or resizing 0077 std::vector<std::shared_ptr<Volume>> m_gaps{}; 0078 /// Reference to the vector of volumes in the stack 0079 std::vector<Volume*>& m_volumes; 0080 }; 0081 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|