/[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 750 by gross, Wed Apr 26 22:39:51 2006 UTC revision 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC
# Line 341  Data::isTagged() const Line 341  Data::isTagged() const
341    return (temp!=0);    return (temp!=0);
342  }  }
343    
344    /* TODO */
345    /* global reduction -- the local data being empty does not imply that it is empty on other processers*/
346  bool  bool
347  Data::isEmpty() const  Data::isEmpty() const
348  {  {
# Line 1103  Data::sqrt() const Line 1105  Data::sqrt() const
1105  double  double
1106  Data::Lsup() const  Data::Lsup() const
1107  {  {
1108      double localValue, globalValue;
1109  #if defined DOPROF  #if defined DOPROF
1110    profData->reduction1++;    profData->reduction1++;
1111  #endif  #endif
1112    //    //
1113    // set the initial absolute maximum value to zero    // set the initial absolute maximum value to zero
1114    
1115    AbsMax abs_max_func;    AbsMax abs_max_func;
1116    return algorithm(abs_max_func,0);    localValue = algorithm(abs_max_func,0);
1117    #ifdef PASO_MPI
1118      MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
1119      return globalValue;
1120    #else
1121      return localValue;
1122    #endif
1123  }  }
1124    
1125  double  double
1126  Data::Linf() const  Data::Linf() const
1127  {  {
1128      double localValue, globalValue;
1129  #if defined DOPROF  #if defined DOPROF
1130    profData->reduction1++;    profData->reduction1++;
1131  #endif  #endif
1132    //    //
1133    // set the initial absolute minimum value to max double    // set the initial absolute minimum value to max double
1134    AbsMin abs_min_func;    AbsMin abs_min_func;
1135    return algorithm(abs_min_func,numeric_limits<double>::max());    localValue = algorithm(abs_min_func,numeric_limits<double>::max());
1136    
1137    #ifdef PASO_MPI
1138      MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
1139      return globalValue;
1140    #else
1141      return localValue;
1142    #endif
1143  }  }
1144    
1145  double  double
1146  Data::sup() const  Data::sup() const
1147  {  {
1148      double localValue, globalValue;
1149  #if defined DOPROF  #if defined DOPROF
1150    profData->reduction1++;    profData->reduction1++;
1151  #endif  #endif
1152    //    //
1153    // set the initial maximum value to min possible double    // set the initial maximum value to min possible double
1154    FMax fmax_func;    FMax fmax_func;
1155    return algorithm(fmax_func,numeric_limits<double>::max()*-1);    localValue = algorithm(fmax_func,numeric_limits<double>::max()*-1);
1156    #ifdef PASO_MPI
1157      MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
1158      return globalValue;
1159    #else
1160      return localValue;
1161    #endif
1162  }  }
1163    
1164  double  double
1165  Data::inf() const  Data::inf() const
1166  {  {
1167      double localValue, globalValue;
1168  #if defined DOPROF  #if defined DOPROF
1169    profData->reduction1++;    profData->reduction1++;
1170  #endif  #endif
1171    //    //
1172    // set the initial minimum value to max possible double    // set the initial minimum value to max possible double
1173    FMin fmin_func;    FMin fmin_func;
1174    return algorithm(fmin_func,numeric_limits<double>::max());    localValue = algorithm(fmin_func,numeric_limits<double>::max());
1175    #ifdef PASO_MPI
1176      MPI_Allreduce( &localValue, &globalValue, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
1177      return globalValue;
1178    #else
1179      return localValue;
1180    #endif
1181  }  }
1182    
1183    /* TODO */
1184    /* global reduction */
1185  Data  Data
1186  Data::maxval() const  Data::maxval() const
1187  {  {
# Line 1425  Data::powD(const Data& right) const Line 1459  Data::powD(const Data& right) const
1459    return result;    return result;
1460  }  }
1461    
1462    void
1463    Data::print()
1464    {
1465      int i,j;
1466      
1467      printf( "Data is %dX%d\n", getNumSamples(), getNumDataPointsPerSample() );
1468      for( i=0; i<getNumSamples(); i++ )
1469      {
1470        printf( "[%6d]", i );
1471        for( j=0; j<getNumDataPointsPerSample(); j++ )
1472          printf( "\t%10.7g", (getSampleData(i))[j] );
1473        printf( "\n" );
1474      }
1475    }
1476    
1477  //  //
1478  // NOTE: It is essential to specify the namespace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1479  Data  Data
# Line 1638  escript::operator/(const boost::python:: Line 1687  escript::operator/(const boost::python::
1687  //  return ret;  //  return ret;
1688  //}  //}
1689    
1690    /* TODO */
1691    /* global reduction */
1692  Data  Data
1693  Data::getItem(const boost::python::object& key) const  Data::getItem(const boost::python::object& key) const
1694  {  {
# Line 1652  Data::getItem(const boost::python::objec Line 1703  Data::getItem(const boost::python::objec
1703    return getSlice(slice_region);    return getSlice(slice_region);
1704  }  }
1705    
1706    /* TODO */
1707    /* global reduction */
1708  Data  Data
1709  Data::getSlice(const DataArrayView::RegionType& region) const  Data::getSlice(const DataArrayView::RegionType& region) const
1710  {  {
# Line 1661  Data::getSlice(const DataArrayView::Regi Line 1714  Data::getSlice(const DataArrayView::Regi
1714    return Data(*this,region);    return Data(*this,region);
1715  }  }
1716    
1717    /* TODO */
1718    /* global reduction */
1719  void  void
1720  Data::setItemO(const boost::python::object& key,  Data::setItemO(const boost::python::object& key,
1721                 const boost::python::object& value)                 const boost::python::object& value)
# Line 1669  Data::setItemO(const boost::python::obje Line 1724  Data::setItemO(const boost::python::obje
1724    setItemD(key,tempData);    setItemD(key,tempData);
1725  }  }
1726    
1727    /* TODO */
1728    /* global reduction */
1729  void  void
1730  Data::setItemD(const boost::python::object& key,  Data::setItemD(const boost::python::object& key,
1731                 const Data& value)                 const Data& value)
# Line 1686  Data::setItemD(const boost::python::obje Line 1743  Data::setItemD(const boost::python::obje
1743    }    }
1744  }  }
1745    
1746    /* TODO */
1747    /* global reduction */
1748  void  void
1749  Data::setSlice(const Data& value,  Data::setSlice(const Data& value,
1750                 const DataArrayView::RegionType& region)                 const DataArrayView::RegionType& region)
# Line 1727  Data::typeMatchRight(const Data& right) Line 1786  Data::typeMatchRight(const Data& right)
1786    }    }
1787  }  }
1788    
1789    /* TODO */
1790    /* global reduction */
1791  void  void
1792  Data::setTaggedValue(int tagKey,  Data::setTaggedValue(int tagKey,
1793                       const boost::python::object& value)                       const boost::python::object& value)
# Line 1748  Data::setTaggedValue(int tagKey, Line 1809  Data::setTaggedValue(int tagKey,
1809    m_data->setTaggedValue(tagKey,valueDataArray.getView());    m_data->setTaggedValue(tagKey,valueDataArray.getView());
1810  }  }
1811    
1812    /* TODO */
1813    /* global reduction */
1814  void  void
1815  Data::setTaggedValueFromCPP(int tagKey,  Data::setTaggedValueFromCPP(int tagKey,
1816                              const DataArrayView& value)                              const DataArrayView& value)
# Line 1765  Data::setTaggedValueFromCPP(int tagKey, Line 1828  Data::setTaggedValueFromCPP(int tagKey,
1828    m_data->setTaggedValue(tagKey,value);    m_data->setTaggedValue(tagKey,value);
1829  }  }
1830    
1831    /* TODO */
1832    /* global reduction */
1833  int  int
1834  Data::getTagNumber(int dpno)  Data::getTagNumber(int dpno)
1835  {  {
1836    return m_data->getTagNumber(dpno);    return m_data->getTagNumber(dpno);
1837  }  }
1838    
1839    /* TODO */
1840    /* global reduction */
1841  void  void
1842  Data::setRefValue(int ref,  Data::setRefValue(int ref,
1843                    const boost::python::numeric::array& value)                    const boost::python::numeric::array& value)
# Line 1784  Data::setRefValue(int ref, Line 1851  Data::setRefValue(int ref,
1851    m_data->setRefValue(ref,valueDataArray);    m_data->setRefValue(ref,valueDataArray);
1852  }  }
1853    
1854    /* TODO */
1855    /* global reduction */
1856  void  void
1857  Data::getRefValue(int ref,  Data::getRefValue(int ref,
1858                    boost::python::numeric::array& value)                    boost::python::numeric::array& value)

Legend:
Removed from v.750  
changed lines
  Added in v.751

  ViewVC Help
Powered by ViewVC 1.1.26