version 3.8
diameter.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_GEOMETRY_DIAMETER_HH
14#define DUMUX_GEOMETRY_DIAMETER_HH
15
16#include <algorithm>
17
18namespace Dumux {
19
25template<class Geometry>
26typename Geometry::ctype diameter(const Geometry& geo)
27{
28 using std::max;
29 typename Geometry::ctype h = 0.0;
30 for (std::size_t i = 0; i < geo.corners(); ++i)
31 for (std::size_t j = i + 1; j < geo.corners(); ++j)
32 h = max(h, (geo.corner(i)-geo.corner(j)).two_norm());
33
34 return h;
35}
36
37} // end namespace Dumux
38
39#endif
Geometry::ctype diameter(const Geometry &geo)
Computes the longest distance between points of a geometry.
Definition: diameter.hh:26
Definition: adapt.hh:17