Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:57:16

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/rasterize/ImageInterface.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 #include "corecel/Macros.hh"
0012 #include "corecel/Types.hh"
0013 #include "corecel/cont/Span.hh"
0014 
0015 namespace celeritas
0016 {
0017 class ImageParams;
0018 
0019 //---------------------------------------------------------------------------//
0020 /*!
0021  * Access data from an image.
0022  *
0023  * Images currently are arrays of integer pixels.
0024  */
0025 class ImageInterface
0026 {
0027   public:
0028     //!@{
0029     //! \name Type aliases
0030     using int_type = int;
0031     using SpanInt = Span<int_type>;
0032     using SPConstParams = std::shared_ptr<ImageParams const>;
0033     //!@}
0034 
0035   public:
0036     //! Default virtual destructor
0037     virtual ~ImageInterface() = default;
0038 
0039     //! Access image properties
0040     virtual SPConstParams const& params() const = 0;
0041 
0042     //! Copy the image to the host
0043     virtual void copy_to_host(SpanInt) const = 0;
0044 
0045   protected:
0046     ImageInterface() = default;
0047     CELER_DEFAULT_COPY_MOVE(ImageInterface);
0048 };
0049 
0050 // Forward-declare image, see Image.hh
0051 template<MemSpace M>
0052 class Image;
0053 
0054 //---------------------------------------------------------------------------//
0055 /*!
0056  * Generate one or more images from a geometry.
0057  */
0058 class ImagerInterface
0059 {
0060   public:
0061     //! Default virtual destructor
0062     virtual ~ImagerInterface() = default;
0063 
0064     //!@{
0065     //! Raytrace an image on host or device
0066     virtual void operator()(Image<MemSpace::host>*) = 0;
0067     virtual void operator()(Image<MemSpace::device>*) = 0;
0068     //!@}
0069 
0070   protected:
0071     ImagerInterface() = default;
0072     CELER_DEFAULT_COPY_MOVE(ImagerInterface);
0073 };
0074 
0075 //---------------------------------------------------------------------------//
0076 }  // namespace celeritas