aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.cc
diff options
context:
space:
mode:
authorschnetter <>2002-03-11 12:17:00 +0000
committerschnetter <>2002-03-11 12:17:00 +0000
commit4fd01aecd88bd63bf3f6a79a63657915992a42b6 (patch)
tree5d9cd07f04aab436382fe93f3f1b1fadc75774ed /Carpet/CarpetLib/src/defs.cc
parent918fcc78c5afd27cdd931a6bfeb36a2cafa6abb0 (diff)
Added stream input routines for some CarpetLib containers.
Added stream input routines for some CarpetLib containers. The regridder now has to explicitly say which boundaries are outer, and which are internal. This will make outer boundaries on fine grid possible, and is also necessary when there are multiple grid patches. Started to add support for arbitrariliy many user-specified refinement regions. Not yet finished. The Carpet driver can now handle multiple grid patches. Added example files for multiple grid patches. They use initial data that does not "fit" the boundary conditions, and they don't use multiple refinement levels so far. Removed old and unused example files in CarpetLib. darcs-hash:20020311121709-07bb3-18594c42bd7a958ee0840d29e158a343208f5711.gz
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