|
||||
File indexing completed on 2025-01-18 10:05:54
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2021-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/detail/BIHData.hh 0007 //! \todo move to orange/BihTreeData 0008 //---------------------------------------------------------------------------// 0009 #pragma once 0010 0011 #include "corecel/OpaqueId.hh" 0012 #include "corecel/Types.hh" 0013 #include "corecel/cont/EnumArray.hh" 0014 #include "corecel/data/Collection.hh" 0015 #include "geocel/BoundingBox.hh" 0016 0017 #include "../OrangeTypes.hh" 0018 0019 namespace celeritas 0020 { 0021 namespace detail 0022 { 0023 //---------------------------------------------------------------------------// 0024 /*! 0025 * Data for a single inner node in a Bounding Interval Hierarchy. 0026 * 0027 * Note that the LEFT bounding plane position is the far right boundary of the 0028 * left side of the tree, and the RIGHT bounding plane position is the far left 0029 * boundary of the right side of the tree. Since the halfspaces of created by 0030 * the bounding planes may overlap, the LEFT bounding plane position could be 0031 * either left or right of the RIGHT bounding plane position. 0032 */ 0033 struct BIHInnerNode 0034 { 0035 using real_type = fast_real_type; 0036 0037 struct BoundingPlane 0038 { 0039 real_type position; 0040 BIHNodeId child; 0041 }; 0042 0043 enum class Edge 0044 { 0045 left, 0046 right, 0047 size_ 0048 }; 0049 0050 BIHNodeId parent; //!< Parent node ID 0051 Axis axis; //!< Axis for "left" and "right" 0052 EnumArray<Edge, BoundingPlane> bounding_planes; //!< Lower and upper bound 0053 0054 explicit CELER_FUNCTION operator bool() const 0055 { 0056 return this->bounding_planes[Edge::left].child 0057 && this->bounding_planes[Edge::right].child; 0058 } 0059 }; 0060 0061 //---------------------------------------------------------------------------// 0062 /*! 0063 * Data for a single leaf node in a Bounding Interval Hierarchy. 0064 */ 0065 struct BIHLeafNode 0066 { 0067 BIHNodeId parent; //!< Parent node ID 0068 ItemRange<LocalVolumeId> vol_ids; 0069 0070 explicit CELER_FUNCTION operator bool() const { return !vol_ids.empty(); } 0071 }; 0072 0073 //---------------------------------------------------------------------------// 0074 /*! 0075 * Bounding Interval Hierarchy tree. 0076 * 0077 * Infinite bounding boxes are not included in the main tree. 0078 * 0079 * \todo Rename BihTreeRecord 0080 */ 0081 struct BIHTree 0082 { 0083 //! All bounding boxes managed by the BIH 0084 ItemMap<LocalVolumeId, FastBBoxId> bboxes; 0085 0086 //! Inner nodes, the first being the root 0087 ItemRange<BIHInnerNode> inner_nodes; 0088 0089 //! Leaf nodes 0090 ItemRange<BIHLeafNode> leaf_nodes; 0091 0092 //! Local volumes that have infinite bounding boxes 0093 ItemRange<LocalVolumeId> inf_volids; 0094 0095 explicit CELER_FUNCTION operator bool() const 0096 { 0097 if (!inner_nodes.empty()) 0098 { 0099 return !bboxes.empty() && !leaf_nodes.empty(); 0100 } 0101 else 0102 { 0103 // Degenerate single leaf node case. This occurs when a tree 0104 // contains either: 0105 // a) a single volume 0106 // b) muliple non-partitionable volumes, 0107 // b) only infinite volumes. 0108 return !bboxes.empty() && leaf_nodes.size() == 1; 0109 } 0110 } 0111 }; 0112 0113 //---------------------------------------------------------------------------// 0114 } // namespace detail 0115 } // 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 |