diff options
author | eschnett <> | 2001-03-01 12:40:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-01 12:40:00 +0000 |
commit | 54deeff2dd0d8773854b227af2c90bce7410ba65 (patch) | |
tree | 0e121ebd44c2fbb7711943fcd8804e85626daca3 /Carpet/CarpetLib/src/vect.cc | |
parent | 47187487f50ae040def8edebbaa3adb5b3c76531 (diff) |
Initial revision
darcs-hash:20010301124010-f6438-fca5ed1e25f84efd816aa0d13fc23b58add7195d.gz
Diffstat (limited to 'Carpet/CarpetLib/src/vect.cc')
-rw-r--r-- | Carpet/CarpetLib/src/vect.cc | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/Carpet/CarpetLib/src/vect.cc b/Carpet/CarpetLib/src/vect.cc index 9af8bca1a..d9fd90594 100644 --- a/Carpet/CarpetLib/src/vect.cc +++ b/Carpet/CarpetLib/src/vect.cc @@ -1,59 +1,61 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.cc,v 1.14 2004/02/18 15:10:17 schnetter Exp $ - -#include <assert.h> - +/*************************************************************************** + vect.cc - Small inline vectors + ------------------- + begin : Sun Jun 11 2000 + copyright : (C) 2000 by Erik Schnetter + email : schnetter@astro.psu.edu + + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.cc,v 1.1 2001/03/01 13:40:10 eschnett Exp $ + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <cassert> #include <iostream> #include "defs.hh" -#include "vect.hh" - -using namespace std; - - - -// Input -template<class T,int D> -void vect<T,D>::input (istream& is) { - skipws (is); - consume (is, '['); - for (int d=0; d<D; ++d) { - is >> (*this)[d]; - if (d<D-1) { - skipws (is); - consume (is, ','); - } - } - skipws (is); - consume (is, ']'); -} +#if !defined(TMPL_IMPLICIT) || !defined(VECT_HH) +# include "vect.hh" +#endif // Output template<class T,int D> -void vect<T,D>::output (ostream& os) const { +ostream& operator<< (ostream& os, const vect<T,D>& a) { os << "["; for (int d=0; d<D; ++d) { - os << (*this)[d]; - if (d<D-1) os << ","; + if (d>0) os << ","; + os << a[d]; } os << "]"; + return os; } -// Note: We need all dimensions all the time. -template class vect<int,0>; +#if defined(TMPL_EXPLICIT) template class vect<int,1>; -template class vect<int,2>; -template class vect<int,3>; +// template class vect<double,1>; +template ostream& operator<< (ostream& os, const vect<int,1>& a); +// template ostream& operator<< (ostream& os, const vect<double,1>& a); -template void vect<double,3>::input (istream& is); -template void vect<vect<bool,2>,3>::input (istream& is); +template class vect<int,2>; +// template class vect<double,2>; +template ostream& operator<< (ostream& os, const vect<int,2>& a); +// template ostream& operator<< (ostream& os, const vect<double,2>& a); -template void vect<bool,2>::output (ostream& os) const; -template void vect<bool,3>::output (ostream& os) const; -template void vect<double,3>::output (ostream& os) const; -template void vect<vect<bool,2>,3>::output (ostream& os) const; -template void vect<vect<int,2>,3>::output (ostream& os) const; +template class vect<int,3>; +// template class vect<double,3>; +template ostream& operator<< (ostream& os, const vect<int,3>& a); +// template ostream& operator<< (ostream& os, const vect<double,3>& a); +#endif |