ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
walberla_bridge/include/walberla_bridge/LatticeWalberla.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2023 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <utils/Vector.hpp>
23
24#include <memory>
25#include <utility>
26
27// forward declarations
29class StructuredBlockForest;
30} // namespace walberla::blockforest
32class IBlock;
33} // namespace walberla::domain_decomposition
34
35/** Class that runs and controls the BlockForest in waLBerla. */
37public:
38 using Lattice_T = walberla::blockforest::StructuredBlockForest;
39
40private:
41 Utils::Vector3i m_grid_dimensions;
42 Utils::Vector3i m_node_grid;
43 unsigned int m_n_ghost_layers;
44
45 /** Block forest */
46 std::shared_ptr<Lattice_T> m_blocks;
47 using IBlock = walberla::domain_decomposition::IBlock;
48 std::vector<IBlock *> m_cached_blocks;
49
50public:
51 LatticeWalberla(Utils::Vector3i const &grid_dimensions,
52 Utils::Vector3i const &node_grid,
53 Utils::Vector3i const &block_grid,
54 unsigned int n_ghost_layers);
55
56 // Grid, domain, halo
57 [[nodiscard]] auto get_ghost_layers() const { return m_n_ghost_layers; }
58 [[nodiscard]] auto const &get_grid_dimensions() const {
59 return m_grid_dimensions;
60 }
61 [[nodiscard]] auto const &get_node_grid() const { return m_node_grid; }
62 [[nodiscard]] auto get_blocks() const { return m_blocks; }
63 [[nodiscard]] auto const &get_cached_blocks() const {
64 return m_cached_blocks;
65 }
66 [[nodiscard]] std::pair<Utils::Vector3d, Utils::Vector3d>
67 get_local_domain() const;
68 [[nodiscard]] std::pair<Utils::Vector3i, Utils::Vector3i>
70
71 [[nodiscard]] Utils::Vector3i get_block_corner(IBlock const &block,
72 bool lower) const;
73 [[nodiscard]] bool node_in_local_domain(Utils::Vector3i const &node) const;
74 [[nodiscard]] bool node_in_local_halo(Utils::Vector3i const &node) const;
75 [[nodiscard]] bool pos_in_local_domain(Utils::Vector3d const &pos) const;
76 [[nodiscard]] bool pos_in_local_halo(Utils::Vector3d const &pos) const;
77 [[nodiscard]] static Utils::Vector3i
78 calc_grid_dimensions(Utils::Vector3d const &box_size, double agrid);
79};
Vector implementation and trait types for boost qvm interoperability.
Class that runs and controls the BlockForest in waLBerla.
bool pos_in_local_halo(Utils::Vector3d const &pos) const
std::pair< Utils::Vector3i, Utils::Vector3i > get_local_grid_range() const
static Utils::Vector3i calc_grid_dimensions(Utils::Vector3d const &box_size, double agrid)
bool node_in_local_halo(Utils::Vector3i const &node) const
std::pair< Utils::Vector3d, Utils::Vector3d > get_local_domain() const
walberla::blockforest::StructuredBlockForest Lattice_T
bool node_in_local_domain(Utils::Vector3i const &node) const
Utils::Vector3i get_block_corner(IBlock const &block, bool lower) const
bool pos_in_local_domain(Utils::Vector3d const &pos) const
static double * block(double *p, std::size_t index, std::size_t size)
Definition elc.cpp:172