Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:22

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2021-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 celeritas/geo/GeoMaterialData.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/data/Collection.hh"
0011 #include "geocel/Types.hh"
0012 #include "celeritas/Types.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Shared data for mapping geometry to materials.
0019  */
0020 template<Ownership W, MemSpace M>
0021 struct GeoMaterialParamsData
0022 {
0023     template<class T>
0024     using VolumeItems = celeritas::Collection<T, W, M, VolumeId>;
0025 
0026     VolumeItems<MaterialId> materials;
0027 
0028     //! True if assigned
0029     explicit CELER_FUNCTION operator bool() const
0030     {
0031         return !materials.empty();
0032     }
0033 
0034     //! Assign from another set of data
0035     template<Ownership W2, MemSpace M2>
0036     GeoMaterialParamsData& operator=(GeoMaterialParamsData<W2, M2> const& other)
0037     {
0038         CELER_EXPECT(other);
0039         materials = other.materials;
0040         return *this;
0041     }
0042 };
0043 
0044 //---------------------------------------------------------------------------//
0045 }  // namespace celeritas