version 3.8
center.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//
12#ifndef DUMUX_GEOMETRY_CENTER_HH
13#define DUMUX_GEOMETRY_CENTER_HH
14
15#include <numeric>
16
17namespace Dumux {
18
23template<class Corners>
24typename Corners::value_type center(const Corners& corners)
25{
26 using Pos = typename Corners::value_type;
27 auto center = std::accumulate(corners.begin(), corners.end(), Pos(0.0));
28 center /= corners.size();
29 return center;
30}
31
32} // end namespace Dumux
33
34#endif
Corners::value_type center(const Corners &corners)
The center of a given list of corners.
Definition: center.hh:24
Definition: adapt.hh:17