diff options
author | eschnett <> | 2001-03-01 11:40:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-01 11:40:00 +0000 |
commit | 310f0ea48d18866b773136aed11200b6eda6378b (patch) | |
tree | 445d3e34ce8b89812994b6614f7bc9f4acbc7fe2 /Carpet/CarpetLib/src/vect.cc |
Initial revision
darcs-hash:20010301114010-f6438-12fb8a9ffcc80e86c0a97e37b5b0dae0dbc59b79.gz
Diffstat (limited to 'Carpet/CarpetLib/src/vect.cc')
-rw-r--r-- | Carpet/CarpetLib/src/vect.cc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/vect.cc b/Carpet/CarpetLib/src/vect.cc new file mode 100644 index 000000000..9af8bca1a --- /dev/null +++ b/Carpet/CarpetLib/src/vect.cc @@ -0,0 +1,59 @@ +// $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> + +#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, ']'); +} + + + +// Output +template<class T,int D> +void vect<T,D>::output (ostream& os) const { + os << "["; + for (int d=0; d<D; ++d) { + os << (*this)[d]; + if (d<D-1) os << ","; + } + os << "]"; +} + + + +// Note: We need all dimensions all the time. +template class vect<int,0>; +template class vect<int,1>; +template class vect<int,2>; +template class vect<int,3>; + +template void vect<double,3>::input (istream& is); +template void vect<vect<bool,2>,3>::input (istream& is); + +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; |