Back to home page

EIC code displayed by LXR

 
 

    


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/IntersectSurfaceState.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <string>
0011 #include <vector>
0012 
0013 #include "orange/surf/FaceNamer.hh"
0014 #include "orange/transform/VariantTransform.hh"
0015 
0016 #include "BoundingZone.hh"
0017 #include "../CsgTypes.hh"
0018 
0019 namespace celeritas
0020 {
0021 namespace orangeinp
0022 {
0023 namespace detail
0024 {
0025 //---------------------------------------------------------------------------//
0026 /*!
0027  * Local state for building a set of intersected surfaces.
0028  *
0029  * Note that the surface clippers have *pointers* to local and global bounding
0030  * zones. Those must exceed the lifetime of this state.
0031  */
0032 struct IntersectSurfaceState
0033 {
0034     //!@{
0035     //! \name Input state
0036     //! Local-to-global transform
0037     VariantTransform const* transform{nullptr};
0038     //! Name of the object being built
0039     std::string object_name;
0040     //! Generate a name from a surface (has internal state)
0041     FaceNamer make_face_name;
0042     //!@}
0043 
0044     //!@{
0045     //! \name Output state
0046     //! Local (to intersecting surface state) interior/exterior
0047     BoundingZone local_bzone = BoundingZone::from_infinite();
0048     //! Global (to unit) interior/exterior
0049     BoundingZone global_bzone = BoundingZone::from_infinite();
0050     //! Inserted CSG nodes
0051     std::vector<NodeId> nodes;
0052     //!@}
0053 
0054     //! True if the state is valid
0055     explicit operator bool() const
0056     {
0057         return transform && !object_name.empty();
0058     }
0059 };
0060 
0061 //---------------------------------------------------------------------------//
0062 // Use the local and global bounding zones to create a better zone
0063 BoundingZone calc_merged_bzone(IntersectSurfaceState const& css);
0064 
0065 //---------------------------------------------------------------------------//
0066 }  // namespace detail
0067 }  // namespace orangeinp
0068 }  // namespace celeritas