![]() |
|
|||
File indexing completed on 2025-09-16 09:03:16
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file orange/orangeinp/detail/InternalSurfaceFlagger.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <vector> 0010 0011 #include "corecel/cont/VariantUtils.hh" 0012 0013 #include "../CsgTree.hh" 0014 #include "../CsgTypes.hh" 0015 0016 namespace celeritas 0017 { 0018 namespace orangeinp 0019 { 0020 namespace detail 0021 { 0022 //---------------------------------------------------------------------------// 0023 /*! 0024 * Return whether a volume has an internal surface crossing. 0025 * 0026 * In a "simple" volume with no internal surface crossings, any intersection 0027 * with any surface guarantees that a track will exit the volume at that 0028 * boundary at that distance. 0029 * 0030 * \return True if internal surface crossings may be present 0031 */ 0032 class InternalSurfaceFlagger 0033 { 0034 public: 0035 // Construct from a tree 0036 explicit InternalSurfaceFlagger(CsgTree const& tree); 0037 0038 //!@{ 0039 //! \name Visit a node directly 0040 0041 // No surface crossings 0042 bool operator()(True const&) { return simple; } 0043 // False is never explicitly part of the node tree 0044 bool operator()(False const&) { CELER_ASSERT_UNREACHABLE(); } 0045 // Surfaces are 'simple' 0046 bool operator()(Surface const&) { return simple; } 0047 // Aliased nodes forward to the alias 0048 bool operator()(Aliased const&); 0049 // Negated nodes may have internal crossings if they negate "joined" 0050 bool operator()(Negated const&); 0051 // Intersections of "simple" nodes are simple; unions are never 0052 bool operator()(Joined const&); 0053 //!@} 0054 0055 // Visit a node, using the cache, to determine its flag 0056 bool operator()(NodeId const& n); 0057 0058 private: 0059 //// TYPES //// 0060 0061 enum Status : signed char 0062 { 0063 unknown = -1, //!< Node has not yet been evaluated 0064 simple = 0, //!< Known not to have reentrant surfaces 0065 internal = 1 //!< Known to have reentrant surfaces 0066 }; 0067 0068 //// DATA //// 0069 0070 CsgTree const& tree_; 0071 std::vector<Status> cache_; 0072 }; 0073 0074 //---------------------------------------------------------------------------// 0075 } // namespace detail 0076 } // namespace orangeinp 0077 } // 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 |
![]() ![]() |