24#ifndef DUMUX_GEOMETRY_BOUNDINGSPHERE_HH
25#define DUMUX_GEOMETRY_BOUNDINGSPHERE_HH
40template<
class ConvexGeometry>
41static inline Sphere<typename ConvexGeometry::ctype, ConvexGeometry::coorddimension>
44 constexpr int dimWorld = ConvexGeometry::coorddimension;
45 assert(geometry.corners() >= 1);
47 auto corner = geometry.corner(0);
48 auto xMin = corner, xMax = corner;
49 using std::max;
using std::min;
52 for (std::size_t i = 1; i < geometry.corners(); ++i)
54 corner = geometry.corner(i);
55 for (std::size_t dimIdx = 0; dimIdx < dimWorld; ++dimIdx)
57 xMin[dimIdx] = min(xMin[dimIdx], corner[dimIdx]);
58 xMax[dimIdx] = max(xMax[dimIdx], corner[dimIdx]);
62 auto center = 0.5*xMax + xMin;
63 auto radius = (
center-xMax).two_norm();
64 return { std::move(
center), std::move(radius) };
68template<
class Scalar,
int dim>
71 const std::vector<Dune::FieldVector<Scalar, dim>>&
points_;
89template<
class Scalar,
int dim>
90static inline Sphere<Scalar, dim>
A function to compute bounding spheres of points clouds or convex polytopes.
static Sphere< typename ConvexGeometry::ctype, ConvexGeometry::coorddimension > boundingSphere(const ConvexGeometry &geometry)
Computes a bounding sphere of a convex polytope geometry (Dune::Geometry interface)
Definition: boundingsphere.hh:42
Corners::value_type center(const Corners &corners)
The center of a given list of corners.
Definition: center.hh:36
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
Definition: boundingsphere.hh:70
static constexpr int coorddimension
Definition: boundingsphere.hh:75
const std::vector< Dune::FieldVector< Scalar, dim > > & points_
Definition: boundingsphere.hh:71
const auto & corner(std::size_t i) const
Definition: boundingsphere.hh:79
Scalar ctype
Definition: boundingsphere.hh:76
auto corners() const
Definition: boundingsphere.hh:78
PointsToGeometryWrapper(const std::vector< Dune::FieldVector< Scalar, dim > > &points)
Definition: boundingsphere.hh:72