/[escript]/trunk/escript/src/BinaryOp.h
ViewVC logotype

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

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

revision 615 by elspeth, Wed Mar 22 02:12:00 2006 UTC revision 697 by gross, Fri Mar 31 04:48:56 2006 UTC
# Line 66  template <class BinaryFunction> Line 66  template <class BinaryFunction>
66  inline void binaryOp(DataTagged& left, const DataTagged& right,  inline void binaryOp(DataTagged& left, const DataTagged& right,
67               BinaryFunction operation)               BinaryFunction operation)
68  {  {
69      int right_rank=right.getPointDataView().getRank();
70    //    //
71    // Add the right hand tag keys which can't currently be found on the left    // Add the right hand tag keys which can't currently be found on the left
72    const DataTagged::DataMapType& rightLookup=right.getTagLookup();    const DataTagged::DataMapType& rightLookup=right.getTagLookup();
# Line 85  inline void binaryOp(DataTagged& left, c Line 86  inline void binaryOp(DataTagged& left, c
86    const DataTagged::DataMapType& leftLookup=left.getTagLookup();    const DataTagged::DataMapType& leftLookup=left.getTagLookup();
87    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();
88    for (i=leftLookup.begin();i!=leftLookupEnd;i++) {    for (i=leftLookup.begin();i!=leftLookupEnd;i++) {
89      left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),operation);      if (right_rank==0) {
90           left.getDataPointByTag(i->first).binaryOp(i->second,right.getDataPointByTag(i->first)(),operation);
91        } else {
92           left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),operation);
93        }
94    }    }
95    //    //
96    // finally perform the operation on the default value    // finally perform the operation on the default value
97    left.getDefaultValue().binaryOp(right.getDefaultValue(),operation);    if (right_rank==0) {
98         left.getDefaultValue().binaryOp(0,right.getDefaultValue()(),operation);
99      } else {
100         left.getDefaultValue().binaryOp(right.getDefaultValue(),operation);
101      }
102  }  }
103    
104  template <class BinaryFunction>  template <class BinaryFunction>

Legend:
Removed from v.615  
changed lines
  Added in v.697

  ViewVC Help
Powered by ViewVC 1.1.26