Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:40

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/grid/NonuniformGridBuilder.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <utility>
0010 #include <vector>
0011 
0012 #include "corecel/Types.hh"
0013 #include "corecel/data/Collection.hh"
0014 #include "corecel/data/DedupeCollectionBuilder.hh"
0015 #include "corecel/grid/NonuniformGridData.hh"
0016 #include "celeritas/Types.hh"
0017 #include "celeritas/inp/Grid.hh"
0018 
0019 namespace celeritas
0020 {
0021 //---------------------------------------------------------------------------//
0022 /*!
0023  * Construct a nonuniform grid.
0024  *
0025  * This uses a deduplicating inserter for real values to improve cacheing.
0026  */
0027 class NonuniformGridBuilder
0028 {
0029   public:
0030     //!@{
0031     //! \name Type aliases
0032     using Grid = NonuniformGridRecord;
0033     using Values = Collection<real_type, Ownership::value, MemSpace::host>;
0034     //!@}
0035 
0036   public:
0037     // Construct with a reference to mutable host data
0038     explicit NonuniformGridBuilder(Values* reals);
0039 
0040     // Add an imported physics vector as a grid
0041     Grid operator()(inp::Grid const&);
0042 
0043   private:
0044     Values* values_;
0045     DedupeCollectionBuilder<real_type> reals_;
0046 };
0047 
0048 //---------------------------------------------------------------------------//
0049 }  // namespace celeritas