# Diff of /trunk/ripley/src/Brick.cpp

revision 4009 by caltinay, Tue Oct 2 05:53:37 2012 UTC revision 4010 by caltinay, Tue Oct 2 06:57:11 2012 UTC
# Line 54  Brick::Brick(int n0, int n1, int n2, dou Line 54  Brick::Brick(int n0, int n1, int n2, dou
54      if (d0<=0 && d1<=0 && d2<=0) {      if (d0<=0 && d1<=0 && d2<=0) {
55          warn=true;          warn=true;
56          d0=(int)(pow(m_mpiInfo->size*(n0+1)*(n0+1)/((float)(n1+1)*(n2+1)), 1.f/3));          d0=(int)(pow(m_mpiInfo->size*(n0+1)*(n0+1)/((float)(n1+1)*(n2+1)), 1.f/3));
57          d1=(int)(d0*n1/(float)n0);          d0=max(1, d0);
58            d1=max(1, (int)(d0*n1/(float)n0));
59          d2=m_mpiInfo->size/(d0*d1);          d2=m_mpiInfo->size/(d0*d1);
60          if (d0*d1*d2 != m_mpiInfo->size) {          if (d0*d1*d2 != m_mpiInfo->size) {
61              // ratios not the same so leave "smallest" side undivided and try              // ratios not the same so leave "smallest" side undivided and try
# Line 80  Brick::Brick(int n0, int n1, int n2, dou Line 81  Brick::Brick(int n0, int n1, int n2, dou
81      }      }
82      if (d0<=0 && d1<=0) {      if (d0<=0 && d1<=0) {
83          warn=true;          warn=true;
84          d0=int(sqrt(m_mpiInfo->size*(n0+1)/(float)(n1+1)));          d0=max(1, int(sqrt(m_mpiInfo->size*(n0+1)/(float)(n1+1))));
85          d1=m_mpiInfo->size/d0;          d1=m_mpiInfo->size/d0;
86          if (d0*d1*d2 != m_mpiInfo->size) {          if (d0*d1*d2 != m_mpiInfo->size) {
87              // ratios not the same so subdivide side with more elements only              // ratios not the same so subdivide side with more elements only
# Line 94  Brick::Brick(int n0, int n1, int n2, dou Line 95  Brick::Brick(int n0, int n1, int n2, dou
95          }          }
96      } else if (d0<=0 && d2<=0) {      } else if (d0<=0 && d2<=0) {
97          warn=true;          warn=true;
98          d0=int(sqrt(m_mpiInfo->size*(n0+1)/(float)(n2+1)));          d0=max(1, int(sqrt(m_mpiInfo->size*(n0+1)/(float)(n2+1))));
99          d2=m_mpiInfo->size/d0;          d2=m_mpiInfo->size/d0;
100          if (d0*d1*d2 != m_mpiInfo->size) {          if (d0*d1*d2 != m_mpiInfo->size) {
101              // ratios not the same so subdivide side with more elements only              // ratios not the same so subdivide side with more elements only
# Line 108  Brick::Brick(int n0, int n1, int n2, dou Line 109  Brick::Brick(int n0, int n1, int n2, dou
109          }          }
110      } else if (d1<=0 && d2<=0) {      } else if (d1<=0 && d2<=0) {
111          warn=true;          warn=true;
112          d1=int(sqrt(m_mpiInfo->size*(n1+1)/(float)(n2+1)));          d1=max(1, int(sqrt(m_mpiInfo->size*(n1+1)/(float)(n2+1))));
113          d2=m_mpiInfo->size/d1;          d2=m_mpiInfo->size/d1;
114          if (d0*d1*d2 != m_mpiInfo->size) {          if (d0*d1*d2 != m_mpiInfo->size) {
115              // ratios not the same so subdivide side with more elements only              // ratios not the same so subdivide side with more elements only

Legend:
 Removed from v.4009 changed lines Added in v.4010