]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add function to create unit vectors
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Nov 2010 16:23:33 +0000 (16:23 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 16 Nov 2010 16:23:33 +0000 (16:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@22759 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/point.h

index e2afd834e8883fadfdceb9e63343092608331c77..d33fe591147a414e3e98b0bb47bbe4307b9dfe26 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -99,6 +99,12 @@ class Point : public Tensor<1,dim>
                                      */
     Point (const double x, const double y, const double z);
 
+                                    /**
+                                     * Return a unit vector in
+                                     * coordinate direction <tt>i</tt>.
+                                     */
+    static Point<dim> e(const unsigned int i);
+    
                                     /**
                                      *  Read access to the <tt>index</tt>th
                                      *  coordinate.
@@ -247,6 +253,16 @@ Point<dim>::Point (const double x, const double y, const double z)
 }
 
 
+template <int dim>
+inline
+Point<dim>
+Point<dim>::e(unsigned int i)
+{
+  Point<dim> p;
+  p[i] = 1.;
+  return p;
+}
+
 
 template <int dim>
 inline

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.