|
||||
File indexing completed on 2025-01-18 10:05:55
0001 //----------------------------------*-C++-*----------------------------------// 0002 // Copyright 2023-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/NodeSimplifier.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "corecel/cont/VariantUtils.hh" 0011 0012 #include "../CsgTree.hh" 0013 #include "../CsgTypes.hh" 0014 0015 namespace celeritas 0016 { 0017 namespace orangeinp 0018 { 0019 namespace detail 0020 { 0021 //---------------------------------------------------------------------------// 0022 /*! 0023 * Simplify a node by visiting up to one level below. 0024 * 0025 * \return The simplified node, an alias, or no_simplification 0026 */ 0027 class NodeSimplifier 0028 { 0029 public: 0030 //!@{ 0031 //! \name Type aliases 0032 using size_type = NodeId::size_type; 0033 //!@} 0034 0035 public: 0036 //! Sentinel for no simplification taking place 0037 static constexpr Aliased no_simplification() { return Aliased{NodeId{}}; } 0038 0039 // Construct with the tree to visit 0040 explicit NodeSimplifier(CsgTree const& tree); 0041 0042 // Replace an aliased node 0043 Node operator()(Aliased const& a) const; 0044 0045 // Replace a negated node 0046 Node operator()(Negated const& n) const; 0047 0048 // Replace joined node 0049 Node operator()(Joined& j) const; 0050 0051 //! Other nodes don't simplify 0052 template<class T> 0053 Node operator()(T const&) const 0054 { 0055 return no_simplification(); 0056 } 0057 0058 private: 0059 ContainerVisitor<CsgTree const&, NodeId> visit_node_; 0060 }; 0061 0062 //---------------------------------------------------------------------------// 0063 } // namespace detail 0064 } // namespace orangeinp 0065 } // 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 |