From: Guido Kanschat Date: Tue, 16 Nov 2010 16:23:33 +0000 (+0000) Subject: Add function to create unit vectors X-Git-Tag: v8.0.0~4898 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b9cc1428222f5338cce92ba99007fa94ae22e31;p=dealii.git Add function to create unit vectors git-svn-id: https://svn.dealii.org/trunk@22759 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/point.h b/deal.II/include/deal.II/base/point.h index e2afd834e8..d33fe59114 100644 --- a/deal.II/include/deal.II/base/point.h +++ b/deal.II/include/deal.II/base/point.h @@ -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 i. + */ + static Point e(const unsigned int i); + /** * Read access to the indexth * coordinate. @@ -247,6 +253,16 @@ Point::Point (const double x, const double y, const double z) } +template +inline +Point +Point::e(unsigned int i) +{ + Point p; + p[i] = 1.; + return p; +} + template inline