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