Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:56

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/Transformed.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "orange/transform/VariantTransform.hh"
0011 
0012 #include "ObjectInterface.hh"
0013 
0014 namespace celeritas
0015 {
0016 namespace orangeinp
0017 {
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Build a translated or transformed object.
0021  */
0022 class Transformed final : public ObjectInterface
0023 {
0024   public:
0025     // Construct a transformed object if nontrivial, or return the original
0026     static SPConstObject
0027     or_object(SPConstObject obj, VariantTransform const& transform);
0028 
0029     // Construct with daughter object and transform
0030     Transformed(SPConstObject obj, VariantTransform const& transform);
0031 
0032     //! Access the daughter object
0033     SPConstObject const& daughter() const { return obj_; }
0034 
0035     //! Access the transform
0036     VariantTransform const& transform() const { return transform_; }
0037 
0038     //! Get the user-provided label
0039     std::string_view label() const final { return obj_->label(); }
0040 
0041     // Construct a volume from this object
0042     NodeId build(VolumeBuilder&) const final;
0043 
0044     // Write the object to JSON
0045     void output(JsonPimpl*) const final;
0046 
0047   private:
0048     SPConstObject obj_;
0049     VariantTransform transform_;
0050 };
0051 
0052 //---------------------------------------------------------------------------//
0053 }  // namespace orangeinp
0054 }  // namespace celeritas