35inline std::vector<Utils::Vector3d>
38 auto const n_grid_points =
40 assert(vec_flat.size() == 3u * n_grid_points or vec_flat.size() == 3u);
41 std::vector<Utils::Vector3d> output_vector;
42 output_vector.reserve(3u * n_grid_points);
44 auto const vec_begin = std::begin(vec_flat);
45 auto const vec_end = std::end(vec_flat);
46 if (vec_flat.size() == 3u) {
48 output_vector.assign(n_grid_points, uniform_vector);
50 output_vector.reserve(n_grid_points);
51 for (
auto it = vec_begin; it < vec_end; it += 3u) {
59inline std::vector<double>
62 auto const n_grid_points =
64 assert(vec_flat.size() == n_grid_points or vec_flat.size() == 1u);
65 std::vector<double> output_vector;
66 output_vector.reserve(n_grid_points);
68 auto const vec_begin = std::begin(vec_flat);
69 auto const vec_end = std::end(vec_flat);
70 if (vec_flat.size() == 1u) {
71 auto const uniform_value = vec_flat[0];
72 output_vector.assign(n_grid_points, uniform_value);
74 output_vector.assign(vec_begin, vec_end);
80template <
class BoundaryModel,
class DataType>
83 std::vector<int>
const &raster_flat,
84 std::vector<DataType>
const &data_flat) {
86 auto const &conv = es2walberla<DataType, typename BoundaryModel::value_type>;
90 assert(raster_flat.size() ==
92 auto const n_y =
static_cast<std::size_t
>(grid_size[1]);
93 auto const n_z =
static_cast<std::size_t
>(grid_size[2]);
96 auto const [size_i, size_j, size_k] = boundary.block_dims(
block);
99 for (
int i = -gl; i < size_i + gl; ++i) {
100 for (
int j = -gl; j < size_j + gl; ++j) {
101 for (
int k = -gl; k < size_k + gl; ++k) {
103 auto const idx = (node + grid_size) % grid_size;
104 auto const index =
static_cast<std::size_t
>(idx[0]) * n_y * n_z +
105 static_cast<std::size_t
>(idx[1]) * n_z +
106 static_cast<std::size_t
>(idx[2]);
107 if (raster_flat[index]) {
108 auto const &value = data_flat[index];
110 assert(bc.has_value());
111 boundary.set_node_value_at_boundary(node, conv(value), *bc);
Vector implementation and trait types for boost qvm interoperability.
Class that runs and controls the BlockForest in waLBerla.
auto get_ghost_layers() const
auto get_local_grid_range() const
auto get_grid_dimensions() const
static double * block(double *p, std::size_t index, std::size_t size)
T product(Vector< T, N > const &v)
\file PackInfoPdfDoublePrecision.cpp \author pystencils
std::optional< BlockAndCell > get_block_and_cell(::LatticeWalberla const &lattice, Utils::Vector3i const &node, bool consider_ghost_layers)
std::vector< double > fill_3D_scalar_array(std::vector< double > const &vec_flat, Utils::Vector3i const &grid_size)
void set_boundary_from_grid(BoundaryModel &boundary, LatticeWalberla const &lattice, std::vector< int > const &raster_flat, std::vector< DataType > const &data_flat)
std::vector< Utils::Vector3d > fill_3D_vector_array(std::vector< double > const &vec_flat, Utils::Vector3i const &grid_size)