diff --git a/dune/gfe/unitvector.hh b/dune/gfe/unitvector.hh index 4c55ab403e8d6a615493a8685143bc04ef62313f..960a0a4595d80c4f182161d4a1fe55408aad3792 100644 --- a/dune/gfe/unitvector.hh +++ b/dune/gfe/unitvector.hh @@ -60,6 +60,25 @@ public: typedef Dune::FieldVector<double,dim-1> TangentVector; typedef Dune::FieldVector<double,dim> EmbeddedTangentVector; + + /** \brief Default constructor */ + UnitVector() + {} + + /** \brief Constructor from a vector. The vector gets normalized */ + UnitVector(const Dune::FieldVector<double,dim>& vector) + : data_(vector) + { + data_ /= data_.two_norm(); + } + + /** \brief Constructor from an array. The array gets normalized */ + UnitVector(const Dune::array<double,dim>& vector) + { + for (int i=0; i<dim; i++) + data_[i] = vector[i]; + data_ /= data_.two_norm(); + } UnitVector<dim>& operator=(const Dune::FieldVector<double,dim>& vector) {