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

Comparing branches/new_design/OOPSE-2.0/src/io/DumpWriter.cpp (file contents):
Revision 1807 by tim, Mon Nov 15 18:02:15 2004 UTC vs.
Revision 1808 by tim, Tue Nov 30 23:14:29 2004 UTC

# Line 1 | Line 1
1   #include "io/DumpWrite.hpp"
2 + #include "primitives/Molecule.hpp"
3   #include "utils/simError.h"
4  
5   #ifdef IS_MPI
6   #include <mpi.h>
7   #endif //is_mpi
8 +
9   namespace oopse {
10 +
11   DumpWriter::DumpWriter(SimInfo* info, const std::string& filename)
12                     : info_(info), filename_(filename){
13   #ifdef IS_MPI
# Line 12 | Line 15 | DumpWriter::DumpWriter(SimInfo* info, const std::strin
15      if (worldRank == 0) {
16   #endif // is_mpi
17  
18 <        dumpFile.open(filename_.c_str(), ios::out | ios::trunc);
18 >        dumpFile_.open(filename_.c_str(), ios::out | ios::trunc);
19  
20 <        if (!dumpFile) {
20 >        if (!dumpFile_) {
21              sprintf(painCave.errMsg, "Could not open \"%s\" for dump output.\n",
22 <                    info_->filename_.c_str());
22 >                    filename_.c_str());
23              painCave.isFatal = 1;
24              simError();
25          }
# Line 39 | Line 42 | DumpWriter::~DumpWriter() {
42      if (worldRank == 0) {
43   #endif // is_mpi
44  
45 <        dumpFile.close();
45 >        dumpFile_.close();
46  
47   #ifdef IS_MPI
48  
# Line 49 | Line 52 | void writeCommentLine(Snapshot* s) {
52  
53   }
54  
55 < void writeCommentLine(Snapshot* s) {
55 > void DumpWriter::writeCommentLine(std::ostream& os, Snapshot* s) {
56  
57      double currentTime;
58      Mat3x3d hmat;
# Line 64 | Line 67 | void writeCommentLine(Snapshot* s) {
67      eta = s->getEta();
68      
69      os << currentTime << ";\t"
70 <         << hmat[0][0] << "\t" << hmat[1][0] << "\t" << hmat[2][0] << ";\t"
71 <         << hmat[0][1] << "\t" << hmat[1][1] << "\t" << hmat[2][1] << ";\t"
72 <         << hmat[0][2] << "\t" << hmat[1][2] << "\t" << hmat[2][2] << ";";
70 >         << hmat(0, 0) << "\t" << hmat(1, 0) << "\t" << hmat(2, 0) << ";\t"
71 >         << hmat(0, 1) << "\t" << hmat(1, 1) << "\t" << hmat(2, 1) << ";\t"
72 >         << hmat(0, 2) << "\t" << hmat(1, 2) << "\t" << hmat(2, 2) << ";";
73  
74      //write out additional parameters, such as chi and eta
75  
76 <    os << chi << "\t" << integralOfChiDt << "\t;"
76 >    os << chi << "\t" << integralOfChiDt << "\t;";
77  
78 <    os << eta[0][0] << "\t" << eta[1][0] << "\t" << eta[2][0] << ";\t"
79 <         << eta[0][1] << "\t" << eta[1][1] << "\t" << eta[2][1] << ";\t"
80 <         << eta[0][2] << "\t" << eta[1][2] << "\t" << eta[2][2] << ";";
78 >    os << eta(0, 0) << "\t" << eta(1, 0) << "\t" << eta(2, 0) << ";\t"
79 >         << eta(0, 1) << "\t" << eta(1, 1) << "\t" << eta(2, 1) << ";\t"
80 >         << eta(0, 2) << "\t" << eta(1, 2) << "\t" << eta(2, 2) << ";";
81          
82      os << endl;
83   }
# Line 93 | Line 96 | void DumpWriter::writeFrame(std::ostream& os) {
96  
97      Molecule* mol;
98      StuntDouble* integrableObject;
99 <    typename SimInfo::MoleculeIterator mi;
100 <    typename Molecule::IntegrableObjectIterator ii;
99 >    SimInfo::MoleculeIterator mi;
100 >    Molecule::IntegrableObjectIterator ii;
101    
102      int nTotObjects;    
103      nTotObjects = info_->getNGlobalIntegrableObjects();
# Line 104 | Line 107 | void DumpWriter::writeFrame(std::ostream& os) {
107  
108      os << nTotObjects << "\n";
109          
110 <    writeCommentLine(info_->getSnapshotManager()->getCurrentSnapshot());
110 >    writeCommentLine(os, info_->getSnapshotManager()->getCurrentSnapshot());
111  
112      for (mol = info_->beginMolecule(mi); mol != NULL; mol = info_->nextMolecule(mi)) {
113  
# Line 116 | Line 119 | void DumpWriter::writeFrame(std::ostream& os) {
119              vel = integrableObject->getVel();
120  
121              sprintf(tempBuffer, "%s\t%lf\t%lf\t%lf\t%lf\t%lf\t%lf\t",
122 <                    integrableObject->getType(),
122 >                    integrableObject->getType().c_str(),
123                      pos[0], pos[1], pos[2],
124                      vel[0], vel[1], vel[2]);
125  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines