Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:07:48

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