diff options
Diffstat (limited to 'Carpet/CarpetLib/src/vect.hh')
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index f41971ae5..814b1bf48 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.13 2003/01/03 15:49:36 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.14 2003/03/18 17:30:26 schnetter Exp $ #ifndef VECT_HH #define VECT_HH @@ -221,6 +221,13 @@ public: } // Non-modifying operators + vect replace (const int d, const T x) { + assert (d>=0 && d<D); + vect r; + for (int dd=0; dd<D; ++dd) r[dd]=dd==d?x:(*this)[dd]; + return r; + } + vect operator+ () const { vect r; for (int d=0; d<D; ++d) r[d]=+r[d]; |