Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:11:35

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 celeritas/io/OpticalDistributionReader.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <fstream>
0010 #include <string>
0011 
0012 #include "corecel/Macros.hh"
0013 #include "celeritas/optical/gen/GeneratorData.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Read optical distribution data from JSON.
0020  *
0021  * This reads file generated by \c OpticalDistributionWriter.
0022  */
0023 class OpticalDistributionReader
0024 {
0025   public:
0026     //!@{
0027     //! \name Type aliases
0028     using VecDistribution = std::vector<optical::GeneratorDistributionData>;
0029     //!@}
0030 
0031     // Construct with filename
0032     explicit OpticalDistributionReader(std::string const& filename);
0033 
0034     //! Prevent copying and moving
0035     CELER_DELETE_COPY_MOVE(OpticalDistributionReader);
0036     ~OpticalDistributionReader() = default;
0037 
0038     // Read distribution data from the JSON file
0039     VecDistribution operator()();
0040 
0041   private:
0042     std::ifstream infile_;
0043 };
0044 
0045 //---------------------------------------------------------------------------//
0046 }  // namespace celeritas