Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:06

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