11#include <xtensor/containers/xarray.hpp>
12#include <xtensor/core/xtensor_forward.hpp>
14namespace oiseau::dg::solver {
22 std::vector<xt::xarray<double>> groups;
27inline void scale_add_in_place(
DGState& target,
double target_scale,
const DGState& source,
28 double source_scale) {
29 for (std::size_t group = 0; group < target.groups.size(); ++group) {
30 auto* values = target.groups[group].data();
31 const auto* source_values = source.groups[group].data();
32 for (std::size_t index = 0; index < target.groups[group].size(); ++index) {
33 const auto old_value = values[index];
34 const auto added_value = source_values[index];
35 values[index] = target_scale * old_value + source_scale * added_value;
40inline DGState add_scaled(
const DGState& base,
const DGState& increment,
double scale) {
42 for (std::size_t group = 0; group < result.groups.size(); ++group) {
43 auto* values = result.groups[group].data();
44 const auto* differences = increment.groups[group].data();
45 for (std::size_t index = 0; index < result.groups[group].size(); ++index) {
46 values[index] += scale * differences[index];