aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/CarpetLib/src/defs.cc')
-rw-r--r--Carpet/CarpetLib/src/defs.cc40
1 files changed, 39 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/defs.cc b/Carpet/CarpetLib/src/defs.cc
index f862195d3..5a913beb0 100644
--- a/Carpet/CarpetLib/src/defs.cc
+++ b/Carpet/CarpetLib/src/defs.cc
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.cc,v 1.8 2001/08/26 13:59:31 schnetter Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.cc,v 1.9 2002/03/11 13:17:12 schnetter Exp $
***************************************************************************/
@@ -19,6 +19,7 @@
***************************************************************************/
#include <assert.h>
+#include <ctype.h>
#include <iostream>
#include <list>
@@ -33,6 +34,38 @@ using namespace std;
+void skipws (istream& is) {
+ while (is.good() && isspace(is.peek())) {
+ is.get();
+ }
+}
+
+
+
+// Vector input
+template<class T>
+istream& input (istream& is, vector<T>& v) {
+ v.clear();
+ skipws (is);
+ assert (is.peek() == '[');
+ is.get();
+ skipws (is);
+ while (is.good() && is.peek() != ']') {
+ v.push_back ();
+ is >> v[v.size()-1];
+ skipws (is);
+ if (is.peek() != ',') break;
+ is.get();
+ skipws (is);
+ }
+ skipws (is);
+ assert (is.peek() == ']');
+ is.get();
+ return is;
+}
+
+
+
// List output
template<class T>
ostream& output (ostream& os, const list<T>& l) {
@@ -76,6 +109,10 @@ ostream& output (ostream& os, const vector<T>& v) {
#include "bbox.hh"
#include "bboxset.hh"
+template istream& input (istream& os, vector<bbox<int,3> >& v);
+template istream& input (istream& os, vector<vector<bbox<int,3> > >& v);
+template istream& input (istream& os, vector<vector<vect<vect<bool,2>,3> > >& v);
+
template ostream& output (ostream& os, const list<bbox<int,3> >& l);
template ostream& output (ostream& os, const set<bbox<int,3> >& s);
template ostream& output (ostream& os, const set<bboxset<int,3> >& s);
@@ -84,5 +121,6 @@ template ostream& output (ostream& os, const vector<bbox<int,3> >& v);
template ostream& output (ostream& os, const vector<list<bbox<int,3> > >& v);
template ostream& output (ostream& os, const vector<vector<int> >& v);
template ostream& output (ostream& os, const vector<vector<bbox<int,3> > >& v);
+template ostream& output (ostream& os, const vector<vector<vect<vect<bool,2>,3> > >& v);
template ostream& output (ostream& os, const vector<vector<vector<bbox<int,3> > > >& v);
#endif