00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <SawUtils.h>
00021
00022
00023
00024
00025 #include <SawVector.h>
00026 #include <SawVectorList.h>
00027
00028
00029
00030 SawUtils::SawUtils()
00031 {}
00032
00033 SawUtils::~SawUtils()
00034 {}
00035
00036 void SawUtils::writeWithFormatMapStyle( ostream& os, SawVector keys, SawVectorList values, int numberColumns, SawObject::NumberFormat formatKeys )
00037 {
00038 bool scientific = false ;
00039
00040 os.precision( values[0].getPrecisionOutputStream() ) ;
00041
00042 os.setf( ios::fixed , ios::floatfield ) ;
00043
00044 int intro = 0 ;
00045
00046 for( int k=0; k < floor((double)keys.getSize()/(double)numberColumns) ; k++ ){
00047
00048 for( int i=k*numberColumns+1; i < (k+1)*numberColumns+1; i++ )
00049 os << setw( values[0].getWidthOutputStream() ) << i ;
00050
00051 os << endl ;
00052
00053 for( int i=k*numberColumns; i < (k+1)*numberColumns; i++ )
00054 os << setw( values[0].getWidthOutputStream() ) << keys.get(i) ;
00055
00056 os << endl ;
00057 os << endl ;
00058
00059 for( int i=0; i < values[0].getSize(); i++ ){
00060 for( int j=k*numberColumns; j < (k+1)*numberColumns; j++ ){
00061 if( !scientific )
00062 os << setw( values[0].getWidthOutputStream() ) << values[j].get(i) ;
00063 else
00064 os << setw( values[0].getWidthOutputStream() + 3 ) << values[j].get(i) ;
00065 }
00066 os << endl ;
00067 }
00068
00069 os << endl ;
00070 os << endl ;
00071
00072 intro++ ;
00073 }
00074
00075 for( int i=intro*numberColumns+1; i < intro*numberColumns+keys.getSize()%numberColumns+1 ; i++ )
00076 os << setw( values[0].getWidthOutputStream() ) << i ;
00077
00078 os << endl ;
00079
00080 for( int i=intro*numberColumns; i < intro*numberColumns+keys.getSize()%numberColumns; i++ )
00081 os << setw( values[0].getWidthOutputStream() ) << keys.get(i) ;
00082
00083 os << endl ;
00084 os << endl ;
00085
00086 for( int i=0; i < values[0].getSize(); i++ ){
00087 for( int j=intro*numberColumns; j < intro*numberColumns+keys.getSize()%numberColumns; j++ ){
00088 if( !scientific )
00089 os << setw( values[0].getWidthOutputStream() ) << values[j].get(i) ;
00090 else
00091 os << setw( values[0].getWidthOutputStream() + 3 ) << values[j].get(i) ;
00092 }
00093 os << endl ;
00094 }
00095 }