ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
erf_sbm::SBMStateAdmission::Impl Struct Reference
Collaboration diagram for erf_sbm::SBMStateAdmission::Impl:

Public Member Functions

 Impl (const SBMLayout &layout)
 

Public Attributes

SBMLayout layout
 
int ncomp {0}
 
std::vector< ConstraintGroup > groups
 
FlattenedConstraintSet flattened
 
amrex::Gpu::DeviceVector< ConstraintDescriptor > constraints
 
amrex::Gpu::DeviceVector< ConstraintTerm > terms
 
amrex::Gpu::DeviceVector< PopulationRemapView > populations
 
amrex::Gpu::DeviceVector< amrex::Real > edges
 
amrex::Gpu::DeviceVector< amrex::Real > pivots
 
amrex::Gpu::DeviceVector< int > properties
 
std::vector< std::unique_ptr< amrex::MultiFab > > invalid
 
Counters counts
 

Constructor & Destructor Documentation

◆ Impl()

erf_sbm::SBMStateAdmission::Impl::Impl ( const SBMLayout &  layout)
inlineexplicit
28  {
29  constraints.resize(flattened.constraints.size());
30  terms.resize(flattened.terms.size());
31  if (!flattened.constraints.empty()) {
32  amrex::Gpu::copy(amrex::Gpu::hostToDevice,
33  flattened.constraints.begin(),
34  flattened.constraints.end(), constraints.begin());
35  }
36  if (!flattened.terms.empty()) {
37  amrex::Gpu::copy(amrex::Gpu::hostToDevice,
38  flattened.terms.begin(), flattened.terms.end(),
39  terms.begin());
40  }
41 
42  std::vector<amrex::Real> host_edges;
43  std::vector<amrex::Real> host_pivots;
44  std::vector<int> host_properties;
45  std::vector<int> edge_offsets, pivot_offsets, property_offsets;
46  for (const auto& population : layout.populations()) {
47  edge_offsets.push_back(static_cast<int>(host_edges.size()));
48  host_edges.insert(host_edges.end(), population.grid.edges().begin(),
49  population.grid.edges().end());
50  pivot_offsets.push_back(static_cast<int>(host_pivots.size()));
51  host_pivots.insert(host_pivots.end(), population.grid.pivots().begin(),
52  population.grid.pivots().end());
53  property_offsets.push_back(static_cast<int>(host_properties.size()));
54  host_properties.insert(host_properties.end(),
55  population.property_component_offsets.begin(),
56  population.property_component_offsets.end());
57  }
58  edges.resize(host_edges.size());
59  pivots.resize(host_pivots.size());
60  properties.resize(host_properties.size());
61  if (!host_edges.empty()) {
62  amrex::Gpu::copy(amrex::Gpu::hostToDevice, host_edges.begin(),
63  host_edges.end(), edges.begin());
64  }
65  if (!host_pivots.empty()) {
66  amrex::Gpu::copy(amrex::Gpu::hostToDevice, host_pivots.begin(),
67  host_pivots.end(), pivots.begin());
68  }
69  if (!host_properties.empty()) {
70  amrex::Gpu::copy(amrex::Gpu::hostToDevice, host_properties.begin(),
71  host_properties.end(), properties.begin());
72  }
73 
74  std::vector<PopulationRemapView> views;
75  views.reserve(layout.populations().size());
76  for (std::size_t p = 0; p < layout.populations().size(); ++p) {
77  auto view = population_remap_view(
78  layout, layout.populations()[p].population_id);
79  view.edges = edges.data() + edge_offsets[p];
80  view.pivots = layout.populations()[p].grid.pivots().empty()
81  ? nullptr : pivots.data() + pivot_offsets[p];
82  view.property_component_offsets =
83  layout.populations()[p].property_component_offsets.empty()
84  ? nullptr : properties.data() + property_offsets[p];
85  views.push_back(view);
86  }
87  populations.resize(views.size());
88  if (!views.empty()) {
89  amrex::Gpu::copy(amrex::Gpu::hostToDevice, views.begin(),
90  views.end(), populations.begin());
91  }
92  }
const std::vector< PopulationLayout > & populations() const noexcept
Definition: ERF_SBMLayout.H:99
int ncomp() const noexcept
Definition: ERF_SBMLayout.H:103
@ p
Definition: ERF_WSM6.H:303
std::vector< ConstraintGroup > make_constraint_groups(const SBMLayout &layout)
Definition: ERF_SBMConstraintGroups.cpp:77
FlattenedConstraintSet make_constraint_descriptors(const SBMLayout &layout)
Definition: ERF_SBMConstraintGroups.cpp:208
PopulationRemapView population_remap_view(const SBMLayout &layout, const int population_id) noexcept
Definition: ERF_SBMRemapping.cpp:8
std::vector< ConstraintTerm > terms
Definition: ERF_SBMConstraintGroups.H:65
std::vector< ConstraintDescriptor > constraints
Definition: ERF_SBMConstraintGroups.H:64
amrex::Gpu::DeviceVector< amrex::Real > pivots
Definition: ERF_SBMRestart.cpp:102
amrex::Gpu::DeviceVector< ConstraintTerm > terms
Definition: ERF_SBMRestart.cpp:99
int ncomp
Definition: ERF_SBMRestart.cpp:95
SBMLayout layout
Definition: ERF_SBMRestart.cpp:94
std::vector< ConstraintGroup > groups
Definition: ERF_SBMRestart.cpp:96
amrex::Gpu::DeviceVector< ConstraintDescriptor > constraints
Definition: ERF_SBMRestart.cpp:98
amrex::Gpu::DeviceVector< amrex::Real > edges
Definition: ERF_SBMRestart.cpp:101
amrex::Gpu::DeviceVector< int > properties
Definition: ERF_SBMRestart.cpp:103
FlattenedConstraintSet flattened
Definition: ERF_SBMRestart.cpp:97
amrex::Gpu::DeviceVector< PopulationRemapView > populations
Definition: ERF_SBMRestart.cpp:100
Here is the call graph for this function:

Member Data Documentation

◆ constraints

amrex::Gpu::DeviceVector<ConstraintDescriptor> erf_sbm::SBMStateAdmission::Impl::constraints

Referenced by Impl().

◆ counts

Counters erf_sbm::SBMStateAdmission::Impl::counts
mutable

◆ edges

amrex::Gpu::DeviceVector<amrex::Real> erf_sbm::SBMStateAdmission::Impl::edges

Referenced by Impl().

◆ flattened

FlattenedConstraintSet erf_sbm::SBMStateAdmission::Impl::flattened

Referenced by Impl().

◆ groups

std::vector<ConstraintGroup> erf_sbm::SBMStateAdmission::Impl::groups

◆ invalid

std::vector<std::unique_ptr<amrex::MultiFab> > erf_sbm::SBMStateAdmission::Impl::invalid

◆ layout

SBMLayout erf_sbm::SBMStateAdmission::Impl::layout

Referenced by Impl().

◆ ncomp

int erf_sbm::SBMStateAdmission::Impl::ncomp {0}

◆ pivots

amrex::Gpu::DeviceVector<amrex::Real> erf_sbm::SBMStateAdmission::Impl::pivots

Referenced by Impl().

◆ populations

amrex::Gpu::DeviceVector<PopulationRemapView> erf_sbm::SBMStateAdmission::Impl::populations

Referenced by Impl().

◆ properties

amrex::Gpu::DeviceVector<int> erf_sbm::SBMStateAdmission::Impl::properties

Referenced by Impl().

◆ terms

amrex::Gpu::DeviceVector<ConstraintTerm> erf_sbm::SBMStateAdmission::Impl::terms

Referenced by Impl().


The documentation for this struct was generated from the following file: