/[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 3971 by caltinay, Wed Sep 19 02:55:35 2012 UTC revision 4002 by caltinay, Fri Sep 28 00:16:56 2012 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2012 by University of Queensland  * Copyright (c) 2003-2012 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * http://www.uq.edu.au
 * http://www.uq.edu.au/esscc  
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
8  * Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
9  * http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
10  *  *
11  *******************************************************/  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12    * Development since 2012 by School of Earth Sciences
13    *
14    *****************************************************************************/
15    
16  #include <ripley/Brick.h>  #include <ripley/Brick.h>
17  extern "C" {  extern "C" {
# Line 297  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]);
# Line 1756  void Brick::dofToNodes(escript::Data& ou Line 1767  void Brick::dofToNodes(escript::Data& ou
1767                  : &buffer[(m_dofMap[i]-numDOF)*numComp]);                  : &buffer[(m_dofMap[i]-numDOF)*numComp]);
1768          copy(src, src+numComp, out.getSampleDataRW(i));          copy(src, src+numComp, out.getSampleDataRW(i));
1769      }      }
1770        Paso_Coupler_free(coupler);
1771  }  }
1772    
1773  //private  //private

Legend:
Removed from v.3971  
changed lines
  Added in v.4002

  ViewVC Help
Powered by ViewVC 1.1.26