aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <>2001-03-27 20:26:00 +0000
committereschnett <>2001-03-27 20:26:00 +0000
commite38a471f8346adf93d4cf7f2157eb4909403de55 (patch)
tree1d57cbc8731a1aabc779da152cdeddb9952b608f
parente212f3431b22ec41ac3e0a5c86f9d0cc2c812376 (diff)
Made Carpet compile on IRIX.
darcs-hash:20010327202631-f6438-d70466b15bf2224f3ce20968622c77a3cca37a73.gz
-rw-r--r--Carpet/Carpet/doc/TODO4
-rw-r--r--Carpet/Carpet/options/carpet-hawaii-sgi6
-rw-r--r--Carpet/CarpetLib/src/bbox.cc28
-rw-r--r--Carpet/CarpetLib/src/bbox.hh15
-rw-r--r--Carpet/CarpetLib/src/bboxset.cc137
-rw-r--r--Carpet/CarpetLib/src/bboxset.hh27
-rw-r--r--Carpet/CarpetLib/src/data.cc4
-rw-r--r--Carpet/CarpetLib/src/data.hh13
-rw-r--r--Carpet/CarpetLib/src/defs.cc21
-rw-r--r--Carpet/CarpetLib/src/defs.hh26
-rw-r--r--Carpet/CarpetLib/src/dh.cc14
-rw-r--r--Carpet/CarpetLib/src/dh.hh10
-rw-r--r--Carpet/CarpetLib/src/gdata.cc10
-rw-r--r--Carpet/CarpetLib/src/gdata.hh15
-rw-r--r--Carpet/CarpetLib/src/gf.cc6
-rw-r--r--Carpet/CarpetLib/src/gf.hh4
-rw-r--r--Carpet/CarpetLib/src/ggf.cc11
-rw-r--r--Carpet/CarpetLib/src/ggf.hh14
-rw-r--r--Carpet/CarpetLib/src/gh.cc20
-rw-r--r--Carpet/CarpetLib/src/gh.hh12
-rw-r--r--Carpet/CarpetLib/src/th.cc12
-rw-r--r--Carpet/CarpetLib/src/th.hh12
-rw-r--r--Carpet/CarpetLib/src/vect.cc43
-rw-r--r--Carpet/CarpetLib/src/vect.hh10
24 files changed, 170 insertions, 304 deletions
diff --git a/Carpet/Carpet/doc/TODO b/Carpet/Carpet/doc/TODO
index 352cfde2f..869c42228 100644
--- a/Carpet/Carpet/doc/TODO
+++ b/Carpet/Carpet/doc/TODO
@@ -1,5 +1,5 @@
-*-Text-*-
-$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/doc/TODO,v 1.2 2001/03/26 02:31:52 eschnett Exp $
+$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/doc/TODO,v 1.3 2001/03/27 22:26:31 eschnett Exp $
CarpetSlab: Add support for diagonal lines
@@ -10,3 +10,5 @@ Carpet: Distribute processes in all directions, not only z
Carpet: Test suite
Carpet: Finish documentation
+
+CarpetLib: Change ofstream to ostream in data.cc
diff --git a/Carpet/Carpet/options/carpet-hawaii-sgi b/Carpet/Carpet/options/carpet-hawaii-sgi
index 0e3340c47..2a9e1317e 100644
--- a/Carpet/Carpet/options/carpet-hawaii-sgi
+++ b/Carpet/Carpet/options/carpet-hawaii-sgi
@@ -1,8 +1,8 @@
-# $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/options/carpet-hawaii-sgi,v 1.2 2002/05/05 22:16:56 schnetter Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/options/carpet-hawaii-sgi,v 1.1 2001/03/27 22:26:31 eschnett Exp $
-CPP = /lib/cpp -DMPIPP_H
+CPP = /lib/cpp -DTMPL_EXPLICIT -DMPIPP_H
-CXXFLAGS = -LANG:std -LANG:vla=ON -FE:eliminate_duplicate_inline_copies -FE:template_in_elf_section -64 -mips4 -r12000 -no_auto_include -ptused -DMPIPP_H
+CXXFLAGS = -LANG:std -LANG:vla=ON -FE:eliminate_duplicate_inline_copies -FE:template_in_elf_section -64 -mips4 -r12000 -no_auto_include -ptused -DTMPL_EXPLICIT -DMPIPP_H
LDFLAGS = -LANG:std -LANG:vla=ON -64 -mips4 -r12000 -Wl,"-woff 84","-woff 85"
C_OPTIMISE_FLAGS = -O3 -INLINE -LNO -OPT:Olimit=100000
diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc
index f90c14d4e..78227a3b8 100644
--- a/Carpet/CarpetLib/src/bbox.cc
+++ b/Carpet/CarpetLib/src/bbox.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/bbox.cc,v 1.5 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.6 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -226,37 +226,15 @@ bbox<T,D>::iterator bbox<T,D>::end () const {
// Output
-#ifndef SGI
-// This doesn't work on SGIs. Is this legal C++?
template<class T,int D>
-ostream& operator<< (ostream& os, const bbox<T,D>& b) {
- os << "(" << b.lower() << ":" << b.upper() << ":" << b.stride() << ")";
- return os;
+void bbox<T,D>::output (ostream& os) const {
+ os << "(" << lower() << ":" << upper() << ":" << stride() << ")";
}
-#else
-ostream& operator<< (ostream& os, const bbox<int,1>& b) {
- os << "(" << b.lower() << ":" << b.upper() << ":" << b.stride() << ")";
- return os;
-}
-ostream& operator<< (ostream& os, const bbox<int,2>& b) {
- os << "(" << b.lower() << ":" << b.upper() << ":" << b.stride() << ")";
- return os;
-}
-ostream& operator<< (ostream& os, const bbox<int,3>& b) {
- os << "(" << b.lower() << ":" << b.upper() << ":" << b.stride() << ")";
- return os;
-}
-#endif
#if defined(TMPL_EXPLICIT)
template class bbox<int,1>;
-template ostream& operator<< (ostream& os, const bbox<int,1>& b);
-
template class bbox<int,2>;
-template ostream& operator<< (ostream& os, const bbox<int,2>& b);
-
template class bbox<int,3>;
-template ostream& operator<< (ostream& os, const bbox<int,3>& b);
#endif
diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh
index 396a9c5ca..160748f27 100644
--- a/Carpet/CarpetLib/src/bbox.hh
+++ b/Carpet/CarpetLib/src/bbox.hh
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.hh,v 1.7 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.hh,v 1.8 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -30,7 +30,7 @@ using namespace std;
-// Forward definition
+// Forward declaration
template<class T, int D> class bbox;
// Output
@@ -117,11 +117,20 @@ public:
iterator end () const;
// Output
- friend ostream& operator<< <>(ostream& os, const bbox& s);
+ void output (ostream& os) const;
};
+// Output
+template<class T,int D>
+inline ostream& operator<< (ostream& os, const bbox<T,D>& b) {
+ b.output(os);
+ return os;
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "bbox.cc"
#endif
diff --git a/Carpet/CarpetLib/src/bboxset.cc b/Carpet/CarpetLib/src/bboxset.cc
index f18385c1b..3976dfb2c 100644
--- a/Carpet/CarpetLib/src/bboxset.cc
+++ b/Carpet/CarpetLib/src/bboxset.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/bboxset.cc,v 1.5 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.cc,v 1.6 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -213,10 +213,8 @@ bboxset<T,D>& bboxset<T,D>::operator&= (const bboxset& s) {
// Difference
-#ifndef SGI
-// This doesn't work on SGIs. Is this legal C++?
template<class T, int D>
-bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2) {
+bboxset<T,D> bboxset<T,D>::minus (const bbox<T,D>& b1, const bbox<T,D>& b2) {
assert (b1.is_aligned_with(b2));
if (b1.empty()) return bboxset<T,D>();
if (b2.empty()) return bboxset<T,D>(b1);
@@ -248,104 +246,6 @@ bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2) {
assert (r.invariant());
return r;
}
-#else
-bboxset<int,1> operator- (const bbox<int,1>& b1, const bbox<int,1>& b2) {
- assert (b1.is_aligned_with(b2));
- if (b1.empty()) return bboxset<int,1>();
- if (b2.empty()) return bboxset<int,1>(b1);
- const vect<int,1> str = b1.stride();
- bboxset<int,1> r;
- for (int d=0; d<1; ++d) {
- // make resulting bboxes as large as possible in x-direction (for
- // better consumption by Fortranly ordered arrays)
- vect<int,1> lb, ub;
- bbox<int,1> b;
- for (int dd=0; dd<1; ++dd) {
- if (dd<d) {
- lb[dd] = b2.lower()[dd];
- ub[dd] = b2.upper()[dd];
- } else if (dd>d) {
- lb[dd] = b1.lower()[dd];
- ub[dd] = b1.upper()[dd];
- }
- }
- lb[d] = b1.lower()[d];
- ub[d] = b2.lower()[d] - str[d];
- b = bbox<int,1>(lb,ub,str) & b1;
- r += b;
- lb[d] = b2.upper()[d] + str[d];
- ub[d] = b1.upper()[d];
- b = bbox<int,1>(lb,ub,str) & b1;
- r += b;
- }
- assert (r.invariant());
- return r;
-}
-bboxset<int,2> operator- (const bbox<int,2>& b1, const bbox<int,2>& b2) {
- assert (b1.is_aligned_with(b2));
- if (b1.empty()) return bboxset<int,2>();
- if (b2.empty()) return bboxset<int,2>(b1);
- const vect<int,2> str = b1.stride();
- bboxset<int,2> r;
- for (int d=0; d<2; ++d) {
- // make resulting bboxes as large as possible in x-direction (for
- // better consumption by Fortranly ordered arrays)
- vect<int,2> lb, ub;
- bbox<int,2> b;
- for (int dd=0; dd<2; ++dd) {
- if (dd<d) {
- lb[dd] = b2.lower()[dd];
- ub[dd] = b2.upper()[dd];
- } else if (dd>d) {
- lb[dd] = b1.lower()[dd];
- ub[dd] = b1.upper()[dd];
- }
- }
- lb[d] = b1.lower()[d];
- ub[d] = b2.lower()[d] - str[d];
- b = bbox<int,2>(lb,ub,str) & b1;
- r += b;
- lb[d] = b2.upper()[d] + str[d];
- ub[d] = b1.upper()[d];
- b = bbox<int,2>(lb,ub,str) & b1;
- r += b;
- }
- assert (r.invariant());
- return r;
-}
-bboxset<int,3> operator- (const bbox<int,3>& b1, const bbox<int,3>& b2) {
- assert (b1.is_aligned_with(b2));
- if (b1.empty()) return bboxset<int,3>();
- if (b2.empty()) return bboxset<int,3>(b1);
- const vect<int,3> str = b1.stride();
- bboxset<int,3> r;
- for (int d=0; d<3; ++d) {
- // make resulting bboxes as large as possible in x-direction (for
- // better consumption by Fortranly ordered arrays)
- vect<int,3> lb, ub;
- bbox<int,3> b;
- for (int dd=0; dd<3; ++dd) {
- if (dd<d) {
- lb[dd] = b2.lower()[dd];
- ub[dd] = b2.upper()[dd];
- } else if (dd>d) {
- lb[dd] = b1.lower()[dd];
- ub[dd] = b1.upper()[dd];
- }
- }
- lb[d] = b1.lower()[d];
- ub[d] = b2.lower()[d] - str[d];
- b = bbox<int,3>(lb,ub,str) & b1;
- r += b;
- lb[d] = b2.upper()[d] + str[d];
- ub[d] = b1.upper()[d];
- b = bbox<int,3>(lb,ub,str) & b1;
- r += b;
- }
- assert (r.invariant());
- return r;
-}
-#endif
template<class T, int D>
bboxset<T,D> bboxset<T,D>::operator- (const box& b) const {
@@ -384,50 +284,23 @@ bboxset<T,D> bboxset<T,D>::operator- (const bboxset& s) const {
return r;
}
-#ifndef SGI
-// This doesn't work on SGIs. Is this legal C++?
template<class T, int D>
-bboxset<T,D> operator- (const bbox<T,D>& b, const bboxset<T,D>& s) {
+bboxset<T,D> bboxset<T,D>::minus (const bbox<T,D>& b, const bboxset<T,D>& s) {
bboxset<T,D> r = bboxset<T,D>(b) - s;
assert (r.invariant());
return r;
}
-#else
-bboxset<int,1> operator- (const bbox<int,1>& b, const bboxset<int,1>& s) {
- bboxset<int,1> r = bboxset<int,1>(b) - s;
- assert (r.invariant());
- return r;
-}
-bboxset<int,2> operator- (const bbox<int,2>& b, const bboxset<int,2>& s) {
- bboxset<int,2> r = bboxset<int,2>(b) - s;
- assert (r.invariant());
- return r;
-}
-bboxset<int,3> operator- (const bbox<int,3>& b, const bboxset<int,3>& s) {
- bboxset<int,3> r = bboxset<int,3>(b) - s;
- assert (r.invariant());
- return r;
-}
-#endif
// Output
template<class T,int D>
-ostream& operator<< (ostream& os, const bboxset<T,D>& s) {
- os << "bboxset<T," << D << ">:size=" << s.size() << "," << "set=" << s.bs;
- return os;
+void bboxset<T,D>::output (ostream& os) const {
+ os << "bboxset<T," << D << ">:size=" << size() << "," << "set=" << bs;
}
#if defined(TMPL_EXPLICIT)
template class bboxset<int,3>;
-
-template
-bboxset<int,3> operator- (const bbox<int,3>& b1, const bbox<int,3>& b3);
-template
-bboxset<int,3> operator- (const bbox<int,3>& b, const bboxset<int,3>& s);
-template
-ostream& operator<< (ostream& os, const bboxset<int,3>& b);
#endif
diff --git a/Carpet/CarpetLib/src/bboxset.hh b/Carpet/CarpetLib/src/bboxset.hh
index 4883cc6e9..6a832ae82 100644
--- a/Carpet/CarpetLib/src/bboxset.hh
+++ b/Carpet/CarpetLib/src/bboxset.hh
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.hh,v 1.4 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.hh,v 1.5 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -34,7 +34,7 @@ using namespace std;
-// Forward definition
+// Forward declaration
template<class T, int D> class bboxset;
template<class T,int D>
@@ -101,11 +101,13 @@ public:
// Difference
// friend bboxset operator- <T,D>(const box& b1, const box& b2);
+ static bboxset minus (const box& b1, const box& b2);
bboxset operator- (const box& b) const;
bboxset& operator-= (const box& b);
bboxset& operator-= (const bboxset& s);
bboxset operator- (const bboxset& s) const;
// friend bboxset operator- <T,D>(const box& b, const bboxset& s);
+ static bboxset minus (const box& b, const bboxset& s);
// Iterators
typedef typename bset::const_iterator const_iterator;
@@ -115,11 +117,30 @@ public:
iterator end () const { return bs.end(); }
// Output
- friend ostream& operator<< <>(ostream& os, const bboxset& s);
+ void output (ostream& os) const;
};
+template<class T,int D>
+inline bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2) {
+ return bboxset<T,D>::minus(b1,b2);
+}
+
+template<class T,int D>
+inline bboxset<T,D> operator- (const bbox<T,D>& b, const bboxset<T,D>& s) {
+ return bboxset<T,D>::minus(b,s);
+}
+
+// Output
+template<class T,int D>
+inline ostream& operator<< (ostream& os, const bboxset<T,D>& s) {
+ s.output(os);
+ return os;
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "bboxset.cc"
#endif
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc
index b75c770ff..0b3899281 100644
--- a/Carpet/CarpetLib/src/data.cc
+++ b/Carpet/CarpetLib/src/data.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/data.cc,v 1.9 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.cc,v 1.10 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -573,7 +573,7 @@ void data<T,D>::write_ascii_output_element (ofstream& file, const ivect& index)
// Output
template<class T,int D>
-ostream& data<T,D>::out (ostream& os) const {
+ostream& data<T,D>::output (ostream& os) const {
os << "data<T," << D << ">:"
<< "extent=" << extent() << ","
<< "stride=" << stride() << ",size=" << size();
diff --git a/Carpet/CarpetLib/src/data.hh b/Carpet/CarpetLib/src/data.hh
index 5182d0379..357ecef68 100644
--- a/Carpet/CarpetLib/src/data.hh
+++ b/Carpet/CarpetLib/src/data.hh
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.hh,v 1.5 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/data.hh,v 1.6 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -35,15 +35,6 @@ using namespace std;
-// Forward definition
-template<class T,int D> class data;
-
-// Output
-template<class T,int D>
-ostream& operator<< (ostream& os, const data<T,D>& d);
-
-
-
// A real data storage
template<class T,int D>
class data: public generic_data<D> {
@@ -119,7 +110,7 @@ public:
public:
// Output
- ostream& out (ostream& os) const;
+ ostream& output (ostream& os) const;
};
diff --git a/Carpet/CarpetLib/src/defs.cc b/Carpet/CarpetLib/src/defs.cc
index aa25b17b8..b73796e54 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.4 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.cc,v 1.5 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -35,7 +35,7 @@ using namespace std;
// List output
template<class T>
-ostream& operator<< (ostream& os, const list<T>& l) {
+ostream& output (ostream& os, const list<T>& l) {
os << "[";
for (list<T>::const_iterator ti=l.begin(); ti!=l.end(); ++ti) {
if (ti!=l.begin()) os << ",";
@@ -47,7 +47,7 @@ ostream& operator<< (ostream& os, const list<T>& l) {
// Set output
template<class T>
-ostream& operator<< (ostream& os, const set<T>& s) {
+ostream& output (ostream& os, const set<T>& s) {
os << "{";
for (set<T>::const_iterator ti=s.begin(); ti!=s.end(); ++ti) {
if (ti!=s.begin()) os << ",";
@@ -59,7 +59,7 @@ ostream& operator<< (ostream& os, const set<T>& s) {
// Vector output
template<class T>
-ostream& operator<< (ostream& os, const vector<T>& v) {
+ostream& output (ostream& os, const vector<T>& v) {
os << "[";
int cnt=0;
for (vector<T>::const_iterator ti=v.begin(); ti!=v.end(); ++ti) {
@@ -76,11 +76,10 @@ ostream& operator<< (ostream& os, const vector<T>& v) {
#include "bbox.hh"
#include "bboxset.hh"
-template ostream& operator<< (ostream& os, const list<bbox<int,3> >& l);
-template ostream& operator<< (ostream& os, const set<bbox<int,3> >& s);
-template ostream& operator<< (ostream& os, const set<bboxset<int,3> >& s);
-template ostream& operator<< (ostream& os, const vector<int>& v);
-template ostream& operator<< (ostream& os, const vector<list<bbox<int,3> > >& v);
-template ostream& operator<< (ostream& os, const vector<vector<bbox<int,3> > >& v);
-template ostream& operator<< (ostream& os, const vector<vector<vector<bbox<int,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);
+template ostream& output (ostream& os, const vector<list<bbox<int,3> > >& v);
+template ostream& output (ostream& os, const vector<vector<bbox<int,3> > >& v);
+template ostream& output (ostream& os, const vector<vector<vector<bbox<int,3> > > >& v);
#endif
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index ec59237f8..f311b9bc8 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -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.hh,v 1.4 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/defs.hh,v 1.5 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -39,9 +39,6 @@ using namespace std;
// Fortranification
#define FORTRAN_NAME(x) x##_
-// Fortran style function arguments
-#define restrict __restrict__
-
// A general type
enum centering { vertex_centered, cell_centered };
@@ -50,9 +47,24 @@ template<class T>
inline T square (const T& x) { return x*x; }
// Container output
-template<class T> ostream& operator<< (ostream& os, const list<T>& l);
-template<class T> ostream& operator<< (ostream& os, const set<T>& s);
-template<class T> ostream& operator<< (ostream& os, const vector<T>& v);
+template<class T> ostream& output (ostream& os, const list<T>& l);
+template<class T> ostream& output (ostream& os, const set<T>& s);
+template<class T> ostream& output (ostream& os, const vector<T>& v);
+
+template<class T>
+inline ostream& operator<< (ostream& os, const list<T>& l) {
+ return output(os,l);
+}
+
+template<class T>
+inline ostream& operator<< (ostream& os, const set<T>& s) {
+ return output(os,s);
+}
+
+template<class T>
+inline ostream& operator<< (ostream& os, const vector<T>& v) {
+ return output(os,v);
+}
diff --git a/Carpet/CarpetLib/src/dh.cc b/Carpet/CarpetLib/src/dh.cc
index c9e03753d..8524b1d5a 100644
--- a/Carpet/CarpetLib/src/dh.cc
+++ b/Carpet/CarpetLib/src/dh.cc
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.cc,v 1.10 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.cc,v 1.11 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -321,23 +321,21 @@ void dh<D>::remove (generic_gf<D>* f) {
// Output
template<int D>
-ostream& operator<< (ostream& os, const dh<D>& d) {
+void dh<D>::output (ostream& os) const {
os << "dh<" << D << ">:"
- << "ghosts=[" << d.lghosts << "," << d.ughosts << "],"
+ << "ghosts=[" << lghosts << "," << ughosts << "],"
<< "gfs={";
int cnt=0;
- for (list<generic_gf<D>*>::const_iterator f = d.gfs.begin();
- f != d.gfs.end(); ++f) {
+ for (list<generic_gf<D>*>::const_iterator f = gfs.begin();
+ f != gfs.end(); ++f) {
if (cnt++) os << ",";
- os << **f;
+ (*f)->output(os);
}
os << "}";
- return os;
}
#if defined(TMPL_EXPLICIT)
template class dh<3>;
-template ostream& operator<< (ostream& os, const dh<3>& d);
#endif
diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh
index aa9e331da..09b185ec5 100644
--- a/Carpet/CarpetLib/src/dh.hh
+++ b/Carpet/CarpetLib/src/dh.hh
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.4 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.5 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -123,9 +123,15 @@ public:
void remove (generic_gf<D>* f);
// Output
- friend ostream& operator<< <> (ostream& os, const dh& d);
+ void output (ostream& os) const;
};
+template<int D>
+inline ostream& operator<< (ostream& os, const dh<D>& d) {
+ d.output(os);
+ return os;
+}
+
#if defined(TMPL_IMPLICIT)
diff --git a/Carpet/CarpetLib/src/gdata.cc b/Carpet/CarpetLib/src/gdata.cc
index 6f2a2ecd3..7eafeed28 100644
--- a/Carpet/CarpetLib/src/gdata.cc
+++ b/Carpet/CarpetLib/src/gdata.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/gdata.cc,v 1.10 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gdata.cc,v 1.11 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -213,16 +213,8 @@ void generic_data<D>::write_ascii (const string name, const int time,
-template<int D>
-ostream& operator<< (ostream& os, const generic_data<D>& f) {
- return f.out(os);
-}
-
-
-
#if defined(TMPL_EXPLICIT)
template class generic_data<3>;
-template ostream& operator<< (ostream& os, const generic_data<3>& d);
template void generic_data<3>
::write_ascii (const string name, const int time,
diff --git a/Carpet/CarpetLib/src/gdata.hh b/Carpet/CarpetLib/src/gdata.hh
index ddb1c0603..185598219 100644
--- a/Carpet/CarpetLib/src/gdata.hh
+++ b/Carpet/CarpetLib/src/gdata.hh
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gdata.hh,v 1.6 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gdata.hh,v 1.7 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -42,7 +42,7 @@ template<int D> class generic_data;
// Output
template<int D>
-ostream& operator<< (ostream& os, const generic_data<D>* f);
+ostream& operator<< (ostream& os, const generic_data<D>& d);
@@ -173,13 +173,18 @@ public:
public:
// Output
- friend ostream& operator<< <>(ostream& os, const generic_data* d);
-
- virtual ostream& out (ostream& os) const = 0;
+ virtual ostream& output (ostream& os) const = 0;
};
+template<int D>
+inline ostream& operator<< (ostream& os, const generic_data<D>& d) {
+ return d.output(os);
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "gdata.cc"
#endif
diff --git a/Carpet/CarpetLib/src/gf.cc b/Carpet/CarpetLib/src/gf.cc
index 6847d8506..c3f923cc6 100644
--- a/Carpet/CarpetLib/src/gf.cc
+++ b/Carpet/CarpetLib/src/gf.cc
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.cc,v 1.3 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.cc,v 1.4 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -69,8 +69,8 @@ data<T,D>* gf<T,D>::operator() (int tl, int rl, int c, int ml) {
// Output
template<class T,int D>
-ostream& gf<T,D>::out (ostream& os) const {
- os << "gf<" STR(T) "," << D << ">:\"" << name << "\","
+ostream& gf<T,D>::output (ostream& os) const {
+ os << "gf<T," << D << ">:\"" << name << "\","
<< "dt=[" << tmin << ":" << tmax<< "]";
return os;
}
diff --git a/Carpet/CarpetLib/src/gf.hh b/Carpet/CarpetLib/src/gf.hh
index bf916bb82..2b4d8254c 100644
--- a/Carpet/CarpetLib/src/gf.hh
+++ b/Carpet/CarpetLib/src/gf.hh
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.hh,v 1.2 2001/03/22 18:42:05 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gf.hh,v 1.3 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -87,7 +87,7 @@ public:
// Output
- virtual ostream& out (ostream& os) const;
+ virtual ostream& output (ostream& os) const;
};
diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc
index 2fbb0eae3..42f4098ba 100644
--- a/Carpet/CarpetLib/src/ggf.cc
+++ b/Carpet/CarpetLib/src/ggf.cc
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.cc,v 1.7 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.cc,v 1.8 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -464,15 +464,6 @@ void generic_gf<D>::ref_prolongate (int tl, int rl, int c, int ml,
-// Output
-template<int D>
-ostream& operator<< (ostream& os, const generic_gf<D>& f) {
- return f.out(os);
-}
-
-
-
#if defined(TMPL_EXPLICIT)
template class generic_gf<3>;
-template ostream& operator<< (ostream& os, const generic_gf<3>& f);
#endif
diff --git a/Carpet/CarpetLib/src/ggf.hh b/Carpet/CarpetLib/src/ggf.hh
index 6cacc0724..28710c2b8 100644
--- a/Carpet/CarpetLib/src/ggf.hh
+++ b/Carpet/CarpetLib/src/ggf.hh
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.hh,v 1.4 2001/03/24 22:38:48 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/ggf.hh,v 1.5 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -52,6 +52,7 @@ template<int D>
class generic_gf {
// Types
+
typedef vect<int,D> ivect;
typedef bbox<int,D> ibbox;
typedef bboxset<int,D> ibset;
@@ -193,13 +194,18 @@ public:
// Output
- friend ostream& operator<< <> (ostream& os, const generic_gf& f);
-
- virtual ostream& out (ostream& os) const = 0;
+ virtual ostream& output (ostream& os) const = 0;
};
+template<int D>
+inline ostream& operator<< (ostream& os, const generic_gf<D>& f) {
+ return f.output(os);
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "ggf.cc"
#endif
diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc
index ee10251b1..0c3d59502 100644
--- a/Carpet/CarpetLib/src/gh.cc
+++ b/Carpet/CarpetLib/src/gh.cc
@@ -7,7 +7,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.cc,v 1.5 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.cc,v 1.6 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -229,26 +229,24 @@ void gh<D>::remove (dh<D>* d) {
template<int D>
-ostream& operator<< (ostream& os, const gh<D>& h) {
+void gh<D>::output (ostream& os) const {
os << "gh<" << D << ">:"
- << "reffactor=" << h.reffact << ",refcentering=" << h.refcent << ","
- << "mgfactor=" << h.mgfact << ",mgcentering=" << h.mgcent << ","
- << "baseextent=" << h.baseextent << ","
- << "extents=" << h.extents << ","
+ << "reffactor=" << reffact << ",refcentering=" << refcent << ","
+ << "mgfactor=" << mgfact << ",mgcentering=" << mgcent << ","
+ << "baseextent=" << baseextent << ","
+ << "extents=" << extents << ","
<< "dhs={";
int cnt=0;
- for (list<dh<D>*>::const_iterator d = h.dhs.begin();
- d != h.dhs.end(); ++d) {
+ for (list<dh<D>*>::const_iterator d = dhs.begin();
+ d != dhs.end(); ++d) {
if (cnt++) os << ",";
- os << **d;
+ (*d)->output(os);
}
os << "}";
- return os;
}
#if defined(TMPL_EXPLICIT)
template class gh<3>;
-template ostream& operator<< (ostream& os, const gh<3>& h);
#endif
diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh
index 841abbdfb..9d9d7939b 100644
--- a/Carpet/CarpetLib/src/gh.hh
+++ b/Carpet/CarpetLib/src/gh.hh
@@ -7,7 +7,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.hh,v 1.3 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.hh,v 1.4 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -138,11 +138,19 @@ public:
void remove (dh<D>* d);
// Output
- friend ostream& operator<< <> (ostream& os, const gh& h);
+ void output (ostream& os) const;
};
+template<int D>
+inline ostream& operator<< (ostream& os, gh<D>& h) {
+ h.output(os);
+ return os;
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "gh.cc"
#endif
diff --git a/Carpet/CarpetLib/src/th.cc b/Carpet/CarpetLib/src/th.cc
index 17aaff924..4a6638b63 100644
--- a/Carpet/CarpetLib/src/th.cc
+++ b/Carpet/CarpetLib/src/th.cc
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.cc,v 1.3 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.cc,v 1.4 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -81,23 +81,21 @@ void th<D>::recompose () {
// Output
template<int D>
-ostream& operator<< (ostream& os, const th<D>& t) {
+void th<D>::output (ostream& os) const {
os << "th<" << D << ">:"
<< "times={";
- for (int rl=0; rl<t.h.reflevels(); ++rl) {
- for (int ml=0; ml<t.h.mglevels(rl,0); ++ml) {
+ for (int rl=0; rl<h.reflevels(); ++rl) {
+ for (int ml=0; ml<h.mglevels(rl,0); ++ml) {
if (!(rl==0 && ml==0)) os << ",";
os << rl << ":" << ml << ":"
- << t.times[rl][ml] << "(" << t.deltas[rl][ml] << ")";
+ << times[rl][ml] << "(" << deltas[rl][ml] << ")";
}
}
os << "}";
- return os;
}
#if defined(TMPL_EXPLICIT)
template class th<3>;
-template ostream& operator<< (ostream& os, const th<3>& t);
#endif
diff --git a/Carpet/CarpetLib/src/th.hh b/Carpet/CarpetLib/src/th.hh
index 7c39a7d18..7abb657a5 100644
--- a/Carpet/CarpetLib/src/th.hh
+++ b/Carpet/CarpetLib/src/th.hh
@@ -6,7 +6,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.hh,v 1.2 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/th.hh,v 1.3 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -99,11 +99,19 @@ public:
}
// Output
- friend ostream& operator<< <> (ostream& os, const th& d);
+ void output (ostream& os) const;
};
+template<int D>
+ostream& operator<< (ostream& os, const th<D>& t) {
+ t.output(os);
+ return os;
+}
+
+
+
#if defined(TMPL_IMPLICIT)
# include "th.cc"
#endif
diff --git a/Carpet/CarpetLib/src/vect.cc b/Carpet/CarpetLib/src/vect.cc
index 5a622fd1c..1016151d8 100644
--- a/Carpet/CarpetLib/src/vect.cc
+++ b/Carpet/CarpetLib/src/vect.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/vect.cc,v 1.3 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.cc,v 1.4 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -33,57 +33,20 @@ using namespace std;
// Output
-#ifndef SGI
-// This doesn't work on SGIs. Is this legal C++?
template<class T,int D>
-ostream& operator<< (ostream& os, const vect<T,D>& a) {
+void vect<T,D>::output (ostream& os) const {
os << "[";
for (int d=0; d<D; ++d) {
if (d>0) os << ",";
- os << a[d];
+ os << (*this)[d];
}
os << "]";
- return os;
}
-#else
-ostream& operator<< (ostream& os, const vect<int,1>& a) {
- os << "[";
- for (int d=0; d<1; ++d) {
- if (d>0) os << ",";
- os << a[d];
- }
- os << "]";
- return os;
-}
-ostream& operator<< (ostream& os, const vect<int,2>& a) {
- os << "[";
- for (int d=0; d<2; ++d) {
- if (d>0) os << ",";
- os << a[d];
- }
- os << "]";
- return os;
-}
-ostream& operator<< (ostream& os, const vect<int,3>& a) {
- os << "[";
- for (int d=0; d<3; ++d) {
- if (d>0) os << ",";
- os << a[d];
- }
- os << "]";
- return os;
-}
-#endif
#if defined(TMPL_EXPLICIT)
template class vect<int,1>;
-template ostream& operator<< (ostream& os, const vect<int,1>& a);
-
template class vect<int,2>;
-template ostream& operator<< (ostream& os, const vect<int,2>& a);
-
template class vect<int,3>;
-template ostream& operator<< (ostream& os, const vect<int,3>& a);
#endif
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh
index d5ad5cbab..f1ee65591 100644
--- a/Carpet/CarpetLib/src/vect.hh
+++ b/Carpet/CarpetLib/src/vect.hh
@@ -5,7 +5,7 @@
copyright : (C) 2000 by Erik Schnetter
email : schnetter@astro.psu.edu
- $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.3 2001/03/22 18:42:06 eschnett Exp $
+ $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.4 2001/03/27 22:26:31 eschnett Exp $
***************************************************************************/
@@ -405,6 +405,7 @@ public:
};
#endif
+ void output (ostream& os) const;
};
@@ -501,6 +502,13 @@ inline T sum (const vect<T,D>& a) {
}
+template<class T,int D>
+inline ostream& operator<< (ostream& os, const vect<T,D>& a) {
+ a.output(os);
+ return os;
+}
+
+
#if defined(TMPL_IMPLICIT)
# include "vect.cc"