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

revision 104 by jgs, Fri Dec 17 07:43:12 2004 UTC revision 106 by jgs, Thu Dec 23 07:20:12 2004 UTC
# Line 643  class Data { Line 643  class Data {
643    /**    /**
644      \transpose      \transpose
645      Transpose each data point of this Data object around the given axis.      Transpose each data point of this Data object around the given axis.
646        --* not implemented yet *--
647    */    */
648    Data    Data
649    transpose(int axis) const;    transpose(int axis) const;
# Line 837  class Data { Line 838  class Data {
838    double    double
839    algorithm(UnaryFunction operation) const;    algorithm(UnaryFunction operation) const;
840
841      template <class UnaryFunction>
842      inline
843      Data
844      dp_algorithm(UnaryFunction operation) const;
845
846    /**    /**
847       \brief       \brief
848       Perform the given binary operation on all of the data's elements.       Perform the given binary operation on all of the data's elements.
# Line 1229  Data::algorithm(UnaryFunction operation) Line 1235  Data::algorithm(UnaryFunction operation)
1235  template <class UnaryFunction>  template <class UnaryFunction>
1236  inline  inline
1237  Data  Data
1238  dp_algorithm(const Data& data,  Data::dp_algorithm(UnaryFunction operation) const
UnaryFunction operation)
1239  {  {
1240    Data result(0,DataArrayView::ShapeType(),data.getFunctionSpace(),data.isExpanded());    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1241    if (data.isExpanded()) {    if (isExpanded()) {
1242      DataExpanded* dataE=dynamic_cast<DataExpanded*>(data.m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1243      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1244      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1245      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1246      escript::dp_algorithm(*dataE,*resultE,operation);      escript::dp_algorithm(*dataE,*resultE,operation);
1247    } else if (data.isTagged()) {    } else if (isTagged()) {
1248      DataTagged* dataT=dynamic_cast<DataTagged*>(data.m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1249      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1250      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1251      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1252      escript::dp_algorithm(*dataT,*resultT,operation);      escript::dp_algorithm(*dataT,*resultT,operation);
1253    } else if (data.isConstant()) {    } else if (isConstant()) {
1254      DataConstant* dataC=dynamic_cast<DataConstant*>(data.m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1255      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1256      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1257      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");

Legend:
 Removed from v.104 changed lines Added in v.106