/[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 4622 by sshaw, Fri Jan 17 04:55:41 2014 UTC revision 4626 by caltinay, Wed Jan 22 06:07:34 2014 UTC
# Line 590  void Brick::writeBinaryGridImpl(const es Line 590  void Brick::writeBinaryGridImpl(const es
590      if (numComp > 1 || dpp > 1)      if (numComp > 1 || dpp > 1)
591          throw RipleyException("writeBinaryGrid(): only scalar, single-value data supported");          throw RipleyException("writeBinaryGrid(): only scalar, single-value data supported");
592    
     escript::Data* _in = const_cast<escript::Data*>(&in);  
   
593      // from here on we know that each sample consists of one value      // from here on we know that each sample consists of one value
594      FileWriter fw;      FileWriter fw;
595      fw.openFile(filename, fileSize);      fw.openFile(filename, fileSize);
# Line 604  void Brick::writeBinaryGridImpl(const es Line 602  void Brick::writeBinaryGridImpl(const es
602              ostringstream oss;              ostringstream oss;
603    
604              for (index_t x=0; x<myN0; x++) {              for (index_t x=0; x<myN0; x++) {
605                  const double* sample = _in->getSampleDataRO(z*myN0*myN1+y*myN0+x);                  const double* sample = in.getSampleDataRO(z*myN0*myN1+y*myN0+x);
606                  ValueType fvalue = static_cast<ValueType>(*sample);                  ValueType fvalue = static_cast<ValueType>(*sample);
607                  if (byteOrder == BYTEORDER_NATIVE) {                  if (byteOrder == BYTEORDER_NATIVE) {
608                      oss.write((char*)&fvalue, sizeof(fvalue));                      oss.write((char*)&fvalue, sizeof(fvalue));
# Line 1151  void Brick::assembleCoordinates(escript: Line 1149  void Brick::assembleCoordinates(escript:
1149  }  }
1150    
1151  //protected  //protected
1152  void Brick::assembleGradient(escript::Data& out, escript::Data& in) const  void Brick::assembleGradient(escript::Data& out, const escript::Data& in) const
1153  {  {
1154      const dim_t numComp = in.getDataPointSize();      const dim_t numComp = in.getDataPointSize();
1155      const double C0 = .044658198738520451079;      const double C0 = .044658198738520451079;
# Line 1622  void Brick::assembleGradient(escript::Da Line 1620  void Brick::assembleGradient(escript::Da
1620  }  }
1621    
1622  //protected  //protected
1623  void Brick::assembleIntegrate(vector<double>& integrals, escript::Data& arg) const  void Brick::assembleIntegrate(vector<double>& integrals, const escript::Data& arg) const
1624  {  {
1625      const dim_t numComp = arg.getDataPointSize();      const dim_t numComp = arg.getDataPointSize();
1626      const index_t left = (m_offset[0]==0 ? 0 : 1);      const index_t left = (m_offset[0]==0 ? 0 : 1);
# Line 1910  dim_t Brick::insertNeighbourNodes(IndexV Line 1908  dim_t Brick::insertNeighbourNodes(IndexV
1908  }  }
1909    
1910  //protected  //protected
1911  void Brick::nodesToDOF(escript::Data& out, escript::Data& in) const  void Brick::nodesToDOF(escript::Data& out, const escript::Data& in) const
1912  {  {
1913      const dim_t numComp = in.getDataPointSize();      const dim_t numComp = in.getDataPointSize();
1914      out.requireWrite();      out.requireWrite();
# Line 1934  void Brick::nodesToDOF(escript::Data& ou Line 1932  void Brick::nodesToDOF(escript::Data& ou
1932  }  }
1933    
1934  //protected  //protected
1935  void Brick::dofToNodes(escript::Data& out, escript::Data& in) const  void Brick::dofToNodes(escript::Data& out, const escript::Data& in) const
1936  {  {
1937      const dim_t numComp = in.getDataPointSize();      const dim_t numComp = in.getDataPointSize();
1938      Paso_Coupler* coupler = Paso_Coupler_alloc(m_connector, numComp);      Paso_Coupler* coupler = Paso_Coupler_alloc(m_connector, numComp);
1939      in.requireWrite();      Paso_Coupler_startCollect(coupler, in.getSampleDataRO(0));
     Paso_Coupler_startCollect(coupler, in.getSampleDataRW(0));  
1940    
1941      const dim_t numDOF = getNumDOF();      const dim_t numDOF = getNumDOF();
1942      out.requireWrite();      out.requireWrite();
# Line 2530  void Brick::addToMatrixAndRHS(Paso_Syste Line 2527  void Brick::addToMatrixAndRHS(Paso_Syste
2527  }  }
2528    
2529  //protected  //protected
2530  void Brick::interpolateNodesOnElements(escript::Data& out, escript::Data& in,  void Brick::interpolateNodesOnElements(escript::Data& out,
2531                                           const escript::Data& in,
2532                                         bool reduced) const                                         bool reduced) const
2533  {  {
2534      const dim_t numComp = in.getDataPointSize();      const dim_t numComp = in.getDataPointSize();
# Line 2613  void Brick::interpolateNodesOnElements(e Line 2611  void Brick::interpolateNodesOnElements(e
2611  }  }
2612    
2613  //protected  //protected
2614  void Brick::interpolateNodesOnFaces(escript::Data& out, escript::Data& in,  void Brick::interpolateNodesOnFaces(escript::Data& out, const escript::Data& in,
2615                                      bool reduced) const                                      bool reduced) const
2616  {  {
2617      const dim_t numComp = in.getDataPointSize();      const dim_t numComp = in.getDataPointSize();
# Line 2847  void Brick::interpolateNodesOnFaces(escr Line 2845  void Brick::interpolateNodesOnFaces(escr
2845      }      }
2846  }  }
2847    
2848  int Brick::findNode(double *coords) const {  int Brick::findNode(const double *coords) const {
2849      const int NOT_MINE = -1;      const int NOT_MINE = -1;
2850      //is the found element even owned by this rank      //is the found element even owned by this rank
2851      for (int dim = 0; dim < m_numDim; dim++) {      for (int dim = 0; dim < m_numDim; dim++) {

Legend:
Removed from v.4622  
changed lines
  Added in v.4626

  ViewVC Help
Powered by ViewVC 1.1.26