8#include <kernel/util/tiny_algebra.hpp>
9#include <kernel/util/math.hpp>
10#include <kernel/util/dist.hpp>
18 template<
typename DomainControl_>
21 typedef typename DomainControl_::LevelType::MeshType::CoordType DataType;
22 static constexpr int dim = DomainControl_::LevelType::MeshType::shape_dim;
37 XASSERTM(domain.size_virtual() >= level,
"Chosen level is larger than virtual size");
40 if(level < domain.size_physical())
43 const auto& mesh = domain.at(level)->get_mesh();
44 const auto& vtx_set = mesh.get_vertex_set();
46 const Index n = vtx_set.get_num_vertices();
47 for(
Index i(0); i < n; ++i)
49 for(
int k = 0; k < dim; ++k)
51 bb_min[k] =
Math::min(bb_min[k], vtx_set[i][k]);
52 bb_max[k] =
Math::max(bb_max[k], vtx_set[i][k]);
58 comm.
allreduce(
static_cast<DataType*
>(&bb_min[0]),
static_cast<DataType*
>(&bb_min[0]), std::size_t(dim),
Dist::op_min);
59 comm.
allreduce(
static_cast<DataType*
>(&bb_max[0]),
static_cast<DataType*
>(&bb_max[0]), std::size_t(dim),
Dist::op_max);
61 return std::make_pair(bb_min, bb_max);
68 template<
typename DomainLevel_>
71 typedef typename DomainLevel_::MeshType::CoordType DataType;
72 static constexpr int dim = DomainLevel_::MeshType::shape_dim;
87 XASSERTM(domain.size_virtual() > level,
"Chosen level is larger than virtual size");
89 return std::make_pair(domain.get_bounding_box_min(), domain.get_bounding_box_max());
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Hierarchical partitioned Slagged Domain Control.
void allreduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking All-Reduce.
MPI_Comm comm
our MPI communicator handle
Math Limits class template.
Tiny Vector class template.
Domain control namespace.
const Operation op_min(MPI_MIN)
Operation wrapper for MPI_MIN.
const Operation op_max(MPI_MAX)
Operation wrapper for MPI_MAX.
T_ min(T_ a, T_ b)
Returns the minimum of two values.
T_ max(T_ a, T_ b)
Returns the maximum of two values.
std::uint64_t Index
Index data type.
static std::pair< CoordVecType, CoordVecType > calculate_global_boundingbox(const Control::Domain::DeslaggedDomainControl< DomainLevel_ > &domain, const Index level=Index(0))
Helper function to calculate global boundingbox on current layer.
Helper class to calculate the global boundingbox of a domain.
static std::pair< CoordVecType, CoordVecType > calculate_global_boundingbox(const DomainControl_ &domain, const Index level=Index(0))
Helper function to calculate global boundingbox on current layer.