Skip to content
Snippets Groups Projects
Commit 90454e33 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

Unit vectors in R^n, or, equivalently, members of S^{n-1}

[[Imported from SVN: r5524]]
parent 4ee9cac1
No related branches found
No related tags found
No related merge requests found
#ifndef UNIT_VECTOR_HH
#define UNIT_VECTOR_HH
#include <dune/common/fvector.hh>
template <int dim>
class UnitVector
{
public:
typedef Dune::FieldVector<double,dim> TangentVector;
typedef Dune::FieldVector<double,dim> EmbeddedTangentVector;
UnitVector<dim>& operator=(const Dune::FieldVector<double,dim>& vector)
{
data_ = vector;
data_ /= data_.two_norm();
return *this;
}
/** \brief Write LocalKey object to output stream */
friend std::ostream& operator<< (std::ostream& s, const UnitVector& unitVector)
{
return s << unitVector.data_;
}
private:
Dune::FieldVector<double,dim> data_;
};
#endif
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