00001
00002
00003
00004
00005 #include "PlayaOut.hpp"
00006 #include "PlayaTabs.hpp"
00007 #include "Teuchos_Array.hpp"
00008
00009 using namespace Playa;
00010 using namespace Teuchos;
00011 using namespace std;
00012
00013
00014 namespace Playa
00015 {
00016
00017 void writeTable(std::ostream& os, const Tabs& tab,
00018 const Array<double>& a, int cols)
00019 {
00020 int rows = a.size() / cols;
00021
00022 for (int i=0; i<rows; i++)
00023 {
00024 os << tab << setw(10) << i << ":";
00025 for (int j=0; j<cols; j++)
00026 os << setw(12) << setprecision(6) << a[i*cols+j];
00027 os << std::endl;
00028 }
00029 int n = a.size() - rows * cols;
00030 if (n==0) return ;
00031 os << tab << setw(10) << rows << ":" ;
00032 for (int j=0; j<n; j++)
00033 os << setw(12) << setprecision(6) << a[rows*cols+j];
00034 os << std::endl;
00035 }
00036
00037
00038 void writeTable(std::ostream& os, const Tabs& tab,
00039 const Array<int>& a, int cols)
00040 {
00041 int rows = a.size() / cols;
00042
00043 for (int i=0; i<rows; i++)
00044 {
00045 os << tab << setw(10) << i << ":";
00046 for (int j=0; j<cols; j++)
00047 os << setw(10) << a[i*cols+j];
00048 os << std::endl;
00049 }
00050 int n = a.size() - rows * cols;
00051 if (n==0) return ;
00052 os << tab << setw(10) << rows << ":" ;
00053 for (int j=0; j<n; j++)
00054 os << setw(10) << a[rows*cols+j];
00055 os << std::endl;
00056 }
00057
00058
00059 }
00060
00061
00062
00063
00064
00065
00066