/[escript]/branches/diaplayground/ripley/src/Brick.cpp
ViewVC logotype

Diff of /branches/diaplayground/ripley/src/Brick.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3981 by jfenwick, Fri Sep 21 02:47:54 2012 UTC revision 3984 by caltinay, Fri Sep 21 06:41:54 2012 UTC
# Line 299  void Brick::readBinaryGrid(escript::Data Line 299  void Brick::readBinaryGrid(escript::Data
299      vector<float> values(num0*numComp);      vector<float> values(num0*numComp);
300      const int dpp = out.getNumDataPointsPerSample();      const int dpp = out.getNumDataPointsPerSample();
301    
302        // whether the y-coordinate runs top-down (invert=true) or bottom-up (false)
303        bool invertY=true;
304    
305      for (index_t z=0; z<num2; z++) {      for (index_t z=0; z<num2; z++) {
306          for (index_t y=0; y<num1; y++) {          for (index_t y=0; y<num1; y++) {
307              const int fileofs = numComp*(idx0+(idx1+y)*numValues[0]+(idx2+z)*numValues[0]*numValues[1]);              const int fileofs = numComp*(idx0+(idx1+y)*numValues[0]+(idx2+z)*numValues[0]*numValues[1]);
308              f.seekg(fileofs*sizeof(float));              f.seekg(fileofs*sizeof(float));
309              f.read((char*)&values[0], num0*numComp*sizeof(float));              f.read((char*)&values[0], num0*numComp*sizeof(float));
310                int dataIndex;
311                if (invertY)
312                    dataIndex = first0+(first1+num1-1-y)*myN0+(first2+z)*myN0*myN1;
313                else
314                    dataIndex = first0+(first1+y)*myN0+(first2+z)*myN0*myN1;
315    
316              for (index_t x=0; x<num0; x++) {              for (index_t x=0; x<num0; x++) {
317                  double* dest = out.getSampleDataRW(first0+x+(first1+y)*myN0+(first2+z)*myN0*myN1);                  double* dest = out.getSampleDataRW(dataIndex+x);
318                  for (index_t c=0; c<numComp; c++) {                  for (index_t c=0; c<numComp; c++) {
319                      for (index_t q=0; q<dpp; q++) {                      for (index_t q=0; q<dpp; q++) {
320                          *dest++ = static_cast<double>(values[x*numComp+c]);                          *dest++ = static_cast<double>(values[x*numComp+c]);

Legend:
Removed from v.3981  
changed lines
  Added in v.3984

  ViewVC Help
Powered by ViewVC 1.1.26