/[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 3691 by caltinay, Wed Nov 23 23:07:37 2011 UTC revision 3697 by caltinay, Mon Nov 28 04:52:00 2011 UTC
# Line 166  void Brick::dump(const string& fileName) Line 166  void Brick::dump(const string& fileName)
166      DBPutQuadmesh(dbfile, "mesh", NULL, coords, dims, 3, DB_DOUBLE,      DBPutQuadmesh(dbfile, "mesh", NULL, coords, dims, 3, DB_DOUBLE,
167              DB_COLLINEAR, NULL);              DB_COLLINEAR, NULL);
168    
169      DBPutQuadvar1(dbfile, "nodeId", "mesh", (void*)&m_nodeId[0], dims, 3, NULL, 0,      DBPutQuadvar1(dbfile, "nodeId", "mesh", (void*)&m_nodeId[0], dims, 3, NULL,
170              DB_INT, DB_NODECENT, NULL);              0, DB_INT, DB_NODECENT, NULL);
171    
172      if (m_mpiInfo->rank == 0) {      if (m_mpiInfo->rank == 0) {
173          vector<string> tempstrings;          vector<string> tempstrings;
# Line 211  void Brick::dump(const string& fileName) Line 211  void Brick::dump(const string& fileName)
211    
212  const int* Brick::borrowSampleReferenceIDs(int fsType) const  const int* Brick::borrowSampleReferenceIDs(int fsType) const
213  {  {
214      if (fsType == Nodes)      switch (fsType) {
215          return &m_nodeId[0];          case Nodes:
216                return &m_nodeId[0];
217            case Elements:
218                return &m_elementId[0];
219            case FaceElements:
220                return &m_faceId[0];
221            default:
222                break;
223        }
224    
225      throw RipleyException("borrowSampleReferenceIDs() only implemented for Nodes");      stringstream msg;
226        msg << "borrowSampleReferenceIDs() not implemented for function space type "
227            << fsType;
228        throw RipleyException(msg.str());
229  }  }
230    
231  bool Brick::ownSample(int fsCode, index_t id) const  bool Brick::ownSample(int fsCode, index_t id) const
# Line 322  void Brick::assembleCoordinates(escript: Line 333  void Brick::assembleCoordinates(escript:
333  //private  //private
334  void Brick::populateSampleIds()  void Brick::populateSampleIds()
335  {  {
336        // identifiers are ordered from left to right, bottom to top, front to back
337        // on each rank, except for the shared nodes which are owned by the rank
338        // below / to the left / to the front of the current rank
339      const index_t firstId = getNumNodes()*m_mpiInfo->rank;      const index_t firstId = getNumNodes()*m_mpiInfo->rank;
340      const index_t diff0 = m_N0*(m_N1*m_N2-1)+1;      const index_t diff0 = m_N0*(m_N1*m_N2-1)+1;
341      const index_t diff1 = m_N0*m_N1*(m_N2*m_NX-1)+m_N0;      const index_t diff1 = m_N0*m_N1*(m_N2*m_NX-1)+m_N0;
# Line 338  void Brick::populateSampleIds() Line 352  void Brick::populateSampleIds()
352              id -= diff2;              id -= diff2;
353          m_nodeId[k]=id;          m_nodeId[k]=id;
354      }      }
355    
356        // elements
357        m_elementId.resize(getNumElements());
358    #pragma omp parallel for
359        for (dim_t k=0; k<getNumElements(); k++) {
360            m_elementId[k]=k;
361        }
362    
363        // face elements
364        m_faceId.resize(getNumFaceElements());
365    #pragma omp parallel for
366        for (dim_t k=0; k<getNumFaceElements(); k++) {
367            m_faceId[k]=k;
368        }
369  }  }
370    
371  } // end of namespace ripley  } // end of namespace ripley

Legend:
Removed from v.3691  
changed lines
  Added in v.3697

  ViewVC Help
Powered by ViewVC 1.1.26