/[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 4657 by jfenwick, Thu Feb 6 06:12:20 2014 UTC revision 4660 by sshaw, Fri Feb 7 03:08:49 2014 UTC
# Line 787  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 3082  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 3103  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.4657  
changed lines
  Added in v.4660

  ViewVC Help
Powered by ViewVC 1.1.26