|
||||
File indexing completed on 2025-01-18 09:59:35
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 geocel/GeoTraits.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include <type_traits> 0011 0012 #include "corecel/Types.hh" 0013 0014 namespace celeritas 0015 { 0016 //---------------------------------------------------------------------------// 0017 class GeoParamsInterface; 0018 0019 //---------------------------------------------------------------------------// 0020 /*! 0021 * Traits class for defining params and device data. 0022 * \tparam G Geometry params class, e.g. VecgeomParams 0023 * 0024 * This traits class \em must be defined for all geometry types. The generic 0025 * instance here is provided as a synopsis and to improve error checking. 0026 */ 0027 template<class G> 0028 struct GeoTraits 0029 { 0030 static_assert(std::is_base_of_v<GeoParamsInterface, G>, 0031 "G must be a geometry params, not params data"); 0032 static_assert(std::is_void_v<G>, "Geo traits must be specialized"); 0033 0034 //! Params data used during runtime 0035 template<Ownership W, MemSpace M> 0036 using ParamsData = void; 0037 0038 //! State data used during runtime 0039 template<Ownership W, MemSpace M> 0040 using StateData = void; 0041 0042 //! Geometry track view 0043 using TrackView = void; 0044 0045 //! Descriptive name for the geometry 0046 static constexpr inline char const* name = nullptr; 0047 0048 //! TO BE REMOVED: "native" file extension for this geometry 0049 static constexpr inline char const* ext = nullptr; 0050 }; 0051 0052 //---------------------------------------------------------------------------// 0053 //! Helper for determining whether a geometry type is available. 0054 template<class G> 0055 inline constexpr bool is_geometry_configured_v 0056 = !std::is_void_v<typename GeoTraits<G>::TrackView>; 0057 0058 //---------------------------------------------------------------------------// 0059 /*! 0060 * Traits class for marking a geometry as not configured. 0061 * 0062 * Specializations should inherit from this class when the geometry is not 0063 * configured. 0064 */ 0065 struct NotConfiguredGeoTraits 0066 { 0067 template<Ownership W, MemSpace M> 0068 using ParamsData = void; 0069 template<Ownership W, MemSpace M> 0070 using StateData = void; 0071 using TrackView = void; 0072 static constexpr inline char const* name = nullptr; 0073 static constexpr inline char const* ext = nullptr; 0074 }; 0075 0076 //---------------------------------------------------------------------------// 0077 } // 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 |