ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-2.0/src/io/StatWriter.cpp
(Generate patch)

Comparing branches/new_design/OOPSE-2.0/src/io/StatWriter.cpp (file contents):
Revision 1727 by tim, Thu Nov 11 16:41:58 2004 UTC vs.
Revision 1846 by tim, Sat Dec 4 00:01:32 2004 UTC

# Line 4 | Line 4 | StatWriter::StatWriter( const std::string& filename, c
4   #include "io/StatWriter.hpp"
5   #include "utils/simError.h"
6  
7 < StatWriter::StatWriter( const std::string& filename, const StatsBitSet& mask) mask_(mask){
7 > namespace oopse {
8 > StatWriter::StatWriter( const std::string& filename, const StatsBitSet& mask) : mask_(mask){
9  
10   #ifdef IS_MPI
11    if(worldRank == 0 ){
12   #endif // is_mpi
13  
14 <    statfile_.open(filename.c_str(), ios::out | ios::trunc );
14 >    statfile_.open(filename.c_str(), std::ios::out | std::ios::trunc );
15      
16      if( !statfile_ ){
17        
# Line 20 | Line 21 | StatWriter::StatWriter( const std::string& filename, c
21        painCave.isFatal = 1;
22        simError();
23      }
24 +
25 +    writeTitle();
26      
27   #ifdef IS_MPI
28    }
# Line 52 | Line 55 | void StatWriter::writeTitle() {
55   #endif // is_mpi
56  
57          //write title
58 <        statfile_ << "#"
59 <            for (int i =0; i < mask_.size(); ++i) {
60 <                if (mask_[i]) {
61 <                statfile_ << "\t" << Stats::getTitle(i) << "(" << Stats::getUnits(i) << ")"
59 <                }
58 >        statfile_ << "#";
59 >        for (int i =0; i < mask_.size(); ++i) {
60 >            if (mask_[i]) {
61 >            statfile_ << "\t" << Stats::getTitle(i) << "(" << Stats::getUnits(i) << ")";
62              }
63 +        }
64          statfile_ << std::endl;
65  
66   #ifdef IS_MPI
# Line 65 | Line 68 | void StatWriter::writeStat(Stats* s){
68   #endif // is_mpi    
69   }
70  
71 < void StatWriter::writeStat(Stats* s){
71 > void StatWriter::writeStat(const Stats& s){
72  
73   #ifdef IS_MPI
74      if(worldRank == 0 ){
# Line 75 | Line 78 | void StatWriter::writeStat(Stats* s){
78  
79          for (int i =0; i < mask_.size(); ++i) {
80              if (mask_[i]) {
81 <                statfile_ << "\t" << s->statData[i];
81 >                statfile_ << "\t" << s[i];
82              }
83          }
84          statfile_ << std::endl;
# Line 87 | Line 90 | void StatWriter::writeStat(Stats* s){
90   #endif // is_mpi
91   }
92  
93 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines