Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:09:32

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