Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/geocel/GeoTraits.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 geocel/GeoTraits.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <type_traits>
0010 
0011 #include "corecel/Types.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 class GeoParamsInterface;
0017 
0018 //---------------------------------------------------------------------------//
0019 /*!
0020  * Traits class for defining params and device data.
0021  * \tparam G Geometry params class, e.g. VecgeomParams
0022  *
0023  * This traits class \em must be defined for all geometry types. The generic
0024  * instance here is provided as a synopsis and to improve error checking.
0025  */
0026 template<class G>
0027 struct GeoTraits
0028 {
0029     static_assert(std::is_base_of_v<GeoParamsInterface, G>,
0030                   "G must be a geometry params, not params data");
0031     static_assert(std::is_void_v<G>, "Geo traits must be specialized");
0032 };
0033 
0034 //---------------------------------------------------------------------------//
0035 //! Helper for determining whether a geometry type is available.
0036 template<class G>
0037 inline constexpr bool is_geometry_configured_v
0038     = !std::is_void_v<typename GeoTraits<G>::TrackView>;
0039 
0040 //---------------------------------------------------------------------------//
0041 /*!
0042  * Traits class for marking a geometry as not configured.
0043  *
0044  * Specializations should inherit from this class when the geometry is not
0045  * configured.
0046  */
0047 struct NotConfiguredGeoTraits
0048 {
0049     template<Ownership W, MemSpace M>
0050     using ParamsData = void;
0051     template<Ownership W, MemSpace M>
0052     using StateData = void;
0053     using TrackView = void;
0054     static constexpr char const name[] = "";
0055     static constexpr char const ext[] = "";
0056 };
0057 
0058 //---------------------------------------------------------------------------//
0059 }  // namespace celeritas