Skip to content
Snippets Groups Projects
Commit a8370118 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[geometry][distance] add specializations for 1d-0d computations

parent afbd717a
No related branches found
No related tags found
1 merge request!2192[geometry] Add header for distance helper functions
...@@ -127,7 +127,7 @@ namespace Detail { ...@@ -127,7 +127,7 @@ namespace Detail {
// helper struct to compute distance between two geometries, specialized below // helper struct to compute distance between two geometries, specialized below
template<class Geo1, class Geo2, template<class Geo1, class Geo2,
int dimworld = Geo1::coorddimension, int dimWorld = Geo1::coorddimension,
int dim1 = Geo1::mydimension, int dim2 = Geo2::mydimension> int dim1 = Geo1::mydimension, int dim2 = Geo2::mydimension>
struct GeometryDistance struct GeometryDistance
{ {
...@@ -140,13 +140,31 @@ struct GeometryDistance ...@@ -140,13 +140,31 @@ struct GeometryDistance
}; };
// distance point-point // distance point-point
template<class Geo1, class Geo2, int dimworld> template<class Geo1, class Geo2, int dimWorld>
struct GeometryDistance<Geo1, Geo2, dimworld, 0, 0> struct GeometryDistance<Geo1, Geo2, dimWorld, 0, 0>
{ {
static_assert(Geo1::coorddimension == Geo2::coorddimension, "Geometries have to have the same coordinate dimensions"); static_assert(Geo1::coorddimension == Geo2::coorddimension, "Geometries have to have the same coordinate dimensions");
static auto distance(const Geo1& geo1, const Geo2& geo2) static auto distance(const Geo1& geo1, const Geo2& geo2)
{ return distance(geo1.corner(0), geo2.corner(0)); } { return Dumux::distance(geo1.corner(0), geo2.corner(0)); }
} };
// distance segment-point
template<class Geo1, class Geo2, int dimWorld>
struct GeometryDistance<Geo1, Geo2, dimWorld, 1, 0>
{
static_assert(Geo1::coorddimension == Geo2::coorddimension, "Geometries have to have the same coordinate dimensions");
static auto distance(const Geo1& geo1, const Geo2& geo2)
{ return distancePointSegment(geo2.corner(0), geo1); }
};
// distance point-segment
template<class Geo1, class Geo2, int dimWorld>
struct GeometryDistance<Geo1, Geo2, dimWorld, 0, 1>
{
static_assert(Geo1::coorddimension == Geo2::coorddimension, "Geometries have to have the same coordinate dimensions");
static auto distance(const Geo1& geo1, const Geo2& geo2)
{ return distancePointSegment(geo1.corner(0), geo2); }
};
} // end namespace Detail } // end namespace Detail
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment