/[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 4650 by jfenwick, Wed Feb 5 04:16:01 2014 UTC revision 4660 by sshaw, Fri Feb 7 03:08:49 2014 UTC
# Line 1  Line 1 
1    
2  /*****************************************************************************  /*****************************************************************************
3  *  *
4  * Copyright (c) 2003-2013 by University of Queensland  * Copyright (c) 2003-2014 by University of Queensland
5  * http://www.uq.edu.au  * http://www.uq.edu.au
6  *  *
7  * Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
# Line 9  Line 9 
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)  * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12  * Development since 2012 by School of Earth Sciences  * Development 2012-2013 by School of Earth Sciences
13    * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
# Line 786  const int* Brick::borrowSampleReferenceI Line 787  const int* Brick::borrowSampleReferenceI
787          case FaceElements:          case FaceElements:
788          case ReducedFaceElements:          case ReducedFaceElements:
789              return &m_faceId[0];              return &m_faceId[0];
790            case Points:
791                return &m_diracPointNodeIDs[0];
792          default:          default:
793              break;              break;
794      }      }
# Line 3030  escript::Data Brick::randomFill(long see Line 3033  escript::Data Brick::randomFill(long see
3033      block.setUsed(m.destbuffid);      block.setUsed(m.destbuffid);
3034      }      }
3035    
3036      for (size_t i=0;i<incoms.size();++i)      for (size_t i=0;i<outcoms.size();++i)
3037      {      {
3038      message& m=incoms[i];      message& m=outcoms[i];
3039      comserr|=MPI_Isend(block.getOutBuffer(m.srcbuffid), block.getBuffSize(m.srcbuffid) , MPI_DOUBLE, m.destID, m.tag, m_mpiInfo->comm, reqs+(rused++));      comserr|=MPI_Isend(block.getOutBuffer(m.srcbuffid), block.getBuffSize(m.srcbuffid) , MPI_DOUBLE, m.destID, m.tag, m_mpiInfo->comm, reqs+(rused++));
3040      }          }    
3041            
# Line 3081  escript::Data Brick::randomFill(long see Line 3084  escript::Data Brick::randomFill(long see
3084  int Brick::findNode(const double *coords) const {  int Brick::findNode(const double *coords) const {
3085      const int NOT_MINE = -1;      const int NOT_MINE = -1;
3086      //is the found element even owned by this rank      //is the found element even owned by this rank
3087        // (inside owned or shared elements but will map to an owned element)
3088      for (int dim = 0; dim < m_numDim; dim++) {      for (int dim = 0; dim < m_numDim; dim++) {
3089          if (m_origin[dim] + m_offset[dim] > coords[dim]  || m_origin[dim]          double min = m_origin[dim] + m_offset[dim]* m_dx[dim]
3090                  + m_offset[dim] + m_dx[dim]*m_ownNE[dim] < coords[dim]) {                  - m_dx[dim]/2.; //allows for point outside mapping onto node
3091            double max = m_origin[dim] + (m_offset[dim] + m_NE[dim])*m_dx[dim]
3092                    + m_dx[dim]/2.;
3093            if (min > coords[dim] || max < coords[dim]) {
3094              return NOT_MINE;              return NOT_MINE;
3095          }          }
3096      }      }
# Line 3102  int Brick::findNode(const double *coords Line 3109  int Brick::findNode(const double *coords
3109          minDist += m_dx[dim]*m_dx[dim];          minDist += m_dx[dim]*m_dx[dim];
3110      }      }
3111      //find the closest node      //find the closest node
3112      for (int dx = 0; dx < 2; dx++) {      for (int dx = 0; dx < 1; dx++) {
3113          double xdist = x - (ex + dx)*m_dx[0];          double xdist = x - (ex + dx)*m_dx[0];
3114          for (int dy = 0; dy < 2; dy++) {          for (int dy = 0; dy < 1; dy++) {
3115              double ydist = y - (ey + dy)*m_dx[1];              double ydist = y - (ey + dy)*m_dx[1];
3116              for (int dz = 0; dz < 2; dz++) {              for (int dz = 0; dz < 1; dz++) {
3117                  double zdist = z - (ez + dz)*m_dx[2];                  double zdist = z - (ez + dz)*m_dx[2];
3118                  double total = xdist*xdist + ydist*ydist + zdist*zdist;                  double total = xdist*xdist + ydist*ydist + zdist*zdist;
3119                  if (total < minDist) {                  if (total < minDist) {
3120                      closest = INDEX3(ex+dy, ey+dy, ez+dz, m_NE[0]+1, m_NE[1]+1);                      closest = INDEX3(ex+dy-m_offset[0], ey+dy-m_offset[1],
3121                                ez+dz-m_offset[2], m_NE[0]+1, m_NE[1]+1);
3122                      minDist = total;                      minDist = total;
3123                  }                  }
3124              }              }
3125          }          }
3126      }      }
3127        if (closest == NOT_MINE) {
3128            throw RipleyException("Unable to map appropriate dirac point to a node, implementation problem in Brick::findNode()");
3129        }
3130      return closest;      return closest;
3131  }  }
3132    

Legend:
Removed from v.4650  
changed lines
  Added in v.4660

  ViewVC Help
Powered by ViewVC 1.1.26