|
||||
File indexing completed on 2025-01-18 10:05:55
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/orangeinp/detail/InternalSurfaceFlagger.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <vector> 0011 0012 #include "corecel/cont/VariantUtils.hh" 0013 0014 #include "../CsgTree.hh" 0015 #include "../CsgTypes.hh" 0016 0017 namespace celeritas 0018 { 0019 namespace orangeinp 0020 { 0021 namespace detail 0022 { 0023 //---------------------------------------------------------------------------// 0024 /*! 0025 * Return whether a volume has an internal surface crossing. 0026 * 0027 * In a "simple" volume with no internal surface crossings, any intersection 0028 * with any surface guarantees that a track will exit the volume at that 0029 * boundary at that distance. 0030 * 0031 * \return True if internal surface crossings may be present 0032 */ 0033 class InternalSurfaceFlagger 0034 { 0035 public: 0036 // Construct from a tree 0037 explicit InternalSurfaceFlagger(CsgTree const& tree); 0038 0039 //!@{ 0040 //! \name Visit a node directly 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 |