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

add constructors from FieldVector and Dune::array

[[Imported from SVN: r6309]]
parent b3669c9e
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,25 @@ public: ...@@ -60,6 +60,25 @@ public:
typedef Dune::FieldVector<double,dim-1> TangentVector; typedef Dune::FieldVector<double,dim-1> TangentVector;
typedef Dune::FieldVector<double,dim> EmbeddedTangentVector; 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) UnitVector<dim>& operator=(const Dune::FieldVector<double,dim>& vector)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment