Back to home page

EIC code displayed by LXR

 
 

    


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

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/phys/GeneratorCountersIO.json.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <nlohmann/json.hpp>
0010 
0011 #include "corecel/io/JsonUtils.json.hh"
0012 
0013 #include "GeneratorCounters.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 
0019 template<class T>
0020 void to_json(nlohmann::json& j, GeneratorCounters<T> const& v)
0021 {
0022     j = nlohmann::json{
0023         CELER_JSON_PAIR(v, buffer_size),
0024         CELER_JSON_PAIR(v, num_pending),
0025         CELER_JSON_PAIR(v, num_generated),
0026     };
0027 }
0028 
0029 template<class T>
0030 void from_json(nlohmann::json const& j, GeneratorCounters<T>& v)
0031 {
0032     CELER_JSON_LOAD_REQUIRED(j, v, buffer_size);
0033     CELER_JSON_LOAD_REQUIRED(j, v, num_pending);
0034     CELER_JSON_LOAD_REQUIRED(j, v, num_generated);
0035 }
0036 
0037 void to_json(nlohmann::json& j, CounterAccumStats const&);
0038 void from_json(nlohmann::json const& j, CounterAccumStats&);
0039 
0040 //---------------------------------------------------------------------------//
0041 }  // namespace celeritas