![]() |
|
|||
File indexing completed on 2025-02-22 10:31:23
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 celeritas/grid/GenericGridBuilder.hh 0007 //---------------------------------------------------------------------------// 0008 #pragma once 0009 0010 #include "corecel/data/Collection.hh" 0011 #include "corecel/data/CollectionBuilder.hh" 0012 #include "corecel/data/DedupeCollectionBuilder.hh" 0013 0014 #include "GenericGridData.hh" 0015 0016 namespace celeritas 0017 { 0018 struct ImportPhysicsVector; 0019 //---------------------------------------------------------------------------// 0020 /*! 0021 * Construct a generic grid. 0022 * 0023 * This uses a deduplicating inserter for real values to improve cacheing. 0024 */ 0025 class GenericGridBuilder 0026 { 0027 public: 0028 //!@{ 0029 //! \name Type aliases 0030 template<class T> 0031 using Items = Collection<T, Ownership::value, MemSpace::host>; 0032 using Grid = GenericGridRecord; 0033 using SpanConstFlt = Span<float const>; 0034 using SpanConstDbl = Span<double const>; 0035 //!@} 0036 0037 public: 0038 // Construct with pointers to data that will be modified 0039 explicit GenericGridBuilder(Items<real_type>* reals); 0040 0041 // Add a grid of generic data with linear interpolation 0042 Grid operator()(SpanConstFlt grid, SpanConstFlt values); 0043 0044 // Add a grid of generic data with linear interpolation 0045 Grid operator()(SpanConstDbl grid, SpanConstDbl values); 0046 0047 // Add a grid from an imported physics vector 0048 Grid operator()(ImportPhysicsVector const&); 0049 0050 private: 0051 DedupeCollectionBuilder<real_type> reals_; 0052 0053 // Insert with floating point conversion if needed 0054 template<class T> 0055 Grid insert_impl(Span<T const> grid, Span<T const> values); 0056 }; 0057 0058 //---------------------------------------------------------------------------// 0059 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |