Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:17:11

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/CsgTreeUtils.hh
0007 //! \brief Free functions to apply to a CSG tree
0008 //---------------------------------------------------------------------------//
0009 #pragma once
0010 
0011 #include <vector>
0012 
0013 #include "orange/OrangeTypes.hh"
0014 
0015 #include "CsgTypes.hh"
0016 
0017 namespace celeritas
0018 {
0019 namespace orangeinp
0020 {
0021 class CsgTree;
0022 //---------------------------------------------------------------------------//
0023 
0024 // Replace a node in the tree with a boolean constant
0025 std::vector<NodeId> replace_and_simplify(CsgTree* tree,
0026                                          orangeinp::NodeId n,
0027                                          orangeinp::Node replacement);
0028 
0029 // Simplify the tree by sweeping
0030 orangeinp::NodeId simplify_up(CsgTree* tree, orangeinp::NodeId start);
0031 
0032 // Simplify the tree iteratively
0033 void simplify(CsgTree* tree, orangeinp::NodeId start);
0034 
0035 // Replace ~&(xs...) with |(~xs...) and ~|(xs...) with &(~xs...)
0036 [[nodiscard]] CsgTree transform_negated_joins(CsgTree const& tree);
0037 
0038 // Transform a CSG node into a string expression
0039 [[nodiscard]] std::string
0040 build_infix_string(CsgTree const& tree, orangeinp::NodeId n);
0041 
0042 // Get the set of unsimplified surfaces in a tree
0043 [[nodiscard]] std::vector<LocalSurfaceId> calc_surfaces(CsgTree const& tree);
0044 
0045 //---------------------------------------------------------------------------//
0046 }  // namespace orangeinp
0047 }  // namespace celeritas