22#ifndef DUMUX_GEOMETRY_NORMAL_HH
23#define DUMUX_GEOMETRY_NORMAL_HH
26#include <dune/common/float_cmp.hh>
38 static_assert(Vector::size() > 1,
"normal expects a coordinate dimension > 1");
40 if constexpr (Vector::size() == 2)
41 return Vector({-v[1], v[0]});
43 const auto it = std::find_if(v.begin(), v.end(), [](
const auto& x) { return Dune::FloatCmp::ne(x, 0.0); });
45 if (index != Vector::size()-1)
48 normal[index] = -v[index+1];
49 normal[index+1] = v[index];
55 normal[index-1] = -v[index];
56 normal[index] = v[index-1];
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: geometry/normal.hh:36
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: geometry/normal.hh:68
ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: geometry/distance.hh:138