Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
8373c09d
Commit
8373c09d
authored
7 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[geometry] Add function to compute a geometry's diameter
parent
8774681f
No related branches found
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dumux/common/geometry/CMakeLists.txt
+1
-0
1 addition, 0 deletions
dumux/common/geometry/CMakeLists.txt
dumux/common/geometry/diameter.hh
+49
-0
49 additions, 0 deletions
dumux/common/geometry/diameter.hh
with
50 additions
and
0 deletions
dumux/common/geometry/CMakeLists.txt
+
1
−
0
View file @
8373c09d
install
(
FILES
boundingboxtree.hh
boundingboxtreeintersection.hh
diameter.hh
geometricentityset.hh
geometryintersection.hh
grahamconvexhull.hh
...
...
This diff is collapsed.
Click to expand it.
dumux/common/geometry/diameter.hh
0 → 100644
+
49
−
0
View file @
8373c09d
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup Common
* \brief A function to compute a geometry's diameter, i.e.
* the longest distance between points of a geometry
*/
#ifndef DUMUX_GEOMETRY_DIAMETER_HH
#define DUMUX_GEOMETRY_DIAMETER_HH
#include
<algorithm>
namespace
Dumux
{
/*!
* \ingroup Common
* \brief Computes the longest distance between points of a geometry
* \note Useful e.g. to compute the maximum cell diameter of a grid
*/
template
<
class
Geometry
>
typename
Geometry
::
ctype
diameter
(
const
Geometry
&
geo
)
{
using
std
::
max
;
typename
Geometry
::
ctype
h
=
0.0
;
for
(
std
::
size_t
i
=
0
;
i
<
geo
.
corners
();
++
i
)
for
(
std
::
size_t
j
=
i
+
1
;
j
<
geo
.
corners
();
++
j
)
h
=
max
(
h
,
(
geo
.
corner
(
i
)
-
geo
.
corner
(
j
)).
two_norm
());
return
h
;
}
}
// end namespace Dumux
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment