Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:17:10

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2022-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 orange/detail/UnitInserter.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include "corecel/Types.hh"
0011 #include "corecel/data/CollectionBuilder.hh"
0012 #include "corecel/data/DedupeCollectionBuilder.hh"
0013 
0014 #include "BIHBuilder.hh"
0015 #include "SurfacesRecordBuilder.hh"
0016 #include "TransformRecordInserter.hh"
0017 #include "../BoundingBoxUtils.hh"
0018 #include "../OrangeData.hh"
0019 #include "../OrangeInput.hh"
0020 #include "../OrangeTypes.hh"
0021 
0022 namespace celeritas
0023 {
0024 namespace detail
0025 {
0026 class UniverseInserter;
0027 //---------------------------------------------------------------------------//
0028 /*!
0029  * Convert a unit input to params data.
0030  *
0031  * Linearize the data in a UnitInput and add it to the host.
0032  */
0033 class UnitInserter
0034 {
0035   public:
0036     //!@{
0037     //! \name Type aliases
0038     using Data = HostVal<OrangeParamsData>;
0039     //!@}
0040 
0041   public:
0042     // Construct from full parameter data
0043     UnitInserter(UniverseInserter* insert_universe, Data* orange_data);
0044 
0045     // Create a simple unit and store in in OrangeParamsData
0046     UniverseId operator()(UnitInput&& inp);
0047 
0048   private:
0049     Data* orange_data_{nullptr};
0050     BIHBuilder build_bih_tree_;
0051     TransformRecordInserter insert_transform_;
0052     SurfacesRecordBuilder build_surfaces_;
0053     UniverseInserter* insert_universe_;
0054 
0055     CollectionBuilder<SimpleUnitRecord> simple_units_;
0056 
0057     DedupeCollectionBuilder<LocalSurfaceId> local_surface_ids_;
0058     DedupeCollectionBuilder<LocalVolumeId> local_volume_ids_;
0059     DedupeCollectionBuilder<OpaqueId<real_type>> real_ids_;
0060     DedupeCollectionBuilder<logic_int> logic_ints_;
0061     DedupeCollectionBuilder<real_type> reals_;
0062     DedupeCollectionBuilder<SurfaceType> surface_types_;
0063     CollectionBuilder<ConnectivityRecord> connectivity_records_;
0064     CollectionBuilder<VolumeRecord> volume_records_;
0065     CollectionBuilder<OrientedBoundingZoneRecord> obz_records_;
0066     CollectionBuilder<Daughter> daughters_;
0067     BoundingBoxBumper<fast_real_type, real_type> calc_bumped_;
0068 
0069     //// HELPER METHODS ////
0070 
0071     VolumeRecord
0072     insert_volume(SurfacesRecord const& unit, VolumeInput const& v);
0073 
0074     void process_daughter(VolumeRecord* vol_record,
0075                           DaughterInput const& daughter_input);
0076 
0077     void process_obz_record(VolumeRecord* vol_record,
0078                             OrientedBoundingZoneInput const& obz_input);
0079 };
0080 
0081 //---------------------------------------------------------------------------//
0082 }  // namespace detail
0083 }  // namespace celeritas