/[escript]/trunk/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk/escript/src/Data.cpp

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

revision 1311 by gross, Tue May 15 04:24:51 2007 UTC revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC
# Line 1  Line 1 
 // $Id$  
1    
2  /*  /* $Id$ */
3   ************************************************************  
4   *          Copyright 2006 by ACcESS MNRF                   *  /*******************************************************
5   *                                                          *   *
6   *              http://www.access.edu.au                    *   *           Copyright 2003-2007 by ACceSS MNRF
7   *       Primary Business: Queensland, Australia            *   *       Copyright 2007 by University of Queensland
8   *  Licensed under the Open Software License version 3.0    *   *
9   *     http://www.opensource.org/licenses/osl-3.0.php       *   *                http://esscc.uq.edu.au
10   *                                                          *   *        Primary Business: Queensland, Australia
11   ************************************************************   *  Licensed under the Open Software License version 3.0
12  */   *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  #include "Data.h"  #include "Data.h"
17    
18  #include "DataExpanded.h"  #include "DataExpanded.h"
# Line 22  Line 24 
24  #include "FunctionSpaceFactory.h"  #include "FunctionSpaceFactory.h"
25  #include "AbstractContinuousDomain.h"  #include "AbstractContinuousDomain.h"
26  #include "UnaryFuncs.h"  #include "UnaryFuncs.h"
27    extern "C" {
28    #include "escript/blocktimer.h"
29    }
30    
31  #include <fstream>  #include <fstream>
32  #include <algorithm>  #include <algorithm>
# Line 67  Data::Data(double value, Line 72  Data::Data(double value,
72             bool expanded)             bool expanded)
73  {  {
74    DataArray temp(dataPointShape,value);    DataArray temp(dataPointShape,value);
   pair<int,int> dataShape=what.getDataShape();  
75    initialise(temp.getView(),what,expanded);    initialise(temp.getView(),what,expanded);
76    m_protected=false;    m_protected=false;
77  }  }
# Line 212  Data::getShapeTuple() const Line 216  Data::getShapeTuple() const
216          throw DataException("Error - illegal Data rank.");          throw DataException("Error - illegal Data rank.");
217    }    }
218  }  }
   
 const  
 boost::python::str  
 Data::str() const  
 {  
   return boost::python::str(toString().c_str());  
 }  
   
219  void  void
220  Data::copy(const Data& other)  Data::copy(const Data& other)
221  {  {
# Line 346  Data::isConstant() const Line 342  Data::isConstant() const
342  }  }
343    
344  void  void
345  Data::setProtection()  Data::setProtection()
346  {  {
347     m_protected=true;     m_protected=true;
348  }  }
349    
350  bool  bool
351  Data::isProtected() const  Data::isProtected() const
352  {  {
353     return m_protected;     return m_protected;
354  }  }
355    
# Line 469  Data::probeInterpolation(const FunctionS Line 465  Data::probeInterpolation(const FunctionS
465  Data  Data
466  Data::gradOn(const FunctionSpace& functionspace) const  Data::gradOn(const FunctionSpace& functionspace) const
467  {  {
468      double blocktimer_start = blocktimer_time();
469    if (functionspace.getDomain()!=getDomain())    if (functionspace.getDomain()!=getDomain())
470      throw DataException("Error - gradient cannot be calculated on different domains.");      throw DataException("Error - gradient cannot be calculated on different domains.");
471    DataArrayView::ShapeType grad_shape=getPointDataView().getShape();    DataArrayView::ShapeType grad_shape=getPointDataView().getShape();
472    grad_shape.push_back(functionspace.getDim());    grad_shape.push_back(functionspace.getDim());
473    Data out(0.0,grad_shape,functionspace,true);    Data out(0.0,grad_shape,functionspace,true);
474    getDomain().setToGradient(out,*this);    getDomain().setToGradient(out,*this);
475      blocktimer_increment("grad()", blocktimer_start);
476    return out;    return out;
477  }  }
478    
# Line 504  Data::getDataPointShape() const Line 502  Data::getDataPointShape() const
502    
503    
504    
505  const  const
506  boost::python::numeric::array  boost::python::numeric::array
507  Data:: getValueOfDataPoint(int dataPointNo)  Data:: getValueOfDataPoint(int dataPointNo)
508  {  {
509    size_t length=0;    size_t length=0;
510    int i, j, k, l;    int i, j, k, l;
# Line 551  Data:: getValueOfDataPoint(int dataPoint Line 549  Data:: getValueOfDataPoint(int dataPoint
549         if ((sampleNo >= getNumSamples()) || (sampleNo < 0 )) {         if ((sampleNo >= getNumSamples()) || (sampleNo < 0 )) {
550             throw DataException("Error - Data::convertToNumArray: invalid sampleNo.");             throw DataException("Error - Data::convertToNumArray: invalid sampleNo.");
551         }         }
552                  
553         //         //
554         // Check a valid data point number has been supplied         // Check a valid data point number has been supplied
555         if ((dataPointNoInSample >= getNumDataPointsPerSample()) || (dataPointNoInSample < 0)) {         if ((dataPointNoInSample >= getNumDataPointsPerSample()) || (dataPointNoInSample < 0)) {
# Line 560  Data:: getValueOfDataPoint(int dataPoint Line 558  Data:: getValueOfDataPoint(int dataPoint
558         // TODO: global error handling         // TODO: global error handling
559         // create a view of the data if it is stored locally         // create a view of the data if it is stored locally
560         DataArrayView dataPointView = getDataPoint(sampleNo, dataPointNoInSample);         DataArrayView dataPointView = getDataPoint(sampleNo, dataPointNoInSample);
561            
562         switch( dataPointRank ){         switch( dataPointRank ){
563              case 0 :              case 0 :
564                  numArray[0] = dataPointView();                  numArray[0] = dataPointView();
565                  break;                  break;
566              case 1 :                      case 1 :
567                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
568                      numArray[i]=dataPointView(i);                      numArray[i]=dataPointView(i);
569                  break;                  break;
570              case 2 :                      case 2 :
571                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
572                      for( j=0; j<dataPointShape[1]; j++)                      for( j=0; j<dataPointShape[1]; j++)
573                          numArray[make_tuple(i,j)]=dataPointView(i,j);                          numArray[make_tuple(i,j)]=dataPointView(i,j);
574                  break;                  break;
575              case 3 :                      case 3 :
576                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
577                      for( j=0; j<dataPointShape[1]; j++ )                      for( j=0; j<dataPointShape[1]; j++ )
578                          for( k=0; k<dataPointShape[2]; k++)                          for( k=0; k<dataPointShape[2]; k++)
# Line 595  Data:: getValueOfDataPoint(int dataPoint Line 593  Data:: getValueOfDataPoint(int dataPoint
593    
594  }  }
595  void  void
596  Data::setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object& py_object)  Data::setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object& py_object)
597  {  {
598      // this will throw if the value cannot be represented      // this will throw if the value cannot be represented
599      boost::python::numeric::array num_array(py_object);      boost::python::numeric::array num_array(py_object);
# Line 612  Data::setValueOfDataPointToArray(int dat Line 610  Data::setValueOfDataPointToArray(int dat
610    }    }
611    //    //
612    // check rank    // check rank
613    if (num_array.getrank()<getDataPointRank())    if (num_array.getrank()<getDataPointRank())
614        throw DataException("Rank of numarray does not match Data object rank");        throw DataException("Rank of numarray does not match Data object rank");
615    
616    //    //
# Line 655  Data::setValueOfDataPoint(int dataPointN Line 653  Data::setValueOfDataPoint(int dataPointN
653    }    }
654  }  }
655    
656  const  const
657  boost::python::numeric::array  boost::python::numeric::array
658  Data::getValueOfGlobalDataPoint(int procNo, int dataPointNo)  Data::getValueOfGlobalDataPoint(int procNo, int dataPointNo)
659  {  {
660    size_t length=0;    size_t length=0;
661    int i, j, k, l, pos;    int i, j, k, l, pos;
# Line 712  Data::getValueOfGlobalDataPoint(int proc Line 710  Data::getValueOfGlobalDataPoint(int proc
710                  if ((sampleNo >= getNumSamples()) || (sampleNo < 0 )) {                  if ((sampleNo >= getNumSamples()) || (sampleNo < 0 )) {
711                    throw DataException("Error - Data::convertToNumArray: invalid sampleNo.");                    throw DataException("Error - Data::convertToNumArray: invalid sampleNo.");
712                  }                  }
713                  
714                  //                  //
715                  // Check a valid data point number has been supplied                  // Check a valid data point number has been supplied
716                  if ((dataPointNoInSample >= getNumDataPointsPerSample()) || (dataPointNoInSample < 0)) {                  if ((dataPointNoInSample >= getNumDataPointsPerSample()) || (dataPointNoInSample < 0)) {
# Line 721  Data::getValueOfGlobalDataPoint(int proc Line 719  Data::getValueOfGlobalDataPoint(int proc
719                  // TODO: global error handling                  // TODO: global error handling
720          // create a view of the data if it is stored locally          // create a view of the data if it is stored locally
721          DataArrayView dataPointView = getDataPoint(sampleNo, dataPointNoInSample);          DataArrayView dataPointView = getDataPoint(sampleNo, dataPointNoInSample);
722            
723          // pack the data from the view into tmpData for MPI communication          // pack the data from the view into tmpData for MPI communication
724          pos=0;          pos=0;
725          switch( dataPointRank ){          switch( dataPointRank ){
726              case 0 :              case 0 :
727                  tmpData[0] = dataPointView();                  tmpData[0] = dataPointView();
728                  break;                  break;
729              case 1 :                      case 1 :
730                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
731                      tmpData[i]=dataPointView(i);                      tmpData[i]=dataPointView(i);
732                  break;                  break;
733              case 2 :                      case 2 :
734                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
735                      for( j=0; j<dataPointShape[1]; j++, pos++ )                      for( j=0; j<dataPointShape[1]; j++, pos++ )
736                          tmpData[pos]=dataPointView(i,j);                          tmpData[pos]=dataPointView(i,j);
737                  break;                  break;
738              case 3 :                      case 3 :
739                  for( i=0; i<dataPointShape[0]; i++ )                  for( i=0; i<dataPointShape[0]; i++ )
740                      for( j=0; j<dataPointShape[1]; j++ )                      for( j=0; j<dataPointShape[1]; j++ )
741                          for( k=0; k<dataPointShape[2]; k++, pos++ )                          for( k=0; k<dataPointShape[2]; k++, pos++ )
# Line 753  Data::getValueOfGlobalDataPoint(int proc Line 751  Data::getValueOfGlobalDataPoint(int proc
751          }          }
752              }              }
753      }      }
754          #ifdef PASO_MPI          #ifdef PASO_MPI
755          // broadcast the data to all other processes          // broadcast the data to all other processes
756      MPI_Bcast( tmpData, length, MPI_DOUBLE, procNo, get_MPIComm() );      MPI_Bcast( tmpData, length, MPI_DOUBLE, procNo, get_MPIComm() );
757          #endif          #endif
# Line 763  Data::getValueOfGlobalDataPoint(int proc Line 761  Data::getValueOfGlobalDataPoint(int proc
761          case 0 :          case 0 :
762              numArray[0]=tmpData[0];              numArray[0]=tmpData[0];
763              break;              break;
764          case 1 :                  case 1 :
765              for( i=0; i<dataPointShape[0]; i++ )              for( i=0; i<dataPointShape[0]; i++ )
766                  numArray[i]=tmpData[i];                  numArray[i]=tmpData[i];
767              break;              break;
768          case 2 :                  case 2 :
769              for( i=0; i<dataPointShape[0]; i++ )              for( i=0; i<dataPointShape[0]; i++ )
770                  for( j=0; j<dataPointShape[1]; j++ )                  for( j=0; j<dataPointShape[1]; j++ )
771                     numArray[make_tuple(i,j)]=tmpData[i+j*dataPointShape[0]];                     numArray[make_tuple(i,j)]=tmpData[i+j*dataPointShape[0]];
772              break;              break;
773          case 3 :                  case 3 :
774              for( i=0; i<dataPointShape[0]; i++ )              for( i=0; i<dataPointShape[0]; i++ )
775                  for( j=0; j<dataPointShape[1]; j++ )                  for( j=0; j<dataPointShape[1]; j++ )
776                      for( k=0; k<dataPointShape[2]; k++ )                      for( k=0; k<dataPointShape[2]; k++ )
# Line 787  Data::getValueOfGlobalDataPoint(int proc Line 785  Data::getValueOfGlobalDataPoint(int proc
785              break;              break;
786      }      }
787    
788      delete [] tmpData;        delete [] tmpData;
789    //    //
790    // return the loaded array    // return the loaded array
791    return numArray;    return numArray;
# Line 801  Data::integrate() const Line 799  Data::integrate() const
799    int index;    int index;
800    int rank = getDataPointRank();    int rank = getDataPointRank();
801    DataArrayView::ShapeType shape = getDataPointShape();    DataArrayView::ShapeType shape = getDataPointShape();
802      int dataPointSize = getDataPointSize();
803    
804    //    //
805    // calculate the integral values    // calculate the integral values
806    vector<double> integrals(getDataPointSize());    vector<double> integrals(dataPointSize);
807      vector<double> integrals_local(dataPointSize);
808    #ifdef PASO_MPI
809      AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals_local,*this);
810      // Global sum: use an array instead of a vector because elements of array are guaranteed to be contiguous in memory
811      double *tmp = new double[dataPointSize];
812      double *tmp_local = new double[dataPointSize];
813      for (int i=0; i<dataPointSize; i++) { tmp_local[i] = integrals_local[i]; }
814      MPI_Allreduce( &tmp_local[0], &tmp[0], dataPointSize, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD );
815      for (int i=0; i<dataPointSize; i++) { integrals[i] = tmp[i]; }
816      delete[] tmp;
817      delete[] tmp_local;
818    #else
819    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals,*this);    AbstractContinuousDomain::asAbstractContinuousDomain(getDomain()).setToIntegrals(integrals,*this);
820    #endif
821    
822    //    //
823    // create the numeric array to be returned    // create the numeric array to be returned
# Line 1021  Data::Lsup() const Line 1032  Data::Lsup() const
1032    localValue = algorithm(abs_max_func,0);    localValue = algorithm(abs_max_func,0);
1033  #ifdef PASO_MPI  #ifdef PASO_MPI
1034    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );    MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
  return globalValue;  
 #else  
   return localValue;  
 #endif  
 }  
   
 double  
 Data::Linf() const  
 {  
   double localValue, globalValue;  
   //  
   // set the initial absolute minimum value to max double  
   AbsMin abs_min_func;  
   localValue = algorithm(abs_min_func,numeric_limits<double>::max());  
   
 #ifdef PASO_MPI  
   MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );  
1035    return globalValue;    return globalValue;
1036  #else  #else
1037    return localValue;    return localValue;
# Line 1126  Data::swapaxes(const int axis0, const in Line 1120  Data::swapaxes(const int axis0, const in
1120       }       }
1121       for (int i=0; i<rank; i++) {       for (int i=0; i<rank; i++) {
1122         if (i == axis0_tmp) {         if (i == axis0_tmp) {
1123            ev_shape.push_back(s[axis1_tmp]);            ev_shape.push_back(s[axis1_tmp]);
1124         } else if (i == axis1_tmp) {         } else if (i == axis1_tmp) {
1125            ev_shape.push_back(s[axis0_tmp]);            ev_shape.push_back(s[axis0_tmp]);
1126         } else {         } else {
1127            ev_shape.push_back(s[i]);            ev_shape.push_back(s[i]);
1128         }         }
1129       }       }
1130       Data ev(0.,ev_shape,getFunctionSpace());       Data ev(0.,ev_shape,getFunctionSpace());
# Line 1146  Data::symmetric() const Line 1140  Data::symmetric() const
1140       // check input       // check input
1141       DataArrayView::ShapeType s=getDataPointShape();       DataArrayView::ShapeType s=getDataPointShape();
1142       if (getDataPointRank()==2) {       if (getDataPointRank()==2) {
1143          if(s[0] != s[1])          if(s[0] != s[1])
1144             throw DataException("Error - Data::symmetric can only be calculated for rank 2 object with equal first and second dimension.");             throw DataException("Error - Data::symmetric can only be calculated for rank 2 object with equal first and second dimension.");
1145       }       }
1146       else if (getDataPointRank()==4) {       else if (getDataPointRank()==4) {
# Line 1168  Data::nonsymmetric() const Line 1162  Data::nonsymmetric() const
1162       // check input       // check input
1163       DataArrayView::ShapeType s=getDataPointShape();       DataArrayView::ShapeType s=getDataPointShape();
1164       if (getDataPointRank()==2) {       if (getDataPointRank()==2) {
1165          if(s[0] != s[1])          if(s[0] != s[1])
1166             throw DataException("Error - Data::nonsymmetric can only be calculated for rank 2 object with equal first and second dimension.");             throw DataException("Error - Data::nonsymmetric can only be calculated for rank 2 object with equal first and second dimension.");
1167          DataArrayView::ShapeType ev_shape;          DataArrayView::ShapeType ev_shape;
1168          ev_shape.push_back(s[0]);          ev_shape.push_back(s[0]);
# Line 1272  Data::eigenvalues() const Line 1266  Data::eigenvalues() const
1266  {  {
1267       // check input       // check input
1268       DataArrayView::ShapeType s=getDataPointShape();       DataArrayView::ShapeType s=getDataPointShape();
1269       if (getDataPointRank()!=2)       if (getDataPointRank()!=2)
1270          throw DataException("Error - Data::eigenvalues can only be calculated for rank 2 object.");          throw DataException("Error - Data::eigenvalues can only be calculated for rank 2 object.");
1271       if(s[0] != s[1])       if(s[0] != s[1])
1272          throw DataException("Error - Data::eigenvalues can only be calculated for object with equal first and second dimension.");          throw DataException("Error - Data::eigenvalues can only be calculated for object with equal first and second dimension.");
1273       // create return       // create return
1274       DataArrayView::ShapeType ev_shape(1,s[0]);       DataArrayView::ShapeType ev_shape(1,s[0]);
# Line 1288  const boost::python::tuple Line 1282  const boost::python::tuple
1282  Data::eigenvalues_and_eigenvectors(const double tol) const  Data::eigenvalues_and_eigenvectors(const double tol) const
1283  {  {
1284       DataArrayView::ShapeType s=getDataPointShape();       DataArrayView::ShapeType s=getDataPointShape();
1285       if (getDataPointRank()!=2)       if (getDataPointRank()!=2)
1286          throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for rank 2 object.");          throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for rank 2 object.");
1287       if(s[0] != s[1])       if(s[0] != s[1])
1288          throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for object with equal first and second dimension.");          throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for object with equal first and second dimension.");
1289       // create return       // create return
1290       DataArrayView::ShapeType ev_shape(1,s[0]);       DataArrayView::ShapeType ev_shape(1,s[0]);
# Line 1360  Data::calc_minGlobalDataPoint(int& ProcN Line 1354  Data::calc_minGlobalDataPoint(int& ProcN
1354      int lowProc = 0;      int lowProc = 0;
1355      double *globalMins = new double[get_MPISize()+1];      double *globalMins = new double[get_MPISize()+1];
1356      int error = MPI_Gather ( &next, 1, MPI_DOUBLE, globalMins, 1, MPI_DOUBLE, 0, get_MPIComm() );      int error = MPI_Gather ( &next, 1, MPI_DOUBLE, globalMins, 1, MPI_DOUBLE, 0, get_MPIComm() );
1357        
1358      if( get_MPIRank()==0 ){      if( get_MPIRank()==0 ){
1359          next = globalMins[lowProc];          next = globalMins[lowProc];
1360          for( i=1; i<get_MPISize(); i++ )          for( i=1; i<get_MPISize(); i++ )
# Line 1414  Data::operator+=(const boost::python::ob Line 1408  Data::operator+=(const boost::python::ob
1408    binaryOp(tmp,plus<double>());    binaryOp(tmp,plus<double>());
1409    return (*this);    return (*this);
1410  }  }
1411    Data&
1412    Data::operator=(const Data& other)
1413    {
1414      copy(other);
1415      return (*this);
1416    }
1417    
1418  Data&  Data&
1419  Data::operator-=(const Data& right)  Data::operator-=(const Data& right)
# Line 1488  Data::powD(const Data& right) const Line 1488  Data::powD(const Data& right) const
1488  {  {
1489    Data result;    Data result;
1490    if (getDataPointRank()<right.getDataPointRank()) {    if (getDataPointRank()<right.getDataPointRank()) {
1491       result.copy(right);       result.copy(right);
1492       result.binaryOp(*this,escript::rpow);       result.binaryOp(*this,escript::rpow);
1493    } else {    } else {
1494       result.copy(*this);       result.copy(*this);
# Line 1682  escript::operator/(const boost::python:: Line 1682  escript::operator/(const boost::python::
1682  /* TODO */  /* TODO */
1683  /* global reduction */  /* global reduction */
1684  Data  Data
1685  Data::getItem(const boost::python::object& key) const  Data::getItem(const boost::python::object& key) const
1686  {  {
1687    const DataArrayView& view=getPointDataView();    const DataArrayView& view=getPointDataView();
1688    
# Line 1713  Data::setItemO(const boost::python::obje Line 1713  Data::setItemO(const boost::python::obje
1713    setItemD(key,tempData);    setItemD(key,tempData);
1714  }  }
1715    
 /* TODO */  
 /* global reduction */  
1716  void  void
1717  Data::setItemD(const boost::python::object& key,  Data::setItemD(const boost::python::object& key,
1718                 const Data& value)                 const Data& value)
# Line 1732  Data::setItemD(const boost::python::obje Line 1730  Data::setItemD(const boost::python::obje
1730    }    }
1731  }  }
1732    
 /* TODO */  
 /* global reduction */  
1733  void  void
1734  Data::setSlice(const Data& value,  Data::setSlice(const Data& value,
1735                 const DataArrayView::RegionType& region)                 const DataArrayView::RegionType& region)
# Line 1777  Data::typeMatchRight(const Data& right) Line 1773  Data::typeMatchRight(const Data& right)
1773    
1774  void  void
1775  Data::setTaggedValueByName(std::string name,  Data::setTaggedValueByName(std::string name,
1776                             const boost::python::object& value)                             const boost::python::object& value)
1777  {  {
1778       if (getFunctionSpace().getDomain().isValidTagName(name)) {       if (getFunctionSpace().getDomain().isValidTagName(name)) {
1779          int tagKey=getFunctionSpace().getDomain().getTag(name);          int tagKey=getFunctionSpace().getDomain().getTag(name);
# Line 1822  Data::setTaggedValueFromCPP(int tagKey, Line 1818  Data::setTaggedValueFromCPP(int tagKey,
1818    if (!isTagged()) {    if (!isTagged()) {
1819      throw DataException("Error - DataTagged conversion failed!!");      throw DataException("Error - DataTagged conversion failed!!");
1820    }    }
1821                                                                                                                  
1822    //    //
1823    // Call DataAbstract::setTaggedValue    // Call DataAbstract::setTaggedValue
1824    m_data->setTaggedValue(tagKey,value);    m_data->setTaggedValue(tagKey,value);
# Line 2184  escript::C_GeneralTensorProduct(Data& ar Line 2180  escript::C_GeneralTensorProduct(Data& ar
2180    // General tensor product: res(SL x SR) = arg_0(SL x SM) * arg_1(SM x SR)    // General tensor product: res(SL x SR) = arg_0(SL x SM) * arg_1(SM x SR)
2181    // SM is the product of the last axis_offset entries in arg_0.getShape().    // SM is the product of the last axis_offset entries in arg_0.getShape().
2182    
   
2183    // Interpolate if necessary and find an appropriate function space    // Interpolate if necessary and find an appropriate function space
2184    Data arg_0_Z, arg_1_Z;    Data arg_0_Z, arg_1_Z;
2185    if (arg_0.getFunctionSpace()!=arg_1.getFunctionSpace()) {    if (arg_0.getFunctionSpace()!=arg_1.getFunctionSpace()) {
# Line 2545  Data::borrowData() const Line 2540  Data::borrowData() const
2540  /* Member functions specific to the MPI implementation */  /* Member functions specific to the MPI implementation */
2541    
2542  void  void
2543  Data::print()  Data::print()
2544  {  {
2545    int i,j;    int i,j;
2546      
2547    printf( "Data is %dX%d\n", getNumSamples(), getNumDataPointsPerSample() );    printf( "Data is %dX%d\n", getNumSamples(), getNumDataPointsPerSample() );
2548    for( i=0; i<getNumSamples(); i++ )    for( i=0; i<getNumSamples(); i++ )
2549    {    {
# Line 2597  Data::get_MPIRank() const Line 2592  Data::get_MPIRank() const
2592    
2593  MPI_Comm  MPI_Comm
2594  Data::get_MPIComm() const  Data::get_MPIComm() const
2595  {  {
2596  #ifdef PASO_MPI  #ifdef PASO_MPI
2597      return MPI_COMM_WORLD;      return MPI_COMM_WORLD;
2598  #else  #else

Legend:
Removed from v.1311  
changed lines
  Added in v.1312

  ViewVC Help
Powered by ViewVC 1.1.26