23#include <Kokkos_Core.hpp>
40 Kokkos::View<rtype *[N_PRIMITIVE]>
P;
54 static int32_t code(
const std::string & name,
const std::vector<std::string> & species_names,
55 const std::string & key);
73 void init(
const toml::value & input,
const std::vector<std::string> & species_names,
uint32_t n_cells);
75 bool enabled()
const {
return !fields.empty(); }
82 std::vector<std::string>
variables()
const;
103 std::vector<std::string> fields;
104 std::vector<std::pair<uint32_t, uint32_t>> products;
109 Kokkos::View<int32_t *> codes;
110 Kokkos::View<uint32_t *[2]> pairs;
111 Kokkos::View<rtype **, Kokkos::LayoutLeft> mean;
112 Kokkos::View<rtype **, Kokkos::LayoutLeft> cov;
113 Kokkos::View<rtype **, Kokkos::LayoutLeft>::host_mirror_type h_mean;
114 Kokkos::View<rtype **, Kokkos::LayoutLeft>::host_mirror_type h_cov;
131 void init(
const toml::value & input,
const Mesh & mesh,
const std::vector<std::string> & species_names,
137 std::vector<std::pair<std::string, std::string>>
summary()
const;
138 std::vector<std::string>
files()
const;
145 std::vector<std::string> variables;
146 std::vector<std::array<double, N_DIM>> points;
147 std::vector<uint32_t> local_points;
148 Kokkos::View<uint32_t *>
cells;
149 Kokkos::View<int32_t *> codes;
150 Kokkos::View<rtype **, Kokkos::LayoutRight> values;
151 std::shared_ptr<std::ofstream>
out;
153 std::vector<Set> sets;
161std::vector<int32_t>
locate_points(
const Mesh & mesh,
const std::vector<std::array<double, N_DIM>> & points);
Point and line probes: the values of the cells holding a set of points, written every interval steps ...
Definition statistics.h:128
void init(const toml::value &input, const Mesh &mesh, const std::vector< std::string > &species_names, bool resume)
Read [[probes]] and locate the points; resume appends to existing files.
Definition statistics.cpp:374
std::vector< std::pair< std::string, std::string > > summary() const
Definition statistics.cpp:480
void write(uint64_t step, rtype t, const CellSampler &sampler)
Definition statistics.cpp:446
std::vector< std::string > files() const
Definition statistics.cpp:492
bool due(uint64_t step) const
Definition statistics.cpp:442
Running time averages per owned cell: means of fields and covariances <a'b'> of pairs of them,...
Definition statistics.h:70
uint64_t samples() const
Definition statistics.h:97
void restore(const RestartData &restart, const std::string &file, rtype t)
Continue the averages of a restart file, or start afresh at time t if it holds none (or with reset); ...
Definition statistics.cpp:168
void copy_device_to_host()
Definition statistics.cpp:162
std::vector< std::string > variables() const
Output variables: MEAN_<field>..., COV__...
Definition statistics.cpp:147
void sample(rtype t, const CellSampler &sampler, uint32_t n_owned)
Add the sample of time t of cells [0, n_owned).
Definition statistics.cpp:123
RestartAttributes attributes() const
Definition statistics.cpp:206
bool enabled() const
Definition statistics.h:75
void register_data(std::vector< Data > &data) const
Definition statistics.cpp:154
const auto & host_covariances() const
Definition statistics.h:100
const auto & host_means() const
Host copies (see copy_device_to_host): (cell, field) means, (cell, product) covariances.
Definition statistics.h:99
void init(const toml::value &input, const std::vector< std::string > &species_names, uint32_t n_cells)
Read [statistics] (if any) and allocate n_cells.
Definition statistics.cpp:64
std::string summary() const
Definition statistics.cpp:213
void start(rtype t)
Start afresh at time t (first sample weighted from max(t, t_start)).
Definition statistics.cpp:114
bool due(uint64_t step, rtype t) const
Definition statistics.h:76
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
Typedefs for common types.
float rtype
Definition common_typedef.h:39
#define N_PRIMITIVE
Definition common_typedef.h:30
Data writer class declaration.
std::vector< std::pair< std::string, double > > RestartAttributes
Named scalars of a restart file (version 3), e.g. the statistics' weight.
Definition data_writer.h:47
Conservative state: the flow block and the species partial densities.
Kokkos::View< rtype *[N_CONSERVATIVE]> StateView
Flow block [rho, rho u, rho E] per cell.
Definition state.h:23
Kokkos::View< rtype **, SpeciesLayout > SpeciesView
Partial densities rho Y_k per (cell, species).
Definition state.h:37
std::vector< int32_t > locate_points(const Mesh &mesh, const std::vector< std::array< double, N_DIM > > &points)
Owned cell of each point on this rank, or -1 where another rank (or none) holds it: the cell containi...
Definition statistics.cpp:221
Cell values that statistics and probes sample, by code: 0 is RHO, 1 + i the primitive PRIMITIVE_NAMES...
Definition statistics.h:37
SpeciesView rhoY
Definition statistics.h:39
KOKKOS_INLINE_FUNCTION rtype operator()(const uint32_t c, const int32_t code) const
Definition statistics.h:47
static int32_t code(const std::string &name, const std::vector< std::string > &species_names, const std::string &key)
Code of a variable name (RHO, a primitive, Y_<species>); throws InputError naming key.
Definition statistics.cpp:25
Kokkos::View< rtype *[N_PRIMITIVE]> P
Definition statistics.h:40
StateView U
Definition statistics.h:38
static constexpr int32_t FIRST_PRIMITIVE
Definition statistics.h:43
static constexpr int32_t RHO
Definition statistics.h:42
static constexpr int32_t FIRST_SPECIES
Definition statistics.h:44
Contents of a restart file.
Definition data_writer.h:67
CellSetup< ExecSpace > c
Definition teno_setup.cpp:1810
TableBatchT< Space > out
Definition teno_setup.cpp:681
Kokkos::View< uint32_t *, Space > cells
Definition teno_setup.cpp:682