Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/orange/transform/NoTransformation.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/transform/NoTransformation.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/cont/Span.hh"
0011 #include "orange/OrangeTypes.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Apply an identity transformation.
0018  *
0019  * This trivial class has the Transformation interface but has no storage
0020  * requirements and simply passes through all its data.
0021  */
0022 class NoTransformation
0023 {
0024   public:
0025     //@{
0026     //! \name Type aliases
0027     using StorageSpan = Span<real_type const, 0>;
0028     //@}
0029 
0030     //! Transform type identifier
0031     static CELER_CONSTEXPR_FUNCTION TransformType transform_type()
0032     {
0033         return TransformType::no_transformation;
0034     }
0035 
0036   public:
0037     //! Construct with an identity NoTransformation
0038     NoTransformation() = default;
0039 
0040     //! Construct inline from storage
0041     explicit CELER_FUNCTION NoTransformation(StorageSpan) {}
0042 
0043     //// ACCESSORS ////
0044 
0045     //! Get a view to the data for type-deleted storage
0046     CELER_FUNCTION StorageSpan data() const { return {}; }
0047 
0048     //// CALCULATION ////
0049 
0050     //! Transform from daughter to parent (identity)
0051     CELER_FUNCTION Real3 const& transform_up(Real3 const& d) const
0052     {
0053         return d;
0054     }
0055 
0056     //! Transform from parent to daughter (identity)
0057     CELER_FUNCTION Real3 const& transform_down(Real3 const& d) const
0058     {
0059         return d;
0060     }
0061 
0062     //! Rotate from daughter to parent (identity)
0063     CELER_FUNCTION Real3 const& rotate_up(Real3 const& d) const { return d; }
0064 
0065     //! Rotate from parent to daughter (identity)
0066     CELER_FUNCTION Real3 const& rotate_down(Real3 const& d) const { return d; }
0067 
0068     // Calculate the inverse during preprocessing
0069     inline NoTransformation calc_inverse() const { return {}; }
0070 };
0071 
0072 //---------------------------------------------------------------------------//
0073 // FREE FUNCTIONS
0074 //---------------------------------------------------------------------------//
0075 //!@{
0076 //! Host-only comparators
0077 inline constexpr bool
0078 operator==(NoTransformation const&, NoTransformation const&)
0079 {
0080     return true;
0081 }
0082 
0083 inline constexpr bool
0084 operator!=(NoTransformation const&, NoTransformation const&)
0085 {
0086     return false;
0087 }
0088 //!@}
0089 
0090 //---------------------------------------------------------------------------//
0091 }  // namespace celeritas