forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpticalCollector.hh
91 lines (75 loc) · 2.74 KB
/
OpticalCollector.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//----------------------------------*-C++-*----------------------------------//
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/optical/OpticalCollector.hh
//---------------------------------------------------------------------------//
#pragma once
#include <memory>
#include "celeritas/Types.hh"
#include "celeritas/optical/OpticalGenData.hh"
#include "detail/PreGenAction.hh"
#include "detail/PreGenGatherAction.hh"
namespace celeritas
{
class ActionRegistry;
class CerenkovParams;
class OpticalPropertyParams;
class ScintillationParams;
namespace detail
{
struct OpticalGenStorage;
} // namespace detail
//---------------------------------------------------------------------------//
/*!
* Generate scintillation and Cerenkov optical distribution data at each step.
*
* This builds the actions for gathering the pre-step data needed to generate
* the optical distributions and generating the optical distributions at the
* end of the step.
*/
class OpticalCollector
{
public:
//!@{
//! \name Type aliases
using SPConstCerenkov = std::shared_ptr<CerenkovParams const>;
using SPConstProperties = std::shared_ptr<OpticalPropertyParams const>;
using SPConstScintillation = std::shared_ptr<ScintillationParams const>;
using SPGenStorage = std::shared_ptr<detail::OpticalGenStorage>;
//!@}
struct Input
{
SPConstProperties properties;
SPConstCerenkov cerenkov;
SPConstScintillation scintillation;
ActionRegistry* action_registry;
size_type buffer_capacity{};
size_type num_streams{};
//! True if all input is assigned and valid
explicit operator bool() const
{
return (scintillation || (cerenkov && properties))
&& action_registry && buffer_capacity > 0 && num_streams > 0;
}
};
public:
// Construct with optical params, number of streams, and action registry
explicit OpticalCollector(Input);
// Default destructor and move and copy
~OpticalCollector() = default;
CELER_DEFAULT_COPY_MOVE(OpticalCollector);
//! Get the distribution data
SPGenStorage const& storage() const { return storage_; };
private:
//// TYPES ////
using SPPreGenAction = std::shared_ptr<detail::PreGenAction>;
using SPGatherAction = std::shared_ptr<detail::PreGenGatherAction>;
//// DATA ////
SPGenStorage storage_;
SPGatherAction gather_action_;
SPPreGenAction pregen_action_;
};
//---------------------------------------------------------------------------//
} // namespace celeritas