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(); |
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> |