3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
diameter.hh
Go to the documentation of this file.
1/*****************************************************************************
2 * See the file COPYING for full copying permissions. *
3 * *
4 * This program is free software: you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation, either version 3 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 *****************************************************************************/
23#ifndef DUMUX_GEOMETRY_DIAMETER_HH
24#define DUMUX_GEOMETRY_DIAMETER_HH
25
26#include <algorithm>
27
28namespace Dumux {
29
35template<class Geometry>
36typename Geometry::ctype diameter(const Geometry& geo)
37{
38 using std::max;
39 typename Geometry::ctype h = 0.0;
40 for (std::size_t i = 0; i < geo.corners(); ++i)
41 for (std::size_t j = i + 1; j < geo.corners(); ++j)
42 h = max(h, (geo.corner(i)-geo.corner(j)).two_norm());
43
44 return h;
45}
46
47} // end namespace Dumux
48
49#endif
Geometry::ctype diameter(const Geometry &geo)
Computes the longest distance between points of a geometry.
Definition: diameter.hh:36
Definition: adapt.hh:29