12#ifndef DUMUX_GEOMETRY_NORMAL_HH
13#define DUMUX_GEOMETRY_NORMAL_HH
16#include <dune/common/float_cmp.hh>
28 static_assert(Vector::size() > 1,
"normal expects a coordinate dimension > 1");
30 if constexpr (Vector::size() == 2)
31 return Vector({-v[1], v[0]});
33 const auto it = std::find_if(v.begin(), v.end(), [](
const auto& x) { return Dune::FloatCmp::ne(x, 0.0); });
35 if (index != Vector::size()-1)
38 normal[index] = -v[index+1];
39 normal[index+1] = v[index];
45 normal[index-1] = -v[index];
46 normal[index] = v[index-1];
static ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:282
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:26
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:58