ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/applications/staticProps/GofXyz.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/applications/staticProps/GofXyz.cpp (file contents):
Revision 2045 by tim, Thu Feb 17 18:30:54 2005 UTC vs.
Revision 2048 by tim, Thu Feb 17 19:50:30 2005 UTC

# Line 47 | Line 47 | GofXyz::GofXyz(SimInfo* info, const std::string& filen
47   namespace oopse {
48  
49   GofXyz::GofXyz(SimInfo* info, const std::string& filename, const std::string& sele1, const std::string& sele2, double len, int nrbins)
50 <    : RadialDistrFunc(info, filename, sele1, sele2), len_(len), nRBins_(nrbins) {
50 >    : RadialDistrFunc(info, filename, sele1, sele2), len_(len), halfLen_(len/2), nRBins_(nrbins) {
51      setOutputName(getPrefix(filename) + ".gxyz");
52  
53 <    deltaR_ = len_ / nRBins_;
53 >    deltaR_ =  len_ / nRBins_;
54      
55      histogram_.resize(nRBins_);
56      for (int i = 0 ; i < nRBins_; ++i) {
# Line 135 | Line 135 | void GofXyz::collectHistogram(StuntDouble* sd1, StuntD
135      double y = dot(r12, i->second.yaxis);
136      double z = dot(r12, i->second.zaxis);
137  
138 <    int xbin = x / deltaR_;
139 <    int ybin = y / deltaR_;
140 <    int zbin = z / deltaR_;
138 >    // x, y and z's possible values range -halfLen_ to halfLen_
139 >    int xbin = (x+ halfLen_) / deltaR_;
140 >    int ybin = (y + halfLen_) / deltaR_;
141 >    int zbin = (z + halfLen_) / deltaR_;
142  
143      if (xbin < nRBins_ && ybin < nRBins_ && zbin < nRBins_) {
144          ++histogram_[x][y][z];
# Line 146 | Line 147 | void GofXyz::writeRdf() {
147   }
148  
149   void GofXyz::writeRdf() {
150 <    std::ofstream rdfStream(outputFilename_.c_str());
150 >    std::ofstream rdfStream(outputFilename_.c_str(), std::ios::binary);
151      if (rdfStream.is_open()) {
152 <        rdfStream << "#g(x, y, z)\n";
153 <        rdfStream << "#selection1: (" << selectionScript1_ << ")\t";
154 <        rdfStream << "selection2: (" << selectionScript2_ << ")\n";
155 <        rdfStream << "#nRBins = " << nRBins_ << "\t maxLen = " << len_ << "deltaR = " << deltaR_ <<"\n";
152 >        //rdfStream << "#g(x, y, z)\n";
153 >        //rdfStream << "#selection1: (" << selectionScript1_ << ")\t";
154 >        //rdfStream << "selection2: (" << selectionScript2_ << ")\n";
155 >        //rdfStream << "#nRBins = " << nRBins_ << "\t maxLen = " << len_ << "deltaR = " << deltaR_ <<"\n";
156          for (int i = 0; i < histogram_.size(); ++i) {
157  
158              for(int j = 0; j < histogram_[i].size(); ++j) {
159  
160                  for(int k = 0;k < histogram_[i].size(); ++k) {
161 <
161 <                    rdfStream << histogram_[i][j][k]/nProcessed_ << "\t";
161 >                    rdfStream.write(reinterpret_cast<char *>(&histogram_[i][j][k] ), sizeof(histogram_[i][j][k] ));
162                  }
163                rdfStream << "\n";                
163              }
164          }
165          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines