/[escript]/branches/ripleygmg_from_3668/ripley/src/Rectangle.cpp
ViewVC logotype

Diff of /branches/ripleygmg_from_3668/ripley/src/Rectangle.cpp

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

revision 3754 by caltinay, Wed Jan 4 07:07:37 2012 UTC revision 3755 by caltinay, Thu Jan 5 06:51:31 2012 UTC
# Line 1118  void Rectangle::populateSampleIds() Line 1118  void Rectangle::populateSampleIds()
1118    
1119          // elements          // elements
1120  #pragma omp for nowait  #pragma omp for nowait
1121          for (dim_t k=0; k<getNumElements(); k++)          for (dim_t i1=0; i1<m_NE1; i1++) {
1122              m_elementId[k]=k;              for (dim_t i0=0; i0<m_NE0; i0++) {
1123                    m_elementId[i0+i1*m_NE0]=(m_offset1+i1)*m_gNE0+m_offset0+i0;
1124                }
1125            }
1126    
1127          // face elements          // face elements
1128  #pragma omp for  #pragma omp for
# Line 1190  void Rectangle::nodesToDOF(escript::Data Line 1193  void Rectangle::nodesToDOF(escript::Data
1193    
1194      const index_t left = (m_offset0==0 ? 0 : 1);      const index_t left = (m_offset0==0 ? 0 : 1);
1195      const index_t bottom = (m_offset1==0 ? 0 : 1);      const index_t bottom = (m_offset1==0 ? 0 : 1);
1196      const index_t right = (m_mpiInfo->rank%m_NX==m_NX-1 ? m_N0 : m_N0-1);      const index_t nDOF0 = (m_gNE0+1)/m_NX;
1197      const index_t top = (m_mpiInfo->rank/m_NX==m_NY-1 ? m_N1 : m_N1-1);      const index_t nDOF1 = (m_gNE1+1)/m_NY;
1198      index_t n=0;  #pragma omp parallel for
1199      for (index_t i=bottom; i<top; i++) {      for (index_t i=0; i<nDOF1; i++) {
1200          for (index_t j=left; j<right; j++, n++) {          for (index_t j=0; j<nDOF0; j++) {
1201              const double* src=in.getSampleDataRO(j+i*m_N0);              const index_t n=j+left+(i+bottom)*m_N0;
1202                const double* src=in.getSampleDataRO(n);
1203                copy(src, src+numComp, out.getSampleDataRW(j+i*nDOF0));
1204            }
1205        }
1206    }
1207    
1208    //protected
1209    void Rectangle::dofToNodes(escript::Data& out, escript::Data& in) const
1210    {
1211        const dim_t numComp = in.getDataPointSize();
1212        out.requireWrite();
1213    
1214        //TODO: use coupler to get the rest of the values
1215    
1216        const index_t left = (m_offset0==0 ? 0 : 1);
1217        const index_t bottom = (m_offset1==0 ? 0 : 1);
1218        const index_t nDOF0 = (m_gNE0+1)/m_NX;
1219        const index_t nDOF1 = (m_gNE1+1)/m_NY;
1220    #pragma omp parallel for
1221        for (index_t i=0; i<nDOF1; i++) {
1222            for (index_t j=0; j<nDOF0; j++) {
1223                const double* src=in.getSampleDataRO(j+i*nDOF0);
1224                const index_t n=j+left+(i+bottom)*m_N0;
1225              copy(src, src+numComp, out.getSampleDataRW(n));              copy(src, src+numComp, out.getSampleDataRW(n));
1226          }          }
1227      }      }

Legend:
Removed from v.3754  
changed lines
  Added in v.3755

  ViewVC Help
Powered by ViewVC 1.1.26